Development

Changeset 5778

You must first sign up to be able to contribute.

Changeset 5778

Show
Ignore:
Timestamp:
10/31/07 14:09:43 (1 year ago)
Author:
Leon.van.der.Ree
Message:

Small updates to readme and howto

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfExtjsThemePlugin/HowTo Sandbox.txt

    r5534 r5778  
    1 Setup the default symfony sandbox: (for the extjs part skip this part)  
     1Setup the default symfony sandbox: (for the extjs part skip this part) 
    22 
    33Start a new project (if you have symfony already installed) or download the sandbox from http://www.symfony-project.com/get/sf_sandbox.tgz 
     
    2222    param: 
    2323      dsn:          mysql://username:password@localhost/username 
    24 [/code]  
     24[/code] 
    2525 
    2626And setup config/propel.ini: (don't be scared, it is almost default, only changed propel.project and database) 
     
    8888[/code] 
    8989 
    90 run "symfony propel-build-all" to generate the model and create the tables in your database  
     90run "symfony propel-build-all" to generate the model and create the tables in your database 
    9191TIP: 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! 
    9292 
    9393 
    9494Create the modules: 
    95 symfony propel-init-admin frontend assignment Assignment  
     95symfony propel-init-admin frontend assignment Assignment 
    9696symfony propel-init-admin frontend parcel Parcel 
    9797 
     
    112112 
    113113For now, you have to do a svn checkout to add the plugin to your project, 
    114 go to your plugin folder and type:  
     114go to your plugin folder and type: 
    115115svn co http://svn.symfony-project.com/plugins/sfExtjsThemePlugin/ 
    116 Or use a gui tool like rapidsvn, tortoise, subclipse, what ever makes you happy  
     116Or use a gui tool like rapidsvn, tortoise, subclipse, what ever makes you happy 
    117117 
    118118Copy the content of the sf_sandbox/plugin/sfExtjsThemePlugin/web folder to your sf_sandbox/web/sfExtjsThemePlugin folder, or in linux, make a symlink: 
     
    134134 
    135135?> 
    136 [/code]  
     136[/code] 
    137137 
    138138Now go to your the generator of your module, for example the one from assignment and change the theme from default to extjs. 
    139139 
    140 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  
     140If 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 
    141141 
    142142(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.) 
     
    147147[code] 
    148148generator: 
    149   class:              sfPropelAdminGenerator 
     149  class:              sfExtjsPropelAdminGenerator 
    150150  param: 
    151151    model_class:      Assignment 
     
    170170You can click on a parcel-name field, to change it name. (Saving the changes still have to be implemented) 
    171171 
    172 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])  
    173  
    174 To give an other example I will use the parcel class.  
     172In 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]) 
     173 
     174To give an other example I will use the parcel class. 
    175175 
    176176First add the folowing code to the lib/model/Assignment.php file: 
     
    183183  } 
    184184} 
    185 [/code]  
     185[/code] 
    186186 
    187187Change the generator.yml file of parcel to: 
    188188[code] 
    189189generator: 
    190   class:              sfPropelAdminGenerator 
     190  class:              sfExtjsPropelAdminGenerator 
    191191  param: 
    192192    model_class:      Parcel 
     
    208208I have to change some things over here. Most obvious: I want the disabled flag placed under the list, not under the edit tag. Besides I also want to have a general fields-tag where you can define this. This way you can distinguish if you can edit a field in your list and/or your edit-view. 
    209209 
    210 The result looks the same in this case, but in this case you cannot see assignment2, because there is no parcel related to it, which makes a huge difference.  
     210The result looks the same in this case, but in this case you cannot see assignment2, because there is no parcel related to it, which makes a huge difference. 
    211211 
    212212Please also try to add group-totals (with the plugin, feature) and also check the Readme. 
  • plugins/sfExtjsThemePlugin/README

    r5616 r5778  
    88I've also used Silk-Icons from Mark James, but I don't know anymore if I still use it (it now still is included). 
    99 
    10 This is a very alpha-alpha release ;) Based on the initial work of Wolfgang Kubens. 
     10This is a very alpha-alpha release ;) Based on the initial work of Wolfgang Kubens. Improved by Jérôme. 
    1111 
    1212Have fun, 
     
    1616 
    1717  * Install the plugin 
    18    
     18 
    1919{{{ 
    2020TODO: (does not work yet) $ symfony plugin-install http://plugins.symfony-project.com/sfExtjsThemePlugin 
     
    3333or by simply copying the contents of the plugins/sfExtjsThemePlugin/web/ folder to /web/sfExtjsThemePlugin 
    3434 
     35  * Change your class in the generator.yml file from sfExtjsPropelAdminGenerator to: sfExtjsPropelAdminGenerator 
    3536  * Change your theme in the generator.yml file from default to: extjs 
    3637 
     
    5253 
    5354    <script type="text/javascript" src="/sfExtjsThemePlugin/js/extGridGroupSummary.js"></script> 
    54      
     55 
    5556    <link rel="stylesheet" type="text/css" href="/sfExtjsThemePlugin/extjs/resources/css/ext-all.css" /> 
    5657    <link rel="stylesheet" type="text/css" href="/sfExtjsThemePlugin/extjs/resources/css/xtheme-default.css" /> 
     
    6869THERE IS ALSO A HOWTO IN THE SVN which tells you how to start from a standard sandbox: http://svn.symfony-project.com/plugins/sfExtjsThemePlugin/HowTo%20Sandbox.txt 
    6970 
    70    
     71 
    7172== Features == 
    7273 
     
    103104Add multisort: true to your list options in your generator.yml 
    104105 
    105 An example of how to sort cities first on country, then on city-name:  
     106An example of how to sort cities first on country, then on city-name: 
    106107 
    107108{{{ 
     
    121122}}} 
    122123 
    123 Because ascending is the default value to sort on,  
     124Because ascending is the default value to sort on, 
    124125 
    125126{{{ 
     
    130131}}} 
    131132 
    132 is valid as well. In these cases the user has the ability to sort on multiple columns at the same time.  
    133  
    134 Please note that in the first example I sort on country, and not on countryid, see new feature: Sort on foreign- and composite-columns. However new functionality in the list (grid) with drop-down combo-boxes reintroduces countryid. If you use country you will not have a drop-down combo-box! setting the sort-field for countryid remains useful in this case.  
     133is valid as well. In these cases the user has the ability to sort on multiple columns at the same time. 
     134 
     135Please note that in the first example I sort on country, and not on countryid, see new feature: Sort on foreign- and composite-columns. However new functionality in the list (grid) with drop-down combo-boxes reintroduces countryid. If you use country you will not have a drop-down combo-box! setting the sort-field for countryid remains useful in this case. 
    135136 
    136137TODO: Currently the filter-reset button also resets the sort-order, but I think it would be nice to have a seperate reset button for it. And I also think the reset should reset the sort-order to the generator.yml file default settings, not to no-sort-order at all which is currently the case... 
    137138 
    138 TODO2: The Extjs-grid does not support the visual feedback in its multi-sort-column-header. It does work because the sorting is done on the server, but your column-header shows only the sorting of the last column you sorted on. I think it should be possible to overwrite the default behavior of the extjs-column-header and make it behave like http://tablesorter.com/docs/ (holding shift to sort on multiple-columns). This does however requires some extra work on the php-code, to make it reset the sorting when you don't hold shift.  
     139TODO2: The Extjs-grid does not support the visual feedback in its multi-sort-column-header. It does work because the sorting is done on the server, but your column-header shows only the sorting of the last column you sorted on. I think it should be possible to overwrite the default behavior of the extjs-column-header and make it behave like http://tablesorter.com/docs/ (holding shift to sort on multiple-columns). This does however requires some extra work on the php-code, to make it reset the sorting when you don't hold shift. 
    139140Multisorting isn't working with ajax set to true, because at the moment extjs cannot handle sorting on mulitple columns. It can only sort one column at a time. If you disable ajax (ajax: false) you can see how it should work. Someone first has to extend extjs with this functionality before this is possible. I very much like the implementation done with jquery: http://tablesorter.com/docs/ (holding the shift-key while pressing the column headers to sort on multiple columns) 
    140141It should be possible to extend extjs with this functionality, but it is not there (yet). At the moment I haven't got time for this yet. And to make it work like the jquery example, there should also be some extention for my plugin, to make the multi-sort reset when you don't hold shift. 
     
    142143=== Sort on foreign- and composite-columns === 
    143144 
    144 You can now also sort your columns on columns with foreign-values or composite values (from multiple/different columns, like full-names which are combined in a partial). You have to add some information to the generator.yml file to define the sort-order though, it can't do magic (yet)...  
     145You can now also sort your columns on columns with foreign-values or composite values (from multiple/different columns, like full-names which are combined in a partial). You have to add some information to the generator.yml file to define the sort-order though, it can't do magic (yet)... 
    145146 
    146147{{{ 
     
    157158If you use the ajax view, you can now also display countryid and see an inline combo-box in the list, when you edit it. 
    158159 
    159 TODO: I think you don't have to define the join_fields. I think this could be automatically resolved by something like $subclassPeerName->translateFieldName(...)  
     160TODO: I think you don't have to define the join_fields. I think this could be automatically resolved by something like $subclassPeerName->translateFieldName(...) 
    160161 
    161162 
     
    164165 
    165166With Ajax you have the option to group you list on columns, you do this by setting the group_field option in your generator.yml file under list. 
    166 When you have not set a sort column, the column which you define here will be used, which is recommended!  
    167  
    168 {{{ 
    169 generator: 
    170   class:              sfPropelAdminGenerator 
     167When you have not set a sort column, the column which you define here will be used, which is recommended! 
     168 
     169{{{ 
     170generator: 
     171  class:              sfExtjsPropelAdminGenerator 
    171172  param: 
    172173    model_class:      City 
     
    182183        field:          country 
    183184        plugins:        summary 
    184          
     185 
    185186      fields: 
    186187        name: 
    187188          summary_type: 'count' 
    188           summary_renderer_function: "return ((v === 0 || v > 1) ? '<b>' + v +' Countries</b>' : '<b>1 Country</b>');"  
     189          summary_renderer_function: "return ((v === 0 || v > 1) ? '<b>' + v +' Countries</b>' : '<b>1 Country</b>');" 
    189190        country: 
    190191          join_fields:  [CityPeer::COUNTRYID, CountryPeer::COUNTRYID] 
    191192          sort_column:  CountryPeer::NAME 
    192          
    193 }}} 
    194  
    195 The summary plugin can be defined by a partial, in which you can write your javascript helper. In this case the total under every group (The number of cities under a country) will be count.  
     193 
     194}}} 
     195 
     196The summary plugin can be defined by a partial, in which you can write your javascript helper. In this case the total under every group (The number of cities under a country) will be count. 
    196197 
    197198TODO: Sorting with a grouped grid is an issue, need testing! (groups can possibly show up multiple times on different pages) 
     
    210211    model_class:      Assignment 
    211212    theme:            extjs 
    212      
     213 
    213214    sub_class: 
    214215      model_class:    Assignmentparcel 
     
    218219          name: Parcel 
    219220          summary_type: 'count' 
    220           summary_renderer_function: "return ((v === 0 || v > 1) ? '<b>' + v +' Parcels</b>' : '<b>1 Parcel</b>');"  
     221          summary_renderer_function: "return ((v === 0 || v > 1) ? '<b>' + v +' Parcels</b>' : '<b>1 Parcel</b>');" 
    221222 
    222223    fields: 
    223224      sf_guard_user_related_by_created_by: 
    224225        name: Created by 
    225       sf_guard_user_related_by_updated_by:     
     226      sf_guard_user_related_by_updated_by: 
    226227        name: Updated by 
    227      
     228 
    228229    list: 
    229230      title:            Assignments 
     
    237238          join_fields:  [AssignmentPeer::VESSELID, VesselPeer::VESSELID] 
    238239          sort_column:  VesselPeer::NAME 
    239 }}}  
     240}}} 
    240241 
    241242In this example you see the grouping field is defined, but it is optional. If you leave it out, the first field of your main-diplay-list is selected. 
     
    243244 
    244245TODO0: At the moment I cannot get an instance of sub_class. I now have copied the code from several symfony methods and placed it in the plugin, this is far from optimal of course. I am also not able to find if fields of a sub-class are foreign-keys to other tables, which makes it impossible to let them appear as drop-down combo-boxes. 
    245   
     246 
    246247TODO1: I have to think about mixing the fields of the main_class and the sub_class. (although all fields in a main-column will be the same for a group) 
    247248TODO2: Maybe it is possible to define the generator.yml file of the sub_class in the master-generator.yml file, instead of this sub_class list. 
     
    251252if you have a field in your class which is a foreign-key to an other table, for example country_id the field in the list gets transformed in a drop-down combo-box. The foreign-table has to have a field called name! (this instead of the __toString() method) 
    252253 
    253 TODO: Add a posibility to set the value-field from the foreign-table (which can also be a partial), now it is set to name, which should become the default column if nothing is set.    
     254TODO: Add a posibility to set the value-field from the foreign-table (which can also be a partial), now it is set to name, which should become the default column if nothing is set. 
    254255 
    255256 
     
    268269}}} 
    269270 
    270 list_max_per_page is the other option, which can be set application-wide.  
     271list_max_per_page is the other option, which can be set application-wide. 
    271272 
    272273 
     
    291292  * Multi-sort is not visible in column-header, limitation of Extjs library which can be extended (but has not been done) 
    292293  * Some values can not be set (like column width, footer on/off, footer text, etc.) 
    293   * Refractoring. At the moment I've copy-pasted code from the symfony-base in my generator, because I cannot instantiate some objects (especially with regard to other(/sub) classes in a list. Besides I currently make no use of any helpers, everything is implemented in the list-partials, which is bad practice but was a lot easier to test the proof of concepts. 
    294  
    295  
     294  * Refractoring. At the moment Jérôme did a great job, but code still can use some cleanup.