Changes for page homeopathsSheet
Last modified by Jip-jan Alunkel on March 26, 17:31
From version 1.61
edited by Jip-jan Alunkel
on March 08, 00:51
on March 08, 00:51
Change comment:
There is no comment for this version
To version 1.55
edited by Jip-jan Alunkel
on March 07, 23:38
on March 07, 23:38
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -7,9 +7,8 @@ 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"}} ... ... @@ -78,14 +78,64 @@ 78 78 #set($children = {}) 79 79 #foreach($item in $classProperties.keySet()) 80 80 #if($classProperties[$item].parent) 80 +$item 81 81 #set($parentID = $classProperties[$item].parent) 82 - #if(!$c hildren[$parentID])82 + #if(!$classProperties[$parentID]) 83 83 #set($discard = $children.put("$parentID", {})) 84 84 #end 85 85 #set($discard = $children["$parentID"].put($item, $classProperties[$item])) 86 86 #end 87 87 #end 88 - #createElementObjects($classProperties) 88 +$children 89 + #foreach($item in $classProperties.keySet()) 90 + #set($label = $services.localization.render("homeopaths.classproperty.${item}")) 91 + #if($theDocObj.getProperty($item)) 92 + #set($value = $theDocObj.getProperty($item).value) 93 + #if($classProperties[$item].type == "bool") 94 + #set($newElem = { 95 + "id" : "$item", 96 + "type" : "checkbox", 97 + "required" : "false", 98 + "label" : "$label", 99 + "value" : "$value", 100 + "data-opener" : "true" 101 + }) 102 + #else 103 +## #if($classProperties[$item].opener) 104 + #set($newElem = { 105 + "id": "$item", 106 + "type": "text", 107 + "required" : "false", 108 + "label" : "$label", 109 + "data-create-xobj" : "true", 110 + "data-xobj-classname" : "homeopaths.Code.homeopathsClass", 111 + "data-xobj-fieldname" : "$item", 112 + "value": "$value" 113 + }) 114 + #end 115 + #set($thisObj["$item"] = $newElem) 116 + #end 117 + #end 118 + #set($practiceName = { 119 + "id": "practiceName", 120 + "type": "text", 121 + "required" : "false", 122 + "label" : "Practice name", 123 + "data-create-xobj" : "true", 124 + "data-xobj-classname" : "homeopaths.Code.homeopathsClass", 125 + "data-xobj-fieldname" : "practiceName", 126 + "value": "$doc.getTitle()" 127 + }) 128 + #set($city = { 129 + "id": "city", 130 + "type": "text", 131 + "required" : "false", 132 + "label" : "City", 133 + "data-create-xobj" : "true", 134 + "data-xobj-classname" : "homeopaths.Code.homeopathsClass", 135 + "data-xobj-fieldname" : "pmCity", 136 + "value": "$theDocObj.getProperty('pmCity').value" 137 + }) 89 89 #set($submit = { 90 90 "id" : "edit_details", 91 91 "button-text" : "Save changes", ... ... @@ -107,11 +107,10 @@ 107 107 </div> 108 108 <div class="modal-body"> 109 109 #foreach($obj in $thisObj) 110 - $obj 111 -## #createFormElement($obj) 159 + #createFormElement($obj) 112 112 #end 113 - ###createFormElement($practiceName)114 - ###createFormElement($city)161 + #createFormElement($practiceName) 162 + #createFormElement($city) 115 115 </div> 116 116 <div class="modal-footer"> 117 117 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> ... ... @@ -125,35 +125,5 @@ 125 125 #else 126 126 This page can not be viewed in inline mode. 127 127 #end 128 - 129 -#macro(createElementObjects $properties) 130 - #foreach($item in $properties.keySet()) 131 - #set($label = $services.localization.render("homeopaths.classproperty.${item}")) 132 - #if($theDocObj.getProperty($item)) 133 - #set($value = $theDocObj.getProperty($item).value) 134 - #set($newElem = { 135 - "id" : "$item", 136 - "type" : $classProperties[$item].type, 137 - "required" : "false", 138 - "label" : "$label", 139 - "data-create-xobj" : "true", 140 - "data-xobj-classname" : $theClass, 141 - "data-xobj-fieldname" : "$item", 142 - "value" : "$value" 143 - }) 144 - #if($classProperties[$item].opener == 1) 145 - #set($discard = $newElem.put("data-opener", "true")) 146 - #end 147 - #if($classProperties[$item].extraAttributes) 148 - #set($attrMap = $classProperties[$item].extraAttributes) 149 - #foreach($attr in $attrMap.keySet()) 150 - #set($discard = $newElem.put("$attr", $attrMap[$attr])) 151 - #end 152 - #end 153 - #set($thisObj["$item"] = $newElem) 154 - #end 155 - #end 156 -#end 157 - 158 158 {{/html}} 159 159 {{/velocity}}