Changeset 575

Show
Ignore:
Timestamp:
09/07/07 15:29:38 (1 year ago)
Author:
laurentj
Message:

ticket #25: created a command to generate a crud controller and a command to generate a jforms file from a dao file
added also a new datatype in dao : text

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/manifests/jelix-dev.mn

    r545 r575  
    100100  CREDITS 
    101101cd lib/jelix-scripts/commands 
    102   createapp.cmd.php 
    103   createdao.cmd.php 
    104   help.cmd.php 
    105   createmodule.cmd.php 
    106   createctrl.cmd.php 
    107   createzone.cmd.php 
    108   createaction.cmd.php 
    109   cleartemp.cmd.php 
    110   aclvalue.cmd.php 
    111102  aclgroup.cmd.php 
    112103  aclright.cmd.php 
     104  aclvalue.cmd.php 
     105  cleartemp.cmd.php 
     106  createaction.cmd.php 
     107  createapp.cmd.php 
     108  createctrl.cmd.php 
     109  createdao.cmd.php 
     110  createdaocrud.cmd.php 
     111  createform.cmd.php 
     112  createmodule.cmd.php 
     113  createzone.cmd.php 
     114  help.cmd.php 
    113115cd lib/jelix-scripts/includes 
    114116  command.class.php 
     
    117119  module.xml.tpl 
    118120  dao.xml.tpl 
     121  form.xml.tpl 
    119122  dao_empty.xml.tpl 
    120123  controller.tpl 
     124  controller.cmdline.tpl 
     125  controller.daocrud.tpl 
    121126  template.tpl 
    122127  zone.tpl 
    123128  project.xml.tpl 
    124129  application.init.php.tpl 
    125   controller.cmdline.tpl 
    126130cd lib/jelix-scripts/templates/www 
    127131  xmlrpc.php.tpl 
  • trunk/build/manifests/jelix-dev.mn

    r545 r575  
    100100  CREDITS 
    101101cd lib/jelix-scripts/commands 
    102   createapp.cmd.php 
    103   createdao.cmd.php 
    104   help.cmd.php 
    105   createmodule.cmd.php 
    106   createctrl.cmd.php 
    107   createzone.cmd.php 
    108   createaction.cmd.php 
    109   cleartemp.cmd.php 
    110   aclvalue.cmd.php 
    111102  aclgroup.cmd.php 
    112103  aclright.cmd.php 
     104  aclvalue.cmd.php 
     105  cleartemp.cmd.php 
     106  createaction.cmd.php 
     107  createapp.cmd.php 
     108  createctrl.cmd.php 
     109  createdao.cmd.php 
     110  createdaocrud.cmd.php 
     111  createform.cmd.php 
     112  createmodule.cmd.php 
     113  createzone.cmd.php 
     114  help.cmd.php 
    113115cd lib/jelix-scripts/includes 
    114116  command.class.php 
     
    117119  module.xml.tpl 
    118120  dao.xml.tpl 
     121  form.xml.tpl 
    119122  dao_empty.xml.tpl 
    120123  controller.tpl 
     124  controller.cmdline.tpl 
     125  controller.daocrud.tpl 
    121126  template.tpl 
    122127  zone.tpl 
    123128  project.xml.tpl 
    124129  application.init.php.tpl 
    125   controller.cmdline.tpl 
    126130cd lib/jelix-scripts/templates/www 
    127131  xmlrpc.php.tpl 
  • trunk/lib/jelix-scripts/commands/createdao.cmd.php

    r413 r575  
    7474            switch($prop->type){ 
    7575 
    76                case 'varchar': 
    7776               case 'text': 
    7877               case 'mediumtext': 
    7978               case 'longtext': 
    8079               case 'tinytext': 
     80                  $type='text'; 
     81                  break; 
     82               case 'varchar': 
    8183               case 'char': 
    8284               case 'enum': 
     
    112114 
    113115               case 'date': 
     116                  $type='date'; 
     117                  break; 
     118               case 'timestamp': 
    114119               case 'datetime': 
    115                case 'timestamp': 
     120                  $type='datetime'; 
     121                  break; 
    116122               case 'time': 
    117                   $type='date'; 
     123                  $type='time'; 
    118124                  break; 
    119125               default: 
     
    131137               } 
    132138               if($prop->not_null && $type != 'autoincrement') 
    133                   $properties.=' required="yes"'; 
     139                  $properties.=' required="true"'; 
    134140               $properties.='/>'; 
    135141            } 
  • trunk/lib/jelix-scripts/commands/createdao.cmd.php

    r413 r575  
    7474            switch($prop->type){ 
    7575 
    76                case 'varchar': 
    7776               case 'text': 
    7877               case 'mediumtext': 
    7978               case 'longtext': 
    8079               case 'tinytext': 
     80                  $type='text'; 
     81                  break; 
     82               case 'varchar': 
    8183               case 'char': 
    8284               case 'enum': 
     
    112114 
    113115               case 'date': 
     116                  $type='date'; 
     117                  break; 
     118               case 'timestamp': 
    114119               case 'datetime': 
    115                case 'timestamp': 
     120                  $type='datetime'; 
     121                  break; 
    116122               case 'time': 
    117                   $type='date'; 
     123                  $type='time'; 
    118124                  break; 
    119125               default: 
     
    131137               } 
    132138               if($prop->not_null && $type != 'autoincrement') 
    133                   $properties.=' required="yes"'; 
     139                  $properties.=' required="true"'; 
    134140               $properties.='/>'; 
    135141            } 
  • trunk/lib/jelix-scripts/commands/createzone.cmd.php

    r413 r575  
    2323    MODULE : le nom du module concerné. 
    2424    ZONE   : nom de la zone à créer. 
    25     TEMPLATE (facultatif) : nom du template associé à créer (par defaut, à 
     25    TEMPLATE (facultatif) : nom du template associé à créer (par defaut, il a 
    2626                            le nom de la zone).", 
    2727        'en'=>" 
  • trunk/lib/jelix-scripts/commands/createzone.cmd.php

    r413 r575  
    2323    MODULE : le nom du module concerné. 
    2424    ZONE   : nom de la zone à créer. 
    25     TEMPLATE (facultatif) : nom du template associé à créer (par defaut, à 
     25    TEMPLATE (facultatif) : nom du template associé à créer (par defaut, il a 
    2626                            le nom de la zone).", 
    2727        'en'=>" 
  • trunk/lib/jelix-scripts/includes/command.class.php

    r10 r575  
    22/** 
    33* @package     jelix-scripts 
    4 * @version     $Id$ 
    54* @author      Jouanneau Laurent 
    65* @contributor 
    7 * @copyright   2005-2006 Jouanneau laurent 
     6* @copyright   2005-2007 Jouanneau laurent 
    87* @link        http://www.jelix.org 
    98* @licence     GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 
     
    1716 
    1817   public $name; 
     18 
     19   /** 
     20    * options available for the command 
     21    * the array contains items like : 
     22    *   key =  name of the option '-foo' 
     23    *   value = boolean: true if the option need a value after it 
     24    * @var array 
     25    */ 
    1926   public $allowed_options=array(); 
     27 
     28   /** 
     29    * parameters needed for the command 
     30    * the array contains items like : 
     31    *   key =  name of the variable which will contains the parameter value 
     32    *   value = boolean: false if the parameter is optional 
     33    * Optional parameters should be declared at the end of the array 
     34    * The last parameter declaration could have '...' as name, so it will contains 
     35    * in an array any additional values given in the command line 
     36    * @var array 
     37    */ 
    2038   public $allowed_parameters=array(); 
    2139 
  • trunk/lib/jelix-scripts/includes/command.class.php

    r10 r575  
    22/** 
    33* @package     jelix-scripts 
    4 * @version     $Id$ 
    54* @author      Jouanneau Laurent 
    65* @contributor 
    7 * @copyright   2005-2006 Jouanneau laurent 
     6* @copyright   2005-2007 Jouanneau laurent 
    87* @link        http://www.jelix.org 
    98* @licence     GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 
     
    1716 
    1817   public $name; 
     18 
     19   /** 
     20    * options available for the command 
     21    * the array contains items like : 
     22    *   key =  name of the option '-foo' 
     23    *   value = boolean: true if the option need a value after it 
     24    * @var array 
     25    */ 
    1926   public $allowed_options=array(); 
     27 
     28   /** 
     29    * parameters needed for the command 
     30    * the array contains items like : 
     31    *   key =  name of the variable which will contains the parameter value 
     32    *   value = boolean: false if the parameter is optional 
     33    * Optional parameters should be declared at the end of the array 
     34    * The last parameter declaration could have '...' as name, so it will contains 
     35    * in an array any additional values given in the command line 
     36    * @var array 
     37    */ 
    2038   public $allowed_parameters=array(); 
    2139 
  • trunk/lib/jelix-scripts/includes/utils.lib.php

    r413 r575  
    22/** 
    33* @package     jelix-scripts 
    4 * @version     $Id$ 
    54* @author      Jouanneau Laurent 
    65* @contributor 
    7 * @copyright   2005-2006 Jouanneau laurent 
     6* @copyright   2005-2007 Jouanneau laurent 
    87* @link        http://www.jelix.org 
    98* @licence     GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 
     
    139138 
    140139function jxs_init_jelix_env(){ 
    141    global $gJConfig; 
    142  
    143    $gJConfig = jConfig::load(JELIXS_APP_CONFIG_FILE); 
    144  
    145  
     140    global $gJConfig; 
     141    if(!$gJConfig) 
     142        $gJConfig = jConfig::load(JELIXS_APP_CONFIG_FILE); 
    146143} 
    147144 
  • trunk/lib/jelix-scripts/includes/utils.lib.php

    r413 r575  
    22/** 
    33* @package     jelix-scripts 
    4 * @version     $Id$ 
    54* @author      Jouanneau Laurent 
    65* @contributor 
    7 * @copyright   2005-2006 Jouanneau laurent 
     6* @copyright   2005-2007 Jouanneau laurent 
    87* @link        http://www.jelix.org 
    98* @licence     GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 
     
    139138 
    140139function jxs_init_jelix_env(){ 
    141    global $gJConfig; 
    142  
    143    $gJConfig = jConfig::load(JELIXS_APP_CONFIG_FILE); 
    144  
    145  
     140    global $gJConfig; 
     141    if(!$gJConfig) 
     142        $gJConfig = jConfig::load(JELIXS_APP_CONFIG_FILE); 
    146143} 
    147144 
  • trunk/lib/jelix/dao/jDaoParser.class.php

    r450 r575  
    305305        } 
    306306        $params['datatype']=trim(strtolower($params['datatype'])); 
    307         $this->needsQuotes = in_array ($params['datatype'], array ('string', 'date', 'datetime', 'time')); 
     307        $this->needsQuotes = in_array ($params['datatype'], array ('string', 'varchar', 'text', 'date', 'datetime', 'time')); 
    308308 
    309309        if (!in_array ($params['datatype'], array ('autoincrement', 'bigautoincrement', 'int', 'datetime', 'time', 
    310                                     'integer', 'varchar', 'string', 'varchardate', 'date', 'numeric', 'double', 'float'))){ 
     310                                    'integer', 'varchar', 'string', 'text', 'varchardate', 'date', 'numeric', 'double', 'float'))){ 
    311311           throw new jDaoXmlException ('wrong.attr', array($params['datatype'], $this->fieldName,'property')); 
    312312        } 
  • trunk/lib/jelix/dao/jDaoParser.class.php

    r450 r575  
    305305        } 
    306306        $params['datatype']=trim(strtolower($params['datatype'])); 
    307         $this->needsQuotes = in_array ($params['datatype'], array ('string', 'date', 'datetime', 'time')); 
     307        $this->needsQuotes = in_array ($params['datatype'], array ('string', 'varchar', 'text', 'date', 'datetime', 'time')); 
    308308 
    309309        if (!in_array ($params['datatype'], array ('autoincrement', 'bigautoincrement', 'int', 'datetime', 'time', 
    310                                     'integer', 'varchar', 'string', 'varchardate', 'date', 'numeric', 'double', 'float'))){ 
     310                                    'integer', 'varchar', 'string', 'text', 'varchardate', 'date', 'numeric', 'double', 'float'))){ 
    311311           throw new jDaoXmlException ('wrong.attr', array($params['datatype'], $this->fieldName,'property')); 
    312312        } 
Download in other formats: Unified Diff Zip Archive