backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 20 Jan 2010 10:10:17 +0100
changeset 4279 e6b9fd79a247
parent 4278 24736a127bf1 (current diff)
parent 4271 dfee17fa363f (diff)
child 4281 74c1597f8a82
backport stable
web/data/cubicweb.edition.js
web/views/basetemplates.py
--- 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``.
--- 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(<relation>, tag)
+  uicfg.autoform_section.tag_object_of(<relation>, tag)
+  uicfg.autoform_field.tag_attribute(<attribut_def>, tag)
+
+Where ``<relation>`` is a three elements tuple ``(Subject Entity Type,
+relation_type, Object Entity Type)``. ``<attribut_def>`` 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()))
+
+
+
+
+
+
+
--- 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;
 }
 
--- 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'</tr></table>\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