Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
erp5
Commits
9781d567
Commit
9781d567
authored
Apr 30, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ODS Style: use an intermediate script to format the date
This script add support for dates < 1900
parent
27231e59
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
4 deletions
+78
-4
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/ERP5Site_formatDateForODF.xml
...portal_skins/erp5_ods_style/ERP5Site_formatDateForODF.xml
+74
-0
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/field_ods_macro.xml
...plateItem/portal_skins/erp5_ods_style/field_ods_macro.xml
+3
-3
bt5/erp5_ods_style/bt/revision
bt5/erp5_ods_style/bt/revision
+1
-1
No files found.
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/ERP5Site_formatDateForODF.xml
0 → 100644
View file @
9781d567
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
try:\n
return date.strftime(\'%Y-%m-%dT%H:%M:%S\')\n
except ValueError: # *** ValueError: year=XXX is before 1900; the datetime strftime() methods require year >
= 1900\n
return "%04d-%02d-%02dT%02d:%02d:%02d" % (date.year(), date.month(), date.day(), date.hour(), date.minute(), date.second())\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
date
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_formatDateForODF
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/field_ods_macro.xml
View file @
9781d567
...
...
@@ -204,7 +204,7 @@
<tal:block
tal:condition=
"python: isinstance(value, DateTime)"
>
\n
<tal:block
tal:define=
"field python: editable_fields.get(column_id, None);"
>
\n
<tal:block
tal:condition=
"python: field is None"
>
\n
<table:table-cell
tal:attributes=
"office:date-value python:
value.strftime(\'%Y-%m-%dT%H:%M:%S\'
);\n
<table:table-cell
tal:attributes=
"office:date-value python:
context.ERP5Site_formatDateForODF(value
);\n
table:style-name string:${style_prefix}date;"
\n
table:style-name=
"date"
\n
office:value-type=
"date"
>
\n
...
...
@@ -214,7 +214,7 @@
<tal:block
tal:condition=
"python: field is not None"
>
\n
<tal:block
tal:condition=
"python:field.meta_type==\'DateTimeField\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'DateTimeField\')"
>
\n
<tal:block
tal:condition=
"python:field.get_value(\'date_only\')"
>
\n
<table:table-cell
tal:attributes=
"office:date-value python:
value.strftime(\'%Y-%m-%dT%H:%M:%S\'
);\n
<table:table-cell
tal:attributes=
"office:date-value python:
context.ERP5Site_formatDateForODF(value
);\n
table:style-name string:${style_prefix}date;"
\n
table:style-name=
"date"
\n
office:value-type=
"date"
>
\n
...
...
@@ -222,7 +222,7 @@
</table:table-cell>
\n
</tal:block>
\n
<tal:block
tal:condition=
"python:field.get_value(\'date_only\')==0"
>
\n
<table:table-cell
tal:attributes=
"office:date-value python:
value.strftime(\'%Y-%m-%dT%H:%M:%S\'
);\n
<table:table-cell
tal:attributes=
"office:date-value python:
context.ERP5Site_formatDateForODF(value
);\n
table:style-name string:${style_prefix}date_with_time;"
\n
table:style-name=
"date_with_time"
\n
office:value-type=
"date"
>
\n
...
...
bt5/erp5_ods_style/bt/revision
View file @
9781d567
255
\ No newline at end of file
256
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment