# HG changeset patch # User Sylvain Thénault # Date 1263978617 -3600 # Node ID e6b9fd79a247e77f7e527049449e17c0441fe3f8 # Parent 24736a127bf15c6860bdc61c3971191c771ae2df# Parent dfee17fa363f0da2c1cc237a700cb465e991871e backport stable diff -r 24736a127bf1 -r e6b9fd79a247 doc/book/en/development/devweb/internationalization.rst --- a/doc/book/en/development/devweb/internationalization.rst Wed Jan 20 10:06:53 2010 +0100 +++ b/doc/book/en/development/devweb/internationalization.rst Wed Jan 20 10:10:17 2010 +0100 @@ -87,15 +87,20 @@ May generate the following message :: - creating EntityB (EntityA %(linkto)s relation_a2b EntityB) + add Execution has_export File subject This message will be used in views of ``EntityA`` for creation of a new ``EntityB`` with a preset relation ``relation_a2b`` between the current ``EntityA`` and the new ``EntityB``. The opposite message :: - creating EntityA (EntityA relation_a2b %(linkto)s EntityA) + add Execution has_export File object -Is used for similar creation of an ``EntityA`` from a view of ``EntityB``. +Is used for similar creation of an ``EntityA`` from a view of ``EntityB``. The +title of they respective creation form will be :: + + creating EntityB (EntityA %(linkto)s relation_a2b EntityB) + + creating EntityA (EntityA relation_a2b %(linkto)s EntityA) In the translated string you can use ``%(linkto)s`` for reference to the source ``entity``. diff -r 24736a127bf1 -r e6b9fd79a247 doc/book/en/development/webstdlib/autoform.rst --- a/doc/book/en/development/webstdlib/autoform.rst Wed Jan 20 10:06:53 2010 +0100 +++ b/doc/book/en/development/webstdlib/autoform.rst Wed Jan 20 10:10:17 2010 +0100 @@ -1,8 +1,25 @@ The automatic entity form (:mod:`cubicweb.web.views.autoform`) --------------------------------------------------------------- +Tags declaration +~~~~~~~~~~~~~~~~~~~~ + It is possible to manage attributes/relations in the simple or multiple -editing form thanks to the following *rtags*: +editing form thanks of the methods bellow :: + + uicfg.autoform_section.tag_subject_of(, tag) + uicfg.autoform_section.tag_object_of(, tag) + uicfg.autoform_field.tag_attribute(, tag) + +Where ```` is a three elements tuple ``(Subject Entity Type, +relation_type, Object Entity Type)``. ```` is a two elements tuple +``(Entity Type, Attribut Name)``. Wildcard ``*`` could be used in place of +``Entity Type`` + +Possible tags are detailled below + +Simple Tags +~~~~~~~~~~~~~~~~~~~~ * `primary`, indicates that an attribute or a relation has to be inserted **in the simple or multiple editing forms**. In the case of @@ -29,3 +46,24 @@ If necessary, it is possible to overwrite the method `relation_category(rtype, x='subject')` to dynamically compute a relation editing category. + + +Advanced Tags +~~~~~~~~~~~~~~~~~~~~ + +Tag can also reference a custom Field crafted with the help of +``cubicweb.web.formfields`` and ``cubicweb.web.formwidget``. In the example +bellow, the field ``path`` of ``ExecData`` entities will be done with a standard +file input dialogue :: + + from cubicweb.web import uicfg, formfields, formwidgets + + uicfg.autoform_field.tag_attribute(('Execdata', 'path'), + formfields.FileField(name='path', widget=formwidgets.FileInput())) + + + + + + + diff -r 24736a127bf1 -r e6b9fd79a247 web/data/cubicweb.edition.js --- a/web/data/cubicweb.edition.js Wed Jan 20 10:06:53 2010 +0100 +++ b/web/data/cubicweb.edition.js Wed Jan 20 10:10:17 2010 +0100 @@ -399,14 +399,14 @@ /* unfreeze form buttons when the validation process is over*/ function unfreezeFormButtons(formid) { jQuery('#progress').hide(); - jQuery('#' + formid + ' input.validateButton').removeAttr('disabled'); + jQuery('#' + formid + ' .validateButton').removeAttr('disabled'); return true; } /* disable form buttons while the validation is being done */ function freezeFormButtons(formid) { jQuery('#progress').show(); - jQuery('#' + formid + ' input.validateButton').attr('disabled', 'disabled'); + jQuery('#' + formid + ' .validateButton').attr('disabled', 'disabled'); return true; } diff -r 24736a127bf1 -r e6b9fd79a247 web/views/basetemplates.py --- a/web/views/basetemplates.py Wed Jan 20 10:06:53 2010 +0100 +++ b/web/views/basetemplates.py Wed Jan 20 10:10:17 2010 +0100 @@ -266,7 +266,10 @@ self.w(u'\n') if can_do_pdf_conversion(): - from xml.etree.cElementTree import ElementTree + try: + from xml.etree.cElementTree import ElementTree + except ImportError: #python2.4 + from elementtree import ElementTree from subprocess import Popen as sub from StringIO import StringIO from tempfile import NamedTemporaryFile