Home » support » General discussion » Building Own Generator ( ) 7 Vote(s)
|
| Re: Building Own Generator [message #45115 is a reply to message #45104 ] |
Fri, 08 February 2008 01:37   |
 |
lvanderree Messages: 652 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
| KRavEN wrote on Thu, 07 February 2008 20:10 |
| lvanderree wrote on Thu, 07 February 2008 12:59 | this 'solution' of yours (the original implementation) is wrong, because now the foreign-key-field is required if the foreign-value-field is required. Or in other words the plugin checks if the field mime_type is required instead of checking if sfPropelFileStorageInfo_id is required
|
Right, I didn't think it was the fix and didn't check it in. I was just letting you know what I did to get the exception to go away in the hopesthat this might help you narrow down the issue.
Your got me thinking though talking about the id being required, so I added it into my list and the problem goes away:
doesn't work:
list:
title: File Manager
display: [_link, _size, sfPropelFileStorageInfo/mime_type, created_at, sfGuardUser/username]
works:
list:
title: File Manager
display: [id, file_id, _link, _size, sfPropelFileStorageInfo/mime_type, created_at, sfGuardUser/username]
hide: [id, file_id]
|
I think one problem is that you shouldn't say sfPropelFileStorageInfo/mime_type, but file_info/mime_type
Unfortunately this doesn't work either, it brakes later on when file_info is translated to sf_propel_file_storage_info somehow... I will continue to investigate this tomorrow.
Leon
|
|
| | |
| Re: Building Own Generator [message #45159 is a reply to message #45155 ] |
Fri, 08 February 2008 14:41   |
 |
lvanderree Messages: 652 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
Sorting isn't really worked out yet.
I have an old implementation, which probably still works (but is not used anymore by me), this was implemented before we had the power of providing the tablename/fieldname structure. I want to use this new structure one day to make sorting work properly.
At the moment the old implementation still should work. You should define the sort-criteria in your generator.yml file under the field-properties, see:
http://trac.symfony-project.com/ticket/924
generator:
class: sfPropelAdminGenerator
param:
model_class: sfGuardUser
theme: default
list:
title: Users
display: [ =username, _show_fullname, _show_emailaddress]
fields:
show_fullname:
name: Fullname
join_fields: [sfGuardUserPeer::ID, UserPeer::USERID]
sort_column: [UserPeer::FIRSTNAME, UserPeer::NAMEADDITIONS, UserPeer::LASTNAME]
show_emailaddress:
name: E-mailaddress
sort_column: UserPeer::EMAILADDRESS
This is old code which probably still works, but sorting isn't my main priority at the moment...
In the future I want sorting to be done automatically for the foreign-fields. For partials something nicer can be invented probably...
[Updated on: Fri, 08 February 2008 14:44] Leon
|
|
| | | | | |
| Re: Building Own Generator [message #45175 is a reply to message #45168 ] |
Fri, 08 February 2008 16:53   |
 |
lvanderree Messages: 652 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
| gzorg wrote on Fri, 08 February 2008 16:37 | Thanx for your quick answer, and for the links i didn't found
As a first question I wonder simply how to transform the layout :
fo exemple I need to have filters in a Box not in a Tab but as a right box.
Is this type of param exist or not?
As I need to make a project to demonstrate capabilities of extjs on symfony in a couple of days, do you think I'd better make changes in a separate theme?
|
This is one of the things which isn't implemented yet, but on the wish-list. I wouldn't recommend on making your own seperate theme, but send me your patches/changes and I will do my best to merge them with the current theme, adding paramters whenever necessary in coordination with you. I would like to make one big theme which can handle a lot, so it can be used and tested and improved by many people.
As you can see in my live-demo: http://tejohnston.dynora.eu/backend_dev.php/ (username/password: admin) that it is possible to change the page in which a link is opened, this is done by altering the renderer in the generator.yml file.
the generator.yml file for this page is here:
generator:
class: sfExtjsPropelAdminGenerator
param:
model_class: AssignmentParcel
theme: extjs
related_tables:
client_company:
module_name: clientcompany
agent_company:
module_name: agentcompany
fields:
assignment/subject:
name: Assignment
params:
header_valuePrefix: "<i>Assignment</i>: "
header_valueSuffix: ""
assignment/client_company/name:
params:
header_valuePrefix: ", <i>Client</i>: "
header_valueSuffix: ""
assignment/voyage/vessel/name:
params:
header_valuePrefix: ", <i>Vessel</i>: "
header_valueSuffix: ""
sf_guard_user/username:
params:
header_valuePrefix: ", <i>Made by</i>: "
header_valueSuffix: ""
assignment_id:
class: hidden
subject:
name: Subject
params:
renderer: "return renderLinkWithBase('Parcel: ' + value, params, record, 'type=\"parcel\" assignmentid=\"'+record.data['assignment_parcel-assignment_id']+'\" assignmenttextcontent=\"Assignment: '+record.data['assignment_parcel-assignment-subject']+'\"');"
product/name:
name: Product
country/name:
name: Origin
quantity:
params:
renderer: "return renderWeight(value)"
list:
title: Assignment overview
display: [=subject, product/name, country/name, quantity, stowage]
grouping:
field: assignment/subject
display: [=assignment/subject, assignment/client_company/name, assignment/voyage/vessel/name]
peer_method: doSelectLeftJoinAssignment
actions:
add_assignment:
name: Add new assignment
class: btn_create
handler_function: "App.openAssignment('create_assignment', '/backend_dev.php/assignment/create', 'New Assignment');"
_separator: -
_refresh: -
_upload: -
_fill: -
_pdf: -
_print: -
edit:
display: []
pages:
general:
title: Parcel General
display: [assignment_id, assignment_parcel_id, subject, product/name, country/name, quantity, stowage]
bl:
title: Bill of Lading
display: [subject]
timelog:
title: Timelog
display: [subject]
surveyor:
title: Surveyor
display: [subject]
laboratory:
title: Laboratory
display: [subject]
report:
title: Report
display: [subject]
invoice:
title: Invoice
display: [subject]
finish:
title: Finished
display: [subject]
Changing the location of the filters isn't possible yet, but if you provide a patch I would like to merge it of course. I also offer to help wherever I can to accomplish this, but I do have my own agenda: getting graduated asap... However all you people's additions can help me in getting graduated sooner, so I like to help as much as I can.
One other note: providing the fields on which you want to filter isn't as nice as for the display fields yet (with tablename/fieldname) this is another todo..
Leon
|
|
| | | | | | |
| Re: Building Own Generator [message #45292 is a reply to message #45253 ] |
Mon, 11 February 2008 16:03   |
 |
lvanderree Messages: 652 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
Grids are fully functional again: including sorting on foreign-fields, grouping and master-detail.
I am now going to look at the edit-pages.
I am thinking about committing this evening, since this Thursday will be the last day I will be working, before I leave for one week to vacation . this way I can give feedback for three days if someone has some problems. (which probably should be enough I guess, to solve the missed bugs).
Important changes in the code are that the $checkname and $class are now obsolete. Everything gets resolved by there table-(foreign)field-names, which makes things a lot cleaner/nicer.
In the code you now still see lots of fragments like:
$columnName = $column->key;
list($class, $checkName) = explode('/', $columnName, 2);
if (strtolower($class) != strtolower($tableName))
{
$class = $tableName;
$checkName = $columnName;
}
this all gets handled by $column->key (which holds the key you defined in the generator.yml file, for instance city_id/country_id/name for a client_company )
you can get the column for a key by calling:
$column = $this->getColumnForFieldName($key);
tableNames can be acquired by calling $column->getTableName()
and ClassNames by calling $column->getTable()->getPhpName()
and PeerNames by calling getTable()->getPhpName().'Peer'
although I don't think you will ever need this if I did my work correctly 
Leon
|
|
| | | | | |
| Re: Building Own Generator [message #45610 is a reply to message #45595 ] |
Fri, 15 February 2008 20:14   |
 |
lvanderree Messages: 652 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
Sorry was a little quiet this week, need to write some reports.
Today I am leaving to Austria for a week, I will be back at sunday the 24th.
About the grouping,
are you absolutely sure your genererator is correct? For me the grouping and master/detail is working.
Here some examples:
Grouping of city's per country
generator:
class: sfExtjsPropelAdminGenerator
param:
model_class: City
theme: extjs
fields:
country_id/name:
name: Country name
params:
editable: true
country_id/abbreviation:
name: Abbreviation
params:
editable: true
list:
display: [=name, country_id/name, country_id/abbreviation]
filters: [name, country_id/name]
grouping:
field: country_id/name
edit:
actions: []
master-detail as in my graduation project:
generator:
class: sfExtjsPropelAdminGenerator
param:
model_class: AssignmentParcel
theme: extjs
related_tables:
client_company:
module_name: clientcompany
agent_company:
module_name: agentcompany
fields:
assignment_id/subject:
name: Assignment
params:
header_valuePrefix: "<i>Assignment</i>: "
header_valueSuffix: ""
assignment_id/client_company_id/name:
params:
header_valuePrefix: ", <i>Client</i>: "
header_valueSuffix: ""
assignment_id/voyage_id/vessel_id/name:
params:
header_valuePrefix: ", <i>Vessel</i>: "
header_valueSuffix: ""
created_by/username:
params:
header_valuePrefix: ", <i>Made by</i>: "
header_valueSuffix: ""
assignment_id:
class: hidden
subject:
name: Subject
params:
renderer: "return renderLinkWithBase('Parcel: ' + value, params, record, 'type=\"parcel\" assignmentid=\"'+record.data['assignment_parcel-assignment_id']+'\" assignmenttextcontent=\"Assignment: '+
record.data['assignment_parcel-assignment-subject']+'\"');"
product/name:
name: Product
country/name:
name: Origin
quantity:
params:
renderer: "return renderWeight(value)"
list:
title: Assignment overview
display: [=subject, product_id/name, country_id/name, quantity, stowage]
grouping:
field: assignment_id/subject
display: [=assignment_id/subject, assignment_id/client_company_id/name, assignment_id/voyage_id/vessel_id/name]
peer_method: doSelectLeftJoinAssignment
actions:
add_assignment:
name: Add new assignment
class: btn_create
handler_function: "App.openAssignment('create_assignment', '/backend_dev.php/assignment/create', 'New Assignment');"
_separator: -
_refresh: -
_upload: -
_fill: -
_pdf: -
_print: -
edit:
display: []
pages:
general:
title: Parcel General
display: [assignment_id, assignment_parcel_id, subject, product_id/name, country_id/name, quantity, stowage]
bl:
title: Bill of Lading
display: [subject]
timelog:
title: Timelog
display: [subject]
surveyor:
title: Surveyor
display: [subject]
laboratory:
title: Laboratory
display: [subject]
report:
title: Report
display: [subject]
invoice:
title: Invoice
display: [subject]
finish:
title: Finished
display: [subject]
Good luck and please keep posting on the forum, I will read everything when I'll get back!
Leon
|
|
| | | | | | | | |
| Re: Building Own Generator [message #47339 is a reply to message #47332 ] |
Fri, 07 March 2008 16:12   |
KRavEN Messages: 213 Registered: May 2007 |
Faithful Member |
|
|
| Quote: | - PJS does not work in the layout as presented in the blog above. This because PJS code is not loaded / executed in code which is loaded via ext load params / method (even if scripts: true). anybody an idea what's wrong there?
|
With PJS I've found if you're loading a pjs file into a div it needs to be inside <head> tags otherwise the scripts:true doesn't work right.
I use PJS a lot to load code for entire grids after initial render and it works very well for me. For a good example look at the code for the file upload action.
[Updated on: Fri, 07 March 2008 16:13]
|
|
| | | |
| Re: Building Own Generator [message #47776 is a reply to message #47771 ] |
Thu, 13 March 2008 16:28   |
KRavEN Messages: 213 Registered: May 2007 |
Faithful Member |
|
|
your problem is that with PJS on it includes the listJs.pjs file AND it includes the javascript in the body of listAjaxSuccess.php. If you go to the net tab in firebug and look at the response from backend_dev.php you will see what I mean.
Check listAjaxSuccess.php in your cache line 23 through 32 should look like:
$sfExtjs2Plugin->load();
?>
<?php
// javascript layout
use_helper('PJS');
use_pjs('tejohnsonston-pjs_on/listJs')
?>
<div id="sf_admin_container">
[Updated on: Thu, 13 March 2008 16:30]
|
|
| | |
| Re: Building Own Generator [message #48341 is a reply to message #24107 ] |
Mon, 24 March 2008 00:48   |
 |
lvanderree Messages: 652 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
I've made a simple presentation to explain how I use the sfExtjsThemePlugin with Symfony to generate the pages I had defined in my functional design-sketches. It is not polished yet, but maybe anyone wants to take a look at it to understand how things work, or to give me feedback about how to improve it.
The main idea behind it is to quickly inform my supervisor why I use Symfony, with ExtJs (and this plugin) to implement the design-sketches in a real application, explain why it is a lot of work, and point at him what still needs to be done.
I've noticed their still are bugs in the generator, related to all the (different) naming of variables in ExtJs grids, data-readers, data-stores, JSON data, Php-objects. This does not really show up in this presentation (yet), since it is very hard to describe all these details in an understandable overview.
UPDATE: I've got an updated version of the presentation in my new post
[Updated on: Tue, 25 March 2008 13:44] Leon
|
|
|
Goto Forum:
|