Changeset 601
- Timestamp:
- 09/29/07 22:26:30 (1 year ago)
- Files:
-
- trunk/lib/jelix/core/jSelector.class.php (modified) (10 diffs)
- trunk/lib/jelix/core/jSelector.class.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/core/jSelector.class.php
r598 r601 497 497 if (is_readable ($overloadedPath)){ 498 498 $this->_path = $overloadedPath; 499 $this->_where = 1;499 $this->_where = 'overloaded/'; 500 500 return; 501 501 } … … 506 506 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "dao")); 507 507 } 508 $this->_where = 0;508 $this->_where = 'modules/'; 509 509 } 510 510 511 511 protected function _createCachePath(){ 512 $d = array('modules/','overloaded/');513 512 // on ne partage pas le même cache pour tous les emplacements possibles 514 513 // au cas où un overload était supprimé 515 $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/daos/'.$ d[$this->_where].$this->module.'~'.$this->resource.'~'.$this->driver.$this->_cacheSuffix;514 $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/daos/'.$this->_where.$this->module.'~'.$this->resource.'~'.$this->driver.$this->_cacheSuffix; 516 515 } 517 516 … … 562 561 } 563 562 563 $path = $this->module.'/'.$this->resource; 564 $lpath = $this->module.'/'.$gJConfig->locale.'/'.$this->resource; 565 564 566 if($gJConfig->theme != 'default'){ 565 567 // on regarde si il y a un template redéfinie pour le theme courant 566 $this->_where = 'themes/'.$gJConfig->theme.'/'.$ this->module.'/'.$gJConfig->locale.'/'.$this->resource;568 $this->_where = 'themes/'.$gJConfig->theme.'/'.$lpath; 567 569 $this->_path = JELIX_APP_VAR_PATH.$this->_where.'.tpl'; 568 570 if (is_readable ($this->_path)){ … … 570 572 } 571 573 // on regarde si il y a un template redéfinie pour le theme courant 572 $this->_where = 'themes/'.$gJConfig->theme.'/'.$ this->module.'/'.$this->resource;574 $this->_where = 'themes/'.$gJConfig->theme.'/'.$path; 573 575 $this->_path = JELIX_APP_VAR_PATH.$this->_where.'.tpl'; 574 576 if (is_readable ($this->_path)){ … … 578 580 579 581 // on regarde si il y a un template redéfinie dans le theme par defaut 580 $this->_where = 'themes/default/'.$ this->module.'/'.$gJConfig->locale.'/'.$this->resource;582 $this->_where = 'themes/default/'.$lpath; 581 583 $this->_path = JELIX_APP_VAR_PATH.$this->_where.'.tpl'; 582 584 if (is_readable ($this->_path)){ … … 584 586 } 585 587 586 $this->_where = 'themes/default/'.$ this->module.'/'.$this->resource;588 $this->_where = 'themes/default/'.$path; 587 589 $this->_path = JELIX_APP_VAR_PATH.$this->_where.'.tpl'; 588 590 if (is_readable ($this->_path)){ … … 593 595 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$gJConfig->locale.'/'.$this->resource.'.tpl'; 594 596 if (is_readable ($this->_path)){ 595 $this->_where = 'modules/'.$ this->module.'/'.$gJConfig->locale.'/'.$this->resource;597 $this->_where = 'modules/'.$lpath; 596 598 return; 597 599 } … … 599 601 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.'.tpl'; 600 602 if (is_readable ($this->_path)){ 601 $this->_where = 'modules/'.$ this->module.'/'.$this->resource;603 $this->_where = 'modules/'.$path; 602 604 return; 603 605 } … … 642 644 class jSelectorForm extends jSelectorModule { 643 645 protected $type = 'form'; 644 646 protected $_where; 647 protected $_dirname = 'forms/'; 648 protected $_suffix = '.form.xml'; 649 645 650 function __construct($sel){ 646 651 647 $this->_dirname = 'forms/';648 $this->_suffix = '.form.xml';649 $this->_cacheSuffix = '.php';650 652 $this->_compiler='jFormsCompiler'; 651 653 $this->_compilerPath=JELIX_LIB_FORMS_PATH.'jFormsCompiler.class.php'; … … 658 660 } 659 661 662 663 protected function _createPath(){ 664 global $gJConfig; 665 if(!isset($gJConfig->_modulesPathList[$this->module])){ 666 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString(true)); 667 } 668 669 // we see if the forms have been redefined 670 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 671 if (is_readable ($overloadedPath)){ 672 $this->_path = $overloadedPath; 673 $this->_where = 'overloaded/'; 674 return; 675 } 676 677 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 678 if (!is_readable ($this->_path)){ 679 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), $this->type)); 680 } 681 $this->_where = 'modules/'; 682 } 683 684 protected function _createCachePath(){ 685 // on ne partage pas le même cache pour tous les emplacements possibles 686 // au cas où un overload était supprimé 687 $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->_where.$this->module.'~'.$this->resource.$this->_cacheSuffix; 688 } 689 660 690 public function getCompiledBuilderFilePath ($type){ 661 return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->module.'~'.$this->resource.'_builder_'.$type.$this->_cacheSuffix; 662 } 691 return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->_where.$this->module.'~'.$this->resource.'_builder_'.$type.$this->_cacheSuffix; 692 } 693 663 694 } 664 695 trunk/lib/jelix/core/jSelector.class.php
r598 r601 497 497 if (is_readable ($overloadedPath)){ 498 498 $this->_path = $overloadedPath; 499 $this->_where = 1;499 $this->_where = 'overloaded/'; 500 500 return; 501 501 } … … 506 506 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "dao")); 507 507 } 508 $this->_where = 0;508 $this->_where = 'modules/'; 509 509 } 510 510 511 511 protected function _createCachePath(){ 512 $d = array('modules/','overloaded/');513 512 // on ne partage pas le même cache pour tous les emplacements possibles 514 513 // au cas où un overload était supprimé 515 $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/daos/'.$ d[$this->_where].$this->module.'~'.$this->resource.'~'.$this->driver.$this->_cacheSuffix;514 $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/daos/'.$this->_where.$this->module.'~'.$this->resource.'~'.$this->driver.$this->_cacheSuffix; 516 515 } 517 516 … … 562 561 } 563 562 563 $path = $this->module.'/'.$this->resource; 564 $lpath = $this->module.'/'.$gJConfig->locale.'/'.$this->resource; 565 564 566 if($gJConfig->theme != 'default'){ 565 567 // on regarde si il y a un template redéfinie pour le theme courant 566 $this->_where = 'themes/'.$gJConfig->theme.'/'.$ this->module.'/'.$gJConfig->locale.'/'.$this->resource;568 $this->_where = 'themes/'.$gJConfig->theme.'/'.$lpath; 567 569 $this->_path = JELIX_APP_VAR_PATH.$this->_where.'.tpl'; 568 570 if (is_readable ($this->_path)){ … … 570 572 } 571 573 // on regarde si il y a un template redéfinie pour le theme courant 572 $this->_where = 'themes/'.$gJConfig->theme.'/'.$ this->module.'/'.$this->resource;574 $this->_where = 'themes/'.$gJConfig->theme.'/'.$path; 573 575 $this->_path = JELIX_APP_VAR_PATH.$this->_where.'.tpl'; 574 576 if (is_readable ($this->_path)){ … … 578 580 579 581 // on regarde si il y a un template redéfinie dans le theme par defaut 580 $this->_where = 'themes/default/'.$ this->module.'/'.$gJConfig->locale.'/'.$this->resource;582 $this->_where = 'themes/default/'.$lpath; 581 583 $this->_path = JELIX_APP_VAR_PATH.$this->_where.'.tpl'; 582 584 if (is_readable ($this->_path)){ … … 584 586 } 585 587 586 $this->_where = 'themes/default/'.$ this->module.'/'.$this->resource;588 $this->_where = 'themes/default/'.$path; 587 589 $this->_path = JELIX_APP_VAR_PATH.$this->_where.'.tpl'; 588 590 if (is_readable ($this->_path)){ … … 593 595 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$gJConfig->locale.'/'.$this->resource.'.tpl'; 594 596 if (is_readable ($this->_path)){ 595 $this->_where = 'modules/'.$ this->module.'/'.$gJConfig->locale.'/'.$this->resource;597 $this->_where = 'modules/'.$lpath; 596 598 return; 597 599 } … … 599 601 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.'.tpl'; 600 602 if (is_readable ($this->_path)){ 601 $this->_where = 'modules/'.$ this->module.'/'.$this->resource;603 $this->_where = 'modules/'.$path; 602 604 return; 603 605 } … … 642 644 class jSelectorForm extends jSelectorModule { 643 645 protected $type = 'form'; 644 646 protected $_where; 647 protected $_dirname = 'forms/'; 648 protected $_suffix = '.form.xml'; 649 645 650 function __construct($sel){ 646 651 647 $this->_dirname = 'forms/';648 $this->_suffix = '.form.xml';649 $this->_cacheSuffix = '.php';650 652 $this->_compiler='jFormsCompiler'; 651 653 $this->_compilerPath=JELIX_LIB_FORMS_PATH.'jFormsCompiler.class.php'; … … 658 660 } 659 661 662 663 protected function _createPath(){ 664 global $gJConfig; 665 if(!isset($gJConfig->_modulesPathList[$this->module])){ 666 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString(true)); 667 } 668 669 // we see if the forms have been redefined 670 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 671 if (is_readable ($overloadedPath)){ 672 $this->_path = $overloadedPath; 673 $this->_where = 'overloaded/'; 674 return; 675 } 676 677 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 678 if (!is_readable ($this->_path)){ 679 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), $this->type)); 680 } 681 $this->_where = 'modules/'; 682 } 683 684 protected function _createCachePath(){ 685 // on ne partage pas le même cache pour tous les emplacements possibles 686 // au cas où un overload était supprimé 687 $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->_where.$this->module.'~'.$this->resource.$this->_cacheSuffix; 688 } 689 660 690 public function getCompiledBuilderFilePath ($type){ 661 return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->module.'~'.$this->resource.'_builder_'.$type.$this->_cacheSuffix; 662 } 691 return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->_where.$this->module.'~'.$this->resource.'_builder_'.$type.$this->_cacheSuffix; 692 } 693 663 694 } 664 695
