Jon !

Blog personnel de Jon

Archive for mai 2009

Rencontre avec la JE de science PO Rennes !

with 5 comments

IEP rennes

IEP Rennes

J’ai eu l’occasion de faire connaissance en tant que représentant de Centrale Nantes Etudes avec la JE de science PO Rennes, nouvellement créée et que l’on parraine. Elle se positionne sur le marché du conseil aux entreprises (Marketing, Communication, Audit …) côte à côte avec les JE de Sup de CO de la région, et en exclusivité sur deux autres marchés, celui du conseil aux organisations à but non-lucratif et aux administrations, ce qui est extrêmement prometteur. C’est à voir ici http://www.sprjuniorconseil.com

Sinon notre rencontre a été très chaleureuse, j’ai pu participer à leur cocktail de fin d’année sur Rennes, et deux d’entre eux sont venus nous voir à Nantes pour l’ascension :

SPR JC & CNE

SPR JC & CNE

Voilà, enfin bon c’était hyper Sympâ !

Written by Jonathan

mai 24, 2009 at 10:11

Publié dans CNE

How to hide your desktop in MacOS X !

leave a comment »

Hiding your desktop allow you get your entropy sensible place ever clean like that :

a clean desktop (geektools activated)

a clean desktop (geektools activated)

To do so, simply open the terminal and type :
defaults write com.apple.finder CreateDesktop -bool false

Then restart finder (right clic on finder, quit, …).

Written by Jonathan

mai 11, 2009 at 11:22

Publié dans en, Mac Os

How to create a new admin-gen theme in symfony 1.2

with 2 comments

As I got yesterday a deep issue in symfony 1.2, I decided to blog about it in english as I hope I will save a lot of time to somebody else. My issue was : « how to create a theme for my admin-gen ? ».

Most of admin-gen user know this piece of code in generator.yml

generator:
  class: sfPropelGenerator
    param:
      model_class:           BlogArticle
      theme:                 admin
      non_verbose_templates: true
      with_show:             false
      singular:              ~
      plural:                ~
      route_prefix:          article
      with_propel_route:     1

let’s talk in deep about it and especially about the theme param. Just an info, don’t try with_show, it’s not supported in symfony 1.2 ^^ !

First of all, back to the basis, what is init-admin, what is generate-admin ?

propel:init-admin

propel:init-admin

Result :

apps/frontend/modules/individu/actions:
actions.class.php
apps/frontend/modules/individu/config:
generator.yml
apps/frontend/modules/individu/templates:
propel:generate-admin

propel:generate-admin

Result :

apps/frontend/modules/entreprise/actions:
actions.class.php
apps/frontend/modules/entreprise/config:
generator.yml
apps/frontend/modules/entreprise/lib:
entrepriseGeneratorConfiguration.class.php      entrepriseGeneratorHelper.class.php
apps/frontend/modules/entreprise/templates:

To be honest, the only difference I see between init-admin and generate-admin is generate-admin is more complete :

  • It creates a routing rules.
  • It creates some helpers.

Anyways, they both works the same way as they will inherit from cache/frontend/dev/modules/autoIndividu and cache/frontend/dev/modules/autoEntreprise for the modules apps/frontend/modules/individu and apps/frontend/modules/entreprise.

OK, let’s go. My first advice :

symfony cc is not enough, it only cleans configuration and basic cache, but not the generated code. Then rm -r cache/* is the best way to handle a clean of the cache.

My second advice is :

changing randomly the theme param value will not get far cause no error is thrown if the theme is missing, as reported in the ticket #6287! Then the correct default value are :

  • default is you are using a propel:init-admin.
  • admin is you are using a propel:generate-admin

Now let’s create a new theme from a existing one.

The documentation says :

Customizing the Theme

There are other partials inherited from the framework that can be overridden in the module templates/ folder to match your custom requirements.

The generator templates are cut into small parts that can be overridden independently, and the actions can also be changed one by one.

Which means you can override parts of the template contained in cache/frontend/dev/modules/autoIndividu/template in apps/frontend/modules/individu/template.

However, if you want to override those for several modules in the same way, you should probably create a reusable theme. A theme is a sub-set of templates and actions that can be used by an administration module if specified in the theme value at the beginning of generator.yml. With the default theme, symfony uses the files defined in $sf_symfony_lib_dir/plugins/sfPropelPlugin/data/generator/sfPropelModule/admin/.

That’s true, but only for a module generated with propel:generate-admin (which btw gets as default theme the value admin). Even if it’s works be aware that have to do a full copy of the theme (no override of the default theme).

Here we do :


# move to root of your project
cd root_of_my_symfony_project
# get the generator's data for symfony 1.2.6
svn export http://svn.symfony-project.com/tags/RELEASE_1_2_6/lib/plugins/sfPropelPlugin/data/generator data/generator
#you can delete what you don't need
rm -r data/generator/sfPropelForm*

Now you get pretty much everything you need for a theme available in a propel:init-admin generated module, or a propel:generate-admin generated module:

  • If you want to make a theme for a init-admin :
    cp -R generator/sfPropelAdmin/default generator/sfPropelAdmin/mytheme
  • If you want to make a theme for a generate-admin :
    cp -R generator/sfPropelModule/admin generator/sfPropelModule/mytheme

To activate your theme :

generator:
  class: sfPropelGenerator
    param:
      model_class:           BlogArticle
      theme:                 mytheme
      non_verbose_templates: true
      with_show:             false
      singular:              ~
      plural:                ~
      route_prefix:          article
      with_propel_route:     1

Enjoy the advanced admin-gen customization and feel free to ping me in comments if you need more info or if you see something, you are much welcome 😉

Written by Jonathan

mai 2, 2009 at 4:10

Publié dans en, symfony

Tagged with ,