Changeset 156
- Timestamp:
- 05/04/06 09:33:50 (3 years ago)
- Files:
-
- trunk/build/manifests/jelix-dev.mn (modified) (1 diff)
- trunk/build/manifests/jelix-lib.mn (modified) (2 diffs)
- trunk/lib/jelix-scripts/commands/createapp.cmd.php (modified) (4 diffs)
- trunk/lib/jelix-scripts/commands/createctrl.cmd.php (modified) (4 diffs)
- trunk/lib/jelix-scripts/jelix.php (modified) (2 diffs)
- trunk/lib/jelix-scripts/scripts.conf.php (modified) (2 diffs)
- trunk/lib/jelix-scripts/templates/application.init.php.tpl (modified) (1 diff)
- trunk/lib/jelix-scripts/templates/config.cmdline.ini.php.tpl (added)
- trunk/lib/jelix-scripts/templates/controller.cmdline.tpl (added)
- trunk/lib/jelix-scripts/templates/scripts (added)
- trunk/lib/jelix-scripts/templates/scripts/cmdline.php.tpl (added)
- trunk/lib/jelix/controllers (added)
- trunk/lib/jelix/controllers/jControllerCmdLine.class.php (added)
- trunk/lib/jelix/core/jController.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/request/jCmdLineRequest.class.php (modified) (2 diffs)
- trunk/lib/jelix/init.php (modified) (3 diffs)
- trunk/lib/jelix/utils/jCmdUtils.class.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/jelix-dev.mn
r150 r156 126 126 dbprofils.ini.php.tpl 127 127 config.classic.ini.php.tpl 128 config.cmdline.ini.php.tpl 129 controller.cmdline.tpl 128 130 cd lib/jelix-scripts/templates/www 129 131 xmlrpc.php.tpl 130 132 index.php.tpl 131 133 jsonrpc.php.tpl 134 cd lib/jelix-scripts/templates/scripts 135 cmdline.php.tpl 132 136 cd lib/jelix/docs/ns 133 137 dao.rng trunk/build/manifests/jelix-lib.mn
r150 r156 22 22 jAclUserGroup.class.php 23 23 jAclManager.class.php 24 25 cd lib/jelix/controllers 26 jControllerCmdLine.class.php 24 27 25 28 cd lib/jelix/core … … 149 152 jZone.class.php 150 153 jDatatype.class.php 154 jCmdUtils.class.php 151 155 152 156 cd lib/json trunk/lib/jelix-scripts/commands/createapp.cmd.php
r153 r156 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor 7 * @contributor Loic Mathaud 8 8 * @copyright 2005-2006 Jouanneau laurent 9 9 * @link http://www.jelix.org … … 14 14 15 15 public $name = 'createapp'; 16 public $allowed_options=array('-withdefaultmodule'=>false );16 public $allowed_options=array('-withdefaultmodule'=>false, '-withcmdline'=>false); 17 17 public $allowed_parameters=array(); 18 18 19 public $syntaxhelp = "[-withdefaultmodule] ";19 public $syntaxhelp = "[-withdefaultmodule] [-withcmdline]"; 20 20 public $help=" 21 21 Cr� une nouvelle application avec tous les r�rtoires n�ssaires. … … 23 23 Si l'option -withdefaultmodule est pr�nte, cr� �lement un module du 24 24 m� nom que l'application. 25 26 Si l'option -withcmdline est pr�nte, cr� un point d'entr�afin de d�lopper des 27 scripts en ligne de commande. 25 28 26 29 Le nom de l'application doit �e indiqu� 1) soit en premier param�e du script jelix.php … … 78 81 $cmd->run(); 79 82 } 83 84 if ($this->getOption('-withcmdline')) { 85 $this->createDir(JELIX_APP_CMD_PATH); 86 $this->createFile(JELIX_APP_CONFIG_PATH.'config.cmdline.ini.php','config.cmdline.ini.php.tpl',$param); 87 $param['rp_cmd'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CMD_PATH); 88 $this->createFile(JELIX_APP_CMD_PATH.'cmdline.php','scripts/cmdline.php.tpl',$param); 89 } 80 90 81 91 } trunk/lib/jelix-scripts/commands/createctrl.cmd.php
r153 r156 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor 7 * @contributor Loic Mathaud 8 8 * @copyright 2005-2006 Jouanneau laurent 9 9 * @link http://www.jelix.org … … 14 14 15 15 public $name = 'createctrl'; 16 public $allowed_options=array( );16 public $allowed_options=array('-cmdline'=>false); 17 17 public $allowed_parameters=array('module'=>true,'name'=>true, 'method'=>false); 18 18 19 public $syntaxhelp = " MODULE NOM_CONTROLEUR [NOM_METHOD]";19 public $syntaxhelp = "[-cmdline] MODULE NOM_CONTROLEUR [NOM_METHOD]"; 20 20 public $help=" 21 Permet de cr� un nouveau fichier d'une classe jController 21 Permet de cr� un nouveau fichier d'une classe jController ou jControllerCmdLine 22 22 23 Si l'option -cmdline est pr�nte, cr�un controller de type jControllerCmdLine, 24 pour d�lopper des scripts en ligne de commande. Sinon, le controller cr�est 25 de type jController. 26 23 27 MODULE : le nom du module concern� NOM_CONTROLEUR : nom du controleur que vous voulez cr�. 24 28 NOM_METHOD (facultatif) : nom de la premi� m�ode. Par d�ut, elle a 25 29 le nom index."; 26 30 27 31 28 32 public function run(){ … … 31 35 $agfilename= $path.'controllers/'; 32 36 $this->createDir($agfilename); 33 34 $agfilename.=strtolower($this->_parameters['name']).'.classic.php'; 37 38 if ($this->getOption('-cmdline')) { 39 $type = 'cmdline'; 40 } else { 41 $type = 'classic'; 42 } 43 44 $agfilename.=strtolower($this->_parameters['name']).'.'. $type .'.php'; 35 45 36 46 $method = $this->getParam('method','index'); … … 38 48 $param= array('name'=>$this->_parameters['name'] , 'method'=>$method); 39 49 40 $this->createFile($agfilename,'controller.tpl',$param); 50 if ($this->getOption('-cmdline')) { 51 $tplname = 'controller.cmdline.tpl'; 52 } else { 53 $tplname = 'controller.tpl'; 54 } 55 $this->createFile($agfilename,$tplname,$param); 41 56 42 57 } trunk/lib/jelix-scripts/jelix.php
r153 r156 4 4 * @version $Id$ 5 5 * @author Jouanneau Laurent 6 * @contributor 6 * @contributor Loic Mathaud 7 7 * @copyright 2005-2006 Jouanneau laurent 8 8 * @link http://www.jelix.org … … 80 80 define ('JELIX_APP_CONFIG_PATH', JELIXS_APPTPL_CONFIG_PATH); 81 81 define ('JELIX_APP_WWW_PATH', JELIXS_APPTPL_WWW_PATH); 82 define ('JELIX_APP_CMD_PATH', JELIXS_APPTPL_CMD_PATH); 82 83 } 83 84 trunk/lib/jelix-scripts/scripts.conf.php
r120 r156 4 4 * @version $Id$ 5 5 * @author Jouanneau Laurent 6 * @contributor 6 * @contributor Loic Mathaud 7 7 * @copyright 2005-2006 Jouanneau laurent 8 8 * @link http://www.jelix.org … … 19 19 define ('JELIXS_APPTPL_LOG_PATH' , JELIXS_APPS_BASEPATH."/$APPNAME/var/log/"); 20 20 define ('JELIXS_APPTPL_CONFIG_PATH' , JELIXS_APPS_BASEPATH."/$APPNAME/var/config/"); 21 define ('JELIXS_APPTPL_CMD_PATH' , JELIXS_APPS_BASEPATH."/$APPNAME/scripts/"); 21 22 define ('JELIXS_INIT_PATH' , JELIXS_APPS_BASEPATH.'/lib/jelix/init.php'); 22 23 trunk/lib/jelix-scripts/templates/application.init.php.tpl
r9 r156 18 18 define ('JELIX_APP_CONFIG_PATH', realpath(JELIX_APP_PATH.'{$rp_conf}').'/'); 19 19 define ('JELIX_APP_WWW_PATH', realpath(JELIX_APP_PATH.'{$rp_www}').'/'); 20 20 define ('JELIX_APP_CMD_PATH', realpath(JELIX_APP_PATH.'{$rp_cmd}').'/'); 21 21 22 22 ?> trunk/lib/jelix/core/jController.class.php
r138 r156 5 5 * @version $Id:$ 6 6 * @author Laurent Jouanneau 7 * @contributor 7 * @contributor Loic Mathaud 8 8 * @copyright 2001-2005 CopixTeam, 2005-2006 Laurent Jouanneau 9 9 * @link http://www.jelix.org … … 26 26 27 27 public $pluginParams=array(); 28 pr ivate$request;28 protected $request; 29 29 30 30 /** trunk/lib/jelix/core/request/jCmdLineRequest.class.php
r51 r156 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor 7 * @contributor Loic Mathaud 8 8 * @copyright 2005-2006 Jouanneau laurent 9 9 * @link http://www.jelix.org … … 19 19 20 20 protected function _initParams(){ 21 if($_SERVER['argc'] < 2){ 22 die("Error: selector is missing\n"); 23 } 24 $argv = $_SERVER['argv']; 21 25 22 $this->url = jUrl::parse($_SERVER['SCRIPT_NAME']); 23 $this->params = $_SERVER['argv']; 26 $scriptName = array_shift($argv); // shift the script name 27 $argsel = array_shift($argv); // get the module~action selector 28 $selector = new jSelectorAct($argsel); 29 30 $this->params = $argv; 31 $this->params['module'] = $selector->module; 32 $this->params['action'] = $selector->controller .'_'. $selector->method; 33 $this->url = null; // no URL in command line mode 24 34 } 25 35 } trunk/lib/jelix/init.php
r150 r156 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor 7 * @contributor Loic Mathaud 8 8 * @copyright 2005-2006 Jouanneau laurent 9 9 * @link http://www.jelix.org … … 27 27 define ('JELIX_LIB_RESPONSE_PATH',JELIX_LIB_PATH.'core/response/'); 28 28 define ('JELIX_LIB_TPL_PATH', JELIX_LIB_PATH.'tpl/'); 29 define ('JELIX_LIB_CTRL_PATH', JELIX_LIB_PATH.'controllers/'); 29 30 30 31 // all path of libs … … 56 57 $gLibPath=array('Db'=>JELIX_LIB_DB_PATH, 'DAO'=>JELIX_LIB_DAO_PATH, 57 58 'Forms'=>JELIX_LIB_FORMS_PATH, 'Event'=>JELIX_LIB_EVENTS_PATH, 'Auth'=>JELIX_LIB_AUTH_PATH, 58 'Tpl'=>JELIX_LIB_TPL_PATH, 'Acl'=>JELIX_LIB_ACL_PATH );59 'Tpl'=>JELIX_LIB_TPL_PATH, 'Acl'=>JELIX_LIB_ACL_PATH, 'Controller'=>JELIX_LIB_CTRL_PATH); 59 60 60 61 61 62 function __autoload($class){ 62 if(preg_match('/^j(Acl| DAO|Db|Forms|Event|Auth|Tpl).*$/', $class, $m)){63 if(preg_match('/^j(Acl|Controller|DAO|Db|Forms|Event|Auth|Tpl).*$/', $class, $m)){ 63 64 $f=$GLOBALS['gLibPath'][$m[1]].$class.'.class.php'; 64 65 }elseif(preg_match('/^cDAO(?:Record)?_(.*)_(.*)_(.*)$/', $class, $m)){
