Home » support » General discussion » Building Own Generator ( ) 6 Vote(s)
| |
| Re: Building Own Generator [message #34863 is a reply to message #34764 ] |
Tue, 04 September 2007 01:30   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
The alpha-alpha release 2.
Lots of improvements, for example edit now works when you double-click an item, but nothing is finished yet (of course...)
The list options from your generator.yml file are now mostly seen back in the ajax-view.
The edit-view still needs lots of work, for example the actions need to be moved.
I found a serious issue regarding secuirty in the plugin: Even though I check for credentials, I send all (other) columns to the user in the ajax-json-result, which now can contain passwords, even though you don't show them in your list and you don't have an edit page... I still have to think about this, comments are welcome.
An other issue can be seen with the sfGuardPlugin. This plugin uses images to show if a user is_active, but this makes the results disappear in your ajax-view.
I don't have the svn account yet, so for this time again a tar.gz:
http://fun4me.demon.nl/~leon/sfExtjsThemePlugin-0.2.tar.gz 3.2MB
Please read the README!!!
I would still be very happy if someone can figure out a way to enable multi-column sort in extjs. It now does work with the ajax-view. But you don't see it.
Other feedback is of course appreciated.
I merged a part of the work of Wolfgang Kubens, but because the panelLayout fills the entire page, it overwrites your default layout. I now show the edit page in a modal dialog.
If I know why the panelLayout overwrites all other divs I will implement the panel solution too.
I will now focus on actions and master-detail
[Updated on: Tue, 04 September 2007 01:42] Leon
|
|
| | |
| Re: Building Own Generator [message #34959 is a reply to message #34779 ] |
Wed, 05 September 2007 12:19   |
DrCore Messages: 59 Registered: August 2007 |
Member |
|
|
A new day, a new release.
New is a master-slave or subform setup setup. It takes care of hiding values which are not connected to the master and it will make sure the master value is added when creating or editing a new record.
Check the README for further details.
Andre
|
|
|
| Re: Building Own Generator [message #35118 is a reply to message #34917 ] |
Fri, 07 September 2007 00:45   |
KRavEN Messages: 154 Registered: May 2007 |
Senior Member |
|
|
I figured out the problem. I needed to override the entire generate function in the crud generator to add the new extensions to the finder there before the files are copied from the template to the tmp directory
I've gotten quite a bit done on kubens ext crud generator. I think it will go well with the ext admin generator.
I've added an extJs helper plugin and a sfPCSS plugin very similar to the sfPJS plugin. Together with the sfPJS plugin I've gotten all the php files split out into javascript, css, and html templates. I like the ability to keep my javascript, css, and html code seperated.
I've only got a few more things to add like create a pake task, make the generator a proper module, and add the ability to change the generator file and not have to regenerate.
The ability to not need to regenerate on generator.yml changes will give some of the advantages of an initiated crud but also provide the ability to customize the source. This will probably come as a helper functions in my extJs helper plugin.
[Updated on: Fri, 07 September 2007 00:46]
|
|
|
| Re: Building Own Generator [message #35905 is a reply to message #24107 ] |
Tue, 18 September 2007 20:27   |
DrCore Messages: 59 Registered: August 2007 |
Member |
|
|
The CustomAdminGenerator plugin has been updated with some new functions and enhancements:
- More then one filterlink active
- helper function for admin list forms
- alignment of values in list forms
- specify type of filters
More functions will pop-up soon.
Andre
|
|
|
| Re: ExtJs powered Generator [message #36876 is a reply to message #34894 ] |
Sat, 06 October 2007 10:52   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
Although I was a little quiet, that was only because I'm still working hard on the Extjs plugin. Extjs2.0 Alpha has been released and this are my results so far:

The master-detail capabilities are almost completely implemented, as you can see. (One Assignment can contain multiple Parcels) At the moment I show a mixture of Assignment- and Parcel-values in the columns, but it still in active development. (The total count at the moment is not correct, I intend to show the number of Assignments+Parcels, not only the Assignments, nor only the parels, because I think it is much harder to implement In this case the total number will become 3+8=11 )
The in-list-editing does not save yet and edit-fields do not work yet, because I still have to start implementing it... What I also want to implement is that the Vessel names in this case, make use of autocompletion and become a drop-down-box, with the values of all vessels. No problems expected overthere, the only thing which I need is time. The errors which firebug shows are only warning, which show up when you edit a field in the list, this is a known bug in Firefox, but has no implications.
I still don't have a svn account, I think Fabien has forgotten about it. I think an SVN account would be appropriate when I finish the edit-view, I will get into contact with Fabien again at that time.
Leon
|
|
| | | |
| Re: ExtJs powered Generator [message #37014 is a reply to message #36942 ] |
Tue, 09 October 2007 02:35   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
I mailed Fabien today and he fixed me an account,
Before I submit the plugin to the svn I have to finish the generator code for the javascript extjs-grid. This requires minor changes so it can handle the added master-detail functionality. My JSON (data output) implementation is already equipped for this.
To get master-detail overview, you can make generators which look like this: (A (master) Assignment can have multiple Assignmentparcels as detail)
The code for the JSON implementation isn't pretty, I had to copy the content of methods from the generator into my partials. See my post at http://www.symfony-project.com/forum/index.php/t/9131/
If you know an answer to this problem, please give me some hints.
generator:
class: sfPropelAdminGenerator
param:
model_class: Assignment
theme: extjs
sub_class:
model_class: Assignmentparcel
display: [ =subject, sf_guard_user_related_by_created_by, created_at, sf_guard_user_related_by_updated_by, updated_at ]
fields:
subject:
summary_type: 'count'
summary_renderer_function: "return ((v === 0 || v > 1) ? '<b>' + v +' Parcels</b>' : '<b>1 Parcel</b>');"
sf_guard_user_related_by_created_by:
name: Created by
sf_guard_user_related_by_updated_by:
name: Updated by
list:
title: Assignments
multisort: false
display: [ =subject, client, vessel ]
grouping:
field: assignmentid
plugins: summary
fields:
vessel:
join_fields: [AssignmentPeer::VESSELID, VesselPeer::VESSELID]
sort_column: VesselPeer::NAME
I think you can expect the initial svn-submit tomorrow, but I don't promise anything...
Leon
|
|
| | |
| Re: Building Own Generator [message #37248 is a reply to message #24107 ] |
Thu, 11 October 2007 16:26   |
raslam Messages: 50 Registered: January 2007 Location: Pakistan |
Member |
|
|
Kubens,
you have done a great job and lvanderree's contribution is very appreciated.
i am also new to symfony but to think about this kind of work, it needs greater knowledge of symfony framework.
I am also trying to digg in framework. Where u studied all the framework? once i get some hands on I'll also try writing some plugins.
Good luck to you guys.
--
raslam
--
regards,
raslam
|
|
| |
| Re: Building Own Generator [message #37256 is a reply to message #24107 ] |
Thu, 11 October 2007 17:19   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
At the moment I think I am ready for the initial commit to the svn, but I found out my svn account isn't working... Or I am doing something wrong (have email Fabien again this morning, so we have to wait for him now).
The new (Extjs) features which are working for now:
- Transform your list into a Extjs-Grid.
- Fields can be a link, can be editable, or read-only (defined in your generator.yml file)
- Master-detail is working (but not recursive. so only 1 deep, first of all a limitation of the extjs-lib, but I did not prepared my code for it either)
- Non-master-detail-lists can also be grouped. So you can for example have a list of cities, which you group by country.
- You can disable the extjs-grid-view per module, in the generator.yml file. This cannot be done in "runtime" (yet), for example when a browser does not support javascript.
- JSON data is created, respecting your credential settings. Also partials can be used.
- Extjs plugins can be defined, for example to count the totals in a group. The plugins can be defined in a partial.
- not Exjs, but working: you can sort columns on foreign-values and partial-values, by defining a sort-column in your generator.yml file.
- also not Extjs specific, you have more control on the edit title. New object can now have an other title than the edit-object title. (can be done from the generator.)
What has to be done:
- sorting in a master-detail view is not yet possible (work in progress, should not be too much work anymore).
- Changing the sort order for the group-by-field is something which should be thought about, there is no gui-possibility for it at the moment in extjs, because the field on which you group-by, does not have a column.
- If multiple fields of your master-object should be shown in the grid, you have to create a partial for it. Maybe it is nicer to let ExtJs combine the seperate fields from the JSON data.
- Extjs does not support showing multi-sort columns (only one column can show if it is asc/desc, my symfony code can handle multisort.)
- I haven't looked at filtering yet.
- At the moment I define the fields of the detail-class (sub-class) in the (master-)generator.yml file, in a new section. Maybe it is nicer to define only the detail-class-name in this generator.yml file, and load the detail-display fields and all other settings from the detail-generator.yml file (in the detail-class directory). The problem is that I think the symfony-lib needs some changes.
- At the moment I copied some code from the symfony-lib into my generator-theme-code, because I was not able to create an instance of some classes, This can be due to me, or because this is not supposed to be done by symfony (look for example at the It contains E.G. )
- For now last, but certainly not Least: You can not edit your content. Edit-view has to be implemented, and editing directly in the list does not get saved. I also want to have auto-complete/drop-down lists for foreign fields. (E.G. In a list of cities with the country next to a city, the country-field should be a drop-down list of countries).
The two most important new files in the generator-theme:
- _json_list_td.php contains the code for the JSON-data rows. Not so nice, it also contains the entire code to get the detail-data...
- _list_ajax_layout.php file, creates the javascript grid code.
For now, pictures:
First non-extjs, with multisort on (sorry, I did not load the default css-file, which explains the broken heading):

now added
to the generator.yml file:

Now added grouping, by adding this to the list:
grouping:
field: country
plugins: summary

The complete generator.yml file, no partials are used:
generator:
class: sfPropelAdminGenerator
param:
model_class: City
theme: extjs
ajax: true
fields:
name: { name: City }
countryid: { name: Country }
list:
title: Cities
multisort: true
sort: [ country, name ]
display: [ =name, country ]
filters: [ countryid ]
grouping:
field: country
plugins: summary
fields:
name:
summary_type: 'count'
summary_renderer_function: "return ((v === 0 || v > 1) ? '<b>' + v +' Countries</b>' : '<b>1 Country</b>');"
country:
join_fields: [CityPeer::COUNTRYID, CountryPeer::COUNTRYID]
sort_column: CountryPeer::NAME
edit:
newtitle: Add new city
title: Edit city "%%name%%"
fields:
countryid:
display: [name, countryid]
ajax: true is default, ajax: false would disable the ajax view. If you don't want ajax-view in any page, you can also define ajax:false in the application.yml settings file (Or not use this theme). As said: multisort: true does not work with ajax:true, or at least is not usefull, because you don't know which column is used for sorting.
As you can see, I can sort on country-names, even though this is a foreign-field
[Updated on: Thu, 11 October 2007 18:05] Leon
|
|
|
| Re: Building Own Generator [message #37260 is a reply to message #24107 ] |
Thu, 11 October 2007 17:38   |
raslam Messages: 50 Registered: January 2007 Location: Pakistan |
Member |
|
|
this is looking very good. theme and generator both are looking good.
keep up the good work.
--
raslam
--
regards,
raslam
|
|
|
| Re: Building Own Generator [message #37279 is a reply to message #37256 ] |
Thu, 11 October 2007 18:54   |
|
great work, lvanderree!
for my current project, i was about to reuse and modify a tree (nested set model, simple controller, ext frontend) i've made before, but now that i see your work, it seems to make more sense to add this functionality into your plugin. Can't await to grab a fresh copy of it from svn 
Or does your current version already support trees?
best regards,
Normen
|
|
| | | |
| Re: Building Own Generator [message #37379 is a reply to message #37378 ] |
Sun, 14 October 2007 01:40   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
Can you be somewhat more specific what goes wrong?
I'm using Symfony 1.0.8, but I think it should work with Symfony 1.0.*
Extjs is included in the library, so if you do an svn checkout it should work.
Haven you checked the Readme, which says you should make a sym-link, or simply copy the contents of the the plugins/sfExtjsThemePlugin/web folder, to the project-web-directory/sfExtjsThemePlugin ?
And have you seen that you should define some stylesheets and javascript files in your applications layout.php?
[Updated on: Sun, 14 October 2007 01:41] Leon
|
|
|
| Re: Building Own Generator [message #37388 is a reply to message #24107 ] |
Sun, 14 October 2007 15:01   |
Pete Messages: 5 Registered: October 2007 |
Junior Member |
|
|
Okay it works (badly) without installing Extjs (may be one should mention explicitly that extjs actually is included).
The page is loading but only the header text is being shown. I checked the source and in the generated js there was the following:
<br />
<b>Notice</b>: Undefined variable: group_field in <b>D:\Dev\mehsite\wwwRoot\cache\backend\dev\modules\autoLanguage\templates\_list_ajax_layout.php</b> on line <b>67</b><br />
I was able to workaround this by adding a @ in front of the statement at line 168 of _list_ajax_layout.php.
After this the page loads once. As soon as i reload the page it says:
[sfException]
Cannot sort on column "", the column does not exist.
stack trace
at ()
in SF_ROOT_DIR\cache\backend\dev\modules\autoArtikel\actions\actions.class.php line 283 ...
catch (Exception $e)
{
// sort column does not exist, throw error
throw new sfException(sprintf('Cannot sort on column "%s", the column does not exist.', $sort_column));
}
break;
}
at autoArtikelActions->addSortCriteria(object('Criteria'))
in SF_ROOT_DIR\cache\backend\dev\modules\autoArtikel\actions\actions.class.php line 55 ...
I did cc all the time.
Thanks!
[Updated on: Sun, 14 October 2007 15:02]
|
|
| |
| Re: Building Own Generator [message #37390 is a reply to message #37388 ] |
Sun, 14 October 2007 15:24   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
My first guess is that you have defined grouping, without a group field and without a list of columns which you want to display.
I don't think my code can handle grouping views, when you don't define display, nor grouping.field
Take for example my city generator.yml file:
generator:
class: sfPropelAdminGenerator
param:
model_class: City
theme: extjs
ajax: true
fields:
name: { name: City }
countryid: { name: Country }
list:
title: Cities
multisort: true
sort: [ country, name ]
display: [ =name, country ]
grouping:
field: country
fields:
country:
join_fields: [CityPeer::COUNTRYID, CountryPeer::COUNTRYID]
sort_column: CountryPeer::NAME
In this case I define both, but at least one of them should be defined.
[Updated on: Sun, 14 October 2007 15:58] Leon
|
|
|
| Re: Building Own Generator [message #37393 is a reply to message #24107 ] |
Sun, 14 October 2007 20:18   |
Pete Messages: 5 Registered: October 2007 |
Junior Member |
|
|
I did not define grouping nor sorting. Actually i did not even had the ajax: true statement in the yml (i just added, it doesnt work).
I dont know why it thinks i want to sort or group.
Here is my yml:
generator:
class: sfPropelAdminGenerator
param:
model_class: Artikel
theme: extjs
ajax: true
Edit: Okay i "fixed" this by inserting
if (!count($sort_columns)) break;
before line 588 in actions.class.php.
It now displays the list. But none of the functionality works - when i click "Add new Artikel" it doesnt do anything. I guess i missed includes?
My js includes are as follows:
<script type="text/javascript" src="/sfExtjsThemePlugin/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/sfExtjsThemePlugin/extjs/ext-all-debug.js"></script>
<script type="text/javascript" src="/sfExtjsThemePlugin/js/extGridGroupSummary.js"></script>
<link rel="stylesheet" type="text/css" href="/sfExtjsThemePlugin/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/sfExtjsThemePlugin/extjs/resources/css/xtheme-default.css" />
<link rel="stylesheet" type="text/css" href="/sfExtjsThemePlugin/css/symfony-extjs.css" />
Instead of creating a symlink or copying the contents of the plugin-web-folder to the site-web-folder i created an alias in apache (i hope there are no fs-calls).
Regards
Pete
Edit 2: And whenever i click an item in order to edit it, i get to a style-less page with no <html>/<head> tags at all - i guess this should be displayed in a div instead but i get it as a regular page.
Btw. thanks for your support, Ivan.
Edit 3: I know copied the files as stated in the README, did not change anything. All the above included files are verified working.
I guess i missed something. None of the ajax-functionality works...
[Updated on: Sun, 14 October 2007 20:40]
|
|
| | | |
| Re: Building Own Generator [message #37436 is a reply to message #24107 ] |
Mon, 15 October 2007 13:01   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
You can use the symfony helpers to include the css and js files, it depend on your needs.
If you use the symfony helpers, the includes are done in the head of your document, conforming the standards, and you won't include a file twice.
However you loose some control. I wanted the files to be included in my body, after I setup a div which says "Loading..." which includes an animated gif. If you do the includes before this, the loading-div would not have a lot of use...
[Updated on: Mon, 15 October 2007 13:02] Leon
|
|
| |
| Re: Building Own Generator [message #37447 is a reply to message #37443 ] |
Mon, 15 October 2007 14:55   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
The layout.js isn't included in the library, and my idea was that this isn't necessarry for the basic functionality, but actually I haven't tested it without it.
If I have time I will build a sandbox tonight, I hope that would make things more clear and maybe some bugs will show up which I don't have at the moment.
the @-workaround is not an option, it should not be necessary, so my goal will be to fix this issue.
At the moment I am having problems with the Extjs Store. The Store provides access to data from the server (the JSON-data) and I want it to load 1 row after another. Normally you would use it to get a couple of rows at once, but when you have a large table, you want to use paging or get rows by their id.
This is possible, as long as you wait till you received the results from your previous request (the load command is theaded), otherwise your previous request gets cancelled. Unfortunately their is no way to wait till or see if your previous request is finished.
I am adding that functionality right now and am now capable of seeing when the load-request is done, so I can do my next request.
Leon
|
|
| | | | |
| Re: Building Own Generator [message #37482 is a reply to message #37470 ] |
Tue, 16 October 2007 01:40   |
 |
lvanderree Messages: 513 Registered: June 2007 Location: Netherlands |
Faithful Member |
|
|
I've created the howto, which guides you to the process of creating a master-detail view from the default symfony sandbox.
I did not bumped into the problem you people have described (can it maybe be due to a php.ini setting?), but I did try to change some code, so please do a svn update to check it out.
| Quote: |
Below the howto, it can also be found on the svn...
|
Setup the default symfony sandbox: (for the extjs part skip this part)
Start a new project (if you have symfony already installed) or download the sandbox from http://www.symfony-project.com/get/sf_sandbox.tgz
If you have downloaded the sandbox you can extract it in linux with "tar xvzf sf_sandbox.tgz", place the extracted folder in any map you like, for simplicity I place the entire content in my webfolder /var/www
Make sure your webserver has permission to write in the log and cache folder (chmod 777 /var/www/sf_sandbox/log; chmod 777 /var/www/sf_sandbox/cache)
You should now be able to browse to http://localhost/sf_sandbox/web/
Setup your database connection:
I prefer to use phpmyadmin, to add a user and database in MySql
- Add a new user
- Comeup with a username, host:localhost, password
- Choose to create a database as well: "Create database with same name and grant all privileges"
- Click Start
- In your project folder, setup config/database.yml:
all:
propel:
class: sfPropelDatabase
param:
dsn: mysql://username:password@localhost/username
And setup config/propel.ini: (don't be scared, it is almost default, only changed propel.project and database)
propel.targetPackage = lib.model
propel.packageObjectModel = true
propel.project = sf_sandbox_extjs
propel.database = mysql
propel.database.createUrl = mysql://localhost/
propel.database.url = mysql://username:password@localhost/username
propel.mysql.tableType = InnoDB
propel.addGenericAccessors = true
propel.addGenericMutators = true
propel.addTimeStamp = false
propel.schema.validate = false
; directories
propel.home = .
propel.output.dir = /var/www/production/sfweb/symfony-for-release/sf_sandbox
propel.schema.dir = ${propel.output.dir}/config
propel.conf.dir = ${propel.output.dir}/config
propel.phpconf.dir = ${propel.output.dir}/config
propel.sql.dir = ${propel.output.dir}/data/sql
propel.runtime.conf.file = runtime-conf.xml
propel.php.dir = ${propel.output.dir}
propel.default.schema.basename = schema
propel.datadump.mapper.from = *schema.xml
propel.datadump.mapper.to = *data.xml
; builder settings
propel.builder.peer.class = addon.propel.builder.SfPeerBuilder
propel.builder.object.class = addon.propel.builder.SfObjectBuilder
propel.builder.objectstub.class = addon.propel.builder.SfExtensionObjectBuilder
propel.builder.peerstub.class = addon.propel.builder.SfExtensionPeerBuilder
propel.builder.objectmultiextend.class = addon.propel.builder.SfMultiExtendObjectBuilder
propel.builder.mapbuilder.class = addon.propel.builder.SfMapBuilderBuilder
propel.builder.interface.class = propel.engine.builder.om.php5.PHP5InterfaceBuilder
propel.builder.node.class = propel.engine.builder.om.php5.PHP5NodeBuilder
propel.builder.nodepeer.class = propel.engine.builder.om.php5.PHP5NodePeerBuilder
propel.builder.nodestub.class = propel.engine.builder.om.php5.PHP5ExtensionNodeBuilder
propel.builder.nodepeerstub.class = propel.engine.builder.om.php5.PHP5ExtensionNodePeerBuilder
propel.builder.addIncludes = false
propel.builder.addComments = false
propel.builder.addBehaviors = false
Setup a schema, in config/schema.yml, I shall define a master-detail relationship
propel:
assignment:
id:
name: {type: varchar(255), required: true}
parcel:
id:
assignment_id:
name: {type: varchar(255), required: true}
run "symfony propel-build-all" to generate the model and create the tables in your database
TIP: if you are running linux, look for the bash completion script, and place it in /etc/bash_completion.d if you now (again) login into a terminal, you have symfony arguments completion. So type "symfony <tab><tab>" and enjoy!
Create the modules:
symfony propel-init-admin frontend assignment Assignment
symfony propel-init-admin frontend parcel Parcel
That's it, you should now be able to visit
http://localhost/sf_sandbox/web/frontend_dev.php/assignment
and
http://localhost/sf_sandbox/web/frontend_dev.php/parcel
Because at the moment my plugin cannot edit, nor save items, it is wise to add some assignments, and parcels.
I created assignment1, assignment2, assignment3 and parcel1a, parcel3a, parcel3b and parcel3c
----------------
OK, this should all have been great (don't forget how cool symfony is ), but familiar.
Time for the Extjs part:
For now, you have to do a svn checkout to add the plugin to your project,
go to your plugin folder and type:
svn co http://svn.symfony-project.com/plugins/sfExtjsThemePlugin/
Or use a gui tool like rapidsvn, tortoise, subclipse, what ever makes you happy
Copy the content of the sf_sandbox/plugin/sfExtjsThemePlugin/web folder to your sf_sandbox/web/sfExtjsThemePlugin folder, or in linux, make a symlink:
cd sf_sandbox/web; ln -s ../plugins/sfExtjsThemePlugin/web/ sfExtjsThemePlugin
Include the javascript and stylesheets, add the following code to your applications layout.php file:
<?php
$Extjsdir = '/sf_sandbox/web/sfExtjsThemePlugin/';
sfContext::getInstance()->getResponse()->addJavascript($Extjsdir.'extjs/adapter/ext/ext-base');
sfContext::getInstance()->getResponse()->addJavascript($Extjsdir.'extjs/ext-all-debug');
sfContext::getInstance()->getResponse()->addJavascript($Extjsdir.'js/extGridGroupSummary');
sfContext::getInstance()->getResponse()->addStylesheet($Extjsdir.'extjs/resources/css/ext-all');
sfContext::getInstance()->getResponse()->addStylesheet($Extjsdir.'extjs/resources/css/xtheme-default');
sfContext::getInstance()->getResponse()->addStylesheet($Extjsdir.'css/docs');
sfContext::getInstance()->getResponse()->addStylesheet($Extjsdir.'css/symfony-extjs');
?>
Now go to your the generator of your module, for example the one from assignment and change the theme from default to extjs.
If you now browse to http://localhost/sf_sandbox/web/frontend_dev.php/assignment you should see a list of assignments (with their id) in the Extjs theme
(Hmmm. For some reason I don't seem to have all css properties. The Add-new button is a square, also the pager buttons look strange, and the column-headers seem to mis a background image, until you hover over them. I haven't firgured out what causes this, yet.)
(Hmmm2, I don't get the errors you people seem to have about group_field not being defined. Can it be a php.ini setting? I think I can add some code to prevent the error, but I can't test it as it does not happen to me...)
Now to make things more interesting, lets make a master detail, change the generator.yml file from assignment to this:
generator:
class: sfPropelAdminGenerator
param:
model_class: Assignment
theme: extjs
sub_class:
model_class: Parcel
join_field: assignment_id
display: [name]
fields:
name:
name: Parcel-Name
list:
display: [name]
I did find one bug. Unfortunately currently I haven't figured out how to automatically resolve the foreign-key-field between two tables, so you have to define the foreign-key-field yourself (I named it join_field). In my situation it went good, because of some lucky field-naming.
Reload http://localhost/sf_sandbox/web/frontend_dev.php/assignment to see the results. (you won't have to ClearCache when you have changed the generator.yml file in this case)
You can click on the header: "parcel-name" to change the sort order within every assignment (click it twice to sort descending)
You can click on a parcel-name field, to change it name. (Saving the changes still have to be implemented)
In the generator.yml file, place a '=' before the diplay name under the sub_class, to make the field a hyperlink to the sub_class edit page. (display: [=name])
To give an other example I will use the parcel class.
First add the folowing code to the lib/model/Assignment.php file:
class Assignment extends BaseAssignment
{
public function __toString()
{
return $this->getName();
}
}
Change the generator.yml file of parcel to:
generator:
class: sfPropel | |
|