Code source wiki de homeopathsSheet

Version 1.54 par Jip-jan Alunkel le mars 07, 23:35

Afficher les derniers auteurs
1 {{include reference="assets.pagemaker.macros"/}}
2
3 {{velocity}}
4 #set($discard = $services.localization.use('document', 'homeopaths.Code.translations'))
5 #set($discard = $services.localization.use('document', 'assets.pagemaker.translations'))
6 #set($discard = $xwiki.ssx.use('assets.pagemaker.WebHome', {'minify': false}))
7 #set($discard = $xwiki.jsx.use('assets.pagemaker.WebHome', {'minify': false, 'language': $context.language, 'myParameter': 'value'}))
8 #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument())
9 #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline')
10 ## Create object (important for sheet binding, do not remove)
11 #set($theDocObj = $doc.getObject("homeopaths.Code.homeopathsClass", true))
12 #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin))
13 $theDoc.getContent()
14 {{html wiki="true" clean="false"}}
15 #if(!$isGuest)
16 <script>
17 var pagemakerOffspring = "disable";
18 </script>
19 #end
20 #if($hasRight)
21 <p class="buttons text-align-right">
22 <a class="btn btn-primary" title="Edit" href="$doc.getURL("edit")?editor=wysiwyg" role="button" rel="nofollow">
23 <span class="fa fa-pencil"></span>
24 <span class="btn-label">Edit contents</span>
25 </a>
26 </p>
27 #end
28 #set($spaceReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent)
29 #set($spaceTitle = $spaceReference.getName())
30 <div class="clearfix"></div>
31 #if($xcontext.action == "view")
32 <div id="${spaceTitle}" class="box sheet_properties">
33 <h2>Details</h2>
34 #set($classProperties = {
35 'practiceName': {'type': 'string', 'opener': 0},
36 'pmStreet': {'type': 'string', 'opener': 0},
37 'pmHousenumber': {'type': 'string', 'opener': 0, 'parent': 'certification'},
38 'pmPostcode': {'type': 'string', 'opener': 0},
39 'pmCity': {'type': 'string', 'opener': 0},
40 'pmCounty': {'type': 'string', 'opener': 0, 'parent': 'certification'},
41 'pmState': {'type': 'string', 'opener': 0},
42 'pmCountry': {'type': 'string', 'opener': 0},
43 'certification': {'type': 'bool', 'opener': 1},
44 'certificationFrom': {'type': 'string', 'opener': 0, 'parent': 'certification'}
45 })
46 #foreach($property in $classProperties.keySet())
47 #if($theDocObj.getProperty($property))
48 <p class="property">
49 #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout.
50 #if($property == "pmStreet") ## Difference with added housenumber because of the streetaddress layout.
51 <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span>
52 #else
53 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
54 #end
55 </p>
56 #end
57 #end
58 #end
59
60 #if($hasRight)
61 <p class="buttons text-align-right">
62 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
63 <span class="btn-label">Edit details</span>
64 </a>
65 </p>
66 #end
67 </div>
68 #if($hasRight)
69 #set($form_start = {
70 "id": "homeopaths_form",
71 "product": "homeopath details",
72 "method": "post",
73 "url": "",
74 "use_captcha": "false"
75 })
76 #set($thisObj = {})
77 #set($children = {})
78 #foreach($item in $classProperties.keySet())
79 #if($classProperties[$item].parent)
80 $item
81 #set($parentID = $classProperties[$item].parent)
82 #set($discard = $children.put("$parentID", {}))
83 #set($discard = $children["$parentID"].put($item, $classProperties[$item]))
84 #end
85 #end
86 $children
87 #foreach($item in $classProperties.keySet())
88 #set($label = $services.localization.render("homeopaths.classproperty.${item}"))
89 #if($theDocObj.getProperty($item))
90 #set($value = $theDocObj.getProperty($item).value)
91 #if($classProperties[$item].type == "bool")
92 #set($newElem = {
93 "id" : "$item",
94 "type" : "checkbox",
95 "required" : "false",
96 "label" : "$label",
97 "value" : "$value",
98 "data-opener" : "true"
99 })
100 #else
101 ## #if($classProperties[$item].opener)
102 #set($newElem = {
103 "id": "$item",
104 "type": "text",
105 "required" : "false",
106 "label" : "$label",
107 "data-create-xobj" : "true",
108 "data-xobj-classname" : "homeopaths.Code.homeopathsClass",
109 "data-xobj-fieldname" : "$item",
110 "value": "$value"
111 })
112 #end
113 #set($thisObj["$item"] = $newElem)
114 #end
115 #end
116 #set($practiceName = {
117 "id": "practiceName",
118 "type": "text",
119 "required" : "false",
120 "label" : "Practice name",
121 "data-create-xobj" : "true",
122 "data-xobj-classname" : "homeopaths.Code.homeopathsClass",
123 "data-xobj-fieldname" : "practiceName",
124 "value": "$doc.getTitle()"
125 })
126 #set($city = {
127 "id": "city",
128 "type": "text",
129 "required" : "false",
130 "label" : "City",
131 "data-create-xobj" : "true",
132 "data-xobj-classname" : "homeopaths.Code.homeopathsClass",
133 "data-xobj-fieldname" : "pmCity",
134 "value": "$theDocObj.getProperty('pmCity').value"
135 })
136 #set($submit = {
137 "id" : "edit_details",
138 "button-text" : "Save changes",
139 "clean": "true",
140 "help-block" : ""
141 })
142 #set($form_end = {
143 "use_captcha": "false"
144 })
145 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
146 <div class="modal-dialog modal-dialog-centered" role="document">
147 <div class="modal-content">
148 #createFormStart($form_start)
149 <div class="modal-header">
150 <h3 class="modal-title">Details</h3>
151 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
152 <span aria-hidden="true">&times;</span>
153 </button>
154 </div>
155 <div class="modal-body">
156 #foreach($obj in $thisObj)
157 #createFormElement($obj)
158 #end
159 #createFormElement($practiceName)
160 #createFormElement($city)
161 </div>
162 <div class="modal-footer">
163 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
164 #createSubmit($submit)
165 </div>
166 #createFormEnd($form_end)
167 </div>
168 </div>
169 </div>
170 #end
171 #else
172 This page can not be viewed in inline mode.
173 #end
174 {{/html}}
175 {{/velocity}}