1 | Metadata-Version: 1.0 |
---|
2 | Name: quintagroup.themetemplate |
---|
3 | Version: 0.26 |
---|
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 | |
---|
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 |
---|
19 | for Plone 3 at http://skins.quintagroup.com. |
---|
20 | |
---|
21 | Contents |
---|
22 | -------- |
---|
23 | 1. Overview |
---|
24 | 2. Creating theme package |
---|
25 | 3. Extending theme |
---|
26 | 4. Release notes |
---|
27 | |
---|
28 | Overview |
---|
29 | ======== |
---|
30 | |
---|
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) |
---|
34 | |
---|
35 | After that you can extend theme package by the following elements: |
---|
36 | |
---|
37 | - skin-layer(s) |
---|
38 | - portlet(s) |
---|
39 | - viewlet(s) |
---|
40 | - css, js resource(s) |
---|
41 | - objects in zexp files |
---|
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 | 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 | |
---|
54 | Let's create plone-3 theme python package. |
---|
55 | Use `paster create` command for that:: |
---|
56 | |
---|
57 | >>> paster('create -t qplone3_theme quintagroup.theme.example --overwrite') |
---|
58 | paster create -t qplone3_theme quintagroup.theme.example ... |
---|
59 | ... |
---|
60 | |
---|
61 | You got standard python package content with |
---|
62 | |
---|
63 | - *quintagroup* upper level namespace. |
---|
64 | - *quintagroup.theme.example-configure.zcml* - zcml file for adding into package-includes directory |
---|
65 | |
---|
66 | Check that:: |
---|
67 | |
---|
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'] |
---|
73 | |
---|
74 | |
---|
75 | *qplone3_theme* template - creates theme with nested namespace. |
---|
76 | |
---|
77 | By default - theme is placed in *quintagroup.theme.<3rd part of dotted package name> namespace* |
---|
78 | |
---|
79 | in our case - quintagroup.theme.example |
---|
80 | |
---|
81 | So check namespaces:: |
---|
82 | |
---|
83 | >>> theme_namespace = os.path.join(package_dir,'quintagroup','theme','example') |
---|
84 | >>> os.path.isdir(theme_namespace) |
---|
85 | True |
---|
86 | |
---|
87 | Theme holds 3 subdirectories (browser, profiles, skins):: |
---|
88 | |
---|
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) :: |
---|
95 | |
---|
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: |
---|
105 | |
---|
106 | - 'templates' resource directory |
---|
107 | - interfaces.py module with IThemeSpecific marker interface |
---|
108 | - configure.zcml, with registered theme marker interface:: |
---|
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 | |
---|
135 | First create configuration file with different skin name:: |
---|
136 | |
---|
137 | >>> conf_data = """ |
---|
138 | ... [pastescript] |
---|
139 | ... skinname=My Theme Name |
---|
140 | ... """ |
---|
141 | >>> file('theme_config.conf','w').write(conf_data) |
---|
142 | |
---|
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') |
---|
146 | paster create ... |
---|
147 | >>> cd(package_dir) |
---|
148 | >>> cat('quintagroup/theme/example/browser/configure.zcml') |
---|
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 |
---|
160 | ----------------- |
---|
161 | |
---|
162 | It contains only README.txt file and NO SKIN LAYERS YET. |
---|
163 | This is a job for localcommand ;) |
---|
164 | |
---|
165 | But check whether I am right ...:: |
---|
166 | |
---|
167 | >>> cd('quintagroup/theme/example') |
---|
168 | >>> ls('skins') |
---|
169 | README.txt |
---|
170 | |
---|
171 | |
---|
172 | *profiles* directory |
---|
173 | -------------------- |
---|
174 | |
---|
175 | There is 'default' and uninstall profiles inside:: |
---|
176 | |
---|
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: |
---|
183 | |
---|
184 | - import_steps.xml - for any reason. |
---|
185 | - skins.xml - for registering skins directory:: |
---|
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, |
---|
195 | without any new layers (yet):: |
---|
196 | |
---|
197 | >>> cat('skins.xml') |
---|
198 | <?xml version="1.0"?> |
---|
199 | ... |
---|
200 | <object name="portal_skins" ... |
---|
201 | default_skin="My Theme Name" request_varname="plone_skin"> |
---|
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 |
---|
210 | _setuphandlers.py_ module for additional installation steps:: |
---|
211 | |
---|
212 | >>> cat('import_steps.xml') |
---|
213 | <?xml version="1.0"?> |
---|
214 | ... |
---|
215 | <import-step id="quintagroup.theme.example.various" |
---|
216 | ... |
---|
217 | handler="quintagroup.theme.example.setuphandlers.setupVarious" |
---|
218 | ... |
---|
219 | </import-step> |
---|
220 | ... |
---|
221 | |
---|
222 | Look at setuphandlers.py module:: |
---|
223 | |
---|
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 | |
---|
235 | This part shows how you can extend a theme (generated with qplone3_theme |
---|
236 | ZopeSkel template) with additional useful stuff: |
---|
237 | |
---|
238 | - skin layers |
---|
239 | - views |
---|
240 | - viewlets |
---|
241 | - portlets |
---|
242 | - css |
---|
243 | - javascripts |
---|
244 | - objects in zexp files |
---|
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 |
---|
251 | work outside this package:: |
---|
252 | |
---|
253 | >>> paster('addcontent -a') |
---|
254 | paster addcontent -a |
---|
255 | ... |
---|
256 | css_dtml_skin: A DTML file in skin layer with CSS registration |
---|
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 | |
---|
279 | For that case use *skin_layer* subtemplate with *addcontent* local command:: |
---|
280 | |
---|
281 | >>> paster('addcontent skin_layer') |
---|
282 | paster addcontent skin_layer ... |
---|
283 | Recursing into profiles |
---|
284 | ... |
---|
285 | |
---|
286 | This command adds NEW 'skin_layer' (default name) directory to _skins_ directory, |
---|
287 | with only CONTENT.txt file inside:: |
---|
288 | |
---|
289 | >>> 'skin_layer' in os.listdir('skins') |
---|
290 | True |
---|
291 | >>> ls('skins/skin_layer') |
---|
292 | CONTENT.txt |
---|
293 | |
---|
294 | *skins.xml* profile is also updated:: |
---|
295 | |
---|
296 | >>> cat('profiles/default/skins.xml') |
---|
297 | <?xml version="1.0"?> |
---|
298 | ... |
---|
299 | <object name="portal_skins" allow_any="False" cookie_persistence="False" |
---|
300 | default_skin="My Theme Name" request_varname="plone_skin"> |
---|
301 | ... |
---|
302 | <object name="skin_layer" |
---|
303 | meta_type="Filesystem Directory View" |
---|
304 | directory="quintagroup.theme.example:skins/skin_layer"/> |
---|
305 | ... |
---|
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: |
---|
315 | |
---|
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 |
---|
321 | ============== |
---|
322 | |
---|
323 | Only initialization files are available in portlets directory before adding new portlet:: |
---|
324 | |
---|
325 | >>> ls('portlets') |
---|
326 | __init__.py |
---|
327 | configure.zcml |
---|
328 | |
---|
329 | Add portlet with *portlet* subtemplate:: |
---|
330 | |
---|
331 | >>> paster('addcontent portlet') |
---|
332 | paster addcontent portlet ... |
---|
333 | ... |
---|
334 | Recursing into portlets |
---|
335 | ... |
---|
336 | |
---|
337 | After executing this local command ... |
---|
338 | |
---|
339 | configure.zcml file in the theme root directory - includes portlets registry:: |
---|
340 | |
---|
341 | >>> cat('configure.zcml') |
---|
342 | <configure |
---|
343 | ... |
---|
344 | <include package=".portlets" /> |
---|
345 | ... |
---|
346 | |
---|
347 | exampleportlet.pt template and exampleportlet.py script added to portlets directory:: |
---|
348 | |
---|
349 | >>> files = ('exampleportlet.pt', 'exampleportlet.py') |
---|
350 | >>> [True for d in files if d in os.listdir('portlets')] |
---|
351 | [True, True] |
---|
352 | |
---|
353 | And portlets/configure.zcml - register new portlet:: |
---|
354 | |
---|
355 | >>> cat('portlets/configure.zcml') |
---|
356 | <configure |
---|
357 | ... |
---|
358 | <plone:portlet |
---|
359 | name="quintagroup.theme.example.portlets.ExamplePortlet" |
---|
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 | |
---|
370 | Finally, new portlet type is registered in portlets.xml profile:: |
---|
371 | |
---|
372 | >>> cat('profiles/default/portlets.xml') |
---|
373 | <?xml version="1.0"?> |
---|
374 | ... |
---|
375 | <portlet |
---|
376 | addview="quintagroup.theme.example.portlets.ExamplePortlet" |
---|
377 | title="Example portlet" |
---|
378 | description="" |
---|
379 | i18n:attributes="title; description" |
---|
380 | /> |
---|
381 | ... |
---|
382 | |
---|
383 | Thanks to ZopeSkel developers for this subtempalte ;) |
---|
384 | |
---|
385 | |
---|
386 | Adding CSS resource |
---|
387 | =================== |
---|
388 | |
---|
389 | Use *css_resource* subtemplate:: |
---|
390 | |
---|
391 | >>> paster("addcontent css_resource") |
---|
392 | paster addcontent css_resource ... |
---|
393 | Recursing into browser |
---|
394 | ... |
---|
395 | Recursing into profiles |
---|
396 | ... |
---|
397 | |
---|
398 | This template adds (if does not exist yet) _stylesheets_ directory in _browser_ |
---|
399 | directory:: |
---|
400 | |
---|
401 | >>> 'stylesheets' in os.listdir('browser') |
---|
402 | True |
---|
403 | |
---|
404 | In _stylesheets_ resource directory empty main.css stylesheet |
---|
405 | resource added:: |
---|
406 | |
---|
407 | >>> 'main.css' in os.listdir('browser/stylesheets') |
---|
408 | True |
---|
409 | >>> cat('browser/stylesheets/main.css') |
---|
410 | <BLANKLINE> |
---|
411 | |
---|
412 | |
---|
413 | New resource directory was registered in configure.zcml:: |
---|
414 | |
---|
415 | >>> cat('browser/configure.zcml') |
---|
416 | <configure |
---|
417 | ... |
---|
418 | <browser:resourceDirectory |
---|
419 | name="quintagroup.theme.example.stylesheets" |
---|
420 | directory="stylesheets" |
---|
421 | layer=".interfaces.IThemeSpecific" |
---|
422 | /> |
---|
423 | ... |
---|
424 | |
---|
425 | |
---|
426 | And cssregistry.xml profile was added into profiles/default directory with |
---|
427 | registered main.css stylesheet:: |
---|
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="" |
---|
436 | id="++resource++quintagroup.theme.example.stylesheets/main.css" |
---|
437 | media="screen" rel="stylesheet" rendering="inline" |
---|
438 | cacheable="True" compression="safe" cookable="True" |
---|
439 | enabled="1" expression=""/> |
---|
440 | ... |
---|
441 | |
---|
442 | |
---|
443 | |
---|
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: |
---|
452 | |
---|
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 | |
---|
461 | Use *css_dtml_skin* subtemplate:: |
---|
462 | |
---|
463 | >>> paster("addcontent css_dtml_skin") |
---|
464 | paster addcontent css_dtml_skin ... |
---|
465 | Recursing into profiles |
---|
466 | ... |
---|
467 | Recursing into skins |
---|
468 | ... |
---|
469 | |
---|
470 | This template adds main.css.dtml file into skins/skin_layer folder:: |
---|
471 | |
---|
472 | >>> 'main.css.dtml' in os.listdir('skins/skin_layer') |
---|
473 | True |
---|
474 | |
---|
475 | The main.css.dtml file already prepared to use as dtml-document:: |
---|
476 | |
---|
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 |
---|
487 | registered main.css stylesheet:: |
---|
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="" |
---|
496 | id="++resource++quintagroup.theme.example.stylesheets/main.css" |
---|
497 | media="screen" rel="stylesheet" rendering="inline" |
---|
498 | cacheable="True" compression="safe" cookable="True" |
---|
499 | enabled="1" expression=""/> |
---|
500 | ... |
---|
501 | |
---|
502 | |
---|
503 | Adding JAVASCRIPT resource |
---|
504 | -------------------------- |
---|
505 | |
---|
506 | Use *js_resource* subtemplate:: |
---|
507 | |
---|
508 | >>> paster('addcontent js_resource') |
---|
509 | paster addcontent js_resource ... |
---|
510 | Recursing into browser |
---|
511 | ... |
---|
512 | Recursing into profiles |
---|
513 | ... |
---|
514 | |
---|
515 | This template adds (if does not exist yet) _scripts_ directory in _browser_ |
---|
516 | directory:: |
---|
517 | |
---|
518 | >>> 'scripts' in os.listdir('browser') |
---|
519 | True |
---|
520 | |
---|
521 | |
---|
522 | Empty foo.js javascript file was added to _scripts_ directory:: |
---|
523 | |
---|
524 | >>> 'foo.js' in os.listdir('browser/scripts') |
---|
525 | True |
---|
526 | >>> cat('browser/scripts/foo.js') |
---|
527 | <BLANKLINE> |
---|
528 | |
---|
529 | |
---|
530 | New resource directory was registered in configure.zcml, if has not been registered yet:: |
---|
531 | |
---|
532 | >>> cat('browser/configure.zcml') |
---|
533 | <configure |
---|
534 | ... |
---|
535 | <browser:resourceDirectory |
---|
536 | name="quintagroup.theme.example.scripts" |
---|
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), |
---|
544 | and register new foo.js javascript resource:: |
---|
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 |
---|
553 | id="++resource++quintagroup.theme.example.scripts/foo.js" |
---|
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: |
---|
566 | |
---|
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 | |
---|
577 | Use *viewlet_order* subtemplate:: |
---|
578 | |
---|
579 | >>> paster('addcontent viewlet_order') |
---|
580 | paster addcontent viewlet_order ... |
---|
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 |
---|
590 | template:: |
---|
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 | |
---|
604 | Check template file in templates directory:: |
---|
605 | |
---|
606 | >>> 'example_viewlet.pt' in os.listdir('browser/templates') |
---|
607 | True |
---|
608 | >>> cat('browser/templates/example_viewlet.pt') |
---|
609 | <BLANKLINE> |
---|
610 | |
---|
611 | New viewlet is registered in configure.zcml:: |
---|
612 | |
---|
613 | >>> cat('browser/configure.zcml') |
---|
614 | <configure |
---|
615 | ... |
---|
616 | <browser:viewlet |
---|
617 | name="quintagroup.theme.example.example" |
---|
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 |
---|
627 | registration, ordered for specified viewlet manager:: |
---|
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 | ... |
---|
639 | <viewlet name="quintagroup.theme.example.example" insert-after="*" /> |
---|
640 | <BLANKLINE> |
---|
641 | </order> |
---|
642 | <BLANKLINE> |
---|
643 | </object> |
---|
644 | |
---|
645 | |
---|
646 | |
---|
647 | Hide EXISTING viewlet |
---|
648 | --------------------- |
---|
649 | |
---|
650 | For that case you can use *viewlet_hidden* subtemplate:: |
---|
651 | |
---|
652 | >>> paster('addcontent viewlet_hidden') |
---|
653 | paster addcontent viewlet_hidden ... |
---|
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 |
---|
661 | which hides viewlet for specified viewlet manager:: |
---|
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 |
---|
690 | into portal root on theme instllation:: |
---|
691 | |
---|
692 | >>> paster('addcontent import_zexps') |
---|
693 | paster addcontent import_zexps ... |
---|
694 | ... |
---|
695 | Recursing into import |
---|
696 | ... |
---|
697 | Recursing into profiles |
---|
698 | ... |
---|
699 | Inserting from profiles.zcml_insert ... |
---|
700 | ... |
---|
701 | Inserting from setuphandlers.py_insert into ... |
---|
702 | ... |
---|
703 | |
---|
704 | As we see from the upper log |
---|
705 | |
---|
706 | - 'import' directory was added into root of the theme |
---|
707 | - profiles stuff was updated |
---|
708 | - profiles.zcml file is updated |
---|
709 | - some stuff into setuphandlers.py module was inserted |
---|
710 | |
---|
711 | 1. There was empty 'import' directory added, where you |
---|
712 | will put zexp objects for install into portal root.:: |
---|
713 | |
---|
714 | >>> ls('import') |
---|
715 | CONTENT.txt |
---|
716 | |
---|
717 | |
---|
718 | 2. import_steps.xml was added in profiles/import_zexps directory, |
---|
719 | which contains additional *quintagroup.theme.example.import_zexps* step:: |
---|
720 | |
---|
721 | >>> 'import_zexps' in os.listdir('profiles') |
---|
722 | True |
---|
723 | >>> 'import_steps.xml' in os.listdir('profiles/import_zexps') |
---|
724 | True |
---|
725 | |
---|
726 | >>> cat('profiles/import_zexps/import_steps.xml') |
---|
727 | <?xml version="1.0"?> |
---|
728 | ... |
---|
729 | <import-step id="quintagroup.theme.example.import_zexps" |
---|
730 | version="..." |
---|
731 | handler="quintagroup.theme.example.setuphandlers.importZEXPs" |
---|
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> |
---|
736 | ... |
---|
737 | |
---|
738 | 3. profiles.zcml configuration updated with new genericsetup profile for zexps |
---|
739 | importing:: |
---|
740 | |
---|
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 | |
---|
754 | 4. Check setuphandlers.py module - there must be importZEXPs function defined:: |
---|
755 | |
---|
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 | |
---|
770 | - remove *theme_vars* argument (its value is useful only for theme development) |
---|
771 | |
---|
772 | - remove *entry_points* argument (same reason). It's useless in plone for now. |
---|
773 | |
---|
774 | - And remove *paster_plugins* argument too (it has sence in conjunction with entry_points during theme developing) |
---|
775 | |
---|
776 | Steps mentioned above prevent possible problems with |
---|
777 | theme distribution/deployment. |
---|
778 | |
---|
779 | Notes: |
---|
780 | ------ |
---|
781 | |
---|
782 | * quintagroup.themetemplate v0.25 compatible with ZopeSkel >= 2.15 |
---|
783 | |
---|
784 | |
---|
785 | Changelog |
---|
786 | ========= |
---|
787 | |
---|
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 | |
---|
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 | |
---|
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) |
---|
818 | ---------------- |
---|
819 | |
---|
820 | - Added new css_dtml_skin subtemplate |
---|
821 | [mylan] |
---|
822 | - Added tests for css_dtml_skin subtemplate |
---|
823 | [mylan] |
---|
824 | |
---|
825 | 0.14 (unreleased) |
---|
826 | ----------------- |
---|
827 | |
---|
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 | |
---|
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 | |
---|
868 | 0.7 (unreleased) |
---|
869 | ---------------- |
---|
870 | |
---|
871 | * Add uninstall profile to fix skins tool after theme is uninstalled |
---|
872 | [piv] |
---|
873 | |
---|
874 | |
---|
875 | 0.1 (unreleased) |
---|
876 | ---------------- |
---|
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 |
---|