[gen] list field now takes into account 'show' attribute of sub-fields.
This commit is contained in:
parent
89de53d56d
commit
e1d0597694
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
/opt/openoffice.org3/program/soffice "-accept=socket,host=localhost,port=2002;urp;"
|
soffice "--accept=socket,host=localhost,port=2002;urp;"
|
||||||
echo "Press <enter>..."
|
echo "Press <enter>..."
|
||||||
read R
|
read R
|
||||||
|
|
|
@ -27,7 +27,7 @@ class List(Field):
|
||||||
# PX for rendering a single row.
|
# PX for rendering a single row.
|
||||||
pxRow = Px('''
|
pxRow = Px('''
|
||||||
<tr valign="top" style=":(rowIndex==-1) and 'display: none' or ''">
|
<tr valign="top" style=":(rowIndex==-1) and 'display: none' or ''">
|
||||||
<td for="info in field.fields" align="center"
|
<td for="info in subFields" if="info[1]" align="center"
|
||||||
var2="field=info[1];
|
var2="field=info[1];
|
||||||
fieldName='%s*%d' % (field.name, rowIndex);
|
fieldName='%s*%d' % (field.name, rowIndex);
|
||||||
tagCss='noStyle'">:field.pxRender</td>
|
tagCss='noStyle'">:field.pxRender</td>
|
||||||
|
@ -42,10 +42,11 @@ class List(Field):
|
||||||
pxTable = Px('''
|
pxTable = Px('''
|
||||||
<table var="isEdit=layoutType == 'edit'" if="isEdit or value"
|
<table var="isEdit=layoutType == 'edit'" if="isEdit or value"
|
||||||
id=":'list_%s' % name" class=":isEdit and 'grid' or 'list'"
|
id=":'list_%s' % name" class=":isEdit and 'grid' or 'list'"
|
||||||
width=":field.width">
|
width=":field.width"
|
||||||
|
var2="subFields=field.getSubFields(zobj, layoutType)">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<tr valign="bottom">
|
<tr valign="bottom">
|
||||||
<th for="info in field.fields"
|
<th for="info in subFields" if="info[1]"
|
||||||
width=":field.widths[loop.info.nb]">::_(info[1].labelId)</th>
|
width=":field.widths[loop.info.nb]">::_(info[1].labelId)</th>
|
||||||
<!-- Icon for adding a new row. -->
|
<!-- Icon for adding a new row. -->
|
||||||
<th if="isEdit">
|
<th if="isEdit">
|
||||||
|
@ -105,6 +106,19 @@ class List(Field):
|
||||||
for n, field in self.fields:
|
for n, field in self.fields:
|
||||||
if n == name: return field
|
if n == name: return field
|
||||||
|
|
||||||
|
def getSubFields(self, obj, layoutType):
|
||||||
|
'''Returns the sub-fields (name, Field) that are showable among
|
||||||
|
field.fields on the given p_layoutType. Fields that cannot appear in
|
||||||
|
the result are nevertheless present as a tuple (name, None). This
|
||||||
|
way, it keeps a nice layouting of the table.'''
|
||||||
|
res = []
|
||||||
|
for n, field in self.fields:
|
||||||
|
elem = (n, None)
|
||||||
|
if field.isShowable(obj, layoutType):
|
||||||
|
elem = (n, field)
|
||||||
|
res.append(elem)
|
||||||
|
return res
|
||||||
|
|
||||||
def getRequestValue(self, request, requestName=None):
|
def getRequestValue(self, request, requestName=None):
|
||||||
'''Concatenates the list from distinct form elements in the request.'''
|
'''Concatenates the list from distinct form elements in the request.'''
|
||||||
name = requestName or self.name # A List may be into another List (?)
|
name = requestName or self.name # A List may be into another List (?)
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
BIN
gen/ui/banner.png
Normal file
BIN
gen/ui/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
BIN
gen/ui/bannerrtl.png
Normal file
BIN
gen/ui/bannerrtl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
|
@ -154,7 +154,7 @@ class AbstractWrapper(object):
|
||||||
<tr class="top">
|
<tr class="top">
|
||||||
<!-- Top banner -->
|
<!-- Top banner -->
|
||||||
<td var="bannerName=(dir == 'ltr') and 'banner' or 'bannerrtl'"
|
<td var="bannerName=(dir == 'ltr') and 'banner' or 'bannerrtl'"
|
||||||
style=":url('%s.jpg' % bannerName, bg=True)">
|
style=":url('%s.png' % bannerName, bg=True)">
|
||||||
|
|
||||||
<!-- Top links -->
|
<!-- Top links -->
|
||||||
<div style="margin-top: 4px" align=":dright">
|
<div style="margin-top: 4px" align=":dright">
|
||||||
|
|
|
@ -214,8 +214,8 @@ class StylesManager:
|
||||||
(a) if the key is (1), (2) or (3), value must be the display name
|
(a) if the key is (1), (2) or (3), value must be the display name
|
||||||
of an ODT style
|
of an ODT style
|
||||||
(b) if the key is (4), value must be an integer indicating how to
|
(b) if the key is (4), value must be an integer indicating how to
|
||||||
map the outline level of outlined styles (ie, for mapping HTML
|
map the outline level of outlined styles (ie, for mapping XHTML
|
||||||
tag "h1" to the ODT style with outline-level=2, value must be
|
tag "h1" to the OD style with outline-level=2, value must be
|
||||||
integer "1". In that case, h2 will be mapped to the ODT style
|
integer "1". In that case, h2 will be mapped to the ODT style
|
||||||
with outline-level=3, etc.). Note that this value can also be
|
with outline-level=3, etc.). Note that this value can also be
|
||||||
negative.
|
negative.
|
||||||
|
|
|
@ -40,6 +40,13 @@ class LdapConnector:
|
||||||
self.server = ldap.initialize(self.serverUri)
|
self.server = ldap.initialize(self.serverUri)
|
||||||
self.server.simple_bind_s(login, password)
|
self.server.simple_bind_s(login, password)
|
||||||
return True, None
|
return True, None
|
||||||
|
except AttributeError, ae:
|
||||||
|
# When the ldap module is not there, trying to catch ldap.LDAPError
|
||||||
|
# will raise an error.
|
||||||
|
message = str(ae)
|
||||||
|
self.log('Ldap connect error with login %s (%s).' % \
|
||||||
|
(login, message))
|
||||||
|
return False, message
|
||||||
except ldap.LDAPError, le:
|
except ldap.LDAPError, le:
|
||||||
message = str(le)
|
message = str(le)
|
||||||
self.log('%s: connect error with login %s (%s).' % \
|
self.log('%s: connect error with login %s (%s).' % \
|
||||||
|
|
|
@ -438,7 +438,7 @@ class LinesCounter:
|
||||||
self.printReport()
|
self.printReport()
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
CONVERSION_ERROR = 'An error occurred while executing command "%s". %s'
|
CONVERSION_ERROR = 'An error occurred. %s'
|
||||||
class FileWrapper:
|
class FileWrapper:
|
||||||
'''When you get, from an appy object, the value of a File attribute, you
|
'''When you get, from an appy object, the value of a File attribute, you
|
||||||
get an instance of this class.'''
|
get an instance of this class.'''
|
||||||
|
@ -476,10 +476,10 @@ class FileWrapper:
|
||||||
must exist. If not, the file will be dumped in the OS temp folder.
|
must exist. If not, the file will be dumped in the OS temp folder.
|
||||||
The absolute path name of the dumped file is returned.
|
The absolute path name of the dumped file is returned.
|
||||||
If an error occurs, the method returns None. If p_format is
|
If an error occurs, the method returns None. If p_format is
|
||||||
specified, OpenOffice will be called for converting the dumped file
|
specified, LibreOffice will be called for converting the dumped file
|
||||||
to the desired format. In this case, p_tool, a Appy tool, must be
|
to the desired format. In this case, p_tool, a Appy tool, must be
|
||||||
provided. Indeed, any Appy tool contains parameters for contacting
|
provided. Indeed, any Appy tool contains parameters for contacting
|
||||||
OpenOffice in server mode.'''
|
LibreOffice in server mode.'''
|
||||||
if not filePath:
|
if not filePath:
|
||||||
filePath = '%s/file%f.%s' % (getOsTempFolder(), time.time(),
|
filePath = '%s/file%f.%s' % (getOsTempFolder(), time.time(),
|
||||||
normalizeString(self.name))
|
normalizeString(self.name))
|
||||||
|
@ -511,7 +511,7 @@ class FileWrapper:
|
||||||
else:
|
else:
|
||||||
filePath = '%s.%s' % (baseName, format)
|
filePath = '%s.%s' % (baseName, format)
|
||||||
if not os.path.exists(filePath):
|
if not os.path.exists(filePath):
|
||||||
tool.log(CONVERSION_ERROR % (cmd, errorMessage), type='error')
|
tool.log(CONVERSION_ERROR % errorMessage, type='error')
|
||||||
return
|
return
|
||||||
return filePath
|
return filePath
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue