symfony
symfony forum
Home » support » General discussion » Admin Generator: Further enhancement beyond symfony's capability
Admin Generator: Further enhancement beyond symfony's capability [message #33583] Fri, 17 August 2007 19:22 Go to next message
sfxpt  is currently offline sfxpt
Messages: 339
Registered: January 2007
Location: Canada
Faithful Member
Hi,

I had always been wondering, how can I make use of the existing Admin Gen generated code, save and use them somewhere else, then twist it further which might beyond symfony's capability, or as the last step to arrange the input fields better, eg, group several entries on one line instead of spreading them vertically, etc.

Plese help/comment.

In the meantime, I notice an interesting topic going on at:
http://www.symfony-project.com/forum/index.php?t=msg&th= 7947&start=0&

Which indicates that, there are at least 3 ways doing so:

- twist directly in cache, which face the problem that the changes can be overwritten at any moment.

- copy them to myapp/modules/module/template folder, and twist there.

- or change theme if you want to make the changes happen automatically.

Furthermore, instead of the current list/edit actions, can we add our own actions, eg, view1, view2, so that we can have multiple views to the same module? Ref, currently the symfony AdminGen interface lacks the possibility to have multiple views to the same module (msg posted at http://www.symfony-project.com/forum/index.php?t=msg&th= 7705),

thanks

[Updated on: Fri, 17 August 2007 19:26]


http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34330 is a reply to message #33583 ] Tue, 28 August 2007 14:39 Go to previous messageGo to next message
lvanderree  is currently offline lvanderree
Messages: 652
Registered: June 2007
Location: Netherlands
Faithful Member
I think you answered your first question yourself.

You can copy the files from cache to your module/template folder and alter them there.

If you want to have multiple items in one column I think you should take a look at http://www.symfony-project.com/book/trunk/14-Generators#List View-Specific Customization and see how you can use a "stacked" layout.

If you want to have these changes in more than one module it is wise to change your theme instead.

--

about your second question, about I think a good solution is to create a second module for the same object, but give it an other name. So
symfony propel-init-admin app module2 Object
and edit your generator too match it for your other view, maybe change the action.yml file to redirect the edit action to the first module and change the actions.yml file of the first module to redirect you back to module2 once you have saved your changes.

An other solution for your second problem would be to add this capability in your theme as well. Which is probably even nicer.

[Updated on: Tue, 28 August 2007 14:45]


Leon
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34345 is a reply to message #34330 ] Tue, 28 August 2007 16:12 Go to previous messageGo to next message
sfxpt  is currently offline sfxpt
Messages: 339
Registered: January 2007
Location: Canada
Faithful Member
about your second question, about I think a good solution is to create a second module for the same object, but give it an other name. So
symfony propel-init-admin app module2 Object


yeah, that's a good idea, I thought of that after my OP, and tested it. Unfortunately, I wasn't able to make it working.

I didn't trying the action.yml method, but I just checked:
Search www.symfony-project.com/book/trunk/
Your search - action.yml - did not match any documents.
http://www.google.com/search?ie=UTF-8&oe=UTF-8&domai ns=www.symfony-project.com%2Fbook%2Ftrunk%2F&sitesearch= www.symfony-project.com%2Fbook%2Ftrunk%2F&q=action.yml&a mp;btnG=search

I actually don't want any redirection. I want the new "view" has a different list view and different edit fields. For ex, I'd like to have the 2nd view to have most fields readonly, ie, only able to change selected few fields, and disable the "create" action.

I managed to get the module2 working by inherit the db object back from module (the original one), but the problem is that the config/generator.yml was from the original one as well. I don't know how to tell symfony to use the generator.yml from my module2, so the new view is useless to me for my above request.


http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34348 is a reply to message #34345 ] Tue, 28 August 2007 16:44 Go to previous messageGo to next message
lvanderree  is currently offline lvanderree
Messages: 652
Registered: June 2007
Location: Netherlands
Faithful Member
The thing you now mention about a simpeler/less powerfull version of the same module can also be accomplished with credentials. Both fields and actions can be linked to a credential and if the user doesn't have the credential the field or button won't be shown. See: http://www.symfony-project.com/book/trunk/14-Generators#Rest ricting User Actions Using Credentials

But when you want to have a seperate module linking to the same object but with a different view, all you have to do is use the admin-generator for the second time with as second argument a name for the new module (so don't copy the module form the original).

The command-line for that is simply

symfony propel-init-admin <app> <module-name-2> <object-name>


you only have to edit the actions.yml file if you want to link the actions from one module to the other, with redirects.


Leon
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34351 is a reply to message #34348 ] Tue, 28 August 2007 17:22 Go to previous messageGo to next message
sfxpt  is currently offline sfxpt
Messages: 339
Registered: January 2007
Location: Canada
Faithful Member
lvanderree wrote on Tue, 28 August 2007 10:44


The command-line for that is simply

symfony propel-init-admin <app> <module-name-2> <object-name>


you only have to edit the actions.yml file . . .


Thanks for the reply, but as I said, that doesn't work. Have you tried it out, just for testing?

Again, I can't find the term "actions.yml" in the book:

Your search - actions.yml - did not match any documents.
http://www.google.com/search?ie=UTF-8&oe=UTF-8&domai ns=www.symfony-project.com%2Fbook%2Ftrunk%2F&sitesearch= www.symfony-project.com%2Fbook%2Ftrunk%2F&q=actions.yml& amp;btnG=search

What do you mean exactly by the term "actions.yml"?

thanks


http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34352 is a reply to message #34348 ] Tue, 28 August 2007 17:31 Go to previous messageGo to next message
sfxpt  is currently offline sfxpt
Messages: 339
Registered: January 2007
Location: Canada
Faithful Member
lvanderree wrote on Tue, 28 August 2007 10:44

. . . Both fields and actions can be linked to a credential and if the user doesn't have the credential the field or button won't be shown. . .


Hmm, I want the create button not shown to everybody, So I just tried:

      object_actions:
        _edit:         ~
      actions:
        _create:      { credentials: [no_exist] }


But the create button is still there.

any suggestions?


http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34353 is a reply to message #34352 ] Tue, 28 August 2007 17:37 Go to previous messageGo to next message
sfxpt  is currently offline sfxpt
Messages: 339
Registered: January 2007
Location: Canada
Faithful Member
sfxpt wrote on Tue, 28 August 2007 11:31

. . . I want the create button not shown to everybody, So I just tried:

        _create:      { credentials: [no_exist] }




It works.

> But the create button is still there.

do not log in as admin.


http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34355 is a reply to message #34351 ] Tue, 28 August 2007 17:56 Go to previous messageGo to next message
lvanderree  is currently offline lvanderree
Messages: 652
Registered: June 2007
Location: Netherlands
Faithful Member
Sorry, I ment actions.class.php instead of actions.yml but you only need this to alter this to be able to redirect from one module to the other.


---

The propel-init-admin does has to work like this. I did test this I have a module assignment and I created a new module assignment2 by only typing:
symfony propel-init-admin backend assignment2 Assignment


And when i browse to http://localhost/backend_dev.php/assignment2 it works immediately... also the create button.


---

I think you have to define the actions under list, I don't see you've defined it there, so like this:

  list:
    actions:
      _create:      { credentials: [no_exist] }


This does not work if you are using sfGuard and logged in as admin though (because you then have all rights (or actually bypassing the credential system)).

To remove the create button for everyone you can however define no buttons, like

  list:
    actions:


Leon
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34374 is a reply to message #34355 ] Tue, 28 August 2007 21:26 Go to previous messageGo to next message
sfxpt  is currently offline sfxpt
Messages: 339
Registered: January 2007
Location: Canada
Faithful Member
lvanderree wrote on Tue, 28 August 2007 11:56

. . .
And when i browse to http://localhost/backend_dev.php/assignment2 it works immediately...


hmm, strange, strange. I tried in my demo project with

symfony propel-init-admin backend post2 Post

and it works as you described.

I'm wondering why it didn't work when I first tried. Here is the log that I dig out.

symfony propel-init-admin management art_imgs ArtInfo
>> dir+      /var/www/art/apps/management/modules/art_imgs/actions
>> file+     /var/www/art/apps/management/mo..._imgs/actions/actions.class.php
>> dir+      /var/www/art/apps/management/modules/art_imgs/config
>> file+     /var/www/art/apps/management/mo...s/art_imgs/config/generator.yml
>> tokens    /var/www/art/apps/management/mo..._imgs/actions/actions.class.php
>> tokens    /var/www/art/apps/management/mo...s/art_imgs/config/generator.yml


but when browsing

http://localhost/art/management_dev.php/art_imgs/

I get:

Fatal error: Class 'autoart_imgsActions' not found in /var/www/art/apps/management/modules/art_imgs/actions/action s.class.php on line 11

hmm. I'm so curious why it didn't work that I redid it again, and it works this time!

Thanks again for helping out. Otherwise, I'd still have the wrong impression, and will carry it on forever...

Thanks!



[Updated on: Tue, 28 August 2007 21:27]


http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34376 is a reply to message #34355 ] Tue, 28 August 2007 21:54 Go to previous messageGo to next message
sfxpt  is currently offline sfxpt
Messages: 339
Registered: January 2007
Location: Canada
Faithful Member
lvanderree wrote on Tue, 28 August 2007 11:56

To remove the create button for everyone you can however define no buttons, like

  list:
    actions:



Are you sure? I tried but it didn't work. Have you tried it out?


http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34378 is a reply to message #34376 ] Tue, 28 August 2007 22:22 Go to previous messageGo to next message
lvanderree  is currently offline lvanderree
Messages: 652
Registered: June 2007
Location: Netherlands
Faithful Member
sorry again, I seem to have missed a part overthere.

You should declare an empty array. I tested it, but apparantly I didn't paste it completely...

it should be:

  list:
    actions: []



Leon
Re: Admin Generator: Further enhancement beyond symfony's capability [message #34450 is a reply to message #34378 ] Wed, 29 August 2007 15:59 Go to previous message
sfxpt  is currently offline sfxpt
Messages: 339
Registered: January 2007
Location: Canada
Faithful Member
lvanderree wrote on Tue, 28 August 2007 16:22


it should be:

  list:
    actions: []





Yep, yep, thx a lot!


http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
Previous Topic:[SOLVED] Custom validator - access to submitted values
Next Topic:Forward/redirect in a component
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software