Commit 2ee47c39 authored by Lingnan Wu's avatar Lingnan Wu

add the new presentation.

parent 380a7837
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value> <value>
<list> <list>
<string>iframe_content</string>
<string>download_pdf</string> <string>download_pdf</string>
</list> </list>
</value> </value>
...@@ -75,7 +74,9 @@ ...@@ -75,7 +74,9 @@
<key> <string>webcontent header bottom</string> </key> <key> <string>webcontent header bottom</string> </key>
<value> <value>
<list> <list>
<string>my_title</string> <string>navigation</string>
<string>page_content</string>
<string>js</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -11,14 +11,15 @@ ...@@ -11,14 +11,15 @@
<value> <value>
<list> <list>
<string>css_class</string> <string>css_class</string>
<string>description</string> <string>default</string>
<string>enabled</string> <string>editable</string>
<string>title</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>iframe_content</string> </value> <value> <string>js</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -59,11 +60,13 @@ ...@@ -59,11 +60,13 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>editable</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
...@@ -78,6 +81,12 @@ ...@@ -78,6 +81,12 @@
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -87,32 +96,70 @@ ...@@ -87,32 +96,70 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string>page iframe hidden_label</string> </value> <value> <string>hidden_label</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string encoding="cdata"><![CDATA[
<script tal:content="structure here/WebSection_renderSubscriptionRequestFormValidator"></script>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>editable</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>iframe_content</string> </value> <value> <string>my_editor_field</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string>WebPage_viewFieldLibrary</string> </value> <value> <string>Base_viewFieldLibrary</string> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <string>Click to edit the target</string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Editor Field</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
python:\'<script>%s</script>\' % here.Presentation_renderSlidePage()
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>string:</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="LabelField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>page_content</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>page_content</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
python:\'<div id="slide_content"></div>\'
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<tal:block>\n
<div class="presentation-preview-navigation">\n
<a id="first_slide">\n
<img id="first_slide_img" src="images/transparent-image.gif"\n
i18n:attributes="alt; title"\n
i18n:domain="ui"\n
alt="First"\n
title="First"\n
class="first"/>\n
</a>\n
<a id="previous_slide">\n
<img id="previous_slide_img" src="images/transparent-image.gif"\n
i18n:attributes="alt; title"\n
i18n:domain="ui"\n
alt="Previous"\n
title="Previous"\n
class="previous"/>\n
</a>\n
\n
<!-- Current Thumbnail / Total Thumbnails -->\n
<input id="slide_selection_index"\n
size="1"\n
value="1"/>\n
/ <span id="slides_total_number">1</span>\n
\n
<a id="next_slide">\n
<img id="next_slide_img" src="images/transparent-image.gif"\n
i18n:attributes="alt; title"\n
i18n:domain="ui"\n
alt="Next"\n
title="Next"\n
class="next"/>\n
</a>\n
<a id="last_slide">\n
<img id="last_slide_img" src="images/transparent-image.gif"\n
i18n:attributes="alt; title"\n
i18n:domain="ui"\n
alt="Last"\n
title="Last"\n
class="last"/>\n
</a>\n
<a id="text_slide">\n
<img id="text_slide_img" src="images/text.png"\n
i18n:attributes="alt; title"\n
i18n:domain="ui"\n
alt="Text"\n
title="Text"\n
class="text"/>\n
</a>\n
<a id="graphics_slide">\n
<img id="graphics_slide_img" src="images/slide.png"\n
i18n:attributes="alt; title"\n
i18n:domain="ui"\n
alt="Graphics"\n
title="Graphics"\n
class="graphics"/>\n
</a>\n
</div>\n
</tal:block>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Presentation_renderHTMLPreviewNavigation</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<!--The content of the presentation-->\n
<tal:block tal:content="structure options/data" />
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Presentation_renderWithNavigation</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -1418,6 +1418,36 @@ div.pdf-preview-navigation img.last{\n ...@@ -1418,6 +1418,36 @@ div.pdf-preview-navigation img.last{\n
background-image:url("images/2rightarrowb.png");\n background-image:url("images/2rightarrowb.png");\n
}\n }\n
\n \n
/* DMS Presentation navigation \n
XXX: probably part of erp5_dms.bt5 */\n
div.presentation-preview-navigation img{\n
width: 22px;\n
height: 22px;\n
margin-right: 1px;\n
background-repeat: no-repeat;\n
vertical-align: middle;\n
}\n
\n
div.presentation-preview-navigation img.shaded{\n
opacity: 0.2;\n
}\n
\n
div.presentation-preview-navigation img.first{\n
background-image:url("images/2leftarrowb.png");\n
}\n
\n
div.presentation-preview-navigation img.previous{\n
background-image:url("images/1leftarrowb.png");\n
}\n
\n
div.presentation-preview-navigation img.next{\n
background-image:url("images/1rightarrowb.png");\n
}\n
\n
div.presentation-preview-navigation img.last{\n
background-image:url("images/2rightarrowb.png");\n
}\n
\n
.horizontal_align_form_box > div.input {\n .horizontal_align_form_box > div.input {\n
float: right;\n float: right;\n
width: 70%; /* because label width is 30%*/\n width: 70%; /* because label width is 30%*/\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Image" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts63601597.84</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>slide.png</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="base64">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ
bWFnZVJlYWR5ccllPAAAAatJREFUeNqkU79LAzEYfclVe9dfohZswUGHOjvUVRSh4Ca4FdpdXSr0
zxDc7FawUHAUhw7SzcXFxUUcHOyBDsUWKbT3o5eYpLZ4tCqlgeTuu3zvfe99lxDOOWYZAblUKpUL
8TiaElvK5/PHkArK5TJnjE01JUZilQLxQVEeXJmAx6BxC4TocCkFBYfc1cSUZu0+Qy23NsIogn6/
r4KETmG93QKtO5DoFmhyF9SICyAXhAOG7iB1hPERtBvXsF7PoTldGF2GqB7DwlIGmqaDwAMXJK5L
JhNIPxGvC7sTge3MwfZMLK82kAgL+fMijQsTAus4XOX6CFzXVUGIBvD0bqD5aaAX0BFOLmLTCIHK
BuC7sjawMMT4FKTTe1jR58Dvb6Dt57CR2kEwFgRTZ4WoHjgefldgfpwiuh5H68EE0S/x+HIGx+0M
SgowFZ10GMdh6nlcgRy21YZlt8AzBpjbhPjhCGgR3+mhvDfeRMkmZZ1s1/Df0SZChcwZKqBy8TxP
BdVqFfV6XSVMmnJP5vzE+CwUCoU/q2ez2dG7z4JgKxWLxakvk7I063X+EmAAIPsjzZFOpdwAAAAA
SUVORK5CYII=</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>16</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>521</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>16</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Image" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts65602636.96</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>text.png</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="base64">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABOUlEQVR4XpWSsaqDQBREr5Iqvfkc
G0vRsI0pAso2gmksxK8IKWy0SCAYMH1+wNJvMQmkVxd8by+sGMXlvYHLgNw5zq4qfd/D7XZLASAA
uTLXdQ8wEQKu12vveZ40nec5QiilXxCVG2MMA+/3G16vF87z+YS6rnG4LMvie8H5fE5ngK7rEKAo
yteoqorO1bYtEEL4bpD+SgBWU0BVVTCVbdvDjuM4UBRFkCQJhGF4wDs4Ho99FEXw+XwwwJ8J56Np
2gx6Op0gjmNlJeqJBmVZYmhJuq7DZrMZMghommYAGIYhAIs+zowb4KU9Hg9pA9M00RcbbLfbpbfL
GwjA/X4fBefa7XbyBvv9XgAkjpnZf4C6XC4gE6UURpn5EXzfF/UlDSZHYIzhF1iv1/AH8V3MjAEZ
ISSA/ynj9gNx+uMEce180wAAAABJRU5ErkJggg==</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>16</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>370</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>16</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -215,6 +215,8 @@ class OOoDocumentExtensibleTraversableMixin(BaseExtensibleTraversableMixin): ...@@ -215,6 +215,8 @@ class OOoDocumentExtensibleTraversableMixin(BaseExtensibleTraversableMixin):
self._convert(format='html') self._convert(format='html')
_setCacheHeaders(_ViewEmulator().__of__(self), web_cache_kw) _setCacheHeaders(_ViewEmulator().__of__(self), web_cache_kw)
mime, data = self.getConversion(format=EMBEDDED_FORMAT, filename=name) mime, data = self.getConversion(format=EMBEDDED_FORMAT, filename=name)
if name.endswith('.html') and self.getPortalType() == 'Presentation':
data = self.Presentation_renderWithNavigation(data=self._stripHTML(html=data)).encode('utf-8')
document = OFSFile(name, name, data, content_type=mime).__of__(self.aq_parent) document = OFSFile(name, name, data, content_type=mime).__of__(self.aq_parent)
except (NotConvertedError, ConversionError, KeyError): except (NotConvertedError, ConversionError, KeyError):
document = DocumentExtensibleTraversableMixin.getExtensibleContent(self, request, name) document = DocumentExtensibleTraversableMixin.getExtensibleContent(self, request, name)
......
...@@ -44,6 +44,7 @@ from Products.ERP5.Document.Document import Document, \ ...@@ -44,6 +44,7 @@ from Products.ERP5.Document.Document import Document, \
from Products.ERP5.Document.Image import getDefaultImageQuality from Products.ERP5.Document.Image import getDefaultImageQuality
from Products.ERP5Type.Utils import fill_args_from_request from Products.ERP5Type.Utils import fill_args_from_request
from zLOG import LOG, ERROR from zLOG import LOG, ERROR
from json import dumps
# Mixin Import # Mixin Import
from Products.ERP5.mixin.base_convertable import BaseConvertableFileMixin from Products.ERP5.mixin.base_convertable import BaseConvertableFileMixin
...@@ -273,6 +274,31 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -273,6 +274,31 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
# XXX: handle possible OOOd server failure # XXX: handle possible OOOd server failure
return response_dict['mime'], Pdata(dec(response_dict['data'])) return response_dict['mime'], Pdata(dec(response_dict['data']))
def getPresentationFileNameList(self, **kw):
"""
Get the file list of name of the converted file
"""
format ="html"
original_format = format
allowed_format_list = self.getTargetFormatList()
format_list = [x for x in allowed_format_list
if x.startswith('html') or x.endswith('html')]
format = format_list[0]
# Do real conversion
mime, data = self._getConversionFromProxyServer(format)
# Extra processing required since
# we receive a zip file
cs = cStringIO.StringIO()
cs.write(str(data))
z = zipfile.ZipFile(cs) # A disk file would be more RAM efficient
mime = 'text/html'
file_name_list = self._populateConversionCacheWithHTML(zip_file=z, **kw) # Maybe some parts should be asynchronous for
# better usability
z.close()
cs.close()
return dumps(file_name_list)
# Conversion API # Conversion API
def _convert(self, format, frame=0, **kw): def _convert(self, format, frame=0, **kw):
"""Convert the document to the given format. """Convert the document to the given format.
...@@ -353,22 +379,15 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -353,22 +379,15 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
cs = cStringIO.StringIO() cs = cStringIO.StringIO()
cs.write(str(data)) cs.write(str(data))
z = zipfile.ZipFile(cs) # A disk file would be more RAM efficient z = zipfile.ZipFile(cs) # A disk file would be more RAM efficient
for f in z.infolist():
fn = f.filename
if fn.endswith('html'):
if self.getPortalType() == 'Presentation'\
and not (fn.find('impr') >= 0):
continue
data = z.read(fn)
break
mime = 'text/html' mime = 'text/html'
self._populateConversionCacheWithHTML(zip_file=z) # Maybe some parts should be asynchronous for self._populateConversionCacheWithHTML(zip_file=z, **kw) # Maybe some parts should be asynchronous for
# better usability # better usability
z.close() z.close()
cs.close() cs.close()
if original_format not in VALID_IMAGE_FORMAT_LIST \ if original_format not in VALID_IMAGE_FORMAT_LIST \
and not requires_pdf_first: and not requires_pdf_first :
self.setConversion(data, mime, format=original_format, **kw) if not self.getPortalType() == 'Presentation':
self.setConversion(data, mime, format=original_format, **kw)
else: else:
# create temporary image and use it to resize accordingly # create temporary image and use it to resize accordingly
temp_image = self.portal_contributions.newContent( temp_image = self.portal_contributions.newContent(
...@@ -381,12 +400,11 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -381,12 +400,11 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
mime, data = temp_image.convert(original_format, frame=frame, **kw) mime, data = temp_image.convert(original_format, frame=frame, **kw)
# store conversion # store conversion
self.setConversion(data, mime, format=original_format, **kw) self.setConversion(data, mime, format=original_format, **kw)
return self.getConversion(format=original_format, **kw) return self.getConversion(format=original_format, **kw)
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'_populateConversionCacheWithHTML') '_populateConversionCacheWithHTML')
def _populateConversionCacheWithHTML(self, zip_file=None): def _populateConversionCacheWithHTML(self, zip_file=None, **kw):
""" """
Extract content from the ODF zip file and populate the document. Extract content from the ODF zip file and populate the document.
Optional parameter zip_file prevents from converting content twice. Optional parameter zip_file prevents from converting content twice.
...@@ -402,6 +420,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -402,6 +420,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
must_close = 1 must_close = 1
else: else:
must_close = 0 must_close = 0
file_name_list=[]
for f in zip_file.infolist(): for f in zip_file.infolist():
filename = f.filename filename = f.filename
document = self.get(filename, None) document = self.get(filename, None)
...@@ -416,13 +435,17 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -416,13 +435,17 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
zip_file.read(filename), zip_file.read(filename),
object=self, context=self, object=self, context=self,
mimetype=mime) mimetype=mime)
file_name_list.append(filename)
else: else:
mime = guess_content_type(filename)[0] mime = guess_content_type(filename)[0]
data = Pdata(zip_file.read(filename)) data = Pdata(zip_file.read(filename))
if ".impr." in filename and self.getPortalType() == 'Presentation':
self.setConversion(data, mime, format="html", **kw)
self.setConversion(data, mime=mime, format=EMBEDDED_FORMAT, filename=filename) self.setConversion(data, mime=mime, format=EMBEDDED_FORMAT, filename=filename)
if must_close: if must_close:
zip_file.close() zip_file.close()
archive_file.close() archive_file.close()
return file_name_list
security.declarePrivate('_convertToBaseFormat') security.declarePrivate('_convertToBaseFormat')
def _convertToBaseFormat(self): def _convertToBaseFormat(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment