This commit is contained in:
Bertrand Chenal committed 2008-06-19 01:30:46 +02:00
commit 66b326d90c
20 files changed
+2252 -280

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ setup(name=PACKAGE,
'trytond': ['init.sql'],
'trytond.ir': ['*.xml'],
'trytond.ir.module': ['*.xml'],
'trytond.ir.ui': ['*.xml', '*.dtd'],
'trytond.ir.ui': ['*.xml', '*.rng', '*.rnc'],
'trytond.res': ['*.xml'],
'trytond.webdav': ['*.xml'],
'trytond.workflow': ['*.xml'],
+6 -28
View File
@@ -7,38 +7,16 @@ class Property(OSV):
"Property"
_name = 'ir.property'
_description = __doc__
name = fields.Char('Name', size=128)
name = fields.Char('Name')
#TODO add function field for other type than many2one
value = fields.Reference('Value', selection='models_get2', size=128)
res = fields.Reference('Resource', selection='models_get', size=128)
value = fields.Reference('Value', selection='models_get')
res = fields.Reference('Resource', selection='models_get')
field = fields.Many2One('ir.model.field', 'Field',
ondelete='cascade', required=True)
def models_get2(self, cursor, user, context=None):
model_field_obj = self.pool.get('ir.model.field')
#TODO add domain for only reference fields
ids = model_field_obj.search(cursor, user, [])
res = []
done = {}
for model_field in model_field_obj.browse(cursor, user, ids,
context=context):
if model_field.relation not in done:
res.append([model_field.relation, model_field.relation])
done[model_field.relation] = True
return res
ondelete='CASCADE', required=True)
def models_get(self, cursor, user, context=None):
model_field_obj = self.pool.get('ir.model.field')
#TODO add domain for only reference fields
ids = model_field_obj.search(cursor, user, [])
res = []
done = {}
for model_field in model_field_obj.browse(cursor, user, ids,
context=context):
if model_field.model.id not in done:
res.append([model_field.model.model,
model_field.model.name])
done[model_field.model.id] = True
cursor.execute('SELECT model, name FROM ir_model ORDER BY name ASC')
res = cursor.fetchall() + [('', '')]
return res
def get(self, cursor, user, name, model, res_ids=None, context=None):
-57
View File
@@ -1,57 +0,0 @@
<!ELEMENT board (image|separator|labe|newline|notebook|group|hpaned|vpaned|action)*>
<!ATTLIST board string CDATA "Unknown">
<!ATTLIST board col CDATA "4">
<!ELEMENT image EMPTY>
<!ATTLIST image name CDATA #REQUIRED>
<!ATTLIST image colspan CDATA "1">
<!ATTLIST image expand (0|1) "0">
<!ATTLIST image fill (0|1) "0">
<!ATTLIST image help CDATA #IMPLIED>
<!ATTLIST image states CDATA #IMPLIED>
<!ELEMENT separator EMPTY>
<!ATTLIST separator string CDATA "">
<!ATTLIST separator name CDATA #IMPLIED>
<!ATTLIST separator states CDATA #IMPLIED>
<!ATTLIST separator align CDATA "0.0">
<!ATTLIST separator colspan CDATA "1">
<!ATTLIST separator expand (0|1) "0">
<!ATTLIST separator fill (0|1) "0">
<!ATTLIST separator help CDATA #IMPLIED>
<!ELEMENT label EMPTY>
<!ATTLIST label string CDATA "">
<!ATTLIST label name CDATA #IMPLIED>
<!ATTLIST label states CDATA #IMPLIED>
<!ATTLIST label align CDATA "0.0">
<!ATTLIST label expand (0|1) "0">
<!ATTLIST label fill (0|1) "0">
<!ATTLIST label xexpand (0|1) "0">
<!ATTLIST label xfill (0|1) "1">
<!ATTLIST label colspan CDATA "1">
<!ATTLIST label help CDATA #IMPLIED>
<!ELEMENT newline EMPTY>
<!ELEMENT notebook (page*)>
<!ATTLIST notebook tabpos (up|down|left|right) #IMPLIED>
<!ATTLIST notebook colspan CDATA "4">
<!ELEMENT page (image|separator|labe|newline|notebook|group|hpaned|vpaned|action)*>
<!ATTLIST page angle CDATA #IMPLIED>
<!ATTLIST page string CDATA "Unknown">
<!ATTLIST page col CDATA "4">
<!ELEMENT group (image|separator|labe|newline|notebook|group|hpaned|vpaned|action)*>
<!ATTLIST group string CDATA #IMPLIED>
<!ATTLIST group colspan CDATA "1">
<!ATTLIST group expand (0|1) "0">
<!ATTLIST group fill (0|1) "1">
<!ATTLIST group rowspan CDATA "1">
<!ATTLIST group col CDATA "4">
<!ELEMENT hpaned (child1?,child2?)>
<!ATTLIST hpaned colspan CDATA "4">
<!ATTLIST hpaned position CDATA #IMPLIED>
<!ELEMENT vpaned (child1?,child2?)>
<!ATTLIST vpaned colspan CDATA "4">
<!ATTLIST vpaned position CDATA #IMPLIED>
<!ELEMENT child1 (image|separator|labe|newline|notebook|group|hpaned|vpaned|action)*>
<!ELEMENT child2 (image|separator|labe|newline|notebook|group|hpaned|vpaned|action)*>
<!ELEMENT data (xpath+)>
<!ELEMENT xpath ANY>
<!ATTLIST xpath expr CDATA #REQUIRED>
<!ATTLIST xpath position (inside|replace|after|before) "inside">
+145
View File
@@ -0,0 +1,145 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
board =
element board {
attlist.board,
(image
| separator
| labe
| newline
| notebook
| group
| hpaned
| vpaned
| action)*
}
attlist.board &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.board &= [ a:defaultValue = "4" ] attribute col { text }?
image = element image { attlist.image, empty }
attlist.image &= attribute name { text }
attlist.image &= [ a:defaultValue = "1" ] attribute colspan { text }?
attlist.image &=
[ a:defaultValue = "0" ] attribute expand { "0" | "1" }?
attlist.image &= [ a:defaultValue = "0" ] attribute fill { "0" | "1" }?
attlist.image &= attribute help { text }?
attlist.image &= attribute states { text }?
separator = element separator { attlist.separator, empty }
attlist.separator &= [ a:defaultValue = "" ] attribute string { text }?
attlist.separator &= attribute name { text }?
attlist.separator &= attribute states { text }?
attlist.separator &=
[ a:defaultValue = "0.0" ] attribute align { text }?
attlist.separator &=
[ a:defaultValue = "1" ] attribute colspan { text }?
attlist.separator &=
[ a:defaultValue = "0" ] attribute expand { "0" | "1" }?
attlist.separator &=
[ a:defaultValue = "0" ] attribute fill { "0" | "1" }?
attlist.separator &= attribute help { text }?
label = element label { attlist.label, empty }
attlist.label &= [ a:defaultValue = "" ] attribute string { text }?
attlist.label &= attribute name { text }?
attlist.label &= attribute states { text }?
attlist.label &= [ a:defaultValue = "0.0" ] attribute align { text }?
attlist.label &=
[ a:defaultValue = "0" ] attribute expand { "0" | "1" }?
attlist.label &= [ a:defaultValue = "0" ] attribute fill { "0" | "1" }?
attlist.label &=
[ a:defaultValue = "0" ] attribute xexpand { "0" | "1" }?
attlist.label &= [ a:defaultValue = "1" ] attribute xfill { "0" | "1" }?
attlist.label &= [ a:defaultValue = "1" ] attribute colspan { text }?
attlist.label &= attribute help { text }?
newline = element newline { attlist.newline, empty }
attlist.newline &= empty
notebook = element notebook { attlist.notebook, page* }
attlist.notebook &=
attribute tabpos { "up" | "down" | "left" | "right" }?
attlist.notebook &= [ a:defaultValue = "4" ] attribute colspan { text }?
page =
element page {
attlist.page,
(image
| separator
| labe
| newline
| notebook
| group
| hpaned
| vpaned
| action)*
}
attlist.page &= attribute angle { text }?
attlist.page &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.page &= [ a:defaultValue = "4" ] attribute col { text }?
group =
element group {
attlist.group,
(image
| separator
| labe
| newline
| notebook
| group
| hpaned
| vpaned
| action)*
}
attlist.group &= attribute string { text }?
attlist.group &= [ a:defaultValue = "1" ] attribute colspan { text }?
attlist.group &=
[ a:defaultValue = "0" ] attribute expand { "0" | "1" }?
attlist.group &= [ a:defaultValue = "1" ] attribute fill { "0" | "1" }?
attlist.group &= [ a:defaultValue = "1" ] attribute rowspan { text }?
attlist.group &= [ a:defaultValue = "4" ] attribute col { text }?
hpaned = element hpaned { attlist.hpaned, child1?, child2? }
attlist.hpaned &= [ a:defaultValue = "4" ] attribute colspan { text }?
attlist.hpaned &= attribute position { text }?
vpaned = element vpaned { attlist.vpaned, child1?, child2? }
attlist.vpaned &= [ a:defaultValue = "4" ] attribute colspan { text }?
attlist.vpaned &= attribute position { text }?
child1 =
element child1 {
attlist.child1,
(image
| separator
| labe
| newline
| notebook
| group
| hpaned
| vpaned
| action)*
}
attlist.child1 &= empty
child2 =
element child2 {
attlist.child2,
(image
| separator
| labe
| newline
| notebook
| group
| hpaned
| vpaned
| action)*
}
attlist.child2 &= empty
data = element data { attlist.data, xpath+ }
attlist.data &= empty
xpath = element xpath { attlist.xpath, any }
attlist.xpath &= attribute expr { text }
attlist.xpath &=
[ a:defaultValue = "inside" ]
attribute position { "inside" | "replace" | "after" | "before" }?
action |= notAllowed
labe |= notAllowed
start = data | board | label
any =
(element * {
attribute * { text }*,
any
}
| text)*
+477
View File
@@ -0,0 +1,477 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<define name="board">
<element name="board">
<ref name="attlist.board"/>
<zeroOrMore>
<choice>
<ref name="image"/>
<ref name="separator"/>
<ref name="labe"/>
<ref name="newline"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="action"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.board" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.board" combine="interleave">
<optional>
<attribute name="col" a:defaultValue="4"/>
</optional>
</define>
<define name="image">
<element name="image">
<ref name="attlist.image"/>
<empty/>
</element>
</define>
<define name="attlist.image" combine="interleave">
<attribute name="name"/>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="expand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="fill" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="help"/>
</optional>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="states"/>
</optional>
</define>
<define name="separator">
<element name="separator">
<ref name="attlist.separator"/>
<empty/>
</element>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="string" a:defaultValue=""/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="name"/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="states"/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="align" a:defaultValue="0.0"/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="expand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="fill" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="help"/>
</optional>
</define>
<define name="label">
<element name="label">
<ref name="attlist.label"/>
<empty/>
</element>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="string" a:defaultValue=""/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="name"/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="states"/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="align" a:defaultValue="0.0"/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="expand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="fill" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="xexpand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="xfill" a:defaultValue="1">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="help"/>
</optional>
</define>
<define name="newline">
<element name="newline">
<ref name="attlist.newline"/>
<empty/>
</element>
</define>
<define name="attlist.newline" combine="interleave">
<empty/>
</define>
<define name="notebook">
<element name="notebook">
<ref name="attlist.notebook"/>
<zeroOrMore>
<ref name="page"/>
</zeroOrMore>
</element>
</define>
<define name="attlist.notebook" combine="interleave">
<optional>
<attribute name="tabpos">
<choice>
<value>up</value>
<value>down</value>
<value>left</value>
<value>right</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.notebook" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="4"/>
</optional>
</define>
<define name="page">
<element name="page">
<ref name="attlist.page"/>
<zeroOrMore>
<choice>
<ref name="image"/>
<ref name="separator"/>
<ref name="labe"/>
<ref name="newline"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="action"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.page" combine="interleave">
<optional>
<attribute name="angle"/>
</optional>
</define>
<define name="attlist.page" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.page" combine="interleave">
<optional>
<attribute name="col" a:defaultValue="4"/>
</optional>
</define>
<define name="group">
<element name="group">
<ref name="attlist.group"/>
<zeroOrMore>
<choice>
<ref name="image"/>
<ref name="separator"/>
<ref name="labe"/>
<ref name="newline"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="action"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="string"/>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="expand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="fill" a:defaultValue="1">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="rowspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="col" a:defaultValue="4"/>
</optional>
</define>
<define name="hpaned">
<element name="hpaned">
<ref name="attlist.hpaned"/>
<optional>
<ref name="child1"/>
</optional>
<optional>
<ref name="child2"/>
</optional>
</element>
</define>
<define name="attlist.hpaned" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="4"/>
</optional>
</define>
<define name="attlist.hpaned" combine="interleave">
<optional>
<attribute name="position"/>
</optional>
</define>
<define name="vpaned">
<element name="vpaned">
<ref name="attlist.vpaned"/>
<optional>
<ref name="child1"/>
</optional>
<optional>
<ref name="child2"/>
</optional>
</element>
</define>
<define name="attlist.vpaned" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="4"/>
</optional>
</define>
<define name="attlist.vpaned" combine="interleave">
<optional>
<attribute name="position"/>
</optional>
</define>
<define name="child1">
<element name="child1">
<ref name="attlist.child1"/>
<zeroOrMore>
<choice>
<ref name="image"/>
<ref name="separator"/>
<ref name="labe"/>
<ref name="newline"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="action"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.child1" combine="interleave">
<empty/>
</define>
<define name="child2">
<element name="child2">
<ref name="attlist.child2"/>
<zeroOrMore>
<choice>
<ref name="image"/>
<ref name="separator"/>
<ref name="labe"/>
<ref name="newline"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="action"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.child2" combine="interleave">
<empty/>
</define>
<define name="data">
<element name="data">
<ref name="attlist.data"/>
<oneOrMore>
<ref name="xpath"/>
</oneOrMore>
</element>
</define>
<define name="attlist.data" combine="interleave">
<empty/>
</define>
<define name="xpath">
<element name="xpath">
<ref name="attlist.xpath"/>
<ref name="any"/>
</element>
</define>
<define name="attlist.xpath" combine="interleave">
<attribute name="expr"/>
</define>
<define name="attlist.xpath" combine="interleave">
<optional>
<attribute name="position" a:defaultValue="inside">
<choice>
<value>inside</value>
<value>replace</value>
<value>after</value>
<value>before</value>
</choice>
</attribute>
</optional>
</define>
<define name="action" combine="choice">
<notAllowed/>
</define>
<define name="labe" combine="choice">
<notAllowed/>
</define>
<start>
<choice>
<ref name="data"/>
<ref name="board"/>
<ref name="label"/>
</choice>
</start>
<define name="any">
<zeroOrMore>
<choice>
<element>
<anyName/>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
<ref name="any"/>
</element>
<text/>
</choice>
</zeroOrMore>
</define>
</grammar>
-106
View File
@@ -1,106 +0,0 @@
<!ELEMENT form (label|field|image|separator|newline|button|notebook|group|hpaned|vpaned|properties)*>
<!ATTLIST form string CDATA "Unknown">
<!ATTLIST form on_write CDATA #IMPLIED>
<!ATTLIST form col CDATA "4">
<!ATTLIST form cursor CDATA #IMPLIED>
<!ELEMENT tree (field+)>
<!ATTLIST tree string CDATA "Unknown">
<!ATTLIST tree on_write CDATA #IMPLIED>
<!ATTLIST tree editable (top|bottom) #IMPLIED>
<!ATTLIST tree sequence CDATA #IMPLIED>
<!ATTLIST tree colors CDATA #IMPLIED>
<!ELEMENT graph (x, y)>
<!ATTLIST graph type (vbar|hbar|line|pie) "vbar">
<!ATTLIST graph string CDATA "Unknown">
<!ATTLIST graph background CDATA "#f5f5f5">
<!ATTLIST graph color CDATA "blue">
<!ATTLIST graph legend (0|1) "1">
<!ELEMENT x (field)>
<!ELEMENT y (field+)>
<!ELEMENT label EMPTY>
<!ATTLIST label string CDATA "">
<!ATTLIST label name CDATA #IMPLIED>
<!ATTLIST label states CDATA #IMPLIED>
<!ATTLIST label align CDATA "0.0">
<!ATTLIST label expand (0|1) "0">
<!ATTLIST label fill (0|1) "0">
<!ATTLIST label xexpand (0|1) "0">
<!ATTLIST label xfill (0|1) "1">
<!ATTLIST label colspan CDATA "1">
<!ATTLIST label help CDATA #IMPLIED>
<!ELEMENT field (tree|form|graph)*>
<!ATTLIST field name CDATA #REQUIRED>
<!ATTLIST field colspan CDATA "1">
<!ATTLIST field widget (date|char|many2one|date|one2many|selection|float|numeric|float_time|interger|datetime|boolean|text|url|email|callto|sip|sha|reference|binary|many2many|image) #IMPLIED>
<!ATTLIST field saves (0|1) #IMPLIED>
<!ATTLIST field expand (0|1) #IMPLIED>
<!ATTLIST field fill (0|1) #IMPLIED>
<!ATTLIST field empty (0|1) #IMPLIED>
<!ATTLIST field xexpand (0|1) "1">
<!ATTLIST field xfill (0|1) "1">
<!ATTLIST field help CDATA #IMPLIED>
<!ATTLIST field width CDATA #IMPLIED>
<!ATTLIST field height CDATA #IMPLIED>
<!ATTLIST field readonly CDATA #IMPLIED>
<!ATTLIST field required CDATA #IMPLIED>
<!ATTLIST field tree_invisible (0|1) "0">
<!ATTLIST field mode CDATA #IMPLIED>
<!ATTLIST field completion (0|1) "0">
<!ATTLIST field invisible (0|1) "0">
<!ATTLIST field sum CDATA #IMPLIED>
<!ATTLIST field key CDATA #IMPLIED>
<!ATTLIST field domain CDATA #IMPLIED>
<!ATTLIST field color CDATA #IMPLIED>
<!ELEMENT image EMPTY>
<!ATTLIST image name CDATA #REQUIRED>
<!ATTLIST image colspan CDATA "1">
<!ATTLIST image expand (0|1) "0">
<!ATTLIST image fill (0|1) "0">
<!ATTLIST image help CDATA #IMPLIED>
<!ATTLIST image states CDATA #IMPLIED>
<!ELEMENT separator EMPTY>
<!ATTLIST separator string CDATA "">
<!ATTLIST separator name CDATA #IMPLIED>
<!ATTLIST separator states CDATA #IMPLIED>
<!ATTLIST separator align CDATA "0.0">
<!ATTLIST separator colspan CDATA "1">
<!ATTLIST separator expand (0|1) "0">
<!ATTLIST separator fill (0|1) "0">
<!ATTLIST separator help CDATA #IMPLIED>
<!ELEMENT newline EMPTY>
<!ELEMENT button EMPTY>
<!ATTLIST button colspan CDATA "1">
<!ATTLIST button help CDATA #IMPLIED>
<!ATTLIST button string CDATA "Unknown">
<!ATTLIST button icon CDATA #IMPLIED>
<!ATTLIST button type (workflow|object|action) "workflow">
<!ATTLIST button confirm CDATA #IMPLIED>
<!ATTLIST button name CDATA #REQUIRED>
<!ATTLIST button states CDATA #IMPLIED>
<!ELEMENT notebook (page*)>
<!ATTLIST notebook tabpos (up|down|left|right) #IMPLIED>
<!ATTLIST notebook colspan CDATA "4">
<!ELEMENT page (label|field|image|separator|newline|button|notebook|group|hpaned|vpaned|properties)*>
<!ATTLIST page angle CDATA #IMPLIED>
<!ATTLIST page string CDATA "Unknown">
<!ATTLIST page col CDATA "4">
<!ELEMENT group (label|field|image|separator|newline|button|notebook|group|hpaned|vpaned|properties)*>
<!ATTLIST group string CDATA #IMPLIED>
<!ATTLIST group colspan CDATA "1">
<!ATTLIST group expand (0|1) "0">
<!ATTLIST group fill (0|1) "1">
<!ATTLIST group rowspan CDATA "1">
<!ATTLIST group col CDATA "4">
<!ELEMENT hpaned (child1?,child2?)>
<!ATTLIST hpaned colspan CDATA "4">
<!ATTLIST hpaned position CDATA #IMPLIED>
<!ELEMENT vpaned (child1?,child2?)>
<!ATTLIST vpaned colspan CDATA "4">
<!ATTLIST vpaned position CDATA #IMPLIED>
<!ELEMENT child1 (label|field|image|separator|newline|button|notebook|group|hpaned|vpaned|properties)*>
<!ELEMENT child2 (label|field|image|separator|newline|button|notebook|group|hpaned|vpaned|properties)*>
<!ELEMENT properties EMPTY>
<!ELEMENT data (xpath+)>
<!ELEMENT xpath ANY>
<!ATTLIST xpath expr CDATA #REQUIRED>
<!ATTLIST xpath position (inside|replace|after|before) "inside">
+256
View File
@@ -0,0 +1,256 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
form =
element form {
attlist.form,
(label
| field
| image
| separator
| newline
| button
| notebook
| group
| hpaned
| vpaned
| properties)*
}
attlist.form &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.form &= attribute on_write { text }?
attlist.form &= [ a:defaultValue = "4" ] attribute col { text }?
attlist.form &= attribute cursor { text }?
tree = element tree { attlist.tree, field+ }
attlist.tree &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.tree &= attribute on_write { text }?
attlist.tree &= attribute editable { "top" | "bottom" }?
attlist.tree &= attribute sequence { text }?
attlist.tree &= attribute colors { text }?
graph = element graph { attlist.graph, x, y }
attlist.graph &=
[ a:defaultValue = "vbar" ]
attribute type { "vbar" | "hbar" | "line" | "pie" }?
attlist.graph &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.graph &=
[ a:defaultValue = "#f5f5f5" ] attribute background { text }?
attlist.graph &= [ a:defaultValue = "blue" ] attribute color { text }?
attlist.graph &=
[ a:defaultValue = "1" ] attribute legend { "0" | "1" }?
x = element x { attlist.x, field }
attlist.x &= empty
y = element y { attlist.y, field+ }
attlist.y &= empty
label = element label { attlist.label, empty }
attlist.label &= [ a:defaultValue = "" ] attribute string { text }?
attlist.label &= attribute name { text }?
attlist.label &= attribute states { text }?
attlist.label &= [ a:defaultValue = "0.0" ] attribute align { text }?
attlist.label &=
[ a:defaultValue = "0" ] attribute expand { "0" | "1" }?
attlist.label &= [ a:defaultValue = "0" ] attribute fill { "0" | "1" }?
attlist.label &=
[ a:defaultValue = "0" ] attribute xexpand { "0" | "1" }?
attlist.label &= [ a:defaultValue = "1" ] attribute xfill { "0" | "1" }?
attlist.label &= [ a:defaultValue = "1" ] attribute colspan { text }?
attlist.label &= attribute help { text }?
field = element field { attlist.field, (tree | form | graph)* }
attlist.field &= attribute name { text }
attlist.field &= [ a:defaultValue = "1" ] attribute colspan { text }?
attlist.field &=
attribute widget {
"date"
| "char"
| "many2one"
| "date"
| "one2many"
| "selection"
| "float"
| "numeric"
| "float_time"
| "interger"
| "datetime"
| "boolean"
| "text"
| "url"
| "email"
| "callto"
| "sip"
| "sha"
| "reference"
| "binary"
| "many2many"
| "image"
}?
attlist.field &= attribute saves { "0" | "1" }?
attlist.field &= attribute expand { "0" | "1" }?
attlist.field &= attribute fill { "0" | "1" }?
attlist.field &= attribute empty { "0" | "1" }?
attlist.field &=
[ a:defaultValue = "1" ] attribute xexpand { "0" | "1" }?
attlist.field &= [ a:defaultValue = "1" ] attribute xfill { "0" | "1" }?
attlist.field &= attribute help { text }?
attlist.field &= attribute width { text }?
attlist.field &= attribute height { text }?
attlist.field &= attribute readonly { text }?
attlist.field &= attribute required { text }?
attlist.field &=
[ a:defaultValue = "0" ] attribute tree_invisible { "0" | "1" }?
attlist.field &= attribute mode { text }?
attlist.field &=
[ a:defaultValue = "0" ] attribute completion { "0" | "1" }?
attlist.field &=
[ a:defaultValue = "0" ] attribute invisible { "0" | "1" }?
attlist.field &= attribute sum { text }?
attlist.field &= attribute key { text }?
attlist.field &= attribute domain { text }?
attlist.field &= attribute color { text }?
image = element image { attlist.image, empty }
attlist.image &= attribute name { text }
attlist.image &= [ a:defaultValue = "1" ] attribute colspan { text }?
attlist.image &=
[ a:defaultValue = "0" ] attribute expand { "0" | "1" }?
attlist.image &= [ a:defaultValue = "0" ] attribute fill { "0" | "1" }?
attlist.image &= attribute help { text }?
attlist.image &= attribute states { text }?
separator = element separator { attlist.separator, empty }
attlist.separator &= [ a:defaultValue = "" ] attribute string { text }?
attlist.separator &= attribute name { text }?
attlist.separator &= attribute states { text }?
attlist.separator &=
[ a:defaultValue = "0.0" ] attribute align { text }?
attlist.separator &=
[ a:defaultValue = "1" ] attribute colspan { text }?
attlist.separator &=
[ a:defaultValue = "0" ] attribute expand { "0" | "1" }?
attlist.separator &=
[ a:defaultValue = "0" ] attribute fill { "0" | "1" }?
attlist.separator &= attribute help { text }?
newline = element newline { attlist.newline, empty }
attlist.newline &= empty
button = element button { attlist.button, empty }
attlist.button &= [ a:defaultValue = "1" ] attribute colspan { text }?
attlist.button &= attribute help { text }?
attlist.button &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.button &= attribute icon { text }?
attlist.button &=
[ a:defaultValue = "workflow" ]
attribute type { "workflow" | "object" | "action" }?
attlist.button &= attribute confirm { text }?
attlist.button &= attribute name { text }
attlist.button &= attribute states { text }?
notebook = element notebook { attlist.notebook, page* }
attlist.notebook &=
attribute tabpos { "up" | "down" | "left" | "right" }?
attlist.notebook &= [ a:defaultValue = "4" ] attribute colspan { text }?
page =
element page {
attlist.page,
(label
| field
| image
| separator
| newline
| button
| notebook
| group
| hpaned
| vpaned
| properties)*
}
attlist.page &= attribute angle { text }?
attlist.page &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.page &= [ a:defaultValue = "4" ] attribute col { text }?
group =
element group {
attlist.group,
(label
| field
| image
| separator
| newline
| button
| notebook
| group
| hpaned
| vpaned
| properties)*
}
attlist.group &= attribute string { text }?
attlist.group &= [ a:defaultValue = "1" ] attribute colspan { text }?
attlist.group &=
[ a:defaultValue = "0" ] attribute expand { "0" | "1" }?
attlist.group &= [ a:defaultValue = "1" ] attribute fill { "0" | "1" }?
attlist.group &= [ a:defaultValue = "1" ] attribute rowspan { text }?
attlist.group &= [ a:defaultValue = "4" ] attribute col { text }?
hpaned = element hpaned { attlist.hpaned, child1?, child2? }
attlist.hpaned &= [ a:defaultValue = "4" ] attribute colspan { text }?
attlist.hpaned &= attribute position { text }?
vpaned = element vpaned { attlist.vpaned, child1?, child2? }
attlist.vpaned &= [ a:defaultValue = "4" ] attribute colspan { text }?
attlist.vpaned &= attribute position { text }?
child1 =
element child1 {
attlist.child1,
(label
| field
| image
| separator
| newline
| button
| notebook
| group
| hpaned
| vpaned
| properties)*
}
attlist.child1 &= empty
child2 =
element child2 {
attlist.child2,
(label
| field
| image
| separator
| newline
| button
| notebook
| group
| hpaned
| vpaned
| properties)*
}
attlist.child2 &= empty
properties = element properties { attlist.properties, empty }
attlist.properties &= empty
data = element data { attlist.data, xpath+ }
attlist.data &= empty
xpath = element xpath { attlist.xpath, any }
attlist.xpath &= attribute expr { text }
attlist.xpath &=
[ a:defaultValue = "inside" ]
attribute position { "inside" | "replace" | "after" | "before" }?
any =
(element * {
attribute * { text }*,
any
}
| text)*
start = data | form
+841
View File
@@ -0,0 +1,841 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<define name="form">
<element name="form">
<ref name="attlist.form"/>
<zeroOrMore>
<choice>
<ref name="label"/>
<ref name="field"/>
<ref name="image"/>
<ref name="separator"/>
<ref name="newline"/>
<ref name="button"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="properties"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.form" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.form" combine="interleave">
<optional>
<attribute name="on_write"/>
</optional>
</define>
<define name="attlist.form" combine="interleave">
<optional>
<attribute name="col" a:defaultValue="4"/>
</optional>
</define>
<define name="attlist.form" combine="interleave">
<optional>
<attribute name="cursor"/>
</optional>
</define>
<define name="tree">
<element name="tree">
<ref name="attlist.tree"/>
<oneOrMore>
<ref name="field"/>
</oneOrMore>
</element>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="on_write"/>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="editable">
<choice>
<value>top</value>
<value>bottom</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="sequence"/>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="colors"/>
</optional>
</define>
<define name="graph">
<element name="graph">
<ref name="attlist.graph"/>
<ref name="x"/>
<ref name="y"/>
</element>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="type" a:defaultValue="vbar">
<choice>
<value>vbar</value>
<value>hbar</value>
<value>line</value>
<value>pie</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="background" a:defaultValue="#f5f5f5"/>
</optional>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="color" a:defaultValue="blue"/>
</optional>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="legend" a:defaultValue="1">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="x">
<element name="x">
<ref name="attlist.x"/>
<ref name="field"/>
</element>
</define>
<define name="attlist.x" combine="interleave">
<empty/>
</define>
<define name="y">
<element name="y">
<ref name="attlist.y"/>
<oneOrMore>
<ref name="field"/>
</oneOrMore>
</element>
</define>
<define name="attlist.y" combine="interleave">
<empty/>
</define>
<define name="label">
<element name="label">
<ref name="attlist.label"/>
<empty/>
</element>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="string" a:defaultValue=""/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="name"/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="states"/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="align" a:defaultValue="0.0"/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="expand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="fill" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="xexpand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="xfill" a:defaultValue="1">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.label" combine="interleave">
<optional>
<attribute name="help"/>
</optional>
</define>
<define name="field">
<element name="field">
<ref name="attlist.field"/>
<zeroOrMore>
<choice>
<ref name="tree"/>
<ref name="form"/>
<ref name="graph"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.field" combine="interleave">
<attribute name="name"/>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="widget">
<choice>
<value>date</value>
<value>char</value>
<value>many2one</value>
<value>date</value>
<value>one2many</value>
<value>selection</value>
<value>float</value>
<value>numeric</value>
<value>float_time</value>
<value>interger</value>
<value>datetime</value>
<value>boolean</value>
<value>text</value>
<value>url</value>
<value>email</value>
<value>callto</value>
<value>sip</value>
<value>sha</value>
<value>reference</value>
<value>binary</value>
<value>many2many</value>
<value>image</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="saves">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="expand">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="fill">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="empty">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="xexpand" a:defaultValue="1">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="xfill" a:defaultValue="1">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="help"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="width"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="height"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="readonly"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="required"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="tree_invisible" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="mode"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="completion" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="invisible" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="sum"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="key"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="domain"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="color"/>
</optional>
</define>
<define name="image">
<element name="image">
<ref name="attlist.image"/>
<empty/>
</element>
</define>
<define name="attlist.image" combine="interleave">
<attribute name="name"/>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="expand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="fill" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="help"/>
</optional>
</define>
<define name="attlist.image" combine="interleave">
<optional>
<attribute name="states"/>
</optional>
</define>
<define name="separator">
<element name="separator">
<ref name="attlist.separator"/>
<empty/>
</element>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="string" a:defaultValue=""/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="name"/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="states"/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="align" a:defaultValue="0.0"/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="expand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="fill" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.separator" combine="interleave">
<optional>
<attribute name="help"/>
</optional>
</define>
<define name="newline">
<element name="newline">
<ref name="attlist.newline"/>
<empty/>
</element>
</define>
<define name="attlist.newline" combine="interleave">
<empty/>
</define>
<define name="button">
<element name="button">
<ref name="attlist.button"/>
<empty/>
</element>
</define>
<define name="attlist.button" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.button" combine="interleave">
<optional>
<attribute name="help"/>
</optional>
</define>
<define name="attlist.button" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.button" combine="interleave">
<optional>
<attribute name="icon"/>
</optional>
</define>
<define name="attlist.button" combine="interleave">
<optional>
<attribute name="type" a:defaultValue="workflow">
<choice>
<value>workflow</value>
<value>object</value>
<value>action</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.button" combine="interleave">
<optional>
<attribute name="confirm"/>
</optional>
</define>
<define name="attlist.button" combine="interleave">
<attribute name="name"/>
</define>
<define name="attlist.button" combine="interleave">
<optional>
<attribute name="states"/>
</optional>
</define>
<define name="notebook">
<element name="notebook">
<ref name="attlist.notebook"/>
<zeroOrMore>
<ref name="page"/>
</zeroOrMore>
</element>
</define>
<define name="attlist.notebook" combine="interleave">
<optional>
<attribute name="tabpos">
<choice>
<value>up</value>
<value>down</value>
<value>left</value>
<value>right</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.notebook" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="4"/>
</optional>
</define>
<define name="page">
<element name="page">
<ref name="attlist.page"/>
<zeroOrMore>
<choice>
<ref name="label"/>
<ref name="field"/>
<ref name="image"/>
<ref name="separator"/>
<ref name="newline"/>
<ref name="button"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="properties"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.page" combine="interleave">
<optional>
<attribute name="angle"/>
</optional>
</define>
<define name="attlist.page" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.page" combine="interleave">
<optional>
<attribute name="col" a:defaultValue="4"/>
</optional>
</define>
<define name="group">
<element name="group">
<ref name="attlist.group"/>
<zeroOrMore>
<choice>
<ref name="label"/>
<ref name="field"/>
<ref name="image"/>
<ref name="separator"/>
<ref name="newline"/>
<ref name="button"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="properties"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="string"/>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="expand" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="fill" a:defaultValue="1">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="rowspan" a:defaultValue="1"/>
</optional>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="col" a:defaultValue="4"/>
</optional>
</define>
<define name="hpaned">
<element name="hpaned">
<ref name="attlist.hpaned"/>
<optional>
<ref name="child1"/>
</optional>
<optional>
<ref name="child2"/>
</optional>
</element>
</define>
<define name="attlist.hpaned" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="4"/>
</optional>
</define>
<define name="attlist.hpaned" combine="interleave">
<optional>
<attribute name="position"/>
</optional>
</define>
<define name="vpaned">
<element name="vpaned">
<ref name="attlist.vpaned"/>
<optional>
<ref name="child1"/>
</optional>
<optional>
<ref name="child2"/>
</optional>
</element>
</define>
<define name="attlist.vpaned" combine="interleave">
<optional>
<attribute name="colspan" a:defaultValue="4"/>
</optional>
</define>
<define name="attlist.vpaned" combine="interleave">
<optional>
<attribute name="position"/>
</optional>
</define>
<define name="child1">
<element name="child1">
<ref name="attlist.child1"/>
<zeroOrMore>
<choice>
<ref name="label"/>
<ref name="field"/>
<ref name="image"/>
<ref name="separator"/>
<ref name="newline"/>
<ref name="button"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="properties"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.child1" combine="interleave">
<empty/>
</define>
<define name="child2">
<element name="child2">
<ref name="attlist.child2"/>
<zeroOrMore>
<choice>
<ref name="label"/>
<ref name="field"/>
<ref name="image"/>
<ref name="separator"/>
<ref name="newline"/>
<ref name="button"/>
<ref name="notebook"/>
<ref name="group"/>
<ref name="hpaned"/>
<ref name="vpaned"/>
<ref name="properties"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="attlist.child2" combine="interleave">
<empty/>
</define>
<define name="properties">
<element name="properties">
<ref name="attlist.properties"/>
<empty/>
</element>
</define>
<define name="attlist.properties" combine="interleave">
<empty/>
</define>
<define name="data">
<element name="data">
<ref name="attlist.data"/>
<oneOrMore>
<ref name="xpath"/>
</oneOrMore>
</element>
</define>
<define name="attlist.data" combine="interleave">
<empty/>
</define>
<define name="xpath">
<element name="xpath">
<ref name="attlist.xpath"/>
<ref name="any"/>
</element>
</define>
<define name="attlist.xpath" combine="interleave">
<attribute name="expr"/>
</define>
<define name="attlist.xpath" combine="interleave">
<optional>
<attribute name="position" a:defaultValue="inside">
<choice>
<value>inside</value>
<value>replace</value>
<value>after</value>
<value>before</value>
</choice>
</attribute>
</optional>
</define>
<define name="any">
<zeroOrMore>
<choice>
<element>
<anyName/>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
<ref name="any"/>
</element>
<text/>
</choice>
</zeroOrMore>
</define>
<start>
<choice>
<ref name="data"/>
<ref name="form"/>
</choice>
</start>
</grammar>
-21
View File
@@ -1,21 +0,0 @@
<!ELEMENT graph (x, y)>
<!ATTLIST graph type (vbar|hbar|line|pie) "vbar">
<!ATTLIST graph string CDATA "Unknown">
<!ATTLIST graph background CDATA "#f5f5f5">
<!ATTLIST graph color CDATA "blue">
<!ATTLIST graph legend (0|1) "1">
<!ELEMENT x (field)>
<!ELEMENT y (field+)>
<!ELEMENT field EMPTY>
<!ATTLIST field name CDATA #REQUIRED>
<!ATTLIST field string CDATA #IMPLIED>
<!ATTLIST field key CDATA #IMPLIED>
<!ATTLIST field domain CDATA #IMPLIED>
<!ATTLIST field fill (0|1) #IMPLIED>
<!ATTLIST field empty (0|1) #IMPLIED>
<!ATTLIST field color CDATA #IMPLIED>
<!ATTLIST field widget (float_time) #IMPLIED>
<!ELEMENT data (xpath+)>
<!ELEMENT xpath ANY>
<!ATTLIST xpath expr CDATA #REQUIRED>
<!ATTLIST xpath position (inside|replace|after|before) "inside">
+40
View File
@@ -0,0 +1,40 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
graph = element graph { attlist.graph, x, y }
attlist.graph &=
[ a:defaultValue = "vbar" ]
attribute type { "vbar" | "hbar" | "line" | "pie" }?
attlist.graph &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.graph &=
[ a:defaultValue = "#f5f5f5" ] attribute background { text }?
attlist.graph &= [ a:defaultValue = "blue" ] attribute color { text }?
attlist.graph &=
[ a:defaultValue = "1" ] attribute legend { "0" | "1" }?
x = element x { attlist.x, field }
attlist.x &= empty
y = element y { attlist.y, field+ }
attlist.y &= empty
field = element field { attlist.field, empty }
attlist.field &= attribute name { text }
attlist.field &= attribute string { text }?
attlist.field &= attribute key { text }?
attlist.field &= attribute domain { text }?
attlist.field &= attribute fill { "0" | "1" }?
attlist.field &= attribute empty { "0" | "1" }?
attlist.field &= attribute color { text }?
attlist.field &= attribute widget { "float_time" }?
data = element data { attlist.data, xpath+ }
attlist.data &= empty
xpath = element xpath { attlist.xpath, any }
attlist.xpath &= attribute expr { text }
attlist.xpath &=
[ a:defaultValue = "inside" ]
attribute position { "inside" | "replace" | "after" | "before" }?
start = data | graph
any =
(element * {
attribute * { text }*,
any
}
| text)*
+177
View File
@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<define name="graph">
<element name="graph">
<ref name="attlist.graph"/>
<ref name="x"/>
<ref name="y"/>
</element>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="type" a:defaultValue="vbar">
<choice>
<value>vbar</value>
<value>hbar</value>
<value>line</value>
<value>pie</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="background" a:defaultValue="#f5f5f5"/>
</optional>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="color" a:defaultValue="blue"/>
</optional>
</define>
<define name="attlist.graph" combine="interleave">
<optional>
<attribute name="legend" a:defaultValue="1">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="x">
<element name="x">
<ref name="attlist.x"/>
<ref name="field"/>
</element>
</define>
<define name="attlist.x" combine="interleave">
<empty/>
</define>
<define name="y">
<element name="y">
<ref name="attlist.y"/>
<oneOrMore>
<ref name="field"/>
</oneOrMore>
</element>
</define>
<define name="attlist.y" combine="interleave">
<empty/>
</define>
<define name="field">
<element name="field">
<ref name="attlist.field"/>
<empty/>
</element>
</define>
<define name="attlist.field" combine="interleave">
<attribute name="name"/>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="string"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="key"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="domain"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="fill">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="empty">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="color"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="widget">
<value>float_time</value>
</attribute>
</optional>
</define>
<define name="data">
<element name="data">
<ref name="attlist.data"/>
<oneOrMore>
<ref name="xpath"/>
</oneOrMore>
</element>
</define>
<define name="attlist.data" combine="interleave">
<empty/>
</define>
<define name="xpath">
<element name="xpath">
<ref name="attlist.xpath"/>
<ref name="any"/>
</element>
</define>
<define name="attlist.xpath" combine="interleave">
<attribute name="expr"/>
</define>
<define name="attlist.xpath" combine="interleave">
<optional>
<attribute name="position" a:defaultValue="inside">
<choice>
<value>inside</value>
<value>replace</value>
<value>after</value>
<value>before</value>
</choice>
</attribute>
</optional>
</define>
<start>
<choice>
<ref name="data"/>
<ref name="graph"/>
</choice>
</start>
<define name="any">
<zeroOrMore>
<choice>
<element>
<anyName/>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
<ref name="any"/>
</element>
<text/>
</choice>
</zeroOrMore>
</define>
</grammar>
-21
View File
@@ -1,21 +0,0 @@
<!ELEMENT tree (field+)>
<!ATTLIST tree string CDATA "Unknown">
<!ATTLIST tree on_write CDATA #IMPLIED>
<!ATTLIST tree editable (top|bottom) #IMPLIED>
<!ATTLIST tree sequence CDATA #IMPLIED>
<!ATTLIST tree colors CDATA #IMPLIED>
<!ATTLIST tree toolbar (0|1) "0">
<!ELEMENT field EMPTY>
<!ATTLIST field name CDATA #REQUIRED>
<!ATTLIST field readonly CDATA #IMPLIED>
<!ATTLIST field required CDATA #IMPLIED>
<!ATTLIST field widget (char|many2one|date|one2many|selection|float|numeric|float_time|interger|datetime|boolean|text|url|email|callto|sip) #IMPLIED>
<!ATTLIST field select (0|1|2) "0">
<!ATTLIST field tree_invisible (0|1) "0">
<!ATTLIST field icon CDATA #IMPLIED>
<!ATTLIST field sum CDATA #IMPLIED>
<!ATTLIST field width CDATA #IMPLIED>
<!ELEMENT data (xpath+)>
<!ELEMENT xpath ANY>
<!ATTLIST xpath expr CDATA #REQUIRED>
<!ATTLIST xpath position (inside|replace|after|before) "inside">
+55
View File
@@ -0,0 +1,55 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
tree = element tree { attlist.tree, field+ }
attlist.tree &=
[ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.tree &= attribute on_write { text }?
attlist.tree &= attribute editable { "top" | "bottom" }?
attlist.tree &= attribute sequence { text }?
attlist.tree &= attribute colors { text }?
attlist.tree &=
[ a:defaultValue = "0" ] attribute toolbar { "0" | "1" }?
field = element field { attlist.field, empty }
attlist.field &= attribute name { text }
attlist.field &= attribute readonly { text }?
attlist.field &= attribute required { text }?
attlist.field &=
attribute widget {
"char"
| "many2one"
| "date"
| "one2many"
| "selection"
| "float"
| "numeric"
| "float_time"
| "interger"
| "datetime"
| "boolean"
| "text"
| "url"
| "email"
| "callto"
| "sip"
}?
attlist.field &=
[ a:defaultValue = "0" ] attribute select { "0" | "1" | "2" }?
attlist.field &=
[ a:defaultValue = "0" ] attribute tree_invisible { "0" | "1" }?
attlist.field &= attribute icon { text }?
attlist.field &= attribute sum { text }?
attlist.field &= attribute width { text }?
data = element data { attlist.data, xpath+ }
attlist.data &= empty
xpath = element xpath { attlist.xpath, any }
attlist.xpath &= attribute expr { text }
attlist.xpath &=
[ a:defaultValue = "inside" ]
attribute position { "inside" | "replace" | "after" | "before" }?
start = tree | data
any =
(element * {
attribute * { text }*,
any
}
| text)*
+184
View File
@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<define name="tree">
<element name="tree">
<ref name="attlist.tree"/>
<oneOrMore>
<ref name="field"/>
</oneOrMore>
</element>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="string" a:defaultValue="Unknown"/>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="on_write"/>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="editable">
<choice>
<value>top</value>
<value>bottom</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="sequence"/>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="colors"/>
</optional>
</define>
<define name="attlist.tree" combine="interleave">
<optional>
<attribute name="toolbar" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="field">
<element name="field">
<ref name="attlist.field"/>
<empty/>
</element>
</define>
<define name="attlist.field" combine="interleave">
<attribute name="name"/>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="readonly"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="required"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="widget">
<choice>
<value>char</value>
<value>many2one</value>
<value>date</value>
<value>one2many</value>
<value>selection</value>
<value>float</value>
<value>numeric</value>
<value>float_time</value>
<value>interger</value>
<value>datetime</value>
<value>boolean</value>
<value>text</value>
<value>url</value>
<value>email</value>
<value>callto</value>
<value>sip</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="select" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
<value>2</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="tree_invisible" a:defaultValue="0">
<choice>
<value>0</value>
<value>1</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="icon"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="sum"/>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="width"/>
</optional>
</define>
<define name="data">
<element name="data">
<ref name="attlist.data"/>
<oneOrMore>
<ref name="xpath"/>
</oneOrMore>
</element>
</define>
<define name="attlist.data" combine="interleave">
<empty/>
</define>
<define name="xpath">
<element name="xpath">
<ref name="attlist.xpath"/>
<ref name="any"/>
</element>
</define>
<define name="attlist.xpath" combine="interleave">
<attribute name="expr"/>
</define>
<define name="attlist.xpath" combine="interleave">
<optional>
<attribute name="position" a:defaultValue="inside">
<choice>
<value>inside</value>
<value>replace</value>
<value>after</value>
<value>before</value>
</choice>
</attribute>
</optional>
</define>
<start>
<choice>
<ref name="tree"/>
<ref name="data"/>
</choice>
</start>
<define name="any">
<zeroOrMore>
<choice>
<element>
<anyName/>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
<ref name="any"/>
</element>
<text/>
</choice>
</zeroOrMore>
</define>
</grammar>
+13 -10
View File
@@ -56,17 +56,20 @@ class View(OSV):
trans_views[trans['name']][trans['src']] = trans
for view in views:
xml = view.arch.strip()
dtd_name = os.path.join(os.path.dirname(__file__),
(view.inherit and view.inherit.type or view.type) + '.dtd')
dtd = etree.DTD(file(dtd_name))
tree = etree.fromstring(xml)
if not dtd.validate(tree):
logger = Logger()
error_log = reduce(lambda x, y: str(x) + '\n' + str(y),
dtd.error_log.filter_from_errors())
logger.notify_channel('ir', LOG_ERROR,
'Invalid xml view:\n%s' % (error_log + '\n' + xml))
return False
# validate the tree using RelaxNG
rng_name = os.path.join(os.path.dirname(__file__),
(view.inherit and view.inherit.type or view.type) + '.rng')
if hasattr(etree, 'RelaxNG'):
validator = etree.RelaxNG(file=rng_name)
if not validator.validate(tree):
logger = Logger()
error_log = reduce(lambda x, y: str(x) + '\n' + str(y),
validator.error_log.filter_from_errors())
logger.notify_channel('ir', LOG_ERROR,
'Invalid xml view:\n%s' % (error_log + '\n' + xml))
return False
root_element = tree.getroottree().getroot()
strings = self._translate_view(root_element)
view_ids = self.search(cursor, 0, [
+4 -4
View File
@@ -1128,7 +1128,7 @@ class ORM(object):
' FROM ' + table_query + '\"' + self._table +'\" ' \
'WHERE id IN ' \
'(' + ','.join([str(x) for x in sub_ids]) + ')'\
' AND ' + domain1 + ' ORDER BY ' + \
' AND (' + domain1 + ') ORDER BY ' + \
','.join([self._table + '.' + x[0] + ' ' + x[1] \
for x in self._order])),
table_args + domain2)
@@ -1365,7 +1365,7 @@ class ORM(object):
domain1, domain2 = self.pool.get('ir.rule').domain_get(cursor, user,
self._name)
if domain1:
domain1 = ' AND ' + domain1
domain1 = ' AND (' + domain1 + ') '
for i in range((len(ids) / ID_MAX) + \
((len(ids) % ID_MAX) and 1 or 0)):
sub_ids = ids[ID_MAX * i:ID_MAX * (i + 1)]
@@ -1491,7 +1491,7 @@ class ORM(object):
domain1, domain2 = self.pool.get('ir.rule').domain_get(cursor,
user, self._name)
if domain1:
domain1 = ' and ' + domain1
domain1 = ' AND (' + domain1 + ') '
for i in range((len(ids) / ID_MAX) + \
((len(ids) % ID_MAX) and 1 or 0)):
sub_ids = ids[ID_MAX * i:ID_MAX * (i + 1)]
@@ -1964,7 +1964,7 @@ class ORM(object):
if next is not None:
for child in element2:
index = parent.index(next)
parent.insert(index - 1, child)
parent.insert(index, child)
else:
parent.extend(element2.getchildren())
elif pos == 'before':
+24 -10
View File
@@ -18,6 +18,12 @@ import time
import os
import datetime
if not hasattr(locale, 'nl_langinfo'):
locale.nl_langinfo = lambda *a: '%x'
if not hasattr(locale, 'D_FMT'):
locale.D_FMT = None
MODULE_LIST = []
MODULE_CLASS_LIST = {}
CLASS_POOL = {}
@@ -537,17 +543,25 @@ class Report(object):
(self._name,
localcontext.get('language', False) or 'en_US'))
if date:
# length of date like 2001-01-01 is ten:
if len(str(value)) == 10:
locale_format = locale.D_FMT
string_pattern = '%Y-%m-%d'
if isinstance(value, time.struct_time):
locale_format = locale.nl_langinfo(locale.D_FMT)\
.replace('%y', '%Y')
date = value
else:
if len(str(value)) > 19:
# assume string, parse it
if len(str(value)) == 10:
# length of date like 2001-01-01 is ten
# assume format '%Y-%m-%d'
locale_format = locale.nl_langinfo(locale.D_FMT)\
.replace('%y', '%Y')
string_pattern = '%Y-%m-%d'
else:
# assume format '%Y-%m-%d %H:%M:%S'
value = str(value)[:19]
locale_format = locale.D_T_FMT
string_pattern = '%Y-%m-%d %H:%M:%S'
date = time.strptime(str(value), string_pattern)
return time.strftime(locale.nl_langinfo(locale_format).\
replace('%y', '%Y'), date)
locale_format = locale.nl_langinfo(locale.D_FMT)\
.replace('%y', '%Y') + ' %H:%M:%S'
string_pattern = '%Y-%m-%d %H:%M:%S'
date = time.strptime(str(value), string_pattern)
return time.strftime(locale_format, date)
return locale.format('%.' + str(digits) + 'f', value, True)
-22
View File
@@ -1,22 +0,0 @@
<!ELEMENT tryton (data*)>
<!ELEMENT data (record|menuitem)*>
<!ATTLIST data noupdate (0|1) "0">
<!ELEMENT record (field*)>
<!ATTLIST record model CDATA #REQUIRED>
<!ATTLIST record id CDATA #REQUIRED>
<!ATTLIST record update (0|1) "0">
<!ELEMENT field (#PCDATA)>
<!ATTLIST field name CDATA #REQUIRED>
<!ATTLIST field search CDATA #IMPLIED>
<!ATTLIST field model CDATA #IMPLIED>
<!ATTLIST field ref CDATA #IMPLIED>
<!ATTLIST field eval CDATA #IMPLIED>
<!ATTLIST field type (xml) #IMPLIED>
<!ELEMENT menuitem EMPTY>
<!ATTLIST menuitem id CDATA #REQUIRED>
<!ATTLIST menuitem name CDATA #IMPLIED>
<!ATTLIST menuitem icon CDATA #IMPLIED>
<!ATTLIST menuitem sequence CDATA #IMPLIED>
<!ATTLIST menuitem parent CDATA #IMPLIED>
<!ATTLIST menuitem action CDATA #IMPLIED>
<!ATTLIST menuitem groups CDATA #IMPLIED>
+28
View File
@@ -0,0 +1,28 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
tryton = element tryton { attlist.tryton, data* }
attlist.tryton &= empty
data = element data { attlist.data, (record | menuitem)* }
attlist.data &=
[ a:defaultValue = "0" ] attribute noupdate { "0" | "1" }?
record = element record { attlist.record, field* }
attlist.record &= attribute model { text }
attlist.record &= attribute id { text }
attlist.record &=
[ a:defaultValue = "0" ] attribute update { "0" | "1" }?
field = element field { attlist.field, text }
attlist.field &= attribute name { text }
attlist.field &= attribute search { text }?
attlist.field &= attribute model { text }?
attlist.field &= attribute ref { text }?
attlist.field &= attribute eval { text }?
attlist.field &= attribute type { "xml" }?
menuitem = element menuitem { attlist.menuitem, empty }
attlist.menuitem &= attribute id { text }
attlist.menuitem &= attribute name { text }?
attlist.menuitem &= attribute icon { text }?
attlist.menuitem &= attribute sequence { text }?
attlist.menuitem &= attribute parent { text }?
attlist.menuitem &= attribute action { text }?
attlist.menuitem &= attribute groups { text }?
start = tryton
+1
View File
@@ -21,6 +21,7 @@ class DB(Service):
self.export_method(self.restore)
self.export_method(self.list)
self.export_method(self.list_lang)
self.export_method(self.db_exist)
self.export_method(self.change_admin_password)
def create(self, password, db_name, lang):