1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
6 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
7 <title>Embedded images</title>
8 <style type="text/css" media="screen">
9 a, a:hover, a:active, a:visited {
32 border: 1px solid #ddd;
35 .lightbox .slide img {
37 border: 1px solid black;
40 .lightbox span.button {
45 .lightbox span[class].button {
49 .lightbox span:hover span.button {
54 <script type="text/javascript" language="javascript" charset="utf-8" src="epoz_script_detect.js"></script>
55 <script type="text/javascript" language="javascript" charset="utf-8" src="javascript_events_api.js"></script>
56 <script type="text/javascript" language="javascript" charset="utf-8" src="sarissa.js"></script>
57 <script type="text/javascript" language="javascript" charset="utf-8" src="DHTMLapi.js"></script>
58 <script type="text/javascript">
60 // var FCK = window.parent.FCK;
61 // var contentPath = FCK.Config.contentPath;
63 // var FCKConfig = window.parent.FCKConfig;
64 // var connUrl = FCKConfig.AttachmentBrowserConnectorUrl;
66 var editor = window.parent.editor;
67 var contentPath = editor.contentPath;
68 var connUrl = window.parent.editor.config.attachmentBrowserConnectorUrl;
72 function _initBrowser(){
73 var form = document.getElementById('uploadAttachmentForm');
74 form.elements['path'].value = contentPath;
75 var loc = window.location;
76 form.elements['redirUrl'].value = loc.protocol + '//' + loc.host + loc.pathname;
77 form.action = connUrl;
78 addListener(document.getElementById('slides'), 'click', handleClick)
82 function importAttachments() {
83 var req = new XMLHttpRequest();
84 req.open("POST", connUrl, false); // synchrone
85 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
86 req.send("command=ls&path="+escape(contentPath));
87 var respDom = req.responseXML.documentElement;
89 var rows = respDom.getElementsByTagName('row');
90 var row, img, slide, a;
91 var slides = document.getElementById('slides');
93 for (var i = 0 ; i<rows.length ; i++)
94 addControlThumbnail(rows[i], slides);
97 function addControlThumbnail(row, dest) {
98 var slide = document.createElement('span');
100 var a = document.createElement('a');
101 a.href = row.getAttribute('url');
102 a.className = 'slide';
104 var img = document.createElement('img');
105 img.src = row.getAttribute('previewUrl');
106 img.width = row.getAttribute('width');
107 img.height = row.getAttribute('height');
108 img.style.marginTop = (slide_size - parseInt(img.height)) / 2 + 'px';
109 img.style.marginLeft = (slide_size - parseInt(img.width)) / 2 + 'px';
113 slide.appendChild(a);
114 dest.appendChild(slide);
116 var spanButton = document.createElement('span');
117 spanButton.className = 'button';
118 var a = document.createElement('a');
120 a.text = "Supprimer";
122 spanButton.appendChild(a);
123 slide.appendChild(spanButton);
125 var spanButtonWidth = getObjectWidth(a);
126 var spanButtonHeight = getObjectHeight(a);
127 spanButton.style.width = spanButtonWidth + 'px';
128 spanButton.style.height = spanButtonHeight + 'px';
129 spanButton.style.top = slide_size - spanButtonHeight - 3 + 'px';
130 spanButton.style.left = slide_size - spanButtonWidth - 3 + 'px';
133 function handleClick(evt) {
134 var target = getTargetedObject(evt);
136 disablePropagation(evt);
137 switch (target.tagName) {
139 var a = target.parentNode;
140 window.parent.updateOrInsertImage(a.getAttribute('href', 2));
143 if (target.name == 'suppr')
144 var a = target.parentNode.parentNode.getElementsByTagName('a')[0];
145 var href = a.getAttribute('href', 2);
146 var imgPath = window.parent.editor.FCKConfig.EditorPath + href;
148 var req = new XMLHttpRequest();
149 req.open("POST", connUrl, false); // synchrone
150 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
151 req.send("command=rm&path="+escape(imgPath));
152 var doc = req.responseXML.documentElement;
153 if (doc.tagName == 'done') {
154 var slide = target.parentNode.parentNode;
155 slide.parentNode.removeChild(slide);
161 addListener(window, 'load', _initBrowser);
166 <body i18n:domain="plinn">
167 <form id="uploadAttachmentForm" action="." method="post" enctype="multipart/form-data">
168 <input type="file" name="file"/>
169 <input type="hidden" name="path" value="" />
170 <input type="hidden" name="command" value="upload" />
171 <input type="hidden" name="Type" value="Photo" />
172 <input type="hidden" name="redirUrl" value="">
173 <input type="submit" name="upload" value="Upload" i18n:attributes="value"/>
175 <div id="slides" class="lightbox"></div>