Code source wiki de Contacts

Version 2.1 par jmy le 2011/12/21 16:05

Afficher les derniers auteurs
1 Cet espace est destiné au référencement des contacts. Un contact n'est pas obligatoirement un utilisateur du wiki, ce qui est vrai principalement sur les projets collaboratifs.
2
3 {{velocity}}
4
5 #if("$!request.docName" != '')
6 ## Request for creating a new instance
7 #set($targetDocName = "${request.spaceName}.${request.docName}")
8 #if(!$xwiki.exists($targetDocName) && $xwiki.hasAccessLevel('edit', $context.user, $targetDocName))
9 $response.sendRedirect($xwiki.getURL($targetDocName, 'inline', "template=${request.template}&parent=${request.parent}"))
10 ## Stop processing, since we already sent a redirect.
11 #stop
12 #end
13 #end
14
15 = Create a new document =
16
17 #if("$!targetDocName" != '' && $xwiki.exists($targetDocName))
18 {{warning}}The target document already exists. Please choose a different name, or [[view the existing document>>$targetDocName]]{{/warning}}
19 #elseif("$!targetDocName" != '')
20 {{warning}}You don't have permission to create that document{{/warning}}
21 #end
22
23 {{html}}
24 <form action="" id="newdoc" method="post">
25 <div>
26 <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
27 <input type="hidden" name="parent" value="${doc.fullName}"/>
28 <input type="hidden" name="template" value="${doc.space}.ContactsTemplate"/>
29 <input type="hidden" name="sheet" value="1"/>
30 <label for="spaceName">Space: </label><input type="text" id="spaceName" name="spaceName" value="${doc.space}" />
31 <label for="docName">Document: </label><input type="text" id="docName" name="docName" value="" class="withTip"'/>
32 <span class="buttonwrapper"><input type="submit" value="Create this document" class="button"/></span>
33 </div>
34 </form>
35 {{/html}}
36
37 = Existing documents =
38
39 #set($sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='${doc.fullName}' and obj.name<>'${classTemplateDoc.fullName}'")
40 #foreach ($item in $xwiki.searchDocuments($sql))
41 * [[$item]]
42 #end
43
44 {{/velocity}}
45
46
47 = Listes des contacts : =
48 {{velocity}}
49 #set($sql = ",BaseObject as obj where doc.fullName=obj.name
50 and obj.className = 'Contacts.ContactsClass'
51 and doc.parent = '${doc.fullName}'")
52 #foreach ($item in $xwiki.searchDocuments($sql))
53 * [[$item]]
54 #end
55 {{/velocity}}