Cambios para el documento homeopathsSheet
Última modificación por Jip-jan Alunkel el marzo 26, 17:31
Desde la versión 3.4
editado por Jip-jan Alunkel
el marzo 08, 21:55
el marzo 08, 21:55
Cambiar el comentario:
Rollback to version 1.38
Hasta la versión 2.1
editado por Jip-jan Alunkel
el marzo 08, 19:05
el marzo 08, 19:05
Cambiar el comentario:
Rollback to version 1.14
Resumen
-
Propiedades de página (1 modificado, 0 añadido, 0 eliminado)
Detalles
- Propiedades de página
-
- Contenido
-
... ... @@ -1,15 +1,14 @@ 1 1 {{include reference="assets.pagemaker.macros"/}} 2 2 3 3 {{velocity}} 4 -#set($discard = $services.localization.use('document', ' assets.global.translations'))4 +#set($discard = $services.localization.use('document', 'homeopaths.Code.translations')) 5 5 #set($discard = $services.localization.use('document', 'assets.pagemaker.translations')) 6 6 #set($discard = $xwiki.ssx.use('assets.pagemaker.WebHome', {'minify': false})) 7 7 #set($discard = $xwiki.jsx.use('assets.pagemaker.WebHome', {'minify': false, 'language': $context.language, 'myParameter': 'value'})) 8 8 #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument()) 9 9 #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline') 10 -#set($theClass = "homeopaths.Code.homeopathsClass") 11 11 ## Create object (important for sheet binding, do not remove) 12 -#set($theDocObj = $doc.getObject( $theClass, true))11 +#set($theDocObj = $doc.getObject("homeopaths.Code.homeopathsClass", true)) 13 13 #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin)) 14 14 $theDoc.getContent() 15 15 {{html wiki="true" clean="false"}} ... ... @@ -32,33 +32,23 @@ 32 32 #if($xcontext.action == "view") 33 33 <div id="${spaceTitle}" class="box sheet_properties"> 34 34 <h2>Details</h2> 35 -## The classProperties Map has to be in the order of how you want the form elements to appear in the form. 36 -#set($classProperties = { 37 - 'practiceName': {'type': 'text'}, 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'}, 46 - 'certification': {'type': 'checkbox', 'opener': 1}, 47 - 'certificationFrom': {'type': 'text', 'parent': 'certification'} 34 +#set($classProperties = ['pmPractice','pmStreet','pmHousenumber','pmPostcode','pmCity','pmCountry','pmState','pmCounty']) 35 +#* 36 +{ 37 + 'pmCountry': '$services.localization.render("homeopaths.pmCountry")', 38 + 'pmState': '$services.localization.render("homeopaths.classproperty.pmState")', 39 + 'pmCounty': '$services.localization.render("homeopaths.classproperty.pmCounty")', 40 + 'pmPostcode': '$services.localization.render("homeopaths.classproperty.pmPostcode")', 41 + 'pmCity': '$services.localization.render("homeopaths.classproperty.pmCity")', 42 + 'pmStreet': '$services.localization.render("homeopaths.classproperty.pmStreet")', 43 + 'pmHousenumber': '$services.localization.render("homeopaths.classproperty.pmHousenumber")' 48 48 }) 49 -#foreach($property in $classProperties.keySet()) 50 - #if($theDocObj.getProperty($property)) 45 +*# 46 +#foreach($property in $classProperties) 47 + #if($theDocObj.getProperty($property).value != "") 51 51 <p class="property"> 52 - #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout. 53 - #if($property == "pmStreet") 54 - <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span> 55 - #elseif($property == "practiceName") ## Difference, should receive the title from the page. 56 - <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.getTitle()</span> 57 - #else ## Normal situation. 58 58 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span> 59 - #end 60 60 </p> 61 - #end 62 62 #end 63 63 #end 64 64 ... ... @@ -70,7 +70,7 @@ 70 70 </p> 71 71 #end 72 72 </div> 73 - #if($hasRight) 62 + #if($hasRight) ## Ook de rechts situatie uitlezen en meenemen. 74 74 #set($form_start = { 75 75 "id": "homeopaths_form", 76 76 "product": "homeopath details", ... ... @@ -78,6 +78,16 @@ 78 78 "url": "", 79 79 "use_captcha": "false" 80 80 }) 70 + #set($city = { 71 + "id": "city", 72 + "type": "text", 73 + "required" : "false", 74 + "label" : "City", 75 + "data-create-xobj" : "true", 76 + "data-xobj-classname" : "homeopaths.Code.homeopathsClass", 77 + "data-xobj-fieldname" : "pmCity", 78 + "value": "$theDocObj.getProperty('pmCity').value" 79 + }) 81 81 #set($submit = { 82 82 "id" : "edit_details", 83 83 "button-text" : "Save changes", ... ... @@ -98,53 +98,7 @@ 98 98 </button> 99 99 </div> 100 100 <div class="modal-body"> 101 -#set($lastChild = "") 102 -#foreach($propertyName in $classProperties.keySet()) 103 - #set($item = $classProperties["$propertyName"]) 104 - #set($propertyType = $item.type) 105 - #set($propertyOpener = $item.opener) 106 - #set($propertyParent = $item.parent) 107 - #set($extraAttributes = $item.extraAttributes) 108 - #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}")) 109 - #if($theDocObj.getProperty($propertyName) || $propertyType == "address") 110 - #set($value = $theDocObj.getProperty($propertyName).value) 111 - #if($propertyType == "checkbox" || $propertyType == "radio") 112 - #set($value = "1") 113 - #end 114 - #if(!$value) 115 - #set($value = "") 116 - #end 117 - #set($newElem = { 118 - "id" : "$propertyName", 119 - "type" : $propertyType, 120 - "required" : "false", 121 - "label" : "$label", 122 - "data-create-xobj" : "true", 123 - "data-xobj-classname" : $theClass, 124 - "data-xobj-fieldname" : "$propertyName", 125 - "value" : "$value" 126 - }) 127 - #if($extraAttributes.keySet().size() > 0) 128 - #set($attrMap = $extraAttributes) 129 - #foreach($attr in $attrMap.keySet()) 130 - #set($discard = $newElem.put("$attr", $attrMap[$attr])) 131 - #end 132 - #end 133 - #if($propertyOpener) 134 - #set($discard = $newElem.put("data-opener", "true")) 135 - #end 136 - #if($propertyParent) 137 - #set($lastChild = "$key") 138 - #elseif($lastChild != "") 139 - #set($lastChild = "") 140 - #createExpandEnd() 141 - #end 142 - #createFormElement($newElem) 143 - #if($propertyOpener) 144 - #createExpandStart($newElem $value) 145 - #end 146 - #end 147 -#end 100 + #createFormElement($city) 148 148 </div> 149 149 <div class="modal-footer"> 150 150 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> ... ... @@ -158,35 +158,5 @@ 158 158 #else 159 159 This page can not be viewed in inline mode. 160 160 #end 161 - 162 -#macro(createElementObjects $properties) 163 - #foreach($item in $properties.keySet()) 164 - #set($label = $services.localization.render("homeopaths.classproperty.${item}")) 165 - #if($theDocObj.getProperty($item)) 166 - #set($value = $theDocObj.getProperty($item).value) 167 - #set($newElem = { 168 - "id" : "$item", 169 - "type" : $classProperties[$item].type, 170 - "required" : "false", 171 - "label" : "$label", 172 - "data-create-xobj" : "true", 173 - "data-xobj-classname" : $theClass, 174 - "data-xobj-fieldname" : "$item", 175 - "value" : "$value" 176 - }) 177 - #if($classProperties[$item].opener == 1) 178 - #set($discard = $newElem.put("data-opener", "true")) 179 - #end 180 - #if($classProperties[$item].extraAttributes) 181 - #set($attrMap = $classProperties[$item].extraAttributes) 182 - #foreach($attr in $attrMap.keySet()) 183 - #set($discard = $newElem.put("$attr", $attrMap[$attr])) 184 - #end 185 - #end 186 - #set($thisObj["$item"] = $newElem) 187 - #end 188 - #end 189 -#end 190 - 191 191 {{/html}} 192 192 {{/velocity}}