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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5
Commits
6da67666
Commit
6da67666
authored
Mar 01, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
Mar 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_dms] Improve export/import code for Image so it works with JIO
parent
acb1d9c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
26 deletions
+28
-26
bt5/erp5_dms/ActionTemplateItem/portal_types/Image/export.xml
...erp5_dms/ActionTemplateItem/portal_types/Image/export.xml
+5
-3
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_uploadFile.py
...TemplateItem/portal_skins/erp5_dms/Document_uploadFile.py
+14
-11
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_uploadFile.xml
...emplateItem/portal_skins/erp5_dms/Document_uploadFile.xml
+1
-1
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Image_convert.py
...s/SkinTemplateItem/portal_skins/erp5_dms/Image_convert.py
+7
-10
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Image_convert.xml
.../SkinTemplateItem/portal_skins/erp5_dms/Image_convert.xml
+1
-1
No files found.
bt5/erp5_dms/ActionTemplateItem/portal_types/Image/export.xml
View file @
6da67666
...
@@ -16,13 +16,13 @@
...
@@ -16,13 +16,13 @@
<key>
<string>
categories
</string>
</key>
<key>
<string>
categories
</string>
</key>
<value>
<value>
<tuple>
<tuple>
<string>
action_type/object_exchange
</string>
<string>
action_type/object_
jio_
exchange
</string>
</tuple>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
category
</string>
</key>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_exchange
</string>
</value>
<value>
<string>
object_
jio_
exchange
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
condition
</string>
</key>
<key>
<string>
condition
</string>
</key>
...
@@ -30,7 +30,9 @@
...
@@ -30,7 +30,9 @@
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
<value>
<none/>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
icon
</string>
</key>
<key>
<string>
icon
</string>
</key>
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_uploadFile.py
View file @
6da67666
...
@@ -8,8 +8,9 @@ It does the following:
...
@@ -8,8 +8,9 @@ It does the following:
Otherwise it just uploads the file, bumps up revision number and calls metadata discovery script.
Otherwise it just uploads the file, bumps up revision number and calls metadata discovery script.
"""
"""
from
Products.ERP5Type.Log
import
log
,
WARNING
translate
String
=
context
.
Base_translateString
translate
=
context
.
Base_translateString
request
=
context
.
REQUEST
request
=
context
.
REQUEST
current_type
=
context
.
getPortalType
()
current_type
=
context
.
getPortalType
()
file_name
=
file
.
filename
file_name
=
file
.
filename
...
@@ -20,19 +21,21 @@ file_name = file.filename
...
@@ -20,19 +21,21 @@ file_name = file.filename
# we accept or suggest appropriate portal type
# we accept or suggest appropriate portal type
ext
=
file_name
[
file_name
.
rfind
(
'.'
)
+
1
:]
ext
=
file_name
[
file_name
.
rfind
(
'.'
)
+
1
:]
candidate_type_list
=
context
.
ContributionTool_getCandidateTypeListByExtension
(
ext
)
candidate_type_list
=
context
.
ContributionTool_getCandidateTypeListByExtension
(
ext
)
if
candidate_type_list
==
()
and
current_type
!=
'File'
:
portal_status_message
=
translateString
(
"Sorry, this is not one of ${portal_type}. This file should be uploaded into a file document."
,
if
not
candidate_type_list
and
current_type
!=
'File'
:
mapping
=
dict
(
portal_type
=
str
(
candidate_type_list
)))
log
(
"Document {!s} does not support extension {!s}. Use generic 'File' document."
.
format
(
current_type
,
ext
),
level
=
WARNING
)
return
context
.
Base_redirect
(
dialog_id
,
keep_items
=
dict
(
portal_status_message
=
portal_status_message
,
cancel_url
=
kw
[
'cancel_url'
]),
**
kw
)
return
context
.
Base_redirect
(
dialog_id
,
keep_items
=
{
'portal_status_message'
:
translate
(
"Current document does not support ${ext} file extension."
,
mapping
=
{
'ext'
:
ext
}),
'cancel_url'
:
cancel_url
})
if
candidate_type_list
and
current_type
not
in
candidate_type_list
:
if
candidate_type_list
and
current_type
not
in
candidate_type_list
:
portal_status_message
=
translateString
(
"Sorry, this is a ${portal_type}. This file should be uploaded into a ${appropriate_type} document."
,
log
(
"File extension {!s} is supported only by {!s}, not by current document {!s}."
.
format
(
ext
,
candidate_type_list
,
current_type
),
level
=
WARNING
)
mapping
=
dict
(
portal_type
=
current_type
,
appropriate_type
=
str
(
candidate_type_list
)))
return
context
.
Base_redirect
(
dialog_id
,
keep_items
=
{
return
context
.
Base_redirect
(
dialog_id
,
keep_items
=
dict
(
portal_status_message
=
portal_status_message
,
cancel_url
=
kw
[
'cancel_url'
]),
**
kw
)
'portal_status_message'
:
translate
(
"Current document does not support ${ext} file extension."
,
mapping
=
{
'ext'
:
ext
}),
'cancel_url'
:
cancel_url
})
context
.
edit
(
file
=
file
)
context
.
edit
(
file
=
file
)
context
.
activate
().
Document_convertToBaseFormatAndDiscoverMetadata
(
file_name
=
file_name
)
context
.
activate
().
Document_convertToBaseFormatAndDiscoverMetadata
(
file_name
=
file_name
)
msg
=
translateString
(
'File uploaded.'
)
# Return to view mode
# Return to view mode
return
context
.
Base_redirect
(
form_id
,
keep_items
=
{
'portal_status_message'
:
msg
},
**
kw
)
return
context
.
Base_redirect
(
form_id
,
keep_items
=
{
'portal_status_message'
:
translateString
(
'File uploaded.'
)}
)
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_uploadFile.xml
View file @
6da67666
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
dialog_id=None,
form_id=None,file=None,
**kw
</string>
</value>
<value>
<string>
dialog_id=None,
form_id=None, file=None, cancel_url=\'\',
**kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Image_convert.py
View file @
6da67666
"""
"""
Processes requests for conversion of and Image to a desired format
.
Convert Image (context) to a desired format and return as a binary `filename` file
.
Requires format and desired filename (adds extension if missing).
Requires format and desired filename (adds extension if missing).
Sets headers and uses native Zope method to produce output.
Sets headers and uses native Zope method to produce output.
"""
"""
request
=
context
.
REQUEST
request
=
context
.
REQUEST
fname
=
request
.
get
(
'filename'
)
format
=
request
.
get
(
'format'
)
if
fname
is
None
or
format
is
None
:
if
not
filename
.
endswith
(
'.'
+
format
):
return
filename
+=
'.'
+
format
if
not
fname
.
endswith
(
'.'
+
format
):
fname
+=
'.'
+
format
request
.
RESPONSE
.
setHeader
(
'Content-type'
,
'application/'
+
format
)
request
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'application/'
+
format
)
request
.
RESPONSE
.
setHeader
(
'Content-disposition'
,
'attachment; filename="%s"'
%
fname
)
request
.
RESPONSE
.
setHeader
(
'Content-Disposition'
,
'attachment; filename="%s"'
%
filename
)
return
context
.
index_html
(
request
,
request
.
RESPONSE
,
**
kw
)
return
context
.
index_html
(
request
,
request
.
RESPONSE
)
# quality, resolution, frame, image_size, crop will remain default values
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Image_convert.xml
View file @
6da67666
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
filename, format,
**kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
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