Code source wiki de Contacts

Modifié par jmy le 2011/12/21 16:13

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 contact=
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">Contact: </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 {{/velocity}}
38
39
40 = Listes des contacts : =
41 {{velocity}}
42 #set($sql = ",BaseObject as obj where doc.fullName=obj.name
43 and obj.className = 'Contacts.ContactsClass'
44 and doc.parent = '${doc.fullName}'")
45 #foreach ($item in $xwiki.searchDocuments($sql))
46 * [[$item]]
47 #end
48 {{/velocity}}