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 | Let's create plone-3 theme python package. |
---|
51 | Use `paster create` command for that:: |
---|
52 | |
---|
53 | >>> paster('create -t qplone3_theme quintagroup.theme.example --overwrite') |
---|
54 | paster create -t qplone3_theme quintagroup.theme.example ... |
---|
55 | ... |
---|
56 | |
---|
57 | You got standard python package content with |
---|
58 | |
---|
59 | - *quintagroup* upper level namespace. |
---|
60 | - *quintagroup.theme.example-configure.zcml* - zcml file for adding into package-includes directory |
---|
61 | |
---|
62 | Check that:: |
---|
63 | |
---|
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'] |
---|
69 | |
---|
70 | |
---|
71 | *qplone3_theme* template - creates theme with nested namespace. |
---|
72 | |
---|
73 | By default - theme is placed in *quintagroup.theme.<3rd part of dotted package name> namespace* |
---|
74 | |
---|
75 | in our case - quintagroup.theme.example |
---|
76 | |
---|
77 | So check namespaces:: |
---|
78 | |
---|
79 | >>> theme_namespace = os.path.join(package_dir,'quintagroup','theme','example') |
---|
80 | >>> os.path.isdir(theme_namespace) |
---|
81 | True |
---|
82 | |
---|
83 | Theme holds 3 subdirectories (browser, profiles, skins):: |
---|
84 | |
---|
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) :: |
---|
91 | |
---|
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: |
---|
101 | |
---|
102 | - 'templates' resource directory |
---|
103 | - interfaces.py module with IThemeSpecific marker interface |
---|
104 | - configure.zcml, with registered theme marker interface:: |
---|
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 | |
---|
131 | First create configuration file with different skin name:: |
---|
132 | |
---|
133 | >>> conf_data = """ |
---|
134 | ... [pastescript] |
---|
135 | ... skinname=My Theme Name |
---|
136 | ... """ |
---|
137 | >>> file('theme_config.conf','w').write(conf_data) |
---|
138 | |
---|
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') |
---|
142 | paster create ... |
---|
143 | >>> cd(package_dir) |
---|
144 | >>> cat('quintagroup/theme/example/browser/configure.zcml') |
---|
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 |
---|
156 | ----------------- |
---|
157 | |
---|
158 | It contains only README.txt file and NO SKIN LAYERS YET. |
---|
159 | This is a job for localcommand ;) |
---|
160 | |
---|
161 | But check whether I am right ...:: |
---|
162 | |
---|
163 | >>> cd('quintagroup/theme/example') |
---|
164 | >>> ls('skins') |
---|
165 | README.txt |
---|
166 | |
---|
167 | |
---|
168 | *profiles* directory |
---|
169 | -------------------- |
---|
170 | |
---|
171 | There is 'default' and uninstall profiles inside:: |
---|
172 | |
---|
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: |
---|
179 | |
---|
180 | - import_steps.xml - for any reason. |
---|
181 | - skins.xml - for registering skins directory:: |
---|
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, |
---|
191 | without any new layers (yet):: |
---|
192 | |
---|
193 | >>> cat('skins.xml') |
---|
194 | <?xml version="1.0"?> |
---|
195 | ... |
---|
196 | <object name="portal_skins" ... |
---|
197 | default_skin="My Theme Name" request_varname="plone_skin"> |
---|
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 |
---|
206 | _setuphandlers.py_ module for additional installation steps:: |
---|
207 | |
---|
208 | >>> cat('import_steps.xml') |
---|
209 | <?xml version="1.0"?> |
---|
210 | ... |
---|
211 | <import-step id="quintagroup.theme.example.various" |
---|
212 | ... |
---|
213 | handler="quintagroup.theme.example.setuphandlers.setupVarious" |
---|
214 | ... |
---|
215 | </import-step> |
---|
216 | ... |
---|
217 | |
---|
218 | Look at setuphandlers.py module:: |
---|
219 | |
---|
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 | |
---|
231 | This part shows how you can extend a theme (generated with qplone3_theme |
---|
232 | ZopeSkel template) with additional useful stuff: |
---|
233 | |
---|
234 | - skin layers |
---|
235 | - views |
---|
236 | - viewlets |
---|
237 | - portlets |
---|
238 | - css |
---|
239 | - javascripts |
---|
240 | - objects in zexp files |
---|
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 |
---|
247 | work outside this package:: |
---|
248 | |
---|
249 | >>> paster('addcontent -a') |
---|
250 | paster addcontent -a |
---|
251 | ... |
---|
252 | css_dtml_skin: A DTML file in skin layer with CSS registration |
---|
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 | |
---|
275 | For that case use *skin_layer* subtemplate with *addcontent* local command:: |
---|
276 | |
---|
277 | >>> paster('addcontent skin_layer') |
---|
278 | paster addcontent skin_layer ... |
---|
279 | Recursing into profiles |
---|
280 | ... |
---|
281 | |
---|
282 | This command adds NEW 'skin_layer' (default name) directory to _skins_ directory, |
---|
283 | with only CONTENT.txt file inside:: |
---|
284 | |
---|
285 | >>> 'skin_layer' in os.listdir('skins') |
---|
286 | True |
---|
287 | >>> ls('skins/skin_layer') |
---|
288 | CONTENT.txt |
---|
289 | |
---|
290 | *skins.xml* profile is also updated:: |
---|
291 | |
---|
292 | >>> cat('profiles/default/skins.xml') |
---|
293 | <?xml version="1.0"?> |
---|
294 | ... |
---|
295 | <object name="portal_skins" allow_any="False" cookie_persistence="False" |
---|
296 | default_skin="My Theme Name" request_varname="plone_skin"> |
---|
297 | ... |
---|
298 | <object name="skin_layer" |
---|
299 | meta_type="Filesystem Directory View" |
---|
300 | directory="quintagroup.theme.example:skins/skin_layer"/> |
---|
301 | ... |
---|
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: |
---|
311 | |
---|
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 |
---|
317 | ============== |
---|
318 | |
---|
319 | Only initialization files are available in portlets directory before adding new portlet:: |
---|
320 | |
---|
321 | >>> ls('portlets') |
---|
322 | __init__.py |
---|
323 | configure.zcml |
---|
324 | |
---|
325 | Add portlet with *portlet* subtemplate:: |
---|
326 | |
---|
327 | >>> paster('addcontent portlet') |
---|
328 | paster addcontent portlet ... |
---|
329 | ... |
---|
330 | Recursing into portlets |
---|
331 | ... |
---|
332 | |
---|
333 | After executing this local command ... |
---|
334 | |
---|
335 | configure.zcml file in the theme root directory - includes portlets registry:: |
---|
336 | |
---|
337 | >>> cat('configure.zcml') |
---|
338 | <configure |
---|
339 | ... |
---|
340 | <include package=".portlets" /> |
---|
341 | ... |
---|
342 | |
---|
343 | exampleportlet.pt template and exampleportlet.py script added to portlets directory:: |
---|
344 | |
---|
345 | >>> files = ('exampleportlet.pt', 'exampleportlet.py') |
---|
346 | >>> [True for d in files if d in os.listdir('portlets')] |
---|
347 | [True, True] |
---|
348 | |
---|
349 | And portlets/configure.zcml - register new portlet:: |
---|
350 | |
---|
351 | >>> cat('portlets/configure.zcml') |
---|
352 | <configure |
---|
353 | ... |
---|
354 | <plone:portlet |
---|
355 | name="quintagroup.theme.example.portlets.ExamplePortlet" |
---|
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 | |
---|
366 | Finally, new portlet type is registered in portlets.xml profile:: |
---|
367 | |
---|
368 | >>> cat('profiles/default/portlets.xml') |
---|
369 | <?xml version="1.0"?> |
---|
370 | ... |
---|
371 | <portlet |
---|
372 | addview="quintagroup.theme.example.portlets.ExamplePortlet" |
---|
373 | title="Example portlet" |
---|
374 | description="" |
---|
375 | i18n:attributes="title; description" |
---|
376 | /> |
---|
377 | ... |
---|
378 | |
---|
379 | Thanks to ZopeSkel developers for this subtempalte ;) |
---|
380 | |
---|
381 | |
---|
382 | Adding CSS resource |
---|
383 | =================== |
---|
384 | |
---|
385 | Use *css_resource* subtemplate:: |
---|
386 | |
---|
387 | >>> paster("addcontent css_resource") |
---|
388 | paster addcontent css_resource ... |
---|
389 | Recursing into browser |
---|
390 | ... |
---|
391 | Recursing into profiles |
---|
392 | ... |
---|
393 | |
---|
394 | This template adds (if does not exist yet) _stylesheets_ directory in _browser_ |
---|
395 | directory:: |
---|
396 | |
---|
397 | >>> 'stylesheets' in os.listdir('browser') |
---|
398 | True |
---|
399 | |
---|
400 | In _stylesheets_ resource directory empty main.css stylesheet |
---|
401 | resource added:: |
---|
402 | |
---|
403 | >>> 'main.css' in os.listdir('browser/stylesheets') |
---|
404 | True |
---|
405 | >>> cat('browser/stylesheets/main.css') |
---|
406 | <BLANKLINE> |
---|
407 | |
---|
408 | |
---|
409 | New resource directory was registered in configure.zcml:: |
---|
410 | |
---|
411 | >>> cat('browser/configure.zcml') |
---|
412 | <configure |
---|
413 | ... |
---|
414 | <browser:resourceDirectory |
---|
415 | name="quintagroup.theme.example.stylesheets" |
---|
416 | directory="stylesheets" |
---|
417 | layer=".interfaces.IThemeSpecific" |
---|
418 | /> |
---|
419 | ... |
---|
420 | |
---|
421 | |
---|
422 | And cssregistry.xml profile was added into profiles/default directory with |
---|
423 | registered main.css stylesheet:: |
---|
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="" |
---|
432 | id="++resource++quintagroup.theme.example.stylesheets/main.css" |
---|
433 | media="screen" rel="stylesheet" rendering="inline" |
---|
434 | cacheable="True" compression="safe" cookable="True" |
---|
435 | enabled="1" expression=""/> |
---|
436 | ... |
---|
437 | |
---|
438 | |
---|
439 | |
---|
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: |
---|
448 | |
---|
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 | |
---|
457 | Use *css_dtml_skin* subtemplate:: |
---|
458 | |
---|
459 | >>> paster("addcontent css_dtml_skin") |
---|
460 | paster addcontent css_dtml_skin ... |
---|
461 | Recursing into profiles |
---|
462 | ... |
---|
463 | Recursing into skins |
---|
464 | ... |
---|
465 | |
---|
466 | This template adds main.css.dtml file into skins/skin_layer folder:: |
---|
467 | |
---|
468 | >>> 'main.css.dtml' in os.listdir('skins/skin_layer') |
---|
469 | True |
---|
470 | |
---|
471 | The main.css.dtml file already prepared to use as dtml-document:: |
---|
472 | |
---|
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 |
---|
483 | registered main.css stylesheet:: |
---|
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="" |
---|
492 | id="++resource++quintagroup.theme.example.stylesheets/main.css" |
---|
493 | media="screen" rel="stylesheet" rendering="inline" |
---|
494 | cacheable="True" compression="safe" cookable="True" |
---|
495 | enabled="1" expression=""/> |
---|
496 | ... |
---|
497 | |
---|
498 | |
---|
499 | Adding JAVASCRIPT resource |
---|
500 | -------------------------- |
---|
501 | |
---|
502 | Use *js_resource* subtemplate:: |
---|
503 | |
---|
504 | >>> paster('addcontent js_resource') |
---|
505 | paster addcontent js_resource ... |
---|
506 | Recursing into browser |
---|
507 | ... |
---|
508 | Recursing into profiles |
---|
509 | ... |
---|
510 | |
---|
511 | This template adds (if does not exist yet) _scripts_ directory in _browser_ |
---|
512 | directory:: |
---|
513 | |
---|
514 | >>> 'scripts' in os.listdir('browser') |
---|
515 | True |
---|
516 | |
---|
517 | |
---|
518 | Empty foo.js javascript file was added to _scripts_ directory:: |
---|
519 | |
---|
520 | >>> 'foo.js' in os.listdir('browser/scripts') |
---|
521 | True |
---|
522 | >>> cat('browser/scripts/foo.js') |
---|
523 | <BLANKLINE> |
---|
524 | |
---|
525 | |
---|
526 | New resource directory was registered in configure.zcml, if has not been registered yet:: |
---|
527 | |
---|
528 | >>> cat('browser/configure.zcml') |
---|
529 | <configure |
---|
530 | ... |
---|
531 | <browser:resourceDirectory |
---|
532 | name="quintagroup.theme.example.scripts" |
---|
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), |
---|
540 | and register new foo.js javascript resource:: |
---|
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 |
---|
549 | id="++resource++quintagroup.theme.example.scripts/foo.js" |
---|
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: |
---|
562 | |
---|
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 | |
---|
573 | Use *viewlet_order* subtemplate:: |
---|
574 | |
---|
575 | >>> paster('addcontent viewlet_order') |
---|
576 | paster addcontent viewlet_order ... |
---|
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 |
---|
586 | template:: |
---|
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 | |
---|
600 | Check template file in templates directory:: |
---|
601 | |
---|
602 | >>> 'example_viewlet.pt' in os.listdir('browser/templates') |
---|
603 | True |
---|
604 | >>> cat('browser/templates/example_viewlet.pt') |
---|
605 | <BLANKLINE> |
---|
606 | |
---|
607 | New viewlet is registered in configure.zcml:: |
---|
608 | |
---|
609 | >>> cat('browser/configure.zcml') |
---|
610 | <configure |
---|
611 | ... |
---|
612 | <browser:viewlet |
---|
613 | name="quintagroup.theme.example.example" |
---|
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 |
---|
623 | registration, ordered for specified viewlet manager:: |
---|
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 | ... |
---|
635 | <viewlet name="quintagroup.theme.example.example" insert-after="*" /> |
---|
636 | <BLANKLINE> |
---|
637 | </order> |
---|
638 | <BLANKLINE> |
---|
639 | </object> |
---|
640 | |
---|
641 | |
---|
642 | |
---|
643 | Hide EXISTING viewlet |
---|
644 | --------------------- |
---|
645 | |
---|
646 | For that case you can use *viewlet_hidden* subtemplate:: |
---|
647 | |
---|
648 | >>> paster('addcontent viewlet_hidden') |
---|
649 | paster addcontent viewlet_hidden ... |
---|
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 |
---|
657 | which hides viewlet for specified viewlet manager:: |
---|
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 |
---|
686 | into portal root on theme instllation:: |
---|
687 | |
---|
688 | >>> paster('addcontent import_zexps') |
---|
689 | paster addcontent import_zexps ... |
---|
690 | ... |
---|
691 | Recursing into import |
---|
692 | ... |
---|
693 | Recursing into profiles |
---|
694 | ... |
---|
695 | Inserting from profiles.zcml_insert ... |
---|
696 | ... |
---|
697 | Inserting from setuphandlers.py_insert into ... |
---|
698 | ... |
---|
699 | |
---|
700 | As we see from the upper log |
---|
701 | |
---|
702 | - 'import' directory was added into root of the theme |
---|
703 | - profiles stuff was updated |
---|
704 | - profiles.zcml file is updated |
---|
705 | - some stuff into setuphandlers.py module was inserted |
---|
706 | |
---|
707 | 1. There was empty 'import' directory added, where you |
---|
708 | will put zexp objects for install into portal root.:: |
---|
709 | |
---|
710 | >>> ls('import') |
---|
711 | CONTENT.txt |
---|
712 | |
---|
713 | |
---|
714 | 2. import_steps.xml was added in profiles/import_zexps directory, |
---|
715 | which contains additional *quintagroup.theme.example.import_zexps* step:: |
---|
716 | |
---|
717 | >>> 'import_zexps' in os.listdir('profiles') |
---|
718 | True |
---|
719 | >>> 'import_steps.xml' in os.listdir('profiles/import_zexps') |
---|
720 | True |
---|
721 | |
---|
722 | >>> cat('profiles/import_zexps/import_steps.xml') |
---|
723 | <?xml version="1.0"?> |
---|
724 | ... |
---|
725 | <import-step id="quintagroup.theme.example.import_zexps" |
---|
726 | version="..." |
---|
727 | handler="quintagroup.theme.example.setuphandlers.importZEXPs" |
---|
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> |
---|
732 | ... |
---|
733 | |
---|
734 | 3. profiles.zcml configuration updated with new genericsetup profile for zexps |
---|
735 | importing:: |
---|
736 | |
---|
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 | |
---|
750 | 4. Check setuphandlers.py module - there must be importZEXPs function defined:: |
---|
751 | |
---|
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 | |
---|
766 | - remove *theme_vars* argument (its value is useful only for theme development) |
---|
767 | |
---|
768 | - remove *entry_points* argument (same reason). It's useless in plone for now. |
---|
769 | |
---|
770 | - And remove *paster_plugins* argument too (it has sence in conjunction with entry_points during theme developing) |
---|
771 | |
---|
772 | Steps mentioned above prevent possible problems with |
---|
773 | theme distribution/deployment. |
---|
774 | |
---|
775 | Notes: |
---|
776 | ------ |
---|
777 | |
---|
778 | * quintagroup.themetemplate v0.25 compatible with ZopeSkel >= 2.15 |
---|
779 | |
---|
780 | |
---|
781 | Changelog |
---|
782 | ========= |
---|
783 | |
---|
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 | |
---|
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) |
---|
805 | ---------------- |
---|
806 | |
---|
807 | - Added new css_dtml_skin subtemplate |
---|
808 | [mylan] |
---|
809 | - Added tests for css_dtml_skin subtemplate |
---|
810 | [mylan] |
---|
811 | |
---|
812 | 0.14 (unreleased) |
---|
813 | ----------------- |
---|
814 | |
---|
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 | |
---|
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 | |
---|
855 | 0.7 (unreleased) |
---|
856 | ---------------- |
---|
857 | |
---|
858 | * Add uninstall profile to fix skins tool after theme is uninstalled |
---|
859 | [piv] |
---|
860 | |
---|
861 | |
---|
862 | 0.1 (unreleased) |
---|
863 | ---------------- |
---|
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 |
---|