Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,29 +1,22 @@ 1 1 1 Best Practices 2 2 3 -# warning("TODO:Explainthe reasons behind these practices")3 +#toc("" "" "") 4 4 5 -1.1 NamingBestPractices5 +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 -