Thursday, January 21, 2010

a new version for sfAdminThemejRollerPlugin 0.2

Finally! We finally managed to catch up and prepare a new version of our Symfony plugin to generate nice admin generator based on jQuery UI Themes.

We tagged this version as 0.2.0 since we still consider this plugin as beta version (but usable on production) but the big news is the support of symfony 1.4! For this specific support I must thank you 2 people that submited 2 patches to make this compatibility possible. Thanks to ( jtexier , "merci Jerome ;-)") and dalexandre and of course I must named jeremyb for his dedication to the project, he did most of the latest development.

I also setup a live demo to allow you to play a little bit with the plugin. It is currently basic but we will add more stuff step by step.

What's new:
  • Theme switcher integrated
  • user interface fixes and enhancements
  • Symfony 1.4 compatibility

You can have some more details on my previous post.

The plugin is available as usual on github, I published as well the packaged plugin on symfony website.

jroller-v0.2-list.png



jroller-v0.2-filter.png


jroller-v0.2-listbottom.png


Screen shot 2010-01-21 at 10.48.44 AM.png

27 comments:

  1. great. in the demo installation if you try to batch delete things it leads to an error page. i suspect this is due to a bug vs csrf handling in symfony 1.3/1.4 (it's the same bug i had with previous versions and i don't know how to fix it)

    ReplyDelete
  2. It looks great but ... do you think that "hidding" the filters in a button/dialog box is a good idea ?

    Could be very confusing if you've forgotten that a filter was set (you can't see that a filter is set without clicking on the filter button ?)

    ReplyDelete
  3. Hi,
    I've ever seen this plugin with the previous version and I really like the new one.

    On problem stay for me : if Javascript is inactive, you loose filters and actions for example and the tabs in new/edit action.

    I work with the accessibility notion and for me, it's really an issue.

    Do you have planed this ?

    ReplyDelete
  4. Hello

    this is a nice plugin, unfortunately I had tried to reach Gerald before for some questions and he should be pretty busy, there is a small bug on the batch actions as described before ... here is the solution:
    you should change the partial :

    plugins/sfAdminThemejRollerPlugin/data/generator/sfDoctrineModule/jroller/template/templates/_list_batch_actions.php

    line: 9 from:

    [?php $form = new sfForm(); if ($form->isCSRFProtected()): ?]

    to:

    [?php $form = new BaseForm(); if ($form->isCSRFProtected()): ?]


    Hope this help for anybody using this great plugin

    Regards

    Adrian

    ReplyDelete
  5. great, i've applied the patch and it works IF you make another little modification in plugins/sfAdminThemejRollerPlugin/data/generator/sfDoctrineModule/jroller/parts/batchAction.php change

    $validator = new sfValidatorDoctrineChoice(array( 'model' => 'getModelClass() ?>'));

    to

    $validator = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'getModelClass() ?>'));

    ReplyDelete
  6. @gunzip: thanks for the bug report, I will look at it. I did not test this feature, maybe there are some changes with sf1.3/1.4. @edsadr gave the solution, I will commit a new version later....oups I did not see your last comment, great you fix it! I will put everything on github later today.

    @vjousse: we did not like the idea to have filters always visible, what you focus on is the list. Our plan is actually to put a flag or something on the filter button when there are filters used. We have not yet done this.

    @anonymous: yes accessibility is also a concern for us but we have not yet look at it in details. Hopefully we can fix this issue too. Thanks to push us in that way.

    ReplyDelete
  7. Very nice plugin. However, you should remove all the .DS_Store hidden files that are a pain for non mac users.

    ReplyDelete
  8. Many thanks for this plugin, really really Great!
    input tag page is not ready ? I make some changes to do that in plugins/sfAdminThemejRollerPlugin/data/generator/sfDoctrineModule/jroller/parts/batchAction.php:
    After checkCRSFPritection in executeBatch()and before checks ids tab :

    if($request->getParameter('page') != $this->getPage())
    {
    $this->setPage($request->getParameter('page'));
    $this->redirect('@getUrlForAction('list') ?>');
    }

    Is the right way or i missed something ?

    Geoff

    ReplyDelete
  9. The batch action do not run

    SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

    and it do no run in the live demo too.

    Someone can help me please.

    (sorry for my english)

    ReplyDelete
  10. @geoff well done, but I've done some corrections, now working for me:

    if($request->getParameter('page') != $this->getPage())
    {
    $this->setPage($request->getParameter('page'));
    $this->redirect('@getUrlForAction('list') ?>');
    }

    ReplyDelete
  11. @mods delete the above post, as it was wrong copy&pasted


    @geoff well done, but I've done some corrections, now working for me:

    if($request->getParameter('page') != $this->getPage())
    {
    $this->setPage($request->getParameter('page'));
    $this->redirect('@getUrlForAction('list') ?>');
    }

    ReplyDelete
  12. Seems like echo and $this are not beeing there, are cut out!

    ReplyDelete
  13. There is a Problem with "ech.o" and "$.this"

    ReplyDelete
  14. okay someone delete all my posts, thx

    ReplyDelete
  15. fix for the pager (when self typing in the pages):

    in: batchAction.php

    if($request->getParameter('page') != $this->getPage())
    {
    $page_my = $request->getParameter('page');

    // page request is bigger then pages available, go to last page
    // go to first, on other extreme
    if ($this->getPager()->getLastPage() < $page_my)
    $page_my = $this->getPager()->getLastPage();
    else if ($this->getPager()->getFirstPage() > $page_my)
    $page_my = $this->getPager()->getFirstPage();

    $this->setPage($page_my);
    $this->redirect('@getUrlForAction('list') ?>');
    }

    ReplyDelete
  16. >>> thomas said...

    The batch action do not run

    SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

    and it do no run in the live demo too.
    =======
    I hate to bring this up, too, but it doesn't work for me, either. If I switch to the ugly 'admin' plugin in 1.4 Doctrine it works fine. I am pulling my hair out a bit and I can see the query being triggered by sfValidatorDoctrineChoice.

    When I comment this code in batchAction, it works (but I obviously lose the functionality). Maybe you can advise?

    This is the code I comment:

    $validator = new sfValidatorDoctrineChoice(array('model' => 'getModelClass() ?>'));
    try
    {
    // validate ids
    $ids = $validator->clean($ids);

    // execute batch
    $this->$method($request);
    }
    catch (sfValidatorError $e)
    {
    $this->getUser()->setFlash('error', 'A problem occurs when deleting the selected items as some items do not exist anymore.');
    }

    ReplyDelete
  17. Ok, I found it. The batch action bug is in batchAction.php.

    Change line 29 to read:

    $validator = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'getModelClass() ?>'));

    (Add 'multiple' => true)

    ReplyDelete
  18. Maybe a dumb question: The Theme doesn't looku quit elike that in the demo tith a default install. Is the demo highly customized (UI icons, pager icons, etc.) or is it a newer version?

    ReplyDelete
  19. @Rolf Ernst:

    Great!! You save my afternoon.
    Thx :)

    ReplyDelete
  20. is there any way to enable it across all admin modules? including the sfGuard ones.

    ReplyDelete
  21. Hi, that plugin is very nice, but i have a little problem. the plugin works fine with all admin module automatic generates, but with sfDoctrineGuard, in sfGuardUser when i click reset in filters window, i have a routing error:

    Action "guard/users" does not exist.

    If you cant see the error and answer me, i'll thank you.

    ReplyDelete
  22. [Sorry for the bad English redacted]
    Changes paging I got in the comments resulted in problems in batchDelete because there was not checked if the page parameter, and always redirected to the list.

    Following is the changed code working:

    if($request->hasParameter('page') && $request->getParameter('page') != $this->getPage())
    {
    $page_my = $request->getParameter('page');

    // page request is bigger then pages available, go to last page
    // go to first, on other extreme
    if ($this->getPager()->getLastPage() < $page_my)
    $page_my = $this->getPager()->getLastPage();
    else if ($this->getPager()->getFirstPage() > $page_my)
    $page_my = $this->getPager()->getFirstPage();

    $this->setPage($page_my);
    $this->redirect('@getUrlForAction('list') ?>');
    }

    ReplyDelete
  23. Not sure about the various versions for the pager but I am running 1.4 and while the above example is correct (mostly) the redirect must look like this:

    $this->redirect('@getUrlForAction('list') ?>');

    (Just pick the same redirect code as for the id redirect.)

    ReplyDelete
  24. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    WARNING: Wordpress apparently strings out part of the string (i.e. it doesn't include the php part.) So my solution also looks wrong.

    Just pick the redirect from a few lines below. If has the string php and echo in it (I cannot post it here since the comments strip it for security, I guess).

    ReplyDelete
  25. I'd wrap your pager fix, also:

    if ($request->hasParameter('page')) {
    // pager fix here..
    }

    Or you may be wondering what happened to your batch actions for four days, crawling the web wondering why nobody seems to have this problem EXCEPT YOU.

    Merry xmas!

    ReplyDelete
  26. After installing the plugin and setting the theme to "jroller", I get this:

    Fatal error: Class 'BaseIncentivesGeneratorConfiguration' not found in /data/work_area/shayr/redchurch/apps/backend/modules/incentives/lib/incentivesGeneratorConfiguration.class.php on line 12

    Anyone know what's going on? I've posted on several boards and heard nothing... Help!

    ReplyDelete