0 Votes

Changes for page Public Web Site

Last modified by Alex Cotiugă on 2025/11/27 10:42

From version 3.54
edited by Alex Cotiugă
on 2025/11/24 11:05
Change comment: There is no comment for this version
To version 3.59
edited by Alex Cotiugă
on 2025/11/24 12:32
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -160,6 +160,7 @@
160 160   <div class="modal-body">
161 161   <div>
162 162   Need help with your XWiki? <a href="mailto:alex@agnease.com">Contact Agnease</a>
163 + #displayFormFromSheetCode()
163 163   </div>
164 164   </div>
165 165   <div class="modal-footer">
... ... @@ -170,4 +170,41 @@
170 170   </div>
171 171   </div>
172 172  #end
174 +
175 +#macro (displayFormFromSheetCode)
176 + #set ($editing = $xcontext.action == 'edit')
177 + ## The object to display.
178 + #set ($xobject = $doc.getObject('Agnease.Code.Lead.LeadClass'))
179 + ## The class that describes the object properties.
180 + #set ($xclass = $xwiki.getXWikiClass('Agnease.Code.Lead.LeadClass'))
181 + $xclass
182 + ## Make sure the following display* method calls use the right object.
183 + #set ($discard = $doc.use($xobject))
184 + ## Using the xform vertical form layout.
185 + <div class="xform">
186 + <dl>
187 + #foreach ($property in $xclass.properties)
188 + <dt #if (!$editing && $hasEdit)
189 + class="editableProperty"
190 + #set ($xobjectPropertyReference = $xobject.getPropertyReference($property.name))
191 + data-property="$escapetool.xml($services.model.serialize($xobjectPropertyReference))"
192 + data-property-type="object"#end>
193 + ## This must match the id generated by the $doc.display() method below.
194 + #set ($propertyId = "${xclass.name}_${xobject.number}_$property.name")
195 + <label#if ($editing) for="$escapetool.xml($propertyId)"#end>
196 + $escapetool.xml($property.translatedPrettyName)
197 + </label>
198 + ## Support for specifying a translation key as hint in the property definition.
199 + <span class="xHint">$!escapetool.xml($services.localization.render($property.hint))</span>
200 + </dt>
201 + <dd>$doc.display($property.name)</dd>
202 + #end
203 + #if (!$xclass.properties || $xclass.properties.size() == 0)
204 + ## Keep the empty definition term in order to have valid HTML.
205 + <dt></dt>
206 + <dd>$escapetool.xml($services.localization.render('xclass.defaultObjectSheet.noProperties'))</dd>
207 + #end
208 + </dl>
209 + </div>
210 +#end
173 173  {{/velocity}}