Il faut écouter l'événement « readystatechange » plutôt que « load » pour récupérer...
[Portfolio.git] / skins / portfolio_presentation_template.pt
1 <html metal:use-macro="here/content_edit_form/macros/master"
2 xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal">
3 <head>
4 <title>Portfolio presentation form</title>
5 <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
6 </head>
7 <body>
8 <div metal:fill-slot="main" tal:omit-tag="" i18n:domain="portfolio">
9 <form tal:attributes="action string:${here/absolute_url}/portfolio_presentation_form" method="post">
10
11 <h3>Page de présentation</h3>
12 <div tal:condition="not:here/hasPresentationPage">
13 <input type="submit" name="createPresentationPage" value="Créer une page de présentation"/>
14 </div>
15 <div tal:condition="here/hasPresentationPage" tal:omit-tag="">
16 <div tal:define="inputname string:presentation_page; inputvalue here/presentation_page" tal:omit-tag="">
17 <div metal:use-macro="here/wysiwyg_support/macros/wysiwygEditorBox">
18 Wysiwig Code
19 </div>
20 </div>
21 <input type="submit" name="savePresentation" value="Save" i18n:attributes="value"/>
22 <input type="submit" name="deletePresentation" value="Delete presentation" i18n:attributes="value"
23 style="float:right"/>
24 <br clear="all"/>
25 </div>
26 </form>
27 <form tal:attributes="action string:${here/absolute_url}/portfolio_presentation_form" method="post" id="sample_image_form">
28 <h3>image échantillon</h3>
29 <div>
30 <span tal:condition="not:here/samplePhotoPath" tal:omit-tag="">
31 <img tal:attributes="src string:${portal_url}/no_image.jpg" width="192" height="180" alt="No sample image defined"
32 id="sampleImageThumbnail"/>
33 </span>
34 <span tal:condition="here/samplePhotoPath" tal:omit-tag="">
35 <span tal:define="sample here/samplePhoto" tal:condition="sample" tal:omit-tag="">
36 <img tal:attributes="src sample/src;
37 alt sample/alt;
38 width sample/width;
39 height sample/height"
40 id="sampleImageThumbnail"/>
41 </span>
42 </span>
43 </div>
44 <input type="text" name="path" tal:attributes="value here/samplePhotoPath" />
45 <input type="submit" name="defineSample" tal:attributes="value python:here.samplePhotoPath is None and 'Définir...' or 'Changer...'"/>
46 &nbsp;&nbsp;
47 <input type="submit" name="deleteSample" value="Delete" i18n:attributes="value"
48 tal:attributes="class python:here.samplePhotoPath is None and 'hidden' or None" />
49
50 </form>
51 <script type="text/javascript">
52 // <!--
53 var fm = new FormManager(document.getElementById('sample_image_form'));
54 var portfolioPresentationForm = document.getElementById('sample_image_form');
55 portfolioPresentationForm.elements.namedItem("path").className = 'hidden';
56 portfolioPresentationForm.elements.namedItem("defineSample").name = 'selectSample';
57
58 fm.onBeforeSubmit = function(m, evt) {
59 if (m.submitButton.name == 'selectSample') {
60 var path = absolute_url().slice(portal_url().length);
61 var url = portal_url() + "/ckeditor/filemanager/browser/mac_finder/browser.html?Connector=connectors/plinn/connector&Type=Image&path=" + path + '/';
62 var winOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes,width=645,height=405";
63 window.open(url, 'StandaloneBrowser', winOptions);
64
65 window.SetUrl = function (url) {
66 with(m.submitButton) {
67 name = 'defineSample';
68 value = 'Valider';
69 }
70 portfolioPresentationForm.elements.namedItem('path').value = unescape(url.slice(absolute_url().length+1));
71 var thumbnail = new Image();
72 thumbnail.src = url + '/getThumbnail';
73 var img = document.getElementById('sampleImageThumbnail');
74 img.parentNode.replaceChild(thumbnail, img);
75 thumbnail.id = 'sampleImageThumbnail';
76 }
77 return 'cancelSubmit'
78 }
79 }
80 // -->
81 </script>
82 </div>
83 </body>
84 </html>