| 1 | <!-- WAeUP layout_lib --> |
|---|
| 2 | <!-- $Id: layout_waeup_lib.pt 1409 2007-02-12 08:50:49Z henrik $ --> |
|---|
| 3 | |
|---|
| 4 | <!-- div_view --> |
|---|
| 5 | |
|---|
| 6 | <metal:block define-macro="div_view" |
|---|
| 7 | tal:define="layout options/layout"> |
|---|
| 8 | <tal:block repeat="row layout/rows"> |
|---|
| 9 | <tal:block repeat="cell row"> |
|---|
| 10 | <tal:block define="widget cell/widget"> |
|---|
| 11 | <div tal:define="dm options/datastructure/getDataModel;" |
|---|
| 12 | tal:attributes="class cell/widget_css_class|nothing; |
|---|
| 13 | id python:widget.getHtmlWidgetId()+'_widget';" |
|---|
| 14 | > |
|---|
| 15 | <tal:block condition="widget/label"> |
|---|
| 16 | <span class="dlabel" i18n:translate="" tal:condition="widget/is_i18n" |
|---|
| 17 | tal:content="widget/label">label</span> |
|---|
| 18 | <span class="dlabel" tal:condition="not:widget/is_i18n" |
|---|
| 19 | tal:content="widget/label">label</span> |
|---|
| 20 | </tal:block> |
|---|
| 21 | <tal:block replace="structure cell/widget_rendered" /> |
|---|
| 22 | </div> |
|---|
| 23 | </tal:block> |
|---|
| 24 | </tal:block> |
|---|
| 25 | </tal:block> |
|---|
| 26 | </metal:block> |
|---|
| 27 | |
|---|
| 28 | <!-- table view --> |
|---|
| 29 | |
|---|
| 30 | <metal:block define-macro="table_view" |
|---|
| 31 | tal:define="layout options/layout"> |
|---|
| 32 | <table> |
|---|
| 33 | <tal:block repeat="row layout/rows"> |
|---|
| 34 | <tr> |
|---|
| 35 | <tal:block repeat="cell row"> |
|---|
| 36 | <tal:block define="widget cell/widget"> |
|---|
| 37 | <div tal:omit-tag="" |
|---|
| 38 | tal:define="dm options/datastructure/getDataModel;" |
|---|
| 39 | tal:attributes="class cell/widget_css_class|nothing; |
|---|
| 40 | id python:widget.getHtmlWidgetId()+'_widget';" |
|---|
| 41 | > |
|---|
| 42 | <tal:block condition="widget/label"> |
|---|
| 43 | <td width="220px" valign="top" nowrap> |
|---|
| 44 | <span i18n:translate="" tal:condition="widget/is_i18n"> |
|---|
| 45 | <span tal:content="widget/label" />:</span> |
|---|
| 46 | <span tal:condition="not:widget/is_i18n"> |
|---|
| 47 | <span tal:content="widget/label" />:</span> |
|---|
| 48 | </td> |
|---|
| 49 | </tal:block> |
|---|
| 50 | <tal:block condition="not: widget/label"> |
|---|
| 51 | <td> |
|---|
| 52 | <div width="220px" valign="top"> no label </div> |
|---|
| 53 | </td> |
|---|
| 54 | </tal:block> |
|---|
| 55 | <td> |
|---|
| 56 | <div class="ddescription" tal:condition="cell" tal:content="structure cell/widget_rendered"></div> |
|---|
| 57 | <div class="ddescription" tal:condition="not:cell/widget_rendered"> none </div> |
|---|
| 58 | </td> |
|---|
| 59 | </div> |
|---|
| 60 | </tal:block> |
|---|
| 61 | </tal:block> |
|---|
| 62 | </tr> |
|---|
| 63 | </tal:block> |
|---|
| 64 | </table> |
|---|
| 65 | </metal:block> |
|---|
| 66 | |
|---|
| 67 | <!-- default edit --> |
|---|
| 68 | |
|---|
| 69 | <metal:block define-macro="default_edit" |
|---|
| 70 | tal:define="layout options/layout; |
|---|
| 71 | ds options/datastructure; |
|---|
| 72 | creation creation|nothing; |
|---|
| 73 | metadata metadata|nothing; |
|---|
| 74 | type_name request/type_name|nothing; |
|---|
| 75 | ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None); |
|---|
| 76 | creation_form python:ti and ti.getActionById('create', 'cpsdocument_create_form') or 'cpsdocument_create_form' ; |
|---|
| 77 | edit_form python:ti and ti.getActionById('edit', 'cpsdocument_edit_form') or 'cpsdocument_edit_form'; |
|---|
| 78 | metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata'; |
|---|
| 79 | formaction python: test(creation, creation_form, |
|---|
| 80 | test(metadata, metadata_form, |
|---|
| 81 | edit_form)); |
|---|
| 82 | first_layout options/first_layout|python:0; |
|---|
| 83 | last_layout options/last_layout|python:0; |
|---|
| 84 | is_flexible options/is_flexible; |
|---|
| 85 | cpsmcat nocall:here/translation_service; |
|---|
| 86 | "> |
|---|
| 87 | <tal:block condition="first_layout"> |
|---|
| 88 | <tal:block |
|---|
| 89 | content="structure string:<form action='${formaction}' method='post' |
|---|
| 90 | enctype='multipart/form-data' class='workflow'> |
|---|
| 91 | <div class=''><div class=''>" /> |
|---|
| 92 | <input type="hidden" name="type_name" value="." |
|---|
| 93 | tal:condition="creation" tal:attributes="value request/type_name" /> |
|---|
| 94 | </tal:block> |
|---|
| 95 | |
|---|
| 96 | <table width="100%" cellpadding="2" cellspacing="2" summary="Form layout"> |
|---|
| 97 | <tr tal:repeat="row layout/rows" valign="top"> |
|---|
| 98 | <td tal:repeat="cell row" |
|---|
| 99 | tal:attributes="colspan cell/ncols"> |
|---|
| 100 | <tal:block define="widget cell/widget; |
|---|
| 101 | wid widget/getWidgetId; |
|---|
| 102 | dm options/datastructure/getDataModel; |
|---|
| 103 | err python:ds.getError(wid); |
|---|
| 104 | err_mapping python:ds.getErrorMapping(wid); |
|---|
| 105 | is_required widget/is_required|nothing; |
|---|
| 106 | tooltip_id python:wid + '_help'; |
|---|
| 107 | widget_css_class cell/widget_css_class|nothing; |
|---|
| 108 | widget_css_class python:test(is_flexible, 'group', widget_css_class); |
|---|
| 109 | css_class python:test(err, 'row error', |
|---|
| 110 | test(is_flexible, 'group', 'row'))"> |
|---|
| 111 | <div tal:attributes="class widget_css_class; |
|---|
| 112 | id python:widget.getHtmlWidgetId()+'_widget'; |
|---|
| 113 | "> |
|---|
| 114 | <div class="label" tal:condition="widget/label_edit" |
|---|
| 115 | tal:attributes="class python:test(is_required, 'label required', |
|---|
| 116 | 'label')"> |
|---|
| 117 | <label i18n:translate="" tal:condition="widget/is_i18n" |
|---|
| 118 | tal:content="widget/label_edit" |
|---|
| 119 | tal:attributes="for cell/widget_input_area_id|nothing;">label</label> |
|---|
| 120 | <label tal:condition="not:widget/is_i18n" |
|---|
| 121 | tal:content="widget/label_edit" |
|---|
| 122 | tal:attributes="for cell/widget_input_area_id|nothing;">label</label> |
|---|
| 123 | </div> |
|---|
| 124 | <button type="button" class="tooltipControl" |
|---|
| 125 | tal:condition="widget/help" |
|---|
| 126 | tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button> |
|---|
| 127 | <div class="field"> |
|---|
| 128 | <div tal:replace="structure cell/widget_rendered"/> |
|---|
| 129 | </div> |
|---|
| 130 | <div class="tooltipArea" style="visibility: hidden;" |
|---|
| 131 | tal:condition="widget/help" |
|---|
| 132 | tal:attributes="id tooltip_id; |
|---|
| 133 | onclick python:'showElement(false, \'%s\')' % tooltip_id;"> |
|---|
| 134 | <tal:block i18n:translate="" tal:condition="widget/is_i18n" |
|---|
| 135 | tal:content="widget/help">i18_key-help_for_this_field</tal:block> |
|---|
| 136 | <tal:block tal:condition="not:widget/is_i18n" |
|---|
| 137 | tal:content="widget/help">This is the help for this field</tal:block> |
|---|
| 138 | </div> |
|---|
| 139 | <tal:block condition="err"> |
|---|
| 140 | <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)"> |
|---|
| 141 | <br /><em style="color: red" |
|---|
| 142 | tal:content="msg">err</em> |
|---|
| 143 | </tal:block> |
|---|
| 144 | </tal:block> |
|---|
| 145 | <div style="float: right;" tal:condition="is_flexible"> |
|---|
| 146 | <input type="submit" value="button_move_up" |
|---|
| 147 | tal:condition="not:repeat/row/start" |
|---|
| 148 | tal:attributes="name string:uprow_${repeat/row/index}" |
|---|
| 149 | class="context moveUp" i18n:attributes="value" /> |
|---|
| 150 | <input type="submit" value="button_move_down" |
|---|
| 151 | tal:condition="not:repeat/row/end" |
|---|
| 152 | tal:attributes="name string:downrow_${repeat/row/index}" |
|---|
| 153 | class="context moveDown" i18n:attributes="value" /> |
|---|
| 154 | <input type="submit" value="button_delete" |
|---|
| 155 | class="destructive" i18n:attributes="value" |
|---|
| 156 | tal:attributes="name string:deleterow_${repeat/row/index}; |
|---|
| 157 | onclick python:'return window.confirm(\'%s\')' % |
|---|
| 158 | (cpsmcat('description_confirm_delete'), )" /> |
|---|
| 159 | </div> |
|---|
| 160 | </div> |
|---|
| 161 | </tal:block> |
|---|
| 162 | </td> |
|---|
| 163 | </tr> |
|---|
| 164 | </table> |
|---|
| 165 | |
|---|
| 166 | <tal:block condition="is_flexible"> |
|---|
| 167 | <div style="float: right;" |
|---|
| 168 | tal:define="flexible_widgets options/flexible_widgets"> |
|---|
| 169 | <input type="hidden" name="layout_id" value="." |
|---|
| 170 | tal:attributes="value layout/layout_id" /> |
|---|
| 171 | <tal:select condition="python:len(flexible_widgets)>1"> |
|---|
| 172 | <select name="widget_type"> |
|---|
| 173 | <tal:block repeat="widget options/flexible_widgets"> |
|---|
| 174 | <option value="." |
|---|
| 175 | tal:condition="widget/is_i18n" |
|---|
| 176 | i18n:translate="" |
|---|
| 177 | tal:attributes="value widget/getWidgetId" |
|---|
| 178 | tal:content="widget/title_or_id">Type</option> |
|---|
| 179 | <option value="." |
|---|
| 180 | tal:condition="not:widget/is_i18n" |
|---|
| 181 | tal:attributes="value widget/getWidgetId" |
|---|
| 182 | tal:content="widget/title_or_id">Type</option> |
|---|
| 183 | </tal:block> |
|---|
| 184 | </select> |
|---|
| 185 | <input type="submit" name="addwidget_button" value="button_add" |
|---|
| 186 | class="context" |
|---|
| 187 | i18n:attributes="value" /> |
|---|
| 188 | </tal:select> |
|---|
| 189 | <tal:button condition="python:len(flexible_widgets) == 1"> |
|---|
| 190 | <tal:block define="widget python:flexible_widgets[0]"> |
|---|
| 191 | <input type="hidden" name="widget_type" |
|---|
| 192 | tal:attributes="value widget/getWidgetId"> |
|---|
| 193 | <input type="submit" name="addwidget_button" |
|---|
| 194 | tal:define="button_add python:cpsmcat('button_add'); |
|---|
| 195 | widget_title python:cpsmcat(widget.title_or_id())" |
|---|
| 196 | tal:attributes="value string:${button_add} ${widget_title}" |
|---|
| 197 | class="context" /> |
|---|
| 198 | </tal:block> |
|---|
| 199 | </tal:button> |
|---|
| 200 | </div> |
|---|
| 201 | </tal:block> |
|---|
| 202 | |
|---|
| 203 | <tal:block condition="last_layout"> |
|---|
| 204 | <tal:block content="structure string:</div>" /> |
|---|
| 205 | <metal:block define-slot="additional_content" /> |
|---|
| 206 | |
|---|
| 207 | <input type="submit" class="standalone" name="cpsdocument_edit_button" |
|---|
| 208 | value="button_change" i18n:attributes="value" |
|---|
| 209 | tal:condition="not:creation" /> |
|---|
| 210 | <input type="submit" class="standalone" name="cpsdocument_create_button" |
|---|
| 211 | value="button_create" i18n:attributes="value" tal:condition="creation" /> |
|---|
| 212 | <tal:block content="structure string:</div></form>" /> |
|---|
| 213 | </tal:block> |
|---|
| 214 | |
|---|
| 215 | </metal:block> |
|---|
| 216 | <!-- default edit --> |
|---|
| 217 | |
|---|
| 218 | <metal:block define-macro="common_edit" |
|---|
| 219 | tal:define="layout options/layout; |
|---|
| 220 | ds options/datastructure; |
|---|
| 221 | creation creation|nothing; |
|---|
| 222 | metadata metadata|nothing; |
|---|
| 223 | type_name request/type_name|nothing; |
|---|
| 224 | ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None); |
|---|
| 225 | tin python:type_name and getattr(here.portal_types,type_name,None); |
|---|
| 226 | creation_form options/create_action|string:create_common; |
|---|
| 227 | edit_form options/edit_action|string:cpsdocument_edit_form; |
|---|
| 228 | metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata'; |
|---|
| 229 | formaction python: test(creation, creation_form, |
|---|
| 230 | test(metadata, metadata_form, |
|---|
| 231 | edit_form)); |
|---|
| 232 | first_layout python:1; |
|---|
| 233 | last_layout python:1; |
|---|
| 234 | is_flexible options/is_flexible; |
|---|
| 235 | cpsmcat nocall:here/translation_service; |
|---|
| 236 | "> |
|---|
| 237 | <tal:block condition="first_layout"> |
|---|
| 238 | <span tal:condition="python: 0"> |
|---|
| 239 | <span tal:content="request/type_name|string:No Typename" /><br /> |
|---|
| 240 | <span tal:content="creation_form" /><br /> |
|---|
| 241 | <span tal:content="ti" /><br /> |
|---|
| 242 | <span tal:content="python:ti.getActionById('create', 'cpsdocument_create_form')" /><br /> |
|---|
| 243 | <span tal:content="python:getattr(here.portal_types,type_name,'no type')" /><br /> |
|---|
| 244 | </span> |
|---|
| 245 | <tal:block |
|---|
| 246 | content="structure string:<form action='${formaction}' method='post' |
|---|
| 247 | enctype='multipart/form-data' class='workflow'> |
|---|
| 248 | <div class=''><div class='documentFields'>" /> |
|---|
| 249 | <input type="hidden" name="type_name" value="." |
|---|
| 250 | tal:condition="creation" tal:attributes="value request/type_name" /> |
|---|
| 251 | </tal:block> |
|---|
| 252 | |
|---|
| 253 | <table width="100%" cellpadding="2" cellspacing="2" summary="Form layout"> |
|---|
| 254 | <tr tal:repeat="row layout/rows" valign="top"> |
|---|
| 255 | <td tal:repeat="cell row" |
|---|
| 256 | tal:attributes="colspan cell/ncols"> |
|---|
| 257 | <tal:block define="widget cell/widget; |
|---|
| 258 | wid widget/getWidgetId; |
|---|
| 259 | dm options/datastructure/getDataModel; |
|---|
| 260 | err python:ds.getError(wid); |
|---|
| 261 | err_mapping python:ds.getErrorMapping(wid); |
|---|
| 262 | is_required widget/is_required|nothing; |
|---|
| 263 | tooltip_id python:wid + '_help'; |
|---|
| 264 | widget_css_class cell/widget_css_class|nothing; |
|---|
| 265 | widget_css_class python:test(is_flexible, 'group', widget_css_class); |
|---|
| 266 | css_class python:test(err, 'row error', |
|---|
| 267 | test(is_flexible, 'group', 'row'))"> |
|---|
| 268 | <div tal:attributes="class widget_css_class; |
|---|
| 269 | id python:widget.getHtmlWidgetId()+'_widget'; |
|---|
| 270 | "> |
|---|
| 271 | <div class="label" tal:condition="widget/label_edit" |
|---|
| 272 | tal:attributes="class python:test(is_required, 'label required', |
|---|
| 273 | 'label')"> |
|---|
| 274 | <label i18n:translate="" tal:condition="widget/is_i18n" |
|---|
| 275 | tal:content="widget/label_edit" |
|---|
| 276 | tal:attributes="for cell/widget_input_area_id|nothing;">label</label> |
|---|
| 277 | <label tal:condition="not:widget/is_i18n" |
|---|
| 278 | tal:content="widget/label_edit" |
|---|
| 279 | tal:attributes="for cell/widget_input_area_id|nothing;">label</label> |
|---|
| 280 | </div> |
|---|
| 281 | <button type="button" class="tooltipControl" |
|---|
| 282 | tal:condition="widget/help" |
|---|
| 283 | tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button> |
|---|
| 284 | <div class="field"> |
|---|
| 285 | <div tal:replace="structure cell/widget_rendered"/> |
|---|
| 286 | </div> |
|---|
| 287 | <div class="tooltipArea" style="visibility: hidden;" |
|---|
| 288 | tal:condition="widget/help" |
|---|
| 289 | tal:attributes="id tooltip_id; |
|---|
| 290 | onclick python:'showElement(false, \'%s\')' % tooltip_id;"> |
|---|
| 291 | <tal:block i18n:translate="" tal:condition="widget/is_i18n" |
|---|
| 292 | tal:content="widget/help">i18_key-help_for_this_field</tal:block> |
|---|
| 293 | <tal:block tal:condition="not:widget/is_i18n" |
|---|
| 294 | tal:content="widget/help">This is the help for this field</tal:block> |
|---|
| 295 | </div> |
|---|
| 296 | <tal:block condition="err"> |
|---|
| 297 | <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)"> |
|---|
| 298 | <br /><em style="color: red" |
|---|
| 299 | tal:content="msg">err</em> |
|---|
| 300 | </tal:block> |
|---|
| 301 | </tal:block> |
|---|
| 302 | <div style="float: right;" tal:condition="is_flexible"> |
|---|
| 303 | <input type="submit" value="button_move_up" |
|---|
| 304 | tal:condition="not:repeat/row/start" |
|---|
| 305 | tal:attributes="name string:uprow_${repeat/row/index}" |
|---|
| 306 | class="context moveUp" i18n:attributes="value" /> |
|---|
| 307 | <input type="submit" value="button_move_down" |
|---|
| 308 | tal:condition="not:repeat/row/end" |
|---|
| 309 | tal:attributes="name string:downrow_${repeat/row/index}" |
|---|
| 310 | class="context moveDown" i18n:attributes="value" /> |
|---|
| 311 | <input type="submit" value="button_delete" |
|---|
| 312 | class="destructive" i18n:attributes="value" |
|---|
| 313 | tal:attributes="name string:deleterow_${repeat/row/index}; |
|---|
| 314 | onclick python:'return window.confirm(\'%s\')' % |
|---|
| 315 | (cpsmcat('description_confirm_delete'), )" /> |
|---|
| 316 | </div> |
|---|
| 317 | </div> |
|---|
| 318 | </tal:block> |
|---|
| 319 | </td> |
|---|
| 320 | </tr> |
|---|
| 321 | </table> |
|---|
| 322 | |
|---|
| 323 | <tal:block condition="is_flexible"> |
|---|
| 324 | <div style="float: right;" |
|---|
| 325 | tal:define="flexible_widgets options/flexible_widgets"> |
|---|
| 326 | <input type="hidden" name="layout_id" value="." |
|---|
| 327 | tal:attributes="value layout/layout_id" /> |
|---|
| 328 | <tal:select condition="python:len(flexible_widgets)>1"> |
|---|
| 329 | <select name="widget_type"> |
|---|
| 330 | <tal:block repeat="widget options/flexible_widgets"> |
|---|
| 331 | <option value="." |
|---|
| 332 | tal:condition="widget/is_i18n" |
|---|
| 333 | i18n:translate="" |
|---|
| 334 | tal:attributes="value widget/getWidgetId" |
|---|
| 335 | tal:content="widget/title_or_id">Type</option> |
|---|
| 336 | <option value="." |
|---|
| 337 | tal:condition="not:widget/is_i18n" |
|---|
| 338 | tal:attributes="value widget/getWidgetId" |
|---|
| 339 | tal:content="widget/title_or_id">Type</option> |
|---|
| 340 | </tal:block> |
|---|
| 341 | </select> |
|---|
| 342 | <input type="submit" name="addwidget_button" value="button_add" |
|---|
| 343 | class="context" |
|---|
| 344 | i18n:attributes="value" /> |
|---|
| 345 | </tal:select> |
|---|
| 346 | <tal:button condition="python:len(flexible_widgets) == 1"> |
|---|
| 347 | <tal:block define="widget python:flexible_widgets[0]"> |
|---|
| 348 | <input type="hidden" name="widget_type" |
|---|
| 349 | tal:attributes="value widget/getWidgetId"> |
|---|
| 350 | <input type="submit" name="addwidget_button" |
|---|
| 351 | tal:define="button_add python:cpsmcat('button_add'); |
|---|
| 352 | widget_title python:cpsmcat(widget.title_or_id())" |
|---|
| 353 | tal:attributes="value string:${button_add} ${widget_title}" |
|---|
| 354 | class="context" /> |
|---|
| 355 | </tal:block> |
|---|
| 356 | </tal:button> |
|---|
| 357 | </div> |
|---|
| 358 | </tal:block> |
|---|
| 359 | |
|---|
| 360 | <tal:block condition="last_layout"> |
|---|
| 361 | <tal:block content="structure string:</div>" /> |
|---|
| 362 | <metal:block define-slot="additional_content" /> |
|---|
| 363 | |
|---|
| 364 | <input type="submit" class="standalone" name="cpsdocument_edit_button" |
|---|
| 365 | value="button_change" i18n:attributes="value" |
|---|
| 366 | tal:condition="not:creation" /> |
|---|
| 367 | <input type="submit" class="standalone" name="cpsdocument_create_button" |
|---|
| 368 | value="button_create" i18n:attributes="value" tal:condition="creation" /> |
|---|
| 369 | <tal:block content="structure string:</div></form>" /> |
|---|
| 370 | </tal:block> |
|---|
| 371 | |
|---|
| 372 | </metal:block> |
|---|
| 373 | |
|---|