Commit e12c637e authored by Lingnan Wu's avatar Lingnan Wu

add the new render presentation which now is totally based on javascript

parent a42877cf
...@@ -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,8 @@ ...@@ -75,7 +74,8 @@
<key> <string>webcontent header bottom</string> </key> <key> <string>webcontent header bottom</string> </key>
<value> <value>
<list> <list>
<string>my_title</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="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[
from json import dumps\n
\n
absolute_url = "%s" % context.absolute_url()\n
\n
return """\n
\n
var slide_total_pages=1\n
var slide_current_page=""\n
\n
function goToNewSlide(relative_path){\n
slide_current_page=relative_path;\n
$.ajax({\n
url: %(absolute_url)s+"/"+relative_path,\n
type: \'get\',\n
async: false,\n
success: function(data) {\n
$(\'#slide_content\').html(data);\n
} \n
});\n
renderNavigation();\n
resetPageSelector();\n
}\n
\n
function resetNavigation(name,id_a,id_img,class_default,class_hide){\n
$nav_default=$("a:contains(\'"+name+"\')")\n
if($nav_default.length>0){\n
$nav_default.addClass("hidden");\n
$("#"+id_a).attr("onclick","goToNewSlide(\'"+$nav_default.attr("href")+"\')");\n
$("#"+id_a).css("cursor","pointer")\n
$("#"+id_img).attr("class",class_default);\n
}\n
else\n
{\n
//remove the string without tag\n
$("#slide_content").html($("#slide_content").html().replace(name, ""));\n
$("#"+id_a).attr("onclick","");\n
$("#"+id_a).css("cursor","default")\n
$("#"+id_img).attr("class",class_hide);\n
}\n
}\n
\n
function renderNavigation(){\n
resetNavigation("First page","first_slide","first_slide_img","first","first shaded");\n
resetNavigation("Back","previous_slide","previous_slide_img","previous","previous shaded");\n
resetNavigation("Continue","next_slide","next_slide_img","next","next shaded");\n
resetNavigation("Last page","last_slide","last_slide_img","last","last shaded");\n
resetNavigation("Text","text_slide","text_slide_img","text","text hidden");\n
resetNavigation("Graphics","graphics_slide","graphics_slide_img","graphics","graphics hidden");\n
}\n
\n
function resetPageSelector(){\n
$("#slides_total_number").text(slide_total_pages);\n
$("#slide_selection_index").keyup(function(event) {\n
if (event.keyCode==13) {\n
redirectPresentationPage()\n
}\n
});\n
if(slide_current_page.indexOf("text")==-1){\n
if(parseInt(slide_current_page.replace(".html","").replace("img","")))\n
$("#slide_selection_index").val(parseInt(slide_current_page.replace(".html","").replace("img",""))+1);\n
else\n
$("#slide_selection_index").val(1);\n
}\n
else\n
if(parseInt(slide_current_page.replace(".html","").replace("text","")))\n
$("#slide_selection_index").val(parseInt(slide_current_page.replace(".html","").replace("text",""))+1);\n
else\n
$("#slide_selection_index").val(1);\n
}\n
\n
function redirectPresentationPage(){\n
//Graphic pages\n
if(slide_current_page.indexOf("text")==-1){\n
if(slide_total_pages!=1)\n
{\n
//if entered number bigger than total number, go to last page, else incorrect number go to first page\n
if( $("#slide_selection_index").val()>1 && $("#slide_selection_index").val()<slide_total_pages){\n
real_page_number=$("#slide_selection_index").val()-1;\n
goToNewSlide("img"+real_page_number+".html");\n
}\n
else if($("#slide_selection_index").val()>=slide_total_pages){\n
real_page_number=slide_total_pages-1\n
goToNewSlide("img"+real_page_number+".html");\n
}\n
else{\n
goToNewSlide("asPresentationHTML");\n
}\n
}\n
else\n
goToNewSlide("asPresentationHTML");\n
}\n
//Text pages\n
else{\n
//if entered number bigger than total number, go to last page, else incorrect number go to first page\n
if( $("#slide_selection_index").val()>1 && $("#slide_selection_index").val()<slide_total_pages){\n
real_page_number=$("#slide_selection_index").val()-1;\n
goToNewSlide("text"+real_page_number+".html");\n
}\n
else if($("#slide_selection_index").val()>=slide_total_pages){\n
real_page_number=slide_total_pages-1\n
goToNewSlide("text"+real_page_number+".html");\n
}\n
else{\n
goToNewSlide("text0.html");\n
}\n
} \n
}\n
\n
function preventEnterKeyInGlobal(){\n
$(function(){\n
var keyStop = {\n
13: "input:text", // stop enter = submit \n
end: null\n
};\n
$(document).bind("keydown", function(event){\n
var selector = keyStop[event.which];\n
if(selector !== undefined && $(event.target).is(selector)) {\n
event.preventDefault(); //stop event\n
}\n
return true;\n
});\n
});\n
}\n
\n
$(document).ready(function() {\n
goToNewSlide("asPresentationHTML");\n
var last_page_href=$("a:contains(\'Last page\')").attr("href");\n
if(last_page_href)\n
slide_total_pages=parseInt(last_page_href.replace(".html","").replace("img",""))+1;\n
else\n
slide_total_pages=1;\n
resetPageSelector();\n
preventEnterKeyInGlobal();\n
});\n
\n
""" % dict(\n
absolute_url = dumps(absolute_url)\n
)\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Presentation_renderSlidePage</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_block.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>\n
<!--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>
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