0 Votes

Wiki source code of User Profile

Last modified by Ryan C on 2025/05/12 16:11

Hide last authors
Ryan C 1.1 1 {{velocity}}
2 #set ($discard = $xwiki.ssx.use('XWiki.XWikiUserSheet'))
3 #set ($discard = $xwiki.ssx.use('XWiki.AdminUserProfileSheet'))
4 ##
5 #set ($sheetDocumentReference = $services.model.createDocumentReference($xcontext.database, 'XWiki', 'AdminUserProfileSheet'))
6 #set ($sheetDocument = $xwiki.getDocument($sheetDocumentReference))
7 ##
8 #set ($sectionsObjectClassName = 'XWiki.UserProfileSectionsClass')
9 #set ($sectionObjectClassName = 'XWiki.UserProfileSectionClass')
10 ##
11 #set ($xredirect = $doc.getURL($xcontext.action, ${request.queryString}))
12 #set ($formToken = $services.csrf.getToken())
13 ##
14 {{html clean='false' wiki='true'}}
15 <form action="$sheetDocument.getURL('save')" method='post'>
16 ## When in edit mode, the form above gets overriden so we need a div with class xform to cover all cases.
17 <div class='xform'>
18 #set ($sectionsObject = $sheetDocument.getObject($sectionsObjectClassName))
19 <h2>$services.localization.render('platform.user.profileConfigureSectionsTitle')</h2>
20 <dl>
21 <dt>
22 <label for="${sectionsObjectClassName}_${sectionsObject.number}_sections">$services.localization.render('platform.user.profileConfigureSectionsLabel')</label>
23 <span class='xHint'>$services.localization.render('platform.user.profileConfigureSectionsHint')</span>
24 </dt>
25 <dd>$sheetDocument.display('sections', 'edit', $sectionsObject)</dd>
26 </dl>
27 <h2>$services.localization.render('platform.user.profileConfigureSectionsAllTitle')</h2>
28 <dl>
29 <dt>
30 <a class='hasIcon icon-button add-button' href="$sheetDocument.getURL('objectadd', "classname=${sectionObjectClassName}&amp;xredirect=$escapetool.url(${xredirect})&amp;form_token=${formToken}")">$services.localization.render('platform.user.profileConfigureSectionAddButtonLabel')</a>
31 </dt>
32 #set ($sectionObjects = $sheetDocument.getObjects($sectionObjectClassName))
33 #foreach ($sectionObject in $sectionObjects)
34 <dt>
35 <a class='hasIcon icon-button remove-button' href="$sheetDocument.getURL('objectremove', "classname=${sectionObjectClassName}&amp;classid=${sectionObject.number}&amp;xredirect=$escapetool.url(${xredirect})&amp;form_token=${formToken}")">$services.localization.render('platform.user.profileConfigureSectionRemoveButtonLabel')</a>
36 <label for="${sectionObjectClassName}_${sectionObject.number}_id">$services.localization.render('platform.user.profileConfigureSectionIdLabel')</label>
37 <span class='xHint'>$services.localization.render('platform.user.profileConfigureSectionIdHint')</span>
38 </dt>
39 <dd>$sheetDocument.display('id', 'edit', $sectionObject)</dd>
40
41 <dt>
42 <label for="${sectionObjectClassName}_${sectionObject.number}_name">$services.localization.render('platform.user.profileConfigureSectionNameLabel')</label>
43 <span class='xHint'>$services.localization.render('platform.user.profileConfigureSectionNameHint', ['http://platform.xwiki.org/xwiki/bin/view/DevGuide/InternationalizingApplications'])</span>
44 </dt>
45 <dd>$sheetDocument.display('name', 'edit', $sectionObject)</dd>
46
47 <dt>
48 <label for="${sectionObjectClassName}_${sectionObject.number}_properties">$services.localization.render('platform.user.profileConfigureSectionPropertiesLabel')</label>
49 <span class='xHint'>$services.localization.render('platform.user.profileConfigureSectionPropertiesHint', ['XWiki.XWikiUsers'])</span>
50 </dt>
51 <dd>$sheetDocument.display('properties', 'edit', $sectionObject)</dd>
52 #end
53 </dl>
54 ## Avoid duplicating the save button for edit mode.
55 #if ($xcontext.action != 'edit' && $xcontext.action != 'inline')
56 <span class='buttonwrapper'>
57 <input class='button' type='submit' name='save' value="$services.localization.render('platform.user.profileConfigureSaveButtonLabel')"/>
58 </span>
59 <input type='hidden' name='xredirect' value="$xredirect" />
60 <input type='hidden' name='form_token' value="$formToken" />
61 #end
62 </div>
63 </form>
64 {{/html}}
65 {{/velocity}}