Changeset 633
- Timestamp:
- 11/09/07 00:16:03 (1 year ago)
- Files:
-
- branches/experimental/jorm (copied) (copied from trunk)
- branches/experimental/jorm (copied) (copied from trunk)
- branches/experimental/jorm/jorm.txt (added)
- branches/experimental/jorm/jorm.txt (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/errors.ISO-8859-1.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/en_EN/errors.ISO-8859-1.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/errors.ISO-8859-1.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/en_EN/errors.ISO-8859-1.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/errors.UTF-8.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/en_EN/errors.UTF-8.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/errors.UTF-8.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/en_EN/errors.UTF-8.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/orm.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/orm.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/orm.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/orm.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/ormxml.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/ormxml.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/ormxml.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_EN/ormxml.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/errors.ISO-8859-1.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/en_US/errors.ISO-8859-1.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/errors.ISO-8859-1.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/en_US/errors.ISO-8859-1.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/errors.UTF-8.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/en_US/errors.UTF-8.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/errors.UTF-8.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/en_US/errors.UTF-8.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/orm.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/orm.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/orm.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/orm.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/ormxml.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/ormxml.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/ormxml.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/en_US/ormxml.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/errors.ISO-8859-1.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/fr_FR/errors.ISO-8859-1.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/errors.ISO-8859-1.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/fr_FR/errors.ISO-8859-1.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/errors.UTF-8.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/fr_FR/errors.UTF-8.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/errors.UTF-8.properties (copied) (copied from trunk/lib/jelix/core-modules/jelix/locales/fr_FR/errors.UTF-8.properties)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/orm.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/orm.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/orm.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/orm.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/ormxml.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/ormxml.ISO-8859-1.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/ormxml.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core-modules/jelix/locales/fr_FR/ormxml.UTF-8.properties (added)
- branches/experimental/jorm/lib/jelix/core/jSelector.class.php (modified) (1 diff)
- branches/experimental/jorm/lib/jelix/core/jSelector.class.php (modified) (1 diff)
- branches/experimental/jorm/lib/jelix/core/response/jResponseRedirectUrl.class.php (copied) (copied from trunk/lib/jelix/core/response/jResponseRedirectUrl.class.php)
- branches/experimental/jorm/lib/jelix/core/response/jResponseRedirectUrl.class.php (copied) (copied from trunk/lib/jelix/core/response/jResponseRedirectUrl.class.php)
- branches/experimental/jorm/lib/jelix/forms/jFormsBuilderBase.class.php (copied) (copied from trunk/lib/jelix/forms/jFormsBuilderBase.class.php)
- branches/experimental/jorm/lib/jelix/forms/jFormsBuilderBase.class.php (copied) (copied from trunk/lib/jelix/forms/jFormsBuilderBase.class.php)
- branches/experimental/jorm/lib/jelix/forms/jFormsCompiler.class.php (copied) (copied from trunk/lib/jelix/forms/jFormsCompiler.class.php)
- branches/experimental/jorm/lib/jelix/forms/jFormsCompiler.class.php (copied) (copied from trunk/lib/jelix/forms/jFormsCompiler.class.php)
- branches/experimental/jorm/lib/jelix/forms/jFormsControl.class.php (copied) (copied from trunk/lib/jelix/forms/jFormsControl.class.php)
- branches/experimental/jorm/lib/jelix/forms/jFormsControl.class.php (copied) (copied from trunk/lib/jelix/forms/jFormsControl.class.php)
- branches/experimental/jorm/lib/jelix/init.php (modified) (3 diffs)
- branches/experimental/jorm/lib/jelix/init.php (modified) (3 diffs)
- branches/experimental/jorm/lib/jelix/orm (added)
- branches/experimental/jorm/lib/jelix/orm (added)
- branches/experimental/jorm/lib/jelix/orm/jOrm.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrm.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmCompiler.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmCompiler.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmCriterias.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmCriterias.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmFactoryBase.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmFactoryBase.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmGenerator.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmGenerator.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmMethod.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmMethod.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmParser.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmParser.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmProperty.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmProperty.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmRecordBase.class.php (added)
- branches/experimental/jorm/lib/jelix/orm/jOrmRecordBase.class.php (added)
- branches/experimental/jorm/testapp/modules/jelix_tests/tests/jforms.compiler.html.php (copied) (copied from trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html.php)
- branches/experimental/jorm/testapp/modules/jelix_tests/tests/jforms.compiler.html.php (copied) (copied from trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html.php)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/experimental/jorm/lib/jelix/core/jSelector.class.php
r601 r633 523 523 } 524 524 525 526 /** 527 * Selector for orm file 528 * syntax : "module~ormName". 529 * file : orms/ormName.orm.xml 530 * @package jelix 531 * @subpackage core_selector 532 */ 533 class jSelectorOrm extends jSelectorModule { 534 protected $type = 'orm'; 535 public $driver; 536 protected $_dirname = 'orms/'; 537 protected $_suffix = '.orm.xml'; 538 protected $_where; 539 540 function __construct($sel, $driver, $isprofil=true){ 541 if($isprofil){ 542 $p = jDb::getProfil($driver); 543 if($p['driver'] == 'pdo'){ 544 $this->driver=substr($p['dsn'],0,strpos($p['dsn'],':')); 545 }else{ 546 $this->driver= $p['driver']; 547 } 548 if($this->driver=='pgsql') 549 $this->driver='postgresql'; 550 }else{ 551 $this->driver=$driver; 552 } 553 $this->_compiler='jOrmCompiler'; 554 $this->_compilerPath=JELIX_LIB_ORM_PATH.'jOrmCompiler.class.php'; 555 parent::__construct($sel); 556 } 557 558 protected function _createPath(){ 559 global $gJConfig; 560 if(!isset($gJConfig->_modulesPathList[$this->module])){ 561 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 562 } 563 564 // on regarde si le dao a été redéfini 565 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 566 if (is_readable ($overloadedPath)){ 567 $this->_path = $overloadedPath; 568 $this->_where = 'overloaded/'; 569 return; 570 } 571 // et sinon, on regarde si le dao existe dans le module en question 572 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 573 574 if (!is_readable ($this->_path)){ 575 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "orm")); 576 } 577 $this->_where = 'modules/'; 578 } 579 580 protected function _createCachePath(){ 581 // on ne partage pas le même cache pour tous les emplacements possibles 582 // au cas où un overload était supprimé 583 $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/orms/'.$this->_where.$this->module.'~'.$this->resource.'~'.$this->driver.$this->_cacheSuffix; 584 } 585 586 public function getOrmClass(){ 587 return 'cOrm_'.$this->module.'_Jx_'.$this->resource.'_Jx_'.$this->driver; 588 } 589 public function getOrmRecordClass(){ 590 return 'cOrmRecord_'.$this->module.'_Jx_'.$this->resource.'_Jx_'.$this->driver; 591 } 592 } 593 594 525 595 /** 526 596 * Template selector branches/experimental/jorm/lib/jelix/core/jSelector.class.php
r601 r633 523 523 } 524 524 525 526 /** 527 * Selector for orm file 528 * syntax : "module~ormName". 529 * file : orms/ormName.orm.xml 530 * @package jelix 531 * @subpackage core_selector 532 */ 533 class jSelectorOrm extends jSelectorModule { 534 protected $type = 'orm'; 535 public $driver; 536 protected $_dirname = 'orms/'; 537 protected $_suffix = '.orm.xml'; 538 protected $_where; 539 540 function __construct($sel, $driver, $isprofil=true){ 541 if($isprofil){ 542 $p = jDb::getProfil($driver); 543 if($p['driver'] == 'pdo'){ 544 $this->driver=substr($p['dsn'],0,strpos($p['dsn'],':')); 545 }else{ 546 $this->driver= $p['driver']; 547 } 548 if($this->driver=='pgsql') 549 $this->driver='postgresql'; 550 }else{ 551 $this->driver=$driver; 552 } 553 $this->_compiler='jOrmCompiler'; 554 $this->_compilerPath=JELIX_LIB_ORM_PATH.'jOrmCompiler.class.php'; 555 parent::__construct($sel); 556 } 557 558 protected function _createPath(){ 559 global $gJConfig; 560 if(!isset($gJConfig->_modulesPathList[$this->module])){ 561 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 562 } 563 564 // on regarde si le dao a été redéfini 565 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 566 if (is_readable ($overloadedPath)){ 567 $this->_path = $overloadedPath; 568 $this->_where = 'overloaded/'; 569 return; 570 } 571 // et sinon, on regarde si le dao existe dans le module en question 572 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 573 574 if (!is_readable ($this->_path)){ 575 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "orm")); 576 } 577 $this->_where = 'modules/'; 578 } 579 580 protected function _createCachePath(){ 581 // on ne partage pas le même cache pour tous les emplacements possibles 582 // au cas où un overload était supprimé 583 $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/orms/'.$this->_where.$this->module.'~'.$this->resource.'~'.$this->driver.$this->_cacheSuffix; 584 } 585 586 public function getOrmClass(){ 587 return 'cOrm_'.$this->module.'_Jx_'.$this->resource.'_Jx_'.$this->driver; 588 } 589 public function getOrmRecordClass(){ 590 return 'cOrmRecord_'.$this->module.'_Jx_'.$this->resource.'_Jx_'.$this->driver; 591 } 592 } 593 594 525 595 /** 526 596 * Template selector branches/experimental/jorm/lib/jelix/init.php
r582 r633 52 52 define ('JELIX_LIB_ACL_PATH', JELIX_LIB_PATH.'acl/'); 53 53 define ('JELIX_LIB_DAO_PATH', JELIX_LIB_PATH.'dao/'); 54 define ('JELIX_LIB_ORM_PATH', JELIX_LIB_PATH.'orm/'); 54 55 define ('JELIX_LIB_EVENTS_PATH', JELIX_LIB_PATH.'events/'); 55 56 define ('JELIX_LIB_FORMS_PATH', JELIX_LIB_PATH.'forms/'); … … 135 136 */ 136 137 $gLibPath=array('Db'=>JELIX_LIB_DB_PATH, 'Dao'=>JELIX_LIB_DAO_PATH, 138 'Orm'=>JELIX_LIB_ORM_PATH, 137 139 'Forms'=>JELIX_LIB_FORMS_PATH, 'Event'=>JELIX_LIB_EVENTS_PATH, 138 140 'Tpl'=>JELIX_LIB_TPL_PATH, 'Acl'=>JELIX_LIB_ACL_PATH, 'Controller'=>JELIX_LIB_CTRL_PATH); … … 142 144 */ 143 145 function __autoload($class){ 144 if(preg_match('/^j(Dao| Tpl|Acl|Event|Db|Controller|Forms).*$/', $class, $m)){146 if(preg_match('/^j(Dao|Orm|Tpl|Acl|Event|Db|Controller|Forms).*$/', $class, $m)){ 145 147 $f=$GLOBALS['gLibPath'][$m[1]].$class.'.class.php'; 146 148 }elseif(preg_match('/^cDao(?:Record)?_(.+)_Jx_(.+)_Jx_(.+)$/', $class, $m)){ 147 149 // pour les dao stockés en sessions notament 148 150 $s = new jSelectorDao($m[1].'~'.$m[2], $m[3], false); 151 if($GLOBALS['gJConfig']->compilation['checkCacheFiletime']){ 152 // si il faut verifier le filetime, alors on inclus via le jIncluder 153 // au cas où il faudrait recompiler le dao avant l'inclusion de la classe 154 jIncluder::inc($s); 155 return; 156 }else{ 157 $f = $s->getCompiledFilePath (); 158 // on verifie que le fichier est là (dans le cas d'un temp purgé, cf bug #6062) 159 if(!file_exists($f)){ // si absent, on recompile 160 jIncluder::inc($s); 161 return; 162 } 163 } 164 }elseif(preg_match('/^cOrm(?:Record)?_(.+)_Jx_(.+)_Jx_(.+)$/', $class, $m)){ 165 // pour les dao stockés en sessions notament 166 $s = new jSelectorOrm($m[1].'~'.$m[2], $m[3], false); 149 167 if($GLOBALS['gJConfig']->compilation['checkCacheFiletime']){ 150 168 // si il faut verifier le filetime, alors on inclus via le jIncluder branches/experimental/jorm/lib/jelix/init.php
r582 r633 52 52 define ('JELIX_LIB_ACL_PATH', JELIX_LIB_PATH.'acl/'); 53 53 define ('JELIX_LIB_DAO_PATH', JELIX_LIB_PATH.'dao/'); 54 define ('JELIX_LIB_ORM_PATH', JELIX_LIB_PATH.'orm/'); 54 55 define ('JELIX_LIB_EVENTS_PATH', JELIX_LIB_PATH.'events/'); 55 56 define ('JELIX_LIB_FORMS_PATH', JELIX_LIB_PATH.'forms/'); … … 135 136 */ 136 137 $gLibPath=array('Db'=>JELIX_LIB_DB_PATH, 'Dao'=>JELIX_LIB_DAO_PATH, 138 'Orm'=>JELIX_LIB_ORM_PATH, 137 139 'Forms'=>JELIX_LIB_FORMS_PATH, 'Event'=>JELIX_LIB_EVENTS_PATH, 138 140 'Tpl'=>JELIX_LIB_TPL_PATH, 'Acl'=>JELIX_LIB_ACL_PATH, 'Controller'=>JELIX_LIB_CTRL_PATH); … … 142 144 */ 143 145 function __autoload($class){ 144 if(preg_match('/^j(Dao| Tpl|Acl|Event|Db|Controller|Forms).*$/', $class, $m)){146 if(preg_match('/^j(Dao|Orm|Tpl|Acl|Event|Db|Controller|Forms).*$/', $class, $m)){ 145 147 $f=$GLOBALS['gLibPath'][$m[1]].$class.'.class.php'; 146 148 }elseif(preg_match('/^cDao(?:Record)?_(.+)_Jx_(.+)_Jx_(.+)$/', $class, $m)){ 147 149 // pour les dao stockés en sessions notament 148 150 $s = new jSelectorDao($m[1].'~'.$m[2], $m[3], false); 151 if($GLOBALS['gJConfig']->compilation['checkCacheFiletime']){ 152 // si il faut verifier le filetime, alors on inclus via le jIncluder 153 // au cas où il faudrait recompiler le dao avant l'inclusion de la classe 154 jIncluder::inc($s); 155 return; 156 }else{ 157 $f = $s->getCompiledFilePath (); 158 // on verifie que le fichier est là (dans le cas d'un temp purgé, cf bug #6062) 159 if(!file_exists($f)){ // si absent, on recompile 160 jIncluder::inc($s); 161 return; 162 } 163 } 164 }elseif(preg_match('/^cOrm(?:Record)?_(.+)_Jx_(.+)_Jx_(.+)$/', $class, $m)){ 165 // pour les dao stockés en sessions notament 166 $s = new jSelectorOrm($m[1].'~'.$m[2], $m[3], false); 149 167 if($GLOBALS['gJConfig']->compilation['checkCacheFiletime']){ 150 168 // si il faut verifier le filetime, alors on inclus via le jIncluder
