Ignore:
Timestamp:
27 Oct 2005, 06:51:08 (19 years ago)
Author:
joachim
Message:

=adding and editing of several types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup_product/trunk/skins/waeup_default/waeup_layout_lib.pt

    r76 r96  
    203203
    204204</metal:block>
     205<!-- default edit  -->
     206
     207<metal:block define-macro="common_edit"
     208  tal:define="layout options/layout;
     209              ds options/datastructure;
     210              creation creation|nothing;
     211              metadata metadata|nothing;
     212              type_name request/type_name|nothing;
     213              ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
     214              tin python:type_name and getattr(here.portal_types,type_name,None);
     215              creation_form options/create_action|string:create_common;
     216              edit_form    options/edit_action|string:cpsdocument_edit_form;
     217              metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata';
     218              formaction python: test(creation, creation_form,
     219                                 test(metadata, metadata_form,
     220                                                edit_form));
     221              first_layout python:1;
     222              last_layout python:1;
     223              is_flexible options/is_flexible;
     224              cpsmcat nocall:here/translation_service;
     225              ">
     226<tal:block condition="first_layout">
     227    <span tal:condition="python: 0">
     228      <span tal:content="request/type_name|string:No Typename" /><br />
     229      <span tal:content="creation_form" /><br />
     230      <span tal:content="ti" /><br />
     231      <span tal:content="python:ti.getActionById('create', 'cpsdocument_create_form')" /><br />
     232      <span tal:content="python:getattr(here.portal_types,type_name,'no type')" /><br />
     233    </span>
     234  <tal:block
     235  content="structure string:<form action='${formaction}' method='post'
     236  enctype='multipart/form-data' class='workflow'>
     237  <div class='group'><div class='documentFields'>" />
     238  <input type="hidden" name="type_name" value="."
     239    tal:condition="creation" tal:attributes="value request/type_name" />
     240</tal:block>
     241
     242<table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
     243  <tr tal:repeat="row layout/rows" valign="top">
     244    <td tal:repeat="cell row"
     245      tal:attributes="colspan cell/ncols">
     246      <tal:block define="widget cell/widget;
     247                         wid widget/getWidgetId;
     248                         dm options/datastructure/getDataModel;
     249                         err python:ds.getError(wid);
     250                         err_mapping python:ds.getErrorMapping(wid);
     251                         is_required widget/is_required|nothing;
     252                         tooltip_id python:wid + '_help';
     253                         widget_css_class cell/widget_css_class|nothing;
     254                         widget_css_class python:test(is_flexible, 'group', widget_css_class);
     255                         css_class python:test(err, 'row error',
     256                                               test(is_flexible, 'group', 'row'))">
     257        <div tal:attributes="class widget_css_class;
     258                             id python:widget.getHtmlWidgetId()+'_widget';
     259                            ">
     260          <div class="label" tal:condition="widget/label_edit"
     261            tal:attributes="class python:test(is_required, 'label required',
     262                                              'label')">
     263            <label i18n:translate="" tal:condition="widget/is_i18n"
     264              tal:content="widget/label_edit"
     265              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
     266            <label tal:condition="not:widget/is_i18n"
     267              tal:content="widget/label_edit"
     268              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
     269          </div>
     270          <button type="button" class="tooltipControl"
     271                  tal:condition="widget/help"
     272                  tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
     273          <div class="field">
     274            <div tal:replace="structure cell/widget_rendered"/>
     275          </div>
     276          <div class="tooltipArea" style="visibility: hidden;"
     277               tal:condition="widget/help"
     278               tal:attributes="id tooltip_id;
     279                               onclick python:'showElement(false, \'%s\')' % tooltip_id;">
     280            <tal:block i18n:translate="" tal:condition="widget/is_i18n"
     281              tal:content="widget/help">i18_key-help_for_this_field</tal:block>
     282            <tal:block tal:condition="not:widget/is_i18n"
     283              tal:content="widget/help">This is the help for this field</tal:block>
     284          </div>
     285          <tal:block condition="err">
     286              <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
     287                <br /><em style="color: red"
     288                  tal:content="msg">err</em>
     289              </tal:block>
     290          </tal:block>
     291          <div style="float: right;" tal:condition="is_flexible">
     292            <input type="submit" value="button_move_up"
     293              tal:condition="not:repeat/row/start"
     294              tal:attributes="name string:uprow_${repeat/row/index}"
     295              class="context moveUp" i18n:attributes="value" />
     296            <input type="submit" value="button_move_down"
     297              tal:condition="not:repeat/row/end"
     298              tal:attributes="name string:downrow_${repeat/row/index}"
     299              class="context moveDown" i18n:attributes="value" />
     300            <input type="submit" value="button_delete"
     301              class="destructive" i18n:attributes="value"
     302              tal:attributes="name string:deleterow_${repeat/row/index};
     303                              onclick python:'return window.confirm(\'%s\')' %
     304                                (cpsmcat('description_confirm_delete'), )" />
     305          </div>
     306        </div>
     307      </tal:block>
     308    </td>
     309  </tr>
     310</table>
     311
     312<tal:block condition="is_flexible">
     313<div style="float: right;"
     314    tal:define="flexible_widgets options/flexible_widgets">
     315  <input type="hidden" name="layout_id" value="."
     316    tal:attributes="value layout/layout_id" />
     317  <tal:select condition="python:len(flexible_widgets)>1">
     318    <select name="widget_type">
     319      <tal:block repeat="widget options/flexible_widgets">
     320      <option value="."
     321        tal:condition="widget/is_i18n"
     322        i18n:translate=""
     323        tal:attributes="value widget/getWidgetId"
     324        tal:content="widget/title_or_id">Type</option>
     325      <option value="."
     326        tal:condition="not:widget/is_i18n"
     327        tal:attributes="value widget/getWidgetId"
     328        tal:content="widget/title_or_id">Type</option>
     329      </tal:block>
     330    </select>
     331    <input type="submit" name="addwidget_button" value="button_add"
     332     class="context"
     333     i18n:attributes="value" />
     334  </tal:select>
     335  <tal:button condition="python:len(flexible_widgets) == 1">
     336    <tal:block define="widget python:flexible_widgets[0]">
     337      <input type="hidden" name="widget_type"
     338        tal:attributes="value widget/getWidgetId">
     339      <input type="submit" name="addwidget_button"
     340        tal:define="button_add python:cpsmcat('button_add');
     341          widget_title python:cpsmcat(widget.title_or_id())"
     342        tal:attributes="value string:${button_add} ${widget_title}"
     343        class="context" />
     344    </tal:block>
     345  </tal:button>
     346</div>
     347</tal:block>
     348
     349<tal:block condition="last_layout">
     350  <tal:block content="structure string:</div>" />
     351  <metal:block define-slot="additional_content" />
     352
     353  <input type="submit" class="standalone" name="cpsdocument_edit_button"
     354    value="button_change" i18n:attributes="value"
     355    tal:condition="not:creation" />
     356  <input type="submit" class="standalone" name="cpsdocument_create_button"
     357    value="button_create" i18n:attributes="value" tal:condition="creation" />
     358  <tal:block content="structure string:</div></form>" />
     359</tal:block>
     360
     361</metal:block>
    205362   
Note: See TracChangeset for help on using the changeset viewer.