New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customization of the way Actions, Views etc. are laid out in the filesystem #668

Closed
dzuelke opened this Issue Jan 8, 2008 · 13 comments

Comments

Projects
None yet
2 participants
@dzuelke
Contributor

dzuelke commented Jan 8, 2008

so instead of

```
$file = AgaviConfig::get(‘core.module_dir’) . ‘/’ . $moduleName . ‘/actions/’ . $actionName . ‘Action.class.php’;
```

in `AgaviController::createActionInstance()`
we expand directives and variables on a string read from, say, “modules.modulename.agavi.action.path”, that defaults to something like

```
core.module_dir/${moduleName}/actions/{$actionName}Action.class.php
```

So you could get rid of the separate folders for view, tpl etc per action by having something like

```
core.module_dir/${moduleName}/{$actionName}/Action.class.php
```

for the action,

```
core.module_dir/${moduleName}/{$actionName}/validate.xml
```

for the validation xml and so on.

All of this should be per-module, as otherwise, modules are not really interchangeable.

Difficult: the Views. They have a scheme like `Default_Sub_MarineSuccessView`, which won’t work unless `Marine` and `Success` (in this example) are separate. That means we also need customization of the way a View shortname (`Success`) and an Action name are concatenated.

Also, template paths are defined through layouts, and handled in `AgaviTemplateLayer` classes, where we can only really adjust `directory`, not all targets, since those are defined globally.

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Aug 19, 2008

Contributor

Milestone changed from 1.1.0 to 1.3.0

Contributor

dzuelke commented Aug 19, 2008

Milestone changed from 1.1.0 to 1.3.0

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Aug 26, 2008

Contributor

this has implications for the build system, too, mind you

Contributor

dzuelke commented Aug 26, 2008

this has implications for the build system, too, mind you

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Sep 4, 2008

Contributor

Milestone changed from 1.3.0 to 1.0.0

Contributor

dzuelke commented Sep 4, 2008

Milestone changed from 1.3.0 to 1.0.0

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Sep 4, 2008

Contributor

Title changed from “Make filesystem path rules configuration directive based” to “Allow customization of Action/View/Template/Caching/Validation file lookup paths and View shortname resolution”

Contributor

dzuelke commented Sep 4, 2008

Title changed from “Make filesystem path rules configuration directive based” to “Allow customization of Action/View/Template/Caching/Validation file lookup paths and View shortname resolution”

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Sep 4, 2008

Contributor

Title changed from “Allow customization of Action/View/Template/Caching/Validation file lookup paths and View shortname resolution” to “Allow customization of the way Actions, Views etc. are laid out in the filesystem”

Contributor

dzuelke commented Sep 4, 2008

Title changed from “Allow customization of Action/View/Template/Caching/Validation file lookup paths and View shortname resolution” to “Allow customization of the way Actions, Views etc. are laid out in the filesystem”

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Sep 4, 2008

Contributor

And then, in a new-style `module.xml` (#834):

```
%core.module_dir%/${moduleName}/${actionName}/Action.class.php
%core.module_dir%/${moduleName}/${actionName}/cache.xml
%core.module_dir%/${module}
%core.module_dir%/${moduleName}/${actionName}/validate.xml
%core.module_dir%/${moduleName}/${viewName}View.class.php
${actionName}/${viewName}
```

Of course, you can also put this into its own `` block and XInclude from elsewhere…

Contributor

dzuelke commented Sep 4, 2008

And then, in a new-style `module.xml` (#834):

```
%core.module_dir%/${moduleName}/${actionName}/Action.class.php
%core.module_dir%/${moduleName}/${actionName}/cache.xml
%core.module_dir%/${module}
%core.module_dir%/${moduleName}/${actionName}/validate.xml
%core.module_dir%/${moduleName}/${viewName}View.class.php
${actionName}/${viewName}
```

Of course, you can also put this into its own `` block and XInclude from elsewhere…

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Sep 4, 2008

Contributor

(In 130d09b85cbcbf86e43c0e728b6577867a512d42) Allow customization of the way Actions, Views etc. are laid out in the filesystem, closes #668

Contributor

dzuelke commented Sep 4, 2008

(In 130d09b85cbcbf86e43c0e728b6577867a512d42) Allow customization of the way Actions, Views etc. are laid out in the filesystem, closes #668

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Sep 4, 2008

Contributor

Issue closed

Contributor

dzuelke commented Sep 4, 2008

Issue closed

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Sep 4, 2008

Contributor

I should mention that the following structure is much nicer:

```
%core.module_dir%/${moduleName}/impl/${actionName}/Action.class.php
%core.module_dir%/${moduleName}/impl/${actionName}/cache.xml
%core.module_dir%/${module}/impl/
%core.module_dir%/${moduleName}/impl/${actionName}/validate.xml
%core.module_dir%/${moduleName}/impl/${viewName}View.class.php
${actionName}/${viewName}
```

as you then have this structure:

```
app
modules
Default
config
impl
lib
models
```

with all actions, views, templates and cache/validation configs inside `impl/`

note that the example (has to) customize the view name, so you now have a slash (subdir) in the view filename (and an underscore in the class name) between action name and view shortname (Success, Input etc)… example: `Default_Sub_Marine_SuccessView` instead of `Default_Sub_MarineSuccessView`

also, using the template lookup pattern where there is a directory per locale does not make much sense with this layout

Contributor

dzuelke commented Sep 4, 2008

I should mention that the following structure is much nicer:

```
%core.module_dir%/${moduleName}/impl/${actionName}/Action.class.php
%core.module_dir%/${moduleName}/impl/${actionName}/cache.xml
%core.module_dir%/${module}/impl/
%core.module_dir%/${moduleName}/impl/${actionName}/validate.xml
%core.module_dir%/${moduleName}/impl/${viewName}View.class.php
${actionName}/${viewName}
```

as you then have this structure:

```
app
modules
Default
config
impl
lib
models
```

with all actions, views, templates and cache/validation configs inside `impl/`

note that the example (has to) customize the view name, so you now have a slash (subdir) in the view filename (and an underscore in the class name) between action name and view shortname (Success, Input etc)… example: `Default_Sub_Marine_SuccessView` instead of `Default_Sub_MarineSuccessView`

also, using the template lookup pattern where there is a directory per locale does not make much sense with this layout

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Sep 22, 2008

Contributor

Also mind you you need to set up config handlers in your application’s or module’s `config_handlers.xml`:

```

%core.agavi_dir%/config/xsd/validators.xsd

core.agavi_dir/config/xsd/caching.xsd

```

Contributor

dzuelke commented Sep 22, 2008

Also mind you you need to set up config handlers in your application’s or module’s `config_handlers.xml`:

```

%core.agavi_dir%/config/xsd/validators.xsd

core.agavi_dir/config/xsd/caching.xsd

```

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 15, 2009

Collaborator

any hints towards how well tested this is with the build system?

(Originally posted to Trac by “anonymous”)

Collaborator

ghost commented Mar 15, 2009

any hints towards how well tested this is with the build system?

(Originally posted to Trac by “anonymous”)

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Mar 15, 2009

Contributor

The issue tracker is not a support system. If you have questions, direct them to the users mailing list.

Contributor

dzuelke commented Mar 15, 2009

The issue tracker is not a support system. If you have questions, direct them to the users mailing list.

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Apr 1, 2009

Contributor

Correct entries for `config_handlers.xml` (the above example is outdated):

``` xml

%core.agavi_dir%/config/xsd/validators.xsd
%core.agavi_dir%/config/xsl/validators.xsl

core.agavi_dir/config/xsd/caching.xsd core.agavi_dir/config/xsl/caching.xsl

```

Contributor

dzuelke commented Apr 1, 2009

Correct entries for `config_handlers.xml` (the above example is outdated):

``` xml

%core.agavi_dir%/config/xsd/validators.xsd
%core.agavi_dir%/config/xsl/validators.xsl

core.agavi_dir/config/xsd/caching.xsd core.agavi_dir/config/xsl/caching.xsl

```

@ghost ghost assigned dzuelke Jan 16, 2014

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment