<
From version < 1.2 >
edited by Vincent Massol
on 2007/01/10
To version < 1.3 >
edited by Vincent Massol
on 2007/04/17
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,29 +1,22 @@
1 1  1 Best Practices
2 2  
3 -#warning("TODO: Explain the reasons behind these practices")
3 +#toc("" "" "")
4 4  
5 -1.1 Naming Best Practices
5 +1.1 Check for Object existence in Class Sheets documents
6 6  
7 -1.1.1 Application
8 -* Each application must have its own Space if a user interface is needed.
7 +Class sheet documents should be written using the following construct (this is an example for displaying documents containing XWiki.XWikiUsers objects):
9 9  
10 -1.1.1 Classes
11 -* Classes must be in the XWiki space
12 -* The name must end with "Class" like "TagClass"
9 +{code}
10 +\#set($obj = \$doc.getObject("XWiki.XWikiUsers"))
11 +\#if(!$obj)
12 + \1 User Sheet
13 + This stylesheet must be applied on a document containing a XWiki.XWikiUsers object.
14 +\#else
15 + \1 \$msg.get("userProfile", [\$xwiki.getUserName($doc.fullName, false)])
16 + ...
17 +\#end
18 +{code}
13 13  
14 -1.1.1 Macro
15 -* Macro must be in the XWiki space
16 -* The name must end with "Macro" like "TagMacro"
20 +#info("The 'if' tests first for the non existence. This is so that XWiki extract the title from the ~~1 User Sheet~~, which is a proper title to display when viewsing the sheet page, instead of the computed name which will usually display something wrong.")
17 17  
18 -1.1.1 Sheets
19 -* Sheets must be in the XWiki space
20 -* The name must end with "Sheet" like "TagSheet"
21 21  
22 -1.1.1 Templates
23 -* Templates must be in the XWiki space
24 -* The name must end with "Templates" like "TagTemplates"
25 -
26 -1.1.1 Objects
27 -* Objects must be in their own space
28 -
29 -

Get Connected