[1005] | 1 | Metadata-Version: 1.0 |
---|
| 2 | Name: quintagroup.themetemplate |
---|
[3049] | 3 | Version: 0.26 |
---|
[1005] | 4 | Summary: Quintagroup theme template for Plone 3 with nested namespace |
---|
| 5 | Home-page: http://svn.quintagroup.com/products/quintagroup.themetemplate |
---|
| 6 | Author: Andriy Mylenkyy |
---|
| 7 | Author-email: support@quintagroup.com |
---|
| 8 | License: GPL |
---|
| 9 | Description: qplone3 theme template |
---|
| 10 | ====================== |
---|
| 11 | |
---|
[1364] | 12 | quintagroup.themetemplate is an enhanced "Plone 3 Theme" template from Zopeskel, |
---|
| 13 | that includes addcontent local command, which allows you to extend base Plone theme |
---|
| 14 | by additional elements, such as: skin layers, portlets, viewlets, css and js resources, |
---|
| 15 | and objects in zexp files. This package is an analogue of Archetype template in terms |
---|
| 16 | of its functionality. |
---|
| 17 | |
---|
| 18 | quintagroup.themetemplate package is used for development of all Quintagroup themes |
---|
[3049] | 19 | for Plone 3 at http://skins.quintagroup.com. |
---|
[1364] | 20 | |
---|
[1005] | 21 | Contents |
---|
| 22 | -------- |
---|
| 23 | 1. Overview |
---|
| 24 | 2. Creating theme package |
---|
| 25 | 3. Extending theme |
---|
| 26 | 4. Release notes |
---|
| 27 | |
---|
| 28 | Overview |
---|
| 29 | ======== |
---|
| 30 | |
---|
[1364] | 31 | This theme template allows you to create initial theme package skeleton, |
---|
| 32 | i.e. create plone3 theme python package with nested namespace (this is different from |
---|
| 33 | deafult plone3_theme template in Zopeskel) |
---|
[1005] | 34 | |
---|
[1364] | 35 | After that you can extend theme package by the following elements: |
---|
| 36 | |
---|
[1005] | 37 | - skin-layer(s) |
---|
| 38 | - portlet(s) |
---|
| 39 | - viewlet(s) |
---|
| 40 | - css, js resource(s) |
---|
[1364] | 41 | - objects in zexp files |
---|
[1005] | 42 | |
---|
| 43 | Creation of a package is performed with *paster create* PasteScript command. |
---|
| 44 | Theme extending with other resources can be done with *paster addcontent* |
---|
| 45 | local ZopeSkel command (extended in this product). |
---|
| 46 | |
---|
| 47 | Creating theme package |
---|
| 48 | ====================== |
---|
| 49 | |
---|
[3051] | 50 | In the demo below we'll use "--overwrite" option as multiple templates are |
---|
| 51 | running one after another, and some same-named files should be overwritten |
---|
| 52 | without extra questions. |
---|
| 53 | |
---|
[1005] | 54 | Let's create plone-3 theme python package. |
---|
| 55 | Use `paster create` command for that:: |
---|
| 56 | |
---|
[3049] | 57 | >>> paster('create -t qplone3_theme quintagroup.theme.example --overwrite') |
---|
| 58 | paster create -t qplone3_theme quintagroup.theme.example ... |
---|
[1005] | 59 | ... |
---|
| 60 | |
---|
| 61 | You got standard python package content with |
---|
[3049] | 62 | |
---|
[1005] | 63 | - *quintagroup* upper level namespace. |
---|
[3049] | 64 | - *quintagroup.theme.example-configure.zcml* - zcml file for adding into package-includes directory |
---|
[1005] | 65 | |
---|
| 66 | Check that:: |
---|
| 67 | |
---|
[2569] | 68 | >>> package_dir = 'quintagroup.theme.example' |
---|
| 69 | >>> objects = ['setup.py', 'quintagroup', 'quintagroup.theme.example-configure.zcml'] |
---|
| 70 | >>> objects.sort() |
---|
| 71 | >>> [o for o in objects if o in os.listdir(package_dir)] |
---|
| 72 | ['quintagroup', 'quintagroup.theme.example-configure.zcml', 'setup.py'] |
---|
[1005] | 73 | |
---|
| 74 | |
---|
| 75 | *qplone3_theme* template - creates theme with nested namespace. |
---|
| 76 | |
---|
[3049] | 77 | By default - theme is placed in *quintagroup.theme.<3rd part of dotted package name> namespace* |
---|
[1005] | 78 | |
---|
[2569] | 79 | in our case - quintagroup.theme.example |
---|
[1005] | 80 | |
---|
| 81 | So check namespaces:: |
---|
[1364] | 82 | |
---|
[2569] | 83 | >>> theme_namespace = os.path.join(package_dir,'quintagroup','theme','example') |
---|
[1005] | 84 | >>> os.path.isdir(theme_namespace) |
---|
| 85 | True |
---|
| 86 | |
---|
| 87 | Theme holds 3 subdirectories (browser, profiles, skins):: |
---|
[1364] | 88 | |
---|
[1005] | 89 | >>> cd(theme_namespace) |
---|
| 90 | >>> dirs = ('skins', 'browser', 'profiles') |
---|
| 91 | >>> [True for d in dirs if d in os.listdir('.')] |
---|
| 92 | [True, True, True] |
---|
| 93 | |
---|
| 94 | And initialization files (__init__.py, configure.zcml) :: |
---|
[1364] | 95 | |
---|
[1005] | 96 | >>> files = ('__init__.py', 'configure.zcml') |
---|
| 97 | >>> [True for d in files if d in os.listdir('.')] |
---|
| 98 | [True, True] |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | *browser* directory |
---|
| 102 | ------------------- |
---|
| 103 | |
---|
| 104 | Browser directory contains: |
---|
[3049] | 105 | |
---|
[1005] | 106 | - 'templates' resource directory |
---|
| 107 | - interfaces.py module with IThemeSpecific marker interface |
---|
[3049] | 108 | - configure.zcml, with registered theme marker interface:: |
---|
[1005] | 109 | |
---|
| 110 | >>> ls('browser') |
---|
| 111 | __init__.py |
---|
| 112 | configure.zcml |
---|
| 113 | interfaces.py |
---|
| 114 | templates |
---|
| 115 | |
---|
| 116 | >>> cat('browser/interfaces.py') |
---|
| 117 | from plone.theme.interfaces import IDefaultPloneLayer |
---|
| 118 | <BLANKLINE> |
---|
| 119 | class IThemeSpecific(IDefaultPloneLayer): |
---|
| 120 | ... |
---|
| 121 | |
---|
| 122 | >>> cat('browser/configure.zcml') |
---|
| 123 | <configure |
---|
| 124 | ... |
---|
| 125 | <interface |
---|
| 126 | interface=".interfaces.IThemeSpecific" |
---|
| 127 | type="zope.publisher.interfaces.browser.IBrowserSkinType" |
---|
| 128 | name="Custom Theme" |
---|
| 129 | /> |
---|
| 130 | ... |
---|
| 131 | |
---|
| 132 | As we see, default theme name is 'Custom Theme', but on theme |
---|
| 133 | creation you can point out your own name. Check this ... |
---|
| 134 | |
---|
[3049] | 135 | First create configuration file with different skin name:: |
---|
| 136 | |
---|
[1005] | 137 | >>> conf_data = """ |
---|
| 138 | ... [pastescript] |
---|
| 139 | ... skinname=My Theme Name |
---|
| 140 | ... """ |
---|
| 141 | >>> file('theme_config.conf','w').write(conf_data) |
---|
| 142 | |
---|
[3049] | 143 | Create the same theme with your own skin name and check this:: |
---|
| 144 | |
---|
| 145 | >>> paster('create -t qplone3_theme quintagroup.theme.example --overwrite --config=theme_config.conf') |
---|
[1005] | 146 | paster create ... |
---|
| 147 | >>> cd(package_dir) |
---|
[2569] | 148 | >>> cat('quintagroup/theme/example/browser/configure.zcml') |
---|
[1005] | 149 | <configure |
---|
| 150 | ... |
---|
| 151 | <interface |
---|
| 152 | interface=".interfaces.IThemeSpecific" |
---|
| 153 | type="zope.publisher.interfaces.browser.IBrowserSkinType" |
---|
| 154 | name="My Theme Name" |
---|
| 155 | /> |
---|
| 156 | ... |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | *skins* directory |
---|
[3049] | 160 | ----------------- |
---|
[1005] | 161 | |
---|
| 162 | It contains only README.txt file and NO SKIN LAYERS YET. |
---|
| 163 | This is a job for localcommand ;) |
---|
| 164 | |
---|
[3049] | 165 | But check whether I am right ...:: |
---|
| 166 | |
---|
[2569] | 167 | >>> cd('quintagroup/theme/example') |
---|
[1005] | 168 | >>> ls('skins') |
---|
| 169 | README.txt |
---|
| 170 | |
---|
| 171 | |
---|
[3049] | 172 | *profiles* directory |
---|
| 173 | -------------------- |
---|
| 174 | |
---|
| 175 | There is 'default' and uninstall profiles inside:: |
---|
| 176 | |
---|
[1005] | 177 | >>> 'default' in os.listdir('profiles') |
---|
| 178 | True |
---|
| 179 | >>> 'uninstall' in os.listdir('profiles') |
---|
| 180 | True |
---|
| 181 | |
---|
| 182 | There are the following items in default profile: |
---|
[3049] | 183 | |
---|
[1005] | 184 | - import_steps.xml - for any reason. |
---|
[3049] | 185 | - skins.xml - for registering skins directory:: |
---|
[1005] | 186 | |
---|
| 187 | >>> cd('profiles/default') |
---|
| 188 | >>> 'import_steps.xml' in os.listdir('.') |
---|
| 189 | True |
---|
| 190 | >>> 'skins.xml' in os.listdir('.') |
---|
| 191 | True |
---|
| 192 | |
---|
| 193 | *skins.xml* profile makes your theme default on installation |
---|
| 194 | and uses layers list from 'Plone Default' for our theme, |
---|
[3049] | 195 | without any new layers (yet):: |
---|
[1005] | 196 | |
---|
| 197 | >>> cat('skins.xml') |
---|
| 198 | <?xml version="1.0"?> |
---|
[2569] | 199 | ... |
---|
[1005] | 200 | <object name="portal_skins" ... |
---|
[3049] | 201 | default_skin="My Theme Name" request_varname="plone_skin"> |
---|
[1005] | 202 | ... |
---|
| 203 | <skin-path name="My Theme Name" based-on="Plone Default"> |
---|
| 204 | <!-- -*- extra layer stuff goes here -*- --> |
---|
| 205 | <BLANKLINE> |
---|
| 206 | </skin-path> |
---|
| 207 | ... |
---|
| 208 | |
---|
| 209 | *import_steps.xml* - call _setupVarious_ function from |
---|
[3049] | 210 | _setuphandlers.py_ module for additional installation steps:: |
---|
[1005] | 211 | |
---|
| 212 | >>> cat('import_steps.xml') |
---|
| 213 | <?xml version="1.0"?> |
---|
| 214 | ... |
---|
[2569] | 215 | <import-step id="quintagroup.theme.example.various" |
---|
[1005] | 216 | ... |
---|
[2569] | 217 | handler="quintagroup.theme.example.setuphandlers.setupVarious" |
---|
[1005] | 218 | ... |
---|
| 219 | </import-step> |
---|
| 220 | ... |
---|
| 221 | |
---|
[3049] | 222 | Look at setuphandlers.py module:: |
---|
| 223 | |
---|
[1005] | 224 | >>> cd('../..') |
---|
| 225 | >>> cat('setuphandlers.py') |
---|
| 226 | def setupVarious(context): |
---|
| 227 | ... |
---|
| 228 | |
---|
| 229 | |
---|
| 230 | Extending theme |
---|
| 231 | =============== |
---|
| 232 | |
---|
| 233 | One of the best features, which ZopeSkel package brings, is *localcommand*. |
---|
| 234 | |
---|
[1364] | 235 | This part shows how you can extend a theme (generated with qplone3_theme |
---|
[1005] | 236 | ZopeSkel template) with additional useful stuff: |
---|
| 237 | |
---|
| 238 | - skin layers |
---|
| 239 | - views |
---|
| 240 | - viewlets |
---|
| 241 | - portlets |
---|
| 242 | - css |
---|
| 243 | - javascripts |
---|
[1364] | 244 | - objects in zexp files |
---|
[1005] | 245 | |
---|
| 246 | So, in qplone3_theme generated package you can use *addcontent* ZopeSkel |
---|
| 247 | local command. |
---|
| 248 | |
---|
| 249 | IMPORTANT TO NOTE: localcommand (addcontent in our case) should be |
---|
| 250 | called in any subdirectory of the generated theme package. And it won't |
---|
[3049] | 251 | work outside this package:: |
---|
[1005] | 252 | |
---|
| 253 | >>> paster('addcontent -a') |
---|
| 254 | paster addcontent -a |
---|
| 255 | ... |
---|
[1364] | 256 | css_dtml_skin: A DTML file in skin layer with CSS registration |
---|
[1005] | 257 | css_resource: A Plone 3 CSS resource template |
---|
| 258 | ... |
---|
| 259 | import_zexps: A template for importing zexp-objects into portal on installation |
---|
| 260 | js_resource: A Plone 3 JS resource template |
---|
| 261 | N portlet: A Plone 3 portlet |
---|
| 262 | ... |
---|
| 263 | skin_layer: A Plone 3 Skin Layer |
---|
| 264 | ... |
---|
| 265 | N view: A browser view skeleton |
---|
| 266 | viewlet_hidden: A Plone 3 Hidden Viewlet template |
---|
| 267 | viewlet_order: A Plone 3 Order Viewlet template |
---|
| 268 | ... |
---|
| 269 | |
---|
| 270 | |
---|
| 271 | We can see a list of extention subtemplates, which can be used for our theme. |
---|
| 272 | 'N' character tells us that these subtemplates are registered for other (archetype) |
---|
| 273 | template, but it does not matter - they can correctly extend our theme. |
---|
| 274 | |
---|
| 275 | |
---|
| 276 | Adding SKIN LAYER |
---|
| 277 | ================= |
---|
| 278 | |
---|
[3049] | 279 | For that case use *skin_layer* subtemplate with *addcontent* local command:: |
---|
[1005] | 280 | |
---|
[3049] | 281 | >>> paster('addcontent skin_layer') |
---|
| 282 | paster addcontent skin_layer ... |
---|
[1005] | 283 | Recursing into profiles |
---|
| 284 | ... |
---|
| 285 | |
---|
| 286 | This command adds NEW 'skin_layer' (default name) directory to _skins_ directory, |
---|
[3049] | 287 | with only CONTENT.txt file inside:: |
---|
[1005] | 288 | |
---|
| 289 | >>> 'skin_layer' in os.listdir('skins') |
---|
| 290 | True |
---|
| 291 | >>> ls('skins/skin_layer') |
---|
| 292 | CONTENT.txt |
---|
| 293 | |
---|
[3049] | 294 | *skins.xml* profile is also updated:: |
---|
[1005] | 295 | |
---|
| 296 | >>> cat('profiles/default/skins.xml') |
---|
| 297 | <?xml version="1.0"?> |
---|
[2569] | 298 | ... |
---|
[1005] | 299 | <object name="portal_skins" allow_any="False" cookie_persistence="False" |
---|
[3049] | 300 | default_skin="My Theme Name" request_varname="plone_skin"> |
---|
[1005] | 301 | ... |
---|
| 302 | <object name="skin_layer" |
---|
| 303 | meta_type="Filesystem Directory View" |
---|
[2569] | 304 | directory="quintagroup.theme.example:skins/skin_layer"/> |
---|
| 305 | ... |
---|
[1005] | 306 | <skin-path name="My Theme Name" based-on="Plone Default"> |
---|
| 307 | ... |
---|
| 308 | <layer name="skin_layer" |
---|
| 309 | insert-after="custom"/> |
---|
| 310 | <BLANKLINE> |
---|
| 311 | </skin-path> |
---|
| 312 | ... |
---|
| 313 | |
---|
| 314 | We can see, that: |
---|
[3049] | 315 | |
---|
[1005] | 316 | - skin_layer directory was registered as Filesystem Directory View |
---|
| 317 | - skin_layer Filesystem Directory View was added to our theme layers list |
---|
| 318 | |
---|
| 319 | |
---|
| 320 | Adding PORTLET |
---|
[3049] | 321 | ============== |
---|
[1005] | 322 | |
---|
[3049] | 323 | Only initialization files are available in portlets directory before adding new portlet:: |
---|
[1005] | 324 | |
---|
| 325 | >>> ls('portlets') |
---|
| 326 | __init__.py |
---|
| 327 | configure.zcml |
---|
| 328 | |
---|
[3049] | 329 | Add portlet with *portlet* subtemplate:: |
---|
[1005] | 330 | |
---|
[3049] | 331 | >>> paster('addcontent portlet') |
---|
| 332 | paster addcontent portlet ... |
---|
[2569] | 333 | ... |
---|
[1005] | 334 | Recursing into portlets |
---|
| 335 | ... |
---|
| 336 | |
---|
| 337 | After executing this local command ... |
---|
| 338 | |
---|
[3049] | 339 | configure.zcml file in the theme root directory - includes portlets registry:: |
---|
[1005] | 340 | |
---|
| 341 | >>> cat('configure.zcml') |
---|
| 342 | <configure |
---|
| 343 | ... |
---|
| 344 | <include package=".portlets" /> |
---|
| 345 | ... |
---|
| 346 | |
---|
[3049] | 347 | exampleportlet.pt template and exampleportlet.py script added to portlets directory:: |
---|
| 348 | |
---|
[1005] | 349 | >>> files = ('exampleportlet.pt', 'exampleportlet.py') |
---|
| 350 | >>> [True for d in files if d in os.listdir('portlets')] |
---|
| 351 | [True, True] |
---|
| 352 | |
---|
[3049] | 353 | And portlets/configure.zcml - register new portlet:: |
---|
| 354 | |
---|
[1005] | 355 | >>> cat('portlets/configure.zcml') |
---|
| 356 | <configure |
---|
| 357 | ... |
---|
| 358 | <plone:portlet |
---|
[2569] | 359 | name="quintagroup.theme.example.portlets.ExamplePortlet" |
---|
[1005] | 360 | interface=".exampleportlet.IExamplePortlet" |
---|
| 361 | assignment=".exampleportlet.Assignment" |
---|
| 362 | view_permission="zope2.View" |
---|
| 363 | edit_permission="cmf.ManagePortal" |
---|
| 364 | renderer=".exampleportlet.Renderer" |
---|
| 365 | addview=".exampleportlet.AddForm" |
---|
| 366 | editview=".exampleportlet.EditForm" |
---|
| 367 | /> |
---|
| 368 | ... |
---|
| 369 | |
---|
[3049] | 370 | Finally, new portlet type is registered in portlets.xml profile:: |
---|
[1005] | 371 | |
---|
| 372 | >>> cat('profiles/default/portlets.xml') |
---|
| 373 | <?xml version="1.0"?> |
---|
| 374 | ... |
---|
| 375 | <portlet |
---|
[2569] | 376 | addview="quintagroup.theme.example.portlets.ExamplePortlet" |
---|
[1005] | 377 | title="Example portlet" |
---|
| 378 | description="" |
---|
[2569] | 379 | i18n:attributes="title; description" |
---|
[1005] | 380 | /> |
---|
| 381 | ... |
---|
| 382 | |
---|
| 383 | Thanks to ZopeSkel developers for this subtempalte ;) |
---|
| 384 | |
---|
| 385 | |
---|
| 386 | Adding CSS resource |
---|
| 387 | =================== |
---|
| 388 | |
---|
[3049] | 389 | Use *css_resource* subtemplate:: |
---|
[1005] | 390 | |
---|
[3049] | 391 | >>> paster("addcontent css_resource") |
---|
| 392 | paster addcontent css_resource ... |
---|
[1005] | 393 | Recursing into browser |
---|
| 394 | ... |
---|
| 395 | Recursing into profiles |
---|
| 396 | ... |
---|
| 397 | |
---|
| 398 | This template adds (if does not exist yet) _stylesheets_ directory in _browser_ |
---|
[3049] | 399 | directory:: |
---|
[1005] | 400 | |
---|
| 401 | >>> 'stylesheets' in os.listdir('browser') |
---|
| 402 | True |
---|
| 403 | |
---|
| 404 | In _stylesheets_ resource directory empty main.css stylesheet |
---|
[3049] | 405 | resource added:: |
---|
[1005] | 406 | |
---|
| 407 | >>> 'main.css' in os.listdir('browser/stylesheets') |
---|
| 408 | True |
---|
| 409 | >>> cat('browser/stylesheets/main.css') |
---|
| 410 | <BLANKLINE> |
---|
| 411 | |
---|
| 412 | |
---|
[3049] | 413 | New resource directory was registered in configure.zcml:: |
---|
[1005] | 414 | |
---|
| 415 | >>> cat('browser/configure.zcml') |
---|
| 416 | <configure |
---|
| 417 | ... |
---|
| 418 | <browser:resourceDirectory |
---|
[2569] | 419 | name="quintagroup.theme.example.stylesheets" |
---|
[1005] | 420 | directory="stylesheets" |
---|
| 421 | layer=".interfaces.IThemeSpecific" |
---|
| 422 | /> |
---|
| 423 | ... |
---|
| 424 | |
---|
| 425 | |
---|
| 426 | And cssregistry.xml profile was added into profiles/default directory with |
---|
[3049] | 427 | registered main.css stylesheet:: |
---|
[1005] | 428 | |
---|
| 429 | >>> 'cssregistry.xml' in os.listdir('profiles/default') |
---|
| 430 | True |
---|
| 431 | >>> cat('profiles/default/cssregistry.xml') |
---|
| 432 | <?xml version="1.0"?> |
---|
| 433 | <object name="portal_css"> |
---|
| 434 | <BLANKLINE> |
---|
| 435 | <stylesheet title="" |
---|
[2569] | 436 | id="++resource++quintagroup.theme.example.stylesheets/main.css" |
---|
[1005] | 437 | media="screen" rel="stylesheet" rendering="inline" |
---|
| 438 | cacheable="True" compression="safe" cookable="True" |
---|
| 439 | enabled="1" expression=""/> |
---|
| 440 | ... |
---|
| 441 | |
---|
| 442 | |
---|
| 443 | |
---|
[1364] | 444 | Adding CSS resource as dtml-file into skins layer |
---|
| 445 | ================================================= |
---|
| 446 | |
---|
| 447 | This template actually absolutely same to the previouse one, but layer_name |
---|
| 448 | variable added to point in which skin layer css dtml-file should be added to. |
---|
| 449 | And, of course, css resource added into pointing *skins/<layer_name>/<css_reseource_name>.dtml* file. |
---|
| 450 | |
---|
| 451 | This subtemplate has several benefits before registering css as resource layer: |
---|
[3049] | 452 | |
---|
[1364] | 453 | - in dtml file you can use power of dtml language |
---|
| 454 | - this resource can be overriden by customer if he needs that |
---|
| 455 | |
---|
| 456 | IMPORTANT: |
---|
| 457 | For add css resource in registered skin layer - you should use this subtemplate |
---|
| 458 | in conjunction with *skin_layer* one. |
---|
| 459 | |
---|
| 460 | |
---|
[3049] | 461 | Use *css_dtml_skin* subtemplate:: |
---|
[1364] | 462 | |
---|
[3049] | 463 | >>> paster("addcontent css_dtml_skin") |
---|
| 464 | paster addcontent css_dtml_skin ... |
---|
[1364] | 465 | Recursing into profiles |
---|
| 466 | ... |
---|
| 467 | Recursing into skins |
---|
| 468 | ... |
---|
| 469 | |
---|
[3049] | 470 | This template adds main.css.dtml file into skins/skin_layer folder:: |
---|
[1364] | 471 | |
---|
| 472 | >>> 'main.css.dtml' in os.listdir('skins/skin_layer') |
---|
| 473 | True |
---|
| 474 | |
---|
[3049] | 475 | The main.css.dtml file already prepared to use as dtml-document:: |
---|
| 476 | |
---|
[1364] | 477 | >>> cat('skins/skin_layer/main.css.dtml') |
---|
| 478 | /* |
---|
| 479 | ... |
---|
| 480 | /* <dtml-with base_properties> (do not remove this :) */ |
---|
| 481 | ... |
---|
| 482 | /* </dtml-with> */ |
---|
| 483 | <BLANKLINE> |
---|
| 484 | |
---|
| 485 | |
---|
| 486 | And cssregistry.xml profile was added into profiles/default directory with |
---|
[3049] | 487 | registered main.css stylesheet:: |
---|
[1364] | 488 | |
---|
| 489 | >>> 'cssregistry.xml' in os.listdir('profiles/default') |
---|
| 490 | True |
---|
| 491 | >>> cat('profiles/default/cssregistry.xml') |
---|
| 492 | <?xml version="1.0"?> |
---|
| 493 | <object name="portal_css"> |
---|
| 494 | <BLANKLINE> |
---|
| 495 | <stylesheet title="" |
---|
[2569] | 496 | id="++resource++quintagroup.theme.example.stylesheets/main.css" |
---|
[1364] | 497 | media="screen" rel="stylesheet" rendering="inline" |
---|
| 498 | cacheable="True" compression="safe" cookable="True" |
---|
| 499 | enabled="1" expression=""/> |
---|
| 500 | ... |
---|
| 501 | |
---|
| 502 | |
---|
[1005] | 503 | Adding JAVASCRIPT resource |
---|
| 504 | -------------------------- |
---|
| 505 | |
---|
[3049] | 506 | Use *js_resource* subtemplate:: |
---|
[1005] | 507 | |
---|
[3049] | 508 | >>> paster('addcontent js_resource') |
---|
| 509 | paster addcontent js_resource ... |
---|
[1005] | 510 | Recursing into browser |
---|
| 511 | ... |
---|
| 512 | Recursing into profiles |
---|
| 513 | ... |
---|
| 514 | |
---|
| 515 | This template adds (if does not exist yet) _scripts_ directory in _browser_ |
---|
[3049] | 516 | directory:: |
---|
[1005] | 517 | |
---|
| 518 | >>> 'scripts' in os.listdir('browser') |
---|
| 519 | True |
---|
| 520 | |
---|
| 521 | |
---|
[3049] | 522 | Empty foo.js javascript file was added to _scripts_ directory:: |
---|
[1005] | 523 | |
---|
| 524 | >>> 'foo.js' in os.listdir('browser/scripts') |
---|
| 525 | True |
---|
| 526 | >>> cat('browser/scripts/foo.js') |
---|
| 527 | <BLANKLINE> |
---|
| 528 | |
---|
| 529 | |
---|
[3049] | 530 | New resource directory was registered in configure.zcml, if has not been registered yet:: |
---|
[1005] | 531 | |
---|
| 532 | >>> cat('browser/configure.zcml') |
---|
| 533 | <configure |
---|
| 534 | ... |
---|
| 535 | <browser:resourceDirectory |
---|
[2569] | 536 | name="quintagroup.theme.example.scripts" |
---|
[1005] | 537 | directory="scripts" |
---|
| 538 | layer=".interfaces.IThemeSpecific" |
---|
| 539 | /> |
---|
| 540 | ... |
---|
| 541 | |
---|
| 542 | |
---|
| 543 | cssregistry.xml profile was added into profiles/default directory (if does not exist yet), |
---|
[3049] | 544 | and register new foo.js javascript resource:: |
---|
[1005] | 545 | |
---|
| 546 | >>> 'jsregistry.xml' in os.listdir('profiles/default') |
---|
| 547 | True |
---|
| 548 | >>> cat('profiles/default/jsregistry.xml') |
---|
| 549 | <?xml version="1.0"?> |
---|
| 550 | <object name="portal_javascripts"> |
---|
| 551 | ... |
---|
| 552 | <javascript |
---|
[2569] | 553 | id="++resource++quintagroup.theme.example.scripts/foo.js" |
---|
[1005] | 554 | inline="False" cacheable="True" compression="safe" |
---|
| 555 | cookable="True" enabled="1" |
---|
| 556 | expression="" |
---|
| 557 | /> |
---|
| 558 | ... |
---|
| 559 | |
---|
| 560 | |
---|
| 561 | |
---|
| 562 | Test viewlets subtemplates |
---|
| 563 | ========================== |
---|
| 564 | |
---|
| 565 | There are 2 types of viewlet subtemplates: |
---|
[3049] | 566 | |
---|
[1005] | 567 | - viewlet_order |
---|
| 568 | - viewlet_hidden |
---|
| 569 | |
---|
| 570 | The first one is used for adding new viewlets and setting |
---|
| 571 | viewlets order for the ViewletManager, the second one only hides |
---|
| 572 | viewlet in pointed ViewletManager. |
---|
| 573 | |
---|
| 574 | Ordered NEW viewlet |
---|
| 575 | ------------------- |
---|
| 576 | |
---|
[3049] | 577 | Use *viewlet_order* subtemplate:: |
---|
[1005] | 578 | |
---|
[3049] | 579 | >>> paster('addcontent viewlet_order') |
---|
| 580 | paster addcontent viewlet_order ... |
---|
[1005] | 581 | Recursing into browser |
---|
| 582 | ... |
---|
| 583 | Recursing into templates |
---|
| 584 | ... |
---|
| 585 | Recursing into profiles |
---|
| 586 | ... |
---|
| 587 | |
---|
| 588 | This template adds (if not exist ;)) _viewlets.py_ module in browser directory. |
---|
| 589 | With added Example ViewletBase class, which is bound to templates/example_viewlet.pt |
---|
[3049] | 590 | template:: |
---|
[1005] | 591 | |
---|
| 592 | >>> 'viewlets.py' in os.listdir('browser') |
---|
| 593 | True |
---|
| 594 | |
---|
| 595 | >>> cat('browser/viewlets.py') |
---|
| 596 | from Products.CMFCore.utils import getToolByName |
---|
| 597 | from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile |
---|
| 598 | from plone.app.layout.viewlets import common |
---|
| 599 | ... |
---|
| 600 | class Example(common.ViewletBase): |
---|
| 601 | render = ViewPageTemplateFile('templates/example_viewlet.pt') |
---|
| 602 | <BLANKLINE> |
---|
| 603 | |
---|
[3049] | 604 | Check template file in templates directory:: |
---|
[1005] | 605 | |
---|
| 606 | >>> 'example_viewlet.pt' in os.listdir('browser/templates') |
---|
| 607 | True |
---|
| 608 | >>> cat('browser/templates/example_viewlet.pt') |
---|
| 609 | <BLANKLINE> |
---|
| 610 | |
---|
[3049] | 611 | New viewlet is registered in configure.zcml:: |
---|
[1005] | 612 | |
---|
| 613 | >>> cat('browser/configure.zcml') |
---|
| 614 | <configure |
---|
| 615 | ... |
---|
| 616 | <browser:viewlet |
---|
[2569] | 617 | name="quintagroup.theme.example.example" |
---|
[1005] | 618 | manager="plone.app.layout.viewlets.interfaces.IPortalHeader" |
---|
| 619 | class=".viewlets.Example" |
---|
| 620 | layer=".interfaces.IThemeSpecific" |
---|
| 621 | permission="zope2.View" |
---|
| 622 | /> |
---|
| 623 | ... |
---|
| 624 | |
---|
| 625 | |
---|
| 626 | viewlets.xml profile is added to profiles/default directory with new viewlet |
---|
[3049] | 627 | registration, ordered for specified viewlet manager:: |
---|
[1005] | 628 | |
---|
| 629 | >>> 'viewlets.xml' in os.listdir('profiles/default') |
---|
| 630 | True |
---|
| 631 | >>> cat('profiles/default/viewlets.xml') |
---|
| 632 | <?xml version="1.0"?> |
---|
| 633 | <object> |
---|
| 634 | ... |
---|
| 635 | <order manager="plone.portalheader" |
---|
| 636 | based-on="Plone Default" |
---|
| 637 | skinname="My Theme Name" > |
---|
| 638 | ... |
---|
[2569] | 639 | <viewlet name="quintagroup.theme.example.example" insert-after="*" /> |
---|
[1005] | 640 | <BLANKLINE> |
---|
| 641 | </order> |
---|
| 642 | <BLANKLINE> |
---|
| 643 | </object> |
---|
| 644 | |
---|
| 645 | |
---|
| 646 | |
---|
| 647 | Hide EXISTING viewlet |
---|
| 648 | --------------------- |
---|
| 649 | |
---|
[3049] | 650 | For that case you can use *viewlet_hidden* subtemplate:: |
---|
[1005] | 651 | |
---|
[3049] | 652 | >>> paster('addcontent viewlet_hidden') |
---|
| 653 | paster addcontent viewlet_hidden ... |
---|
[1005] | 654 | Recursing into profiles |
---|
| 655 | ... |
---|
| 656 | |
---|
| 657 | As we see from upper log - there is stuff for adding/updating profiles only. |
---|
| 658 | |
---|
| 659 | |
---|
| 660 | There is viewlet.xml profile in profiles/default directory |
---|
[3049] | 661 | which hides viewlet for specified viewlet manager:: |
---|
[1005] | 662 | |
---|
| 663 | >>> 'viewlets.xml' in os.listdir('profiles/default') |
---|
| 664 | True |
---|
| 665 | >>> cat('profiles/default/viewlets.xml') |
---|
| 666 | <?xml version="1.0"?> |
---|
| 667 | <object> |
---|
| 668 | ... |
---|
| 669 | <hidden manager="plone.portalheader" skinname="My Theme Name"> |
---|
| 670 | ... |
---|
| 671 | <viewlet name="example" /> |
---|
| 672 | <BLANKLINE> |
---|
| 673 | </hidden> |
---|
| 674 | ... |
---|
| 675 | </object> |
---|
| 676 | |
---|
| 677 | |
---|
| 678 | Adding ZEXPs importing |
---|
| 679 | ====================== |
---|
| 680 | |
---|
| 681 | Imagine situation, when you develop a theme, which uses some |
---|
| 682 | extra portal objects (documents with text for some potlets) |
---|
| 683 | Then customer of your theme can edit these objects according |
---|
| 684 | to his need. |
---|
| 685 | |
---|
| 686 | For this situation *import_zexps* subtemplate exists. |
---|
| 687 | |
---|
| 688 | *import_zexps* subtemplate extends your theme with |
---|
| 689 | mechanism for importing list of zexp formated files |
---|
[3049] | 690 | into portal root on theme instllation:: |
---|
[1005] | 691 | |
---|
[3049] | 692 | >>> paster('addcontent import_zexps') |
---|
| 693 | paster addcontent import_zexps ... |
---|
[1005] | 694 | ... |
---|
| 695 | Recursing into import |
---|
| 696 | ... |
---|
| 697 | Recursing into profiles |
---|
| 698 | ... |
---|
[1364] | 699 | Inserting from profiles.zcml_insert ... |
---|
| 700 | ... |
---|
[1005] | 701 | Inserting from setuphandlers.py_insert into ... |
---|
| 702 | ... |
---|
| 703 | |
---|
[3049] | 704 | As we see from the upper log |
---|
| 705 | |
---|
[1005] | 706 | - 'import' directory was added into root of the theme |
---|
| 707 | - profiles stuff was updated |
---|
[1364] | 708 | - profiles.zcml file is updated |
---|
[1005] | 709 | - some stuff into setuphandlers.py module was inserted |
---|
| 710 | |
---|
| 711 | 1. There was empty 'import' directory added, where you |
---|
[3049] | 712 | will put zexp objects for install into portal root.:: |
---|
[1005] | 713 | |
---|
| 714 | >>> ls('import') |
---|
| 715 | CONTENT.txt |
---|
| 716 | |
---|
| 717 | |
---|
[1364] | 718 | 2. import_steps.xml was added in profiles/import_zexps directory, |
---|
[3049] | 719 | which contains additional *quintagroup.theme.example.import_zexps* step:: |
---|
[1005] | 720 | |
---|
[1364] | 721 | >>> 'import_zexps' in os.listdir('profiles') |
---|
[1005] | 722 | True |
---|
[1364] | 723 | >>> 'import_steps.xml' in os.listdir('profiles/import_zexps') |
---|
| 724 | True |
---|
[1005] | 725 | |
---|
[1364] | 726 | >>> cat('profiles/import_zexps/import_steps.xml') |
---|
[1005] | 727 | <?xml version="1.0"?> |
---|
| 728 | ... |
---|
[2569] | 729 | <import-step id="quintagroup.theme.example.import_zexps" |
---|
[1005] | 730 | version="..." |
---|
[2569] | 731 | handler="quintagroup.theme.example.setuphandlers.importZEXPs" |
---|
[1005] | 732 | title="My Theme Name: Import zexps objects"> |
---|
| 733 | Import zexp objects into portal on My Theme Name theme installation |
---|
| 734 | </import-step> |
---|
| 735 | <BLANKLINE> |
---|
[1364] | 736 | ... |
---|
[1005] | 737 | |
---|
[1364] | 738 | 3. profiles.zcml configuration updated with new genericsetup profile for zexps |
---|
[3049] | 739 | importing:: |
---|
[1005] | 740 | |
---|
[1364] | 741 | >>> cat('profiles.zcml') |
---|
| 742 | <configure |
---|
| 743 | ... |
---|
| 744 | <genericsetup:registerProfile |
---|
| 745 | name="import_zexps" |
---|
| 746 | title="My Theme Name: Import ZEXPs" |
---|
| 747 | directory="profiles/import_zexps" |
---|
| 748 | description='Extension profile for importing objects of the "My Theme Name" Plone theme.' |
---|
| 749 | provides="Products.GenericSetup.interfaces.EXTENSION" |
---|
| 750 | /> |
---|
| 751 | <BLANKLINE> |
---|
| 752 | ... |
---|
| 753 | |
---|
[3049] | 754 | 4. Check setuphandlers.py module - there must be importZEXPs function defined:: |
---|
[1364] | 755 | |
---|
[1005] | 756 | >>> cat('setuphandlers.py') |
---|
| 757 | def setupVarious(context): |
---|
| 758 | ... |
---|
| 759 | def importZEXPs(context): |
---|
| 760 | ... |
---|
| 761 | |
---|
| 762 | Then simply prepare zexp objects and copy them to *import* directory. |
---|
| 763 | |
---|
| 764 | |
---|
| 765 | RELEASE NOTES ! |
---|
| 766 | =============== |
---|
| 767 | |
---|
| 768 | Before releasing theme - I suggest to clean up setup.py script: |
---|
| 769 | |
---|
[3049] | 770 | - remove *theme_vars* argument (its value is useful only for theme development) |
---|
[1005] | 771 | |
---|
[3049] | 772 | - remove *entry_points* argument (same reason). It's useless in plone for now. |
---|
[1005] | 773 | |
---|
[3049] | 774 | - And remove *paster_plugins* argument too (it has sence in conjunction with entry_points during theme developing) |
---|
[1005] | 775 | |
---|
| 776 | Steps mentioned above prevent possible problems with |
---|
| 777 | theme distribution/deployment. |
---|
| 778 | |
---|
[3049] | 779 | Notes: |
---|
| 780 | ------ |
---|
| 781 | |
---|
| 782 | * quintagroup.themetemplate v0.25 compatible with ZopeSkel >= 2.15 |
---|
| 783 | |
---|
| 784 | |
---|
[1005] | 785 | Changelog |
---|
| 786 | ========= |
---|
| 787 | |
---|
[3051] | 788 | 0.26 (2010-11-22) |
---|
| 789 | ----------------- |
---|
| 790 | |
---|
| 791 | - Updated README: hidden --no-interactive option, |
---|
| 792 | added note about reason of --overwrite option |
---|
| 793 | usage. |
---|
| 794 | [mylan] |
---|
| 795 | |
---|
| 796 | |
---|
[3049] | 797 | 0.25 (2010-06-24) |
---|
| 798 | ----------------- |
---|
| 799 | |
---|
| 800 | - Correct version of the pacakge |
---|
| 801 | [mylan] |
---|
| 802 | - Fix incompatibility wity ZopeSkel>=2.15 |
---|
| 803 | [mylan] |
---|
| 804 | - Updated tests |
---|
| 805 | [mylan] |
---|
| 806 | |
---|
| 807 | |
---|
[1364] | 808 | 0.2.2 (unreleased) |
---|
| 809 | ------------------ |
---|
| 810 | |
---|
| 811 | - Updated import_zexps subtemplate - move this step into |
---|
| 812 | separate genericsetup profile |
---|
| 813 | [mylan] |
---|
| 814 | - Updated tests for changed import_zexps subtemplate |
---|
| 815 | [mylan] |
---|
| 816 | |
---|
| 817 | 0.2 (unreleased) |
---|
[1005] | 818 | ---------------- |
---|
| 819 | |
---|
[1364] | 820 | - Added new css_dtml_skin subtemplate |
---|
| 821 | [mylan] |
---|
| 822 | - Added tests for css_dtml_skin subtemplate |
---|
| 823 | [mylan] |
---|
[1005] | 824 | |
---|
[1364] | 825 | 0.14 (unreleased) |
---|
| 826 | ----------------- |
---|
[1005] | 827 | |
---|
[1364] | 828 | - Refactoring theme vars storage-now storing in separate |
---|
| 829 | theme_vars.cfg file, without distutils writers [mylan] |
---|
| 830 | - Cleanup code [mylan] |
---|
| 831 | |
---|
| 832 | |
---|
| 833 | 0.11 (2009-04-13) |
---|
| 834 | ----------------- |
---|
| 835 | |
---|
| 836 | - Removed setup.cfg |
---|
| 837 | [mylan] |
---|
| 838 | |
---|
| 839 | |
---|
| 840 | 0.10 (2009-04-13) |
---|
| 841 | ----------------- |
---|
| 842 | |
---|
| 843 | - Updated README |
---|
| 844 | [olha] |
---|
| 845 | |
---|
| 846 | |
---|
| 847 | 0.9 (2009-04-11) |
---|
| 848 | ---------------- |
---|
| 849 | |
---|
| 850 | - Changed package name/namespace to |
---|
| 851 | quintagroup.themetemplate. |
---|
| 852 | [mylan] |
---|
| 853 | |
---|
| 854 | |
---|
[1005] | 855 | 0.8 (2009-04-10) |
---|
| 856 | ---------------- |
---|
| 857 | |
---|
| 858 | * Update tests, readme |
---|
| 859 | [mylan] |
---|
| 860 | |
---|
| 861 | * Update viewlet-order subtemplate |
---|
| 862 | [mylan] |
---|
| 863 | |
---|
| 864 | * Fix uninstall bug |
---|
| 865 | [mylan] |
---|
| 866 | |
---|
| 867 | |
---|
[3049] | 868 | 0.7 (unreleased) |
---|
| 869 | ---------------- |
---|
[1005] | 870 | |
---|
| 871 | * Add uninstall profile to fix skins tool after theme is uninstalled |
---|
| 872 | [piv] |
---|
| 873 | |
---|
| 874 | |
---|
[3049] | 875 | 0.1 (unreleased) |
---|
| 876 | ---------------- |
---|
[1005] | 877 | |
---|
| 878 | * Initial import Theme template with nested namespace. |
---|
| 879 | Support ZopeSkel' "addcommad" local command for extend |
---|
| 880 | Theme template, support extending with portlet, view local |
---|
| 881 | templates. |
---|
| 882 | [mylan] |
---|
| 883 | |
---|
| 884 | Keywords: ZopeSkel theme template plone3 Quintagroup |
---|
| 885 | Platform: UNKNOWN |
---|
| 886 | Classifier: Programming Language :: Python |
---|
| 887 | Classifier: Topic :: Software Development :: Libraries :: Python Modules |
---|