Changes for page homeopathsSheet

Last modified by Jip-jan Alunkel on March 26, 17:31

From version 3.13
edited by Jip-jan Alunkel
on March 09, 00:23
Change comment: Rollback to version 1.38
To version 3.21
edited by Jip-jan Alunkel
on March 09, 01:27
Change comment: Rollback to version 1.38

Summary

Details

Page properties
Content
... ... @@ -35,14 +35,15 @@
35 35  ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
36 36   #set($classProperties = {
37 37   'practiceName': {'type': 'text', 'extraAttributes': {"disabled": "disabled", "help-block" : 'The name of your practice is the title of this page. If you want to change it, you should edit the content of this page.'}},
38 - 'pmAddress': {'type': 'address', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "data-auto-first-capital": "true", "data-query-type": "address", "data-query-reference": "", "data-query-list-type": "suggest-select", "data-query-list-header": "$services.localization.render('pagemaker.line.suggest_select_list')", "data-query-list-contents": "value/key", "data-query-list-editable": "false", "data-create-xobj": "true", "data-xobj-classname": "homeopaths.Code.homeopathsClass", "help-block" : 'Input street and number, then select the address of your practice.'}},
39 - 'pmStreet': {'type': 'text'},
40 - 'pmHousenumber': {'type': 'text'},
41 - 'pmPostcode': {'type': 'text'},
42 - 'pmCity': {'type': 'text'},
43 - 'pmCounty': {'type': 'text'},
44 - 'pmState': {'type': 'text'},
45 - 'pmCountry': {'type': 'text'},
38 + 'editAddress': {'type': 'checkbox', 'opener': 1},
39 + 'pmAddress': {'type': 'address', 'parent': 'editAddress', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "data-auto-first-capital": "true", "data-query-type": "address", "data-query-reference": "", "data-query-list-type": "suggest-select", "data-query-list-header": "$services.localization.render('pagemaker.line.suggest_select_list')", "data-query-list-contents": "value/key", "data-query-list-editable": "false", "data-create-xobj": "true", "data-xobj-classname": "homeopaths.Code.homeopathsClass", "help-block" : 'Input street and number, then select the address of your practice.'}},
40 + 'pmStreet': {'type': 'text', 'disabled': 1},
41 + 'pmHousenumber': {'type': 'text', 'disabled': 1},
42 + 'pmPostcode': {'type': 'text', 'disabled': 1},
43 + 'pmCity': {'type': 'text', 'disabled': 1},
44 + 'pmCounty': {'type': 'text', 'disabled': 1},
45 + 'pmState': {'type': 'text', 'disabled': 1},
46 + 'pmCountry': {'type': 'text', 'disabled': 1},
46 46   'certification': {'type': 'checkbox', 'opener': 1},
47 47   'certificationFrom': {'type': 'text', 'parent': 'certification'}
48 48   })
... ... @@ -101,10 +101,21 @@
101 101   <fieldset class="fieldset">
102 102   <address>
103 103  $doc.getTitle()<br />
104 -$theDocObj.getProperty('pmStreet').value $theDocObj.getProperty('pmHousenumber').value<br />
105 -$theDocObj.getProperty('pmPostcode').value $theDocObj.getProperty('pmCity').value<br />
106 -$theDocObj.getProperty('pmCounty,').value $theDocObj.getProperty('pmState').value<br />
107 -$theDocObj.getProperty('pmCountry').value.toUpperCase()
105 +#set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
106 +#set($x = {})
107 +#foreach($datapart in $addressArray)
108 + #if($theDocObj.getProperty($datapart))
109 + #set($datapart4Publish = $theDocObj.getProperty($datapart).value)
110 + #if($datapart == 'pmCountry')
111 + #set($datapart4Publish = $datapart4Publish.toUpperCase())
112 + #end
113 + #set($discard = $x.put("$datapart", $datapart4Publish))
114 + #end
115 +#end
116 +$x['pmStreet'] $x['pmHousenumber']<br />
117 +$x['pmPostcode'] $x['pmCity']<br />
118 +$x['pmCounty'] $x['pmState']<br />
119 +$x['pmCountry']
108 108   </address>
109 109   </fieldset>
110 110  #set($lastChild = "")
... ... @@ -117,44 +117,43 @@
117 117   #set($propertyParent = $item.parent)
118 118   #set($extraAttributes = $item.extraAttributes)
119 119   #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
120 - #if($theDocObj.getProperty($propertyName) || $propertyType == "address")
132 + #if($propertyType == "checkbox" || $propertyType == "radio")
133 + #set($value = "1")
134 + #elseif($theDocObj.getProperty($propertyName) || $propertyType == "address")
121 121   #set($value = $theDocObj.getProperty($propertyName).value)
122 - #if($propertyType == "checkbox" || $propertyType == "radio")
123 - #set($value = "1")
136 + #end
137 + #if(!$value)
138 + #set($value = "")
139 + #end
140 + #set($newElem = {
141 + "id" : "$propertyName",
142 + "type" : $propertyType,
143 + "required" : "false",
144 + "label" : "$label",
145 + "data-create-xobj" : "true",
146 + "data-xobj-classname" : $theClass,
147 + "data-xobj-fieldname" : "$propertyName",
148 + "value" : "$value"
149 + })
150 + #if($extraAttributes.keySet().size() > 0)
151 + #set($attrMap = $extraAttributes)
152 + #foreach($attr in $attrMap.keySet())
153 + #set($discard = $newElem.put("$attr", $attrMap[$attr]))
124 124   #end
125 - #if(!$value)
126 - #set($value = "")
127 - #end
128 - #set($newElem = {
129 - "id" : "$propertyName",
130 - "type" : $propertyType,
131 - "required" : "false",
132 - "label" : "$label",
133 - "data-create-xobj" : "true",
134 - "data-xobj-classname" : $theClass,
135 - "data-xobj-fieldname" : "$propertyName",
136 - "value" : "$value"
137 - })
138 - #if($extraAttributes.keySet().size() > 0)
139 - #set($attrMap = $extraAttributes)
140 - #foreach($attr in $attrMap.keySet())
141 - #set($discard = $newElem.put("$attr", $attrMap[$attr]))
142 - #end
143 - #end
144 - #if($propertyOpener)
145 - #set($discard = $newElem.put("data-opener", "true"))
146 - #end
147 - #if($propertyParent)
148 - #set($lastChild = "$key")
149 - #elseif($lastChild != "")
150 - #set($lastChild = "")
151 - #createExpandEnd()
152 - #end
153 - #createFormElement($newElem)
154 - #if($propertyOpener)
155 - #createExpandStart($newElem $value)
156 - #end
157 157   #end
156 + #if($propertyOpener)
157 + #set($discard = $newElem.put("data-opener", "true"))
158 + #end
159 + #if($propertyParent)
160 + #set($lastChild = "$key")
161 + #elseif($lastChild != "")
162 + #set($lastChild = "")
163 + #createExpandEnd()
164 + #end
165 + #createFormElement($newElem)
166 + #if($propertyOpener)
167 + #createExpandStart($newElem $value)
168 + #end
158 158   #end
159 159  #end
160 160   </div>