Commit 6670a490 authored by Rafael Monnerat's avatar Rafael Monnerat

Improve Image handling on SlideShow Editor and compatibitlity with Web Page.

parent e6a7601b
......@@ -61,6 +61,9 @@ from Products.ERP5Type.Document import newTempBase\n
translateString = context.Base_translateString\n
portal_status_message = ""\n
\n
if image_caption in [None, ""]:\n
image_caption = chapter_title\n
\n
session = context.ERP5RunMyDocs_acquireSession()\n
if session.has_key(\'listbox\') and len(session[\'listbox\']) > 0:\n
listbox = session[\'listbox\']\n
......@@ -75,17 +78,12 @@ if slide_type in [\'Illustration\',\'Screenshot\']:\n
test_page_path = session[\'test_page_path\']\n
test_page = context.restrictedTraverse(test_page_path)\n
\n
if slide_type == \'Illustration\':\n
if slide_type in [\'Illustration\', \'Screenshot\']:\n
if image_url != "":\n
image_id = image_url\n
else:\n
image_id = test_page.TestPage_getNextImageID(chapter_title, slide_type)\n
image = test_page.TestPage_uploadImage(image_id, file, batch_mode = True)\n
\n
if slide_type == \'Screenshot\':\n
tested = True\n
image_id = test_page.TestPage_getNextImageID(chapter_title, slide_type)\n
image = test_page.TestPage_uploadImage(image_id, file, batch_mode = True)\n
image = test_page.TestPage_uploadImage(image_id, file, batch_mode=True, image_caption=image_caption)\n
\n
listbox.append(newTempBase(context.getPortalObject(),\n
\'\',\n
......@@ -93,6 +91,7 @@ listbox.append(newTempBase(context.getPortalObject(),\n
uid = str(int_index),\n
int_index = int_index,\n
image_id = image_id,\n
image_title = image_caption,\n
slide_type = slide_type,\n
text_content = text_content,\n
slide_content = slide_content,\n
......@@ -109,7 +108,7 @@ return context.Base_redirect(\'TestPageModule_viewChapterCreationWizard\', \n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>chapter_title, slide_type, image_url, file, text_content, slide_content, tested, **kw</string> </value>
<value> <string>chapter_title, slide_type, image_url, image_caption, file, text_content, slide_content, tested=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -51,22 +51,27 @@
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
Creates a Test Page (with no text) and generates the first chapter/slide\n
Creates a Test|Web Page (with no text) and generates the first chapter/slide\n
"""\n
\n
portal_type = \'Test Page\'\n
\n
if context.getPortalType() == "Web Page Module":\n
# This should be much more clever\n
portal_type = \'Web Page\'\n
\n
from Products.ERP5Type.Document import newTempBase\n
translateString = context.Base_translateString\n
portal_status_message = translateString("Test Page created. You can now add your first chapter.")\n
portal_status_message = translateString("%s created. You can now add your first chapter." % portal_type)\n
\n
test_page = context.newContent(portal_type = \'Test Page\',\n
title = title,\n
reference = \'\'.join(c for c in (\'.\'.join(title.split(\' \'))) if c.isalnum() or c == \'.\'))\n
page = context.newContent(portal_type=portal_type,\n
title = title)\n
\n
session = context.ERP5RunMyDocs_acquireSession()\n
session[\'title\'] = title\n
session[\'author\'] = author\n
session[\'author_mail\'] = author_mail\n
session[\'test_page_path\'] = test_page.getPath()\n
session[\'test_page_path\'] = page.getPath()\n
session[\'listbox\'] = [newTempBase(context.getPortalObject(), \'\',\n
title = title,\n
uid = \'0\',\n
......
......@@ -58,7 +58,7 @@
\n
from Products.ERP5Type.Document import newTempBase\n
# Add the last chapter to the listbox\n
context.TestPageModule_createChapter(chapter_title, slide_type, image_url, \n
context.TestPageModule_createChapter(chapter_title, slide_type, image_url, image_caption,\n
file, text_content, slide_content, tested, **kw)\n
\n
translateString = context.Base_translateString\n
......@@ -105,7 +105,7 @@ for chapter in listbox[1:]:\n
<h1>"""+ title +"""</h1>"""\n
if not(image_id is None or not image_id):\n
text_content +=\'\'\'\n
<img type="image/svg+xml" alt="" src="\'\'\'+ image_id + \'\'\'?format=" width="90%"/>\'\'\'\n
<img type="image/svg+xml" title="\'\'\' + chapter.image_title + \'\'\'" alt="\'\'\' + chapter.image_title + \'\'\'" src="\'\'\'+ image_id + \'\'\'?format=" width="90%"/>\'\'\'\n
if not(slide_content is None or not slide_content):\n
text_content += """\n
"""+ slide_content\n
......@@ -166,7 +166,7 @@ return test_page.Base_redirect(\'view\', \n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>chapter_title, slide_type, image_url, file, text_content, slide_content, tested, **kw</string> </value>
<value> <string>chapter_title, slide_type, image_url, image_caption, file, text_content, slide_content, tested=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -87,6 +87,8 @@
<string>your_title</string>
<string>your_chapter_title</string>
<string>your_slide_type</string>
<string>your_image_explanation</string>
<string>your_image_caption</string>
<string>your_image_url</string>
<string>your_file</string>
<string>your_slide_content</string>
......
......@@ -94,7 +94,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Upload an Image</string> </value>
<value> <string>Upload an Embedded Image</string> </value>
</item>
</dictionary>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>display_width</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_image_caption</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</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>description</string> </key>
<value> <string>Caption of the image that will be used when generate Books.</string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>90</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Image Caption (Default is Chapter Title)</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_image_explanation</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</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>default</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />\n
Images information will be only considered if you use Screenshot or Illustration.\n
<br />\n
If you define Image URL, the file uploaded will be ignored.
]]></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_label_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string encoding="cdata"><![CDATA[
&nbsp;
]]></string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -11,6 +11,7 @@
<value>
<list>
<string>description</string>
<string>enabled</string>
<string>title</string>
</list>
</value>
......@@ -53,6 +54,16 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -80,6 +91,10 @@
<key> <string>description</string> </key>
<value> <string>Check it if you want to add a sample test to this chapter.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
......@@ -102,4 +117,17 @@
</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>python: here.getPortalType() == \'Test Page\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -57,7 +57,7 @@
"""\n
\n
path = context.getPath()\n
image_id = title + "_" + slide_type\n
image_id = title.lower() + "_" + slide_type.lower()\n
\n
# We replace all the whitespaces by dots\n
image_id = \'\'.join(c for c in (\'_\'.join(image_id.split(\' \'))) if c.isalnum() or c == \'_\')\n
......
......@@ -56,41 +56,38 @@
\n
translateString = context.Base_translateString\n
\n
msg = \'Slide created.\'\n
if image_caption in ["", None]:\n
image_caption = chapter_title\n
\n
if edit_mode == 1:\n
msg = \'Slide updated.\'\n
if edit_mode:\n
msg = translateString(\'Slide updated.\')\n
else:\n
msg = translateString(\'Slide created.\')\n
\n
def createImage(image_id):\n
return context.newContent(portal_type = \'Embedded File\',\n
title = image_id,\n
id = image_id,\n
reference = image_id,\n
short_title = image_id)\n
title=image_caption,\n
id=image_id)\n
\n
if slide_type in [\'Screenshot\', \'Illustration\']:\n
if slide_type in [\'Screenshot\', \'Illustration\'] and upload_image:\n
if not(file is None or not file):\n
if edit_mode:\n
if image_id is None or not image_id:\n
image = createImage(context.TestPage_getNextImageID(chapter_title, slide_type))\n
else:\n
try:\n
image = context.restrictedTraverse(context.getPath() + \'/\' + image_id)\n
except:\n
if not batch_mode:\n
image_id = context.TestPage_getNextImageID(chapter_title, slide_type)\n
image = createImage(image_id)\n
msg += \' Image %s created.\' % image_id\n
else:\n
if not batch_mode:\n
image_id = context.TestPage_getNextImageID(chapter_title, slide_type)\n
image = createImage(image_id)\n
msg += \' Image \' + image_id + \' created.\'\n
msg += \' Image %s created.\' % image_id\n
\n
if not(file is None or not file):\n
image.edit(file=file, \n
data=file.read(), \n
filename=file.filename)\n
\n
msg += \' Image uploaded.\'\n
image.edit(file=file)\n
\n
msg += \' Image content uploaded to %s.\' % image.getRelativeUrl()\n
\n
if image_caption not in ["", None]:\n
image.setTitle(image_caption)\n
\n
if batch_mode:\n
return image\n
......@@ -102,7 +99,7 @@ context.Base_redirect(form_id,\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>image_id, file, edit_mode = 0, slide_type = \'Illustration\', chapter_title = \'\', batch_mode = False, **kw</string> </value>
<value> <string>image_id, file, edit_mode = 0, slide_type = \'Illustration\', chapter_title = \'\', batch_mode = False, image_caption = None, upload_image = 1, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -95,11 +95,14 @@
<list>
<string>your_chapter_title</string>
<string>your_slide_type</string>
<string>your_image_caption</string>
<string>your_image_id</string>
<string>your_file</string>
<string>your_image_url</string>
<string>your_slide_content</string>
<string>your_text_content</string>
<string>your_tested</string>
<string>your_image_id</string>
<string>your_upload_image</string>
</list>
</value>
</item>
......
......@@ -11,6 +11,7 @@
<value>
<list>
<string>display_width</string>
<string>extra</string>
<string>required</string>
</list>
</value>
......@@ -84,6 +85,10 @@
<key> <string>display_width</string> </key>
<value> <int>40</int> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string>required="required"</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_title</string> </value>
......@@ -94,7 +99,7 @@
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_image_caption</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</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>description</string> </key>
<value> <string>Caption of the image that will be used when generate Books.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Image Caption</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -84,11 +84,11 @@
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_title</string> </value>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewTestPageFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>required</string> </key>
......@@ -100,7 +100,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Image ID</string> </value>
<value> <string>Embedded Image ID</string> </value>
</item>
</dictionary>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_image_url</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</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>description</string> </key>
<value> <string>The URL to the image, you can use relative urls or image reference.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Image URL</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -11,6 +11,7 @@
<value>
<list>
<string>description</string>
<string>enabled</string>
<string>title</string>
</list>
</value>
......@@ -53,6 +54,16 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -80,6 +91,10 @@
<key> <string>description</string> </key>
<value> <string>Check it if you want to add a sample test to this chapter.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
......@@ -102,4 +117,17 @@
</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>python: here.getPortalType() == \'Test Page\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_upload_image</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</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>description</string> </key>
<value> <string>Do you want to upload a new image on ERP5?</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Upload New Image?</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -95,13 +95,16 @@
<list>
<string>your_chapter_title</string>
<string>your_slide_type</string>
<string>your_image_caption</string>
<string>your_image_id</string>
<string>your_file</string>
<string>your_image_url</string>
<string>your_slide_content</string>
<string>your_text_content</string>
<string>your_tested</string>
<string>your_not_tested</string>
<string>your_image_id</string>
<string>your_edit_mode</string>
<string>your_upload_image</string>
</list>
</value>
</item>
......
......@@ -94,7 +94,7 @@
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_image_caption</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</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>description</string> </key>
<value> <string>Caption of the image that will be used when generate Books.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Image Caption</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -12,6 +12,7 @@
<list>
<string>css_class</string>
<string>description</string>
<string>extra</string>
<string>required</string>
<string>title</string>
</list>
......@@ -82,13 +83,17 @@
<key> <string>description</string> </key>
<value> <string>Don\'t modify it manually.</string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string>readonly="readonly"</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_title</string> </value>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewTestPageFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>required</string> </key>
......@@ -100,7 +105,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Image ID</string> </value>
<value> <string>Embedded Image ID (Read Only)</string> </value>
</item>
</dictionary>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_image_url</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</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>description</string> </key>
<value> <string>The URL to the image, you can use relative urls or image reference.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Image URL</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>description</string>
<string>title</string>
</list>
......@@ -53,6 +54,16 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<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>field_id</string> </key>
<value> <string></string> </value>
......@@ -76,6 +87,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Check it if you want to remove the current test from this chapter.</string> </value>
......@@ -102,4 +117,17 @@
</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>python: here.getPortalType() == \'Web Page\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -11,6 +11,7 @@
<value>
<list>
<string>description</string>
<string>enabled</string>
<string>title</string>
</list>
</value>
......@@ -53,6 +54,16 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -80,6 +91,10 @@
<key> <string>description</string> </key>
<value> <string>Check it if you want to add a sample test to this chapter.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
......@@ -102,4 +117,17 @@
</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>python: here.getPortalType() == \'Test Page\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_upload_image</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</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>description</string> </key>
<value> <string>Do you want to upload a new image on ERP5?</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Upload New Image?</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -51,6 +51,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
var slideList, textContent, testPageHTML, addSlideIframe, addSlideIframeContents, editSlideIframe, editSlideIframeContents, slideNumber;\n
var $dialogEdit;\n
\n
function isUrl(s) {\n
// Test if the string is a URL or a relative path (contains a/b/..)\n
var regexurl = /(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/\n
return regexurl.test(s) || (s.split("?")[0].indexOf("/") != -1);\n
}\n
\n
//Remove a slide\n
function removeClick(trigger){\n
slideNumber = parseInt($(trigger).attr(\'id\').split(\'_\')[2]);\n
......@@ -121,13 +127,71 @@ function updateTextContent(){\n
var images = $(\'#list > section > img\');\n
removeImagesURLAttrib(images,\'display\');\n
removeImagesURLAttrib(images,\'timestamp\');\n
changeImagesURLAttrib(images,\'format\',\'\');\n
// changeImagesURLAttrib(images,\'format\',\'\');\n
body.append($(\'#list > section\').clone());\n
changeImagesURLAttrib(images,\'display\',\'xsmall\');\n
// changeImagesURLAttrib(images,\'display\',\'xsmall\');\n
body[0].innerHTML = indent(body[0].cloneNode(true), 2);\n
$(textContent).text(body[0].innerHTML);\n
}\n
\n
function updateImageInput(frameContent){ \n
var className = $(\'select[name="field_your_slide_type"]\', frameContent).val();\n
if (className == \'Screenshot\' || className == \'Illustration\') {\n
$(\'input[name="field_your_image_caption"]\', frameContent).parent().parent().removeClass(\'hidden\');\n
if (!$(\'input[name="field_your_upload_image"]\', frameContent).is(\':checked\')) {\n
$(\'input[name="field_your_image_url"]\', frameContent).parent().parent().removeClass(\'hidden\');\n
}\n
$(\'input[name="field_your_upload_image"]\', frameContent).parent().parent().removeClass(\'hidden\');\n
}\n
else {\n
$(\'input[name="field_your_image_caption"]\', frameContent).parent().parent().addClass(\'hidden\');\n
$(\'input[name="field_your_image_url"]\', frameContent).parent().parent().addClass(\'hidden\');\n
$(\'input[name="field_your_image_id"]\', frameContent).parent().parent().addClass(\'hidden\');\n
$(\'input[name="field_your_file"]\', frameContent).parent().parent().addClass(\'hidden\');\n
$(\'input[name="field_your_upload_image"]\', frameContent).parent().parent().addClass(\'hidden\');\n
$(\'input[name="field_your_upload_image"]\', frameContent).attr(\'checked\', false);\n
}\n
}\n
\n
function updateUploadImageInput(frameContent){\n
var className = $(\'select[name="field_your_slide_type"]\', frameContent).val();\n
if ($(\'input[name="field_your_upload_image"]\', frameContent).is(\':checked\')) {\n
$(\'input[name="field_your_file"]\', frameContent).parent().parent().removeClass(\'hidden\');\n
$(\'input[name="field_your_image_url"]\', frameContent).parent().parent().addClass(\'hidden\');;\n
$(\'input[name="field_your_image_id"]\', frameContent).parent().parent().removeClass(\'hidden\')\n
$(\'input[name="field_your_image_id"]\', frameContent).removeClass(\'hidden\');\n
var targetFrameContent = frameContent;\n
image_id = $(\'input[name="field_your_image_id"]\', frameContent).val()\n
if (isUrl(image_id) || image_id == "") {\n
get_image_id_url = \'TestPage_getNextImageID?title=\' + $(\'input[name="field_your_chapter_title"]\', frameContent).val() + \'&slide_type=\' + className\n
$.get(get_image_id_url, function(data, textStatus, jqXHR){\n
$(\'input[name="field_your_image_id"]\', targetFrameContent).val(data);\n
});\n
}\n
} else {\n
$(\'input[name="field_your_file"]\', frameContent).parent().parent().addClass(\'hidden\');\n
$(\'input[name="field_your_image_id"]\', frameContent).parent().parent().addClass(\'hidden\');\n
if (className == \'Screenshot\' || className == \'Illustration\') {\n
$(\'input[name="field_your_image_url"]\', frameContent).parent().parent().removeClass(\'hidden\');\n
}\n
$(\'input[name="field_your_image_id"]\', frameContent).val($(\'input[name="field_your_image_url"]\', frameContent).val());\n
}\n
}\n
\n
function createNewImageTag(working_frame){\n
var image = $(\'<img>\');\n
if (!$(\'input[name="field_your_upload_image"]\', working_frame).is(\':checked\')) {\n
image.attr(\'src\', $(\'input[name="field_your_image_url"]\', working_frame).val());\n
} else {\n
image.attr(\'src\', $(\'input[name="field_your_image_id"]\', working_frame).val() + \'?format=\');\n
}\n
// Bad hardcoding for type\n
image.attr(\'type\', \'image/svg+xml\');\n
image_caption = $(\'input[name="field_your_image_caption"]\', working_frame).val()\n
image.attr(\'title\', image_caption).attr(\'alt\', image_caption);\n
return image\n
}\n
\n
//Change/add a GET attribute in the src url of an image (located after the question mark in the url)\n
function changeImagesURLAttrib(images, attname, attval){\n
var n = images.length;\n
......@@ -157,7 +221,7 @@ function changeImagesURLAttrib(images, attname, attval){\n
}\n
}\n
\n
//Remove a GET attribute in the src url of an image (located after the question mark in the url)\n
// Remove a GET attribute in the src url of an image (located after the question mark in the url)\n
function removeImagesURLAttrib(images, attname){\n
var n = images.length;\n
for(var i = 0; i < n; i++){\n
......@@ -178,8 +242,12 @@ function removeImagesURLAttrib(images, attname){\n
}\n
if(notFound)\n
img.attr(\'src\', img.attr(\'src\'));\n
else\n
img.attr(\'src\', url + \'?\' + attrbs.join(\'&\'));\n
else {\n
complement = "";\n
if (attrbs.length > 0)\n
complement = \'?\' + attrbs.join(\'&\');\n
img.attr(\'src\', url + complement);\n
}\n
}\n
else\n
img.attr(\'src\', url);\n
......@@ -204,7 +272,7 @@ $(document).ready(function(){\n
$(tmp).html($(textContent).text());\n
$(\'body\',testPageHTML).append($(\'section\', tmp));\n
body = $(\'section\', testPageHTML);\n
changeImagesURLAttrib($(\'> img\', body),\'display\',\'xsmall\');\n
// changeImagesURLAttrib($(\'> img\', body),\'display\',\'xsmall\');\n
slideList = $(\'#list\');\n
slideList.append(body);\n
body = $(\'body\', testPageHTML); \n
......@@ -232,6 +300,10 @@ $(document).ready(function(){\n
addSlideIframe.load(function() {\n
function initFrame(){ \n
addSlideIframeContents = addSlideIframe.contents();\n
updateImageInput(addSlideIframeContents);\n
updateUploadImageInput(addSlideIframeContents);\n
$(\'input[name="field_your_upload_image"]\', addSlideIframeContents).click(function() {updateUploadImageInput(addSlideIframeContents);});\n
$(\'select[name="field_your_slide_type"]\', addSlideIframeContents).change(function() {updateImageInput(addSlideIframeContents);});\n
var submit_button = $("#dialog_submit_button", addSlideIframeContents).click(function(){\n
var section = document.createElement("section");\n
var className = $(\'select[name="field_your_slide_type"]\', addSlideIframeContents).val();\n
......@@ -239,17 +311,18 @@ $(document).ready(function(){\n
var title = document.createElement("h1");\n
$(title).html($(\'input[name="field_your_chapter_title"]\', addSlideIframeContents).val());\n
var details = document.createElement("details");\n
$(details).attr("open", "true")\n
$(details).html($(\'textarea[name="field_your_text_content"]\', addSlideIframeContents).val());\n
$(section).append($(title));\n
var image_id = "";\n
var isScreenshot = className == \'Screenshot\';\n
\n
//Append a new slide, update HTML Code\n
// Append a new slide, update HTML Code\n
function appendSection(){\n
$(section).append($(\'textarea[name="field_your_slide_content"]\', addSlideIframeContents).val());\n
$(section).append($(details));\n
var isTested = $(\'input[name="field_your_tested"]\', addSlideIframeContents).attr(\'checked\');\n
if(isScreenshot || isTested == \'checked\' || isTested){\n
if((isTested == \'checked\' || isTested) && (image_id != "")){\n
var test = createTest();\n
appendTestLine(test, "selectAndWait", "name=select_module", "label=Test Pages");\n
appendTestLine(test, "verifyTextPresent", "Test Pages", ""); \n
......@@ -266,18 +339,14 @@ $(document).ready(function(){\n
$(section).hover(function() {slideHover(this);}, function(){slideOut(this);}).mousedown(function() {slideOut(this);});\n
updateTextContent();\n
}\n
if(isScreenshot || className == \'Illustration\'){\n
$.get(\'TestPage_getNextImageID?title=\' + $(\'input[name="field_your_chapter_title"]\', addSlideIframeContents).val() + \'&slide_type=\' + className, function(data, textStatus, jqXHR){\n
image_id = data;\n
$(\'input[name="field_your_image_id"]\', addSlideIframeContents).val(image_id);\n
var image = $(\'<img>\');\n
image.attr(\'src\', image_id + \'?format=\');\n
image.attr(\'type\', \'image/svg+xml\');\n
if(isScreenshot || className == \'Illustration\') {\n
image = createNewImageTag(addSlideIframeContents);\n
image_id = "";\n
if (!isUrl(image.attr(\'src\'))) {\n
image_id = image.attr(\'src\');\n
}\n
$(section).append(image);\n
appendSection();\n
});\n
}\n
else\n
appendSection();\n
});\n
}\n
......@@ -317,8 +386,22 @@ $(document).ready(function(){\n
return false;\n
}\n
var slide = $(\'section:eq(\'+slideNumber+\')\', slideList);\n
changeImagesURLAttrib($(\'> img:first\', slide), \'timestamp\', new Date().getTime()); //This updates the image displayed\n
// This updates the image displayed\n
var img = $(\'> img:first\', slide);\n
editSlideIframeContents = editSlideIframe.contents();\n
updateUploadImageInput(editSlideIframeContents);\n
$(\'input[name="field_your_upload_image"]\', editSlideIframeContents).click(function() {updateUploadImageInput(editSlideIframeContents);});\n
$(\'select[name="field_your_slide_type"]\', editSlideIframeContents).change(function() {updateImageInput(editSlideIframeContents);});\n
if(img.length > 0) {\n
$(\'input[name="field_your_image_id"]\', editSlideIframeContents).val(img.attr(\'src\').split(\'?\')[0]);\n
$(\'input[name="field_your_image_caption"]\', editSlideIframeContents).val(img.attr(\'title\'));\n
//if(isUrl(img.attr(\'src\')))\n
removeImagesURLAttrib(img,\'timestamp\');\n
$(\'input[name="field_your_image_url"]\', editSlideIframeContents).val(img.attr(\'src\'));\n
} else \n
updateImageInput(editSlideIframeContents);\n
\n
changeImagesURLAttrib($(\'> img:first\', slide), \'timestamp\', new Date().getTime()); \n
$(\'input[name="field_your_chapter_title"]\', editSlideIframeContents).val($(\'h1:first\', slide).html().trim());\n
if (slide.attr(\'class\') != null) {\n
$(\'select[name="field_your_slide_type"]\', editSlideIframeContents).val(slide.attr(\'class\').replace(/^\\w/, function($0) { return $0.toUpperCase(); }));\n
......@@ -327,9 +410,7 @@ $(document).ready(function(){\n
$("h1:first, img:first, details, test", tmpSlide).remove();\n
$(\'textarea[name="field_your_slide_content"]\', editSlideIframeContents).val(tmpSlide.html().trim());\n
$(\'textarea[name="field_your_text_content"]\', editSlideIframeContents).val($(\'details\', slide).html().trim());\n
var img = $(\'img:first\', slide);\n
if(img.length > 0)\n
$(\'input[name="field_your_image_id"]\', editSlideIframeContents).val(img.attr(\'src\').split(\'?\')[0])\n
\n
var hasTest = $(\'test\', slide).length > 0;\n
if(hasTest){\n
$(\'input[name="field_your_not_tested"]\', editSlideIframeContents).parent().parent().attr(\'class\',\'field\');\n
......@@ -347,14 +428,18 @@ $(document).ready(function(){\n
var className = $(\'select[name="field_your_slide_type"]\', editSlideIframeContents).val();\n
slide.attr(\'class\', className.toLowerCase());\n
$(\'details\', slide).html($(\'textarea[name="field_your_text_content"]\', editSlideIframeContents).val().trim());\n
$("section > :not(h1:first, img:first, details, test)", slide).remove();\n
$("section > (h1:first, img:first)", slide).filter(\':last\').after($(\'textarea[name="field_your_slide_content"]\', editSlideIframeContents).val().trim());\n
$(\'details\', slide).attr("open", "true")\n
$("> :not(h1:first, img:first, details, test)", slide).remove();\n
// Remove also the standalone text inputed by the user.\n
slide.contents().filter(function(){return this.nodeType === 3;}).remove();\n
// Read from Slide editor\n
$(" > h1:first, img:first", slide).filter(\':last\').after($(\'textarea[name="field_your_slide_content"]\', editSlideIframeContents).val().trim());\n
var image_id = "";\n
var isScreenshot = className == \'Screenshot\';\n
function appendSection(){\n
var isTested = $(\'input[name="field_your_tested"]\', editSlideIframeContents).attr(\'checked\');\n
var removeTest = $(\'input[name="field_your_not_tested"]\', editSlideIframeContents).attr(\'checked\');\n
if(!hasTest && (isScreenshot || isTested == \'checked\' || isTested)){\n
if(!hasTest && (isTested == \'checked\' || isTested) && (image_id != "")){\n
var test = createTest();\n
appendTestLine(test, "selectAndWait", "name=select_module", "label=Test Pages");\n
appendTestLine(test, "verifyTextPresent", "Test Pages", ""); \n
......@@ -370,21 +455,23 @@ $(document).ready(function(){\n
if(isScreenshot || className == \'Illustration\'){\n
var img = $(\'img:first\', slide);\n
if(img.length > 0){\n
appendSection();\n
var image_caption = $(\'input[name="field_your_image_caption"]\', editSlideIframeContents).val()\n
if (image_caption.length > 0)\n
img.attr(\'title\', image_caption).attr(\'alt\', image_caption);\n
var image_url = $(\'input[name="field_your_image_url"]\', editSlideIframeContents).val();\n
if (isUrl(image_url)) {\n
image_id = "";\n
}\n
else{\n
$.get(\'TestPage_getNextImageID?title=\' + $(\'input[name="field_your_chapter_title"]\', addSlideIframeContents).val() + \'&slide_type=\' + className, function(data, textStatus, jqXHR){\n
image_id = data;\n
$(\'input[name="field_your_image_id"]\', addSlideIframeContents).val(image_id);\n
var image = $(\'<img>\');\n
image.attr(\'src\', image_id + \'?format=\');\n
image.attr(\'type\', \'image/svg+xml\');\n
$("section > (h1:first, img:first)", slide).after(image);\n
appendSection();\n
});\n
img.attr(\'src\', image_url)\n
} else {\n
image = createNewImageTag(editSlideIframeContents);\n
image_id = "";\n
if (!isUrl(image.attr(\'src\'))) {\n
image_id = image.attr(\'src\');\n
}\n
$("> h1:first", slide).after(image);\n
}\n
else\n
} \n
appendSection();\n
});\n
}\n
......
42
\ No newline at end of file
43
\ No newline at end of file
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