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