/[drupal]/contributions/modules/imc_alba/upload_module_img_fckeditor_support.diff
ViewVC logotype

Contents of /contributions/modules/imc_alba/upload_module_img_fckeditor_support.diff

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Sat Apr 26 19:11:57 2008 UTC (19 months ago) by tomm
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, DRUPAL-6--1-1, DRUPAL-6--1-2, HEAD
Branch point for: DRUPAL-6--1
File MIME type: text/x-diff
oops. add upload module diff crud
1 diff -u -r -N ../../../modules/upload/CVS/Entries upload/CVS/Entries
2 --- ../../../modules/upload/CVS/Entries 2008-03-28 16:29:16.000000000 +0000
3 +++ upload/CVS/Entries 2008-03-19 13:19:36.000000000 +0000
4 @@ -1,5 +1,5 @@
5 /upload.admin.inc/1.7/Sun Jan 13 13:17:56 2008//TDRUPAL-6
6 /upload.info/1.4/Fri Jun 8 05:50:57 2007//TDRUPAL-6
7 /upload.install/1.6.2.1/Thu Feb 14 15:24:42 2008//TDRUPAL-6
8 -/upload.module/1.197.2.1/Fri Mar 28 16:29:16 2008//TDRUPAL-6
9 +/upload.module/1.197.2.1/Thu Feb 14 15:24:42 2008//TDRUPAL-6
10 D
11 diff -u -r -N ../../../modules/upload/insertotherpopup.html upload/insertotherpopup.html
12 --- ../../../modules/upload/insertotherpopup.html 1970-01-01 01:00:00.000000000 +0100
13 +++ upload/insertotherpopup.html 2008-04-20 12:36:06.000000000 +0100
14 @@ -0,0 +1,146 @@
15 +<html xmlns="http://www.w3.org/1999/xhtml">
16 +<head>
17 + <title>Insert an image</title>
18 + <script type="text/javascript" src="/misc/jquery.js"></script>
19 + <script type="text/javascript" src="/misc/drupal.js"></script>
20 + <style type="text/css">
21 +a { color: #700; cursor: pointer; }
22 +a:hover { color: #f00; }
23 +body {
24 + font-size: 90%;
25 + font: 13px/1.5 "Arial", sans-serif;
26 +}
27 +td { padding: 0.5em; margin: 0px; }
28 +td.date { font-size: 80%; color: #555; }
29 +td.node-title { font-size: 80%; }
30 +td.filename { font-size: 80%; }
31 +td.insert { font-size: 80%; }
32 +tr.zebra1 { background-color: #ddf; }
33 +tr.zebra0 { background-color: #eef; }
34 +table { width: 100%; border-collapse: collapse; }
35 +div.pager { text-align: center; }
36 +.imgpreview { font-size: 80%; }
37 +th { font-size: 80%; font-weight: bold; }
38 +h2 { color: #700; }
39 +#breadcrumb { color: #700; font-size: 120%; }
40 +
41 + </style>
42 + <script type="text/javascript">
43 +
44 + $(document).ready(function() {
45 + $("#wank").click(function() {
46 + var oEditor = window.opener.oooFCKeditorAPI.GetInstance( window.opener.oooFckName ) ;
47 + //var oEditor = FCKeditorAPI.GetInstance(fckLaunchedJsId[0]) ;
48 + //oEditor.InsertHtml("<p>Poohat</p>");
49 + oEditor.InsertHtml("<p>Poohat</p>");
50 + });
51 + });
52 +
53 +var gPage = 0;
54 +
55 +function clickedNode(nid) {
56 + $.getJSON("/upload/ajax_get_article_files?nid="+nid, function(data) {
57 + updateContent(data['status'], data['files']);
58 + drawPager(0);
59 + });
60 +}
61 +
62 +function clickedFile(filepath) {
63 + var oEditor = window.opener.oooFCKeditorAPI.GetInstance( window.opener.oooFckName ) ;
64 + var imgtag = "<img src=\""+filepath+"\" alt=\"\" />";
65 + oEditor.InsertHtml(imgtag);
66 +}
67 +
68 +function makeNodeLink(info) {
69 + return '<td class="date">'+info['created']+'</td><td class="node-title"><a onclick="clickedNode('+info['nid']+');">'+info['title']+'</a></td>';
70 +}
71 +
72 +function min(a,b) {
73 + return a<b?a:b;
74 +}
75 +
76 +function max(a,b) {
77 + return a>b?a:b;
78 +}
79 +
80 +function drawPager(numPages) {
81 + if ((!numPages) || numPages==1) {
82 + $('#pager-wrapper-top').html('');
83 + $('#pager-wrapper-bottom').html('');
84 + } else {
85 + var out = '';
86 + if (gPage > 1) out += '<a onclick="gPage=0; goToRoot();">first</a> ';
87 + if (gPage > 0) out += '<a onclick="gPage--; goToRoot();">previous</a> ';
88 + var _min = max(gPage-4,0);
89 + var _max = min(_min+9,numPages);
90 + for (var x=_min; x<_max; x++) {
91 + if (gPage == x) out += ' '+(x+1)+' ';
92 + else out += ' <a onclick="gPage='+x+'; goToRoot();">'+(x+1)+'</a> ';
93 + }
94 + if (gPage < numPages-1) {
95 + out += '<a onclick="gPage++; goToRoot();">next</a> ';
96 + }
97 + $('#pager-wrapper-top').html(out);
98 + $('#pager-wrapper-bottom').html(out);
99 + }
100 +}
101 +
102 +function goToRoot() {
103 + if (gPage < 0) gPage = 0;
104 + $.getJSON("/upload/ajax_get_article_files?page="+gPage, function(data) {
105 + //alert(data['status']);
106 + updateContent(data['status'], data['articles']);
107 + drawPager(data['pages']);
108 + });
109 +}
110 +
111 +function makeFileLink(info) {
112 + var out = '';
113 + if (info['thumbpath']) {
114 + out += '<td class="imgpreview"><img src="'+info['thumbpath']+'" />';
115 + out += '<div class="imgpreview">'+info['filename']+'</div></td>';
116 + out += '<td class="insert">';
117 + out += '<p><a onclick="clickedFile(\''+info['thumbpath']+'\');">(thumbnail)</a></p>';
118 + out += '<p><a onclick="clickedFile(\''+info['filepath']+'\');">(full-sized)</a></p>';
119 + out += '</td>';
120 + } else {
121 + out += '<td class="filename"><a onclick="clickedFile(\''+info['filepath']+'\');">'+info['filename']+'</a></td>';
122 + }
123 + return out;
124 +}
125 +
126 +function updateContent(state, data) {
127 + var out = '<table>';
128 + if (state == 'nodes') {
129 + $('#breadcrumb').html('');
130 + for (var i=0; i<data.length; i++) {
131 + out += '<tr class="zebra'+(i&1)+'">'+makeNodeLink(data[i])+'</tr>';
132 + }
133 + } else if (state == 'files') {
134 + $('#breadcrumb').html('<a onclick="goToRoot();">.. go back</a></td></tr>');
135 + out += '<tr><th>&nbsp;</th><th>Insert</th></tr>';
136 + for (var i=0; i<data.length; i++) {
137 + out += '<tr class="zebra'+(i&1)+'">'+makeFileLink(data[i])+'</tr>';
138 + }
139 + }
140 + out += '</table>';
141 + $('#list-wrapper').html(out);
142 +}
143 +
144 +$(document).ready(function() {
145 + goToRoot();
146 +});
147 +
148 + </script>
149 +<body>
150 +<div id="wrapper">
151 + <h2>Insert images from an article</h2>
152 + <div class="content">
153 + <div class="pager" id="pager-wrapper-top"></div>
154 + <div id="breadcrumb"></div>
155 + <div id="list-wrapper"></div>
156 + <div class="pager" id="pager-wrapper-bottom"></div>
157 + </div>
158 +</div>
159 +</body>
160 +</html>
161 diff -u -r -N ../../../modules/upload/upload.admin.inc upload/upload.admin.inc
162 --- ../../../modules/upload/upload.admin.inc 2008-01-13 13:17:56.000000000 +0000
163 +++ upload/upload.admin.inc 2008-03-23 12:44:48.000000000 +0000
164 @@ -10,13 +10,17 @@
165 form_set_error('upload_max_resolution', t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.'));
166 }
167 }
168 -
169 +
170 + $thumbnail_size = $form_state['values']['upload_thumbnail_width'];
171 $default_uploadsize = $form_state['values']['upload_uploadsize_default'];
172 $default_usersize = $form_state['values']['upload_usersize_default'];
173
174 $exceed_max_msg = t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))) .'<br/>';
175 $more_info = t("Depending on your server environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory.");
176
177 + if (!is_numeric($thumbnail_size) || ($thumbnail_size <= 0)) {
178 + form_set_error('upload_thumbnail_width', t('The thumbnail width must be a number and greater than zero.'));
179 + }
180 if (!is_numeric($default_uploadsize) || ($default_uploadsize <= 0)) {
181 form_set_error('upload_uploadsize_default', t('The %role file size limit must be a number and greater than zero.', array('%role' => t('default'))));
182 }
183 @@ -73,6 +77,14 @@
184 '#description' => t('The maximum allowed image size (e.g. 640x480). Set to 0 for no restriction. If an <a href="!image-toolkit-link">image toolkit</a> is installed, files exceeding this value will be scaled down to fit.', array('!image-toolkit-link' => url('admin/settings/image-toolkit'))),
185 '#field_suffix' => '<kbd>'. t('WIDTHxHEIGHT') .'</kbd>'
186 );
187 + $form['settings_general']['upload_thumbnail_width'] = array(
188 + '#type' => 'textfield',
189 + '#title' => t('Width of generated thumbnails'),
190 + '#default_value' => variable_get('upload_thumbnail_width', UPLOAD_DEFAULT_THUMBNAIL_WIDTH),
191 + '#size' => 15,
192 + '#maxlength' => 4,
193 + '#description' => t('When images are attached thumbnails will be generated with this width'),
194 + );
195 $form['settings_general']['upload_list_default'] = array(
196 '#type' => 'select',
197 '#title' => t('List files by default'),
198 diff -u -r -N ../../../modules/upload/upload.install upload/upload.install
199 --- ../../../modules/upload/upload.install 2008-02-14 15:24:42.000000000 +0000
200 +++ upload/upload.install 2008-03-19 16:59:02.000000000 +0000
201 @@ -8,7 +8,8 @@
202 // Create table. The upload table might have been created in the Drupal 5
203 // to Drupal 6 upgrade, and was migrated from the file_revisions table. So
204 // in this case, there is no need to create the table, it is already there.
205 - if (!db_table_exists('upload')) {
206 + if (!db_table_exists('upload') ||
207 + !db_table_exists('upload_derivative')) {
208 drupal_install_schema('upload');
209 }
210 }
211 @@ -25,6 +26,37 @@
212 * Implementation of hook_schema().
213 */
214 function upload_schema() {
215 + $schema['upload_derivative'] = array(
216 + 'description' => t('Stores uploaded image file information and table associations.'),
217 + 'fields' => array(
218 + 'fid' => array(
219 + 'type' => 'int',
220 + 'unsigned' => TRUE,
221 + 'not null' => TRUE,
222 + 'default' => 0,
223 + 'description' => t('Primary Key: The {files}.fid of the derived image (thumbnail or other resizing probably).'),
224 + ),
225 + 'fid_parent' => array(
226 + 'type' => 'int',
227 + 'unsigned' => TRUE,
228 + 'not null' => TRUE,
229 + 'default' => 0,
230 + 'description' => t('The {files}.fid of the original image.'),
231 + ),
232 + 'type' => array(
233 + 'type' => 'varchar',
234 + 'length' => 64,
235 + 'not null' => TRUE,
236 + 'default' => '',
237 + 'description' => t('Type of derived file. eg \'thumbnail\'.'),
238 + ),
239 + ),
240 + 'primary key' => array('fid'),
241 + 'indexes' => array(
242 + 'fid' => array('fid'),
243 + 'fid_parent' => array('fid_parent'),
244 + ),
245 + );
246 $schema['upload'] = array(
247 'description' => t('Stores uploaded file information and table associations.'),
248 'fields' => array(
249 diff -u -r -N ../../../modules/upload/upload.module upload/upload.module
250 --- ../../../modules/upload/upload.module 2008-03-28 16:29:16.000000000 +0000
251 +++ upload/upload.module 2008-04-20 12:51:55.000000000 +0100
252 @@ -1,6 +1,8 @@
253 <?php
254 // $Id: upload.module,v 1.197.2.1 2008/02/11 15:08:09 goba Exp $
255
256 +define('UPLOAD_DEFAULT_THUMBNAIL_WIDTH', 100);
257 +
258 /**
259 * @file
260 * File-handling and attaching files to nodes.
261 @@ -91,9 +93,43 @@
262 'type' => MENU_NORMAL_ITEM,
263 'file' => 'upload.admin.inc',
264 );
265 + $items['upload/ajax_get_article_files'] = array(
266 + 'page callback' => 'upload_ajax_get_article_files',
267 + 'access arguments' => array('upload files'),
268 + 'type' => MENU_CALLBACK
269 + );
270 return $items;
271 }
272
273 +function upload_ajax_get_article_files() {
274 + if (isset($_GET['nid'])) {
275 + $nid = intval($_GET['nid']);
276 + $q = db_query("SELECT f.filename,f.filepath,tf.filepath AS thumbpath FROM {files} f
277 + INNER JOIN {upload} u ON u.fid = f.fid AND u.nid = %d
278 + LEFT OUTER JOIN {upload_derivative} d ON d.fid_parent=f.fid AND d.type='img.thumb'
279 + LEFT OUTER JOIN {files} tf ON tf.fid=d.fid
280 + ", $nid);
281 + $results = array();
282 + while ($r = db_fetch_array($q)) {
283 + $r['filepath'] = file_create_url($r['filepath']);
284 + $r['thumbpath'] = file_create_url($r['thumbpath']);
285 + $results[] = $r;
286 + }
287 + print drupal_to_js(array('status' => 'files', 'files' => $results));
288 + } else {
289 + global $pager_total;
290 + $q = pager_query(db_rewrite_sql("SELECT DISTINCT n.nid,n.created,n.title FROM {node} n INNER JOIN {upload} u ON u.nid=n.nid WHERE n.status = 1 ORDER BY n.created DESC"), 20, 0,
291 + "SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {upload} u ON u.nid=n.nid WHERE n.status=1");
292 +
293 + $results = array();
294 + while ($r = db_fetch_array($q)) {
295 + $r['created'] = format_date($r['created'], 'custom', 'j-M-y');
296 + $results[] = $r;
297 + }
298 + print drupal_to_js(array('status' => "nodes", 'pages' => $pager_total, 'articles' => $results));
299 + }
300 +}
301 +
302 function upload_menu_alter(&$items) {
303 $items['system/files']['access arguments'] = array('view uploaded files');
304 }
305 @@ -158,6 +194,39 @@
306 }
307 }
308
309 +function upload_make_derivatives(&$file) {
310 + global $user;
311 + // make a thumbnail if it is an image
312 + if ($info = image_get_info($file->filepath)) {
313 + // don't list images by default, since they should probably be inserted
314 + // into the body
315 + $file->list = 0;
316 + $aspect_ratio = $info['height'] / $info['width'];
317 + $thumb_path = dirname($file->filepath).'/thumb.'.basename($file->filepath);
318 + $thumb_path = file_destination($thumb_path, FILE_EXISTS_RENAME);
319 + $thumb_width = variable_get('upload_thumbnail_width', UPLOAD_DEFAULT_THUMBNAIL_WIDTH);
320 + image_scale($file->filepath, $thumb_path, $thumb_width, $thumb_width*$aspect_ratio);
321 + $info = image_get_info($thumb_path);
322 + $tb_file = array(
323 + 'uid' => $user->uid,
324 + 'filename' => '_thumbnail',
325 + 'filepath' => $thumb_path,
326 + 'filemime' => $info['mime_type'],
327 + 'filesize' => $info['file_size'],
328 + 'status' => FILE_STATUS_TEMPORARY,
329 + 'timestamp' => time(),
330 + );
331 + drupal_write_record('files', $tb_file);
332 + $upload_deriv = array(
333 + 'fid' => $tb_file['fid'],
334 + 'fid_parent' => $file->fid,
335 + 'type' => 'img.thumb',
336 + );
337 + drupal_write_record('upload_derivative', $upload_deriv);
338 + return $tb_file['fid'];
339 + }
340 +}
341 +
342 /**
343 * Save new uploads and store them in the session to be associated to the node
344 * on upload_save.
345 @@ -181,6 +250,8 @@
346 $file->description = $file->filename;
347 $file->weight = 0;
348 $_SESSION['upload_files'][$file->fid] = $file;
349 +
350 + upload_make_derivatives($file);
351 }
352
353 // Attach session files to node.
354 @@ -217,18 +288,103 @@
355
356 if (isset($form['type']) && isset($form['#node'])) {
357 $node = $form['#node'];
358 +
359 + drupal_add_js('
360 +
361 +$.fn.insertAtCaret = function (myValue) {
362 + return this.each(function(){
363 + //IE support
364 + if (document.selection) {
365 + this.focus();
366 + sel = document.selection.createRange();
367 + sel.text = myValue;
368 + this.focus();
369 + }
370 + //MOZILLA/NETSCAPE support
371 + else if (this.selectionStart || this.selectionStart == "0") {
372 + var startPos = this.selectionStart;
373 + var endPos = this.selectionEnd;
374 + var scrollTop = this.scrollTop;
375 + this.value = this.value.substring(0, startPos)
376 + + myValue
377 + + this.value.substring(endPos,
378 +this.value.length);
379 + this.focus();
380 + this.selectionStart = startPos + myValue.length;
381 + this.selectionEnd = startPos + myValue.length;
382 + this.scrollTop = scrollTop;
383 + } else {
384 + this.value += myValue;
385 + this.focus();
386 + }
387 + });
388 +
389 +};
390 +
391 +function update_click_inserts() {
392 + $("button.insertimg").click(function() {
393 + var caption = prompt("If you would like an image caption enter it here, otherwise leave it blank","");
394 + var imgtag = "<img src=\""+this.id+"\" alt=\"\" />";
395 + if (caption) {
396 + imgtag = "<span class=\"imgbox\">"+imgtag+"<div class=\"imgcaption\">"+caption+"</div></span>";
397 + }
398 + try {
399 + $("#edit-body").insertAtCaret(imgtag);
400 + } catch (error) {}
401 + try {
402 + var oEditor = FCKeditorAPI.GetInstance(fckLaunchedJsId[0]) ;
403 + oEditor.InsertHtml(imgtag);
404 + } catch (error) {}
405 + });
406 + $("button.insertthumb").click(function() {
407 + var imgtag = "<img src=\""+this.id+"\" alt=\"\" />";
408 + try {
409 + $("#edit-body").insertAtCaret(imgtag);
410 + } catch (error) {}
411 + try {
412 + var oEditor = FCKeditorAPI.GetInstance(fckLaunchedJsId[0]) ;
413 + oEditor.InsertHtml(imgtag);
414 + } catch (error) {}
415 + });
416 +}
417 + jQuery.fn["replaceAndUpdateHandlers"] = function(value) {
418 + this.empty().append(value);
419 + update_click_inserts();
420 + }
421 + $(document).ready(function() {
422 + update_click_inserts();
423 + setup_insert_other_img();
424 + });
425 +
426 + function setup_insert_other_img() {
427 + $("#insert-other-img").html("poo");
428 + }
429 +
430 + function FCKeditor_OnComplete( editorInstance )
431 + {
432 + FCKeditor_OnCompleteOld(editorInstance);
433 + window.oooFckName = editorInstance.Name;
434 + window.oooFCKeditorAPI = FCKeditorAPI;
435 + }
436 +
437 + function open_fucking_window() {
438 + var win = window.open("/sites/all/modules/upload/insertotherpopup.html?var=oFCK_1", null, "toolbar=no, location=no, menubar=no, status=no, scrollbars=yes, width=400, height=500");
439 + }
440 +
441 + ','inline');
442 +
443 if ($form['type']['#value'] .'_node_form' == $form_id && variable_get("upload_$node->type", TRUE)) {
444 // Attachments fieldset
445 $form['attachments'] = array(
446 '#type' => 'fieldset',
447 '#access' => user_access('upload files'),
448 - '#title' => t('File attachments'),
449 + '#title' => t('Images and File attachments'),
450 '#collapsible' => TRUE,
451 - '#collapsed' => empty($node->files),
452 - '#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
453 + '#collapsed' => FALSE,
454 + // '#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
455 '#prefix' => '<div class="attachments">',
456 '#suffix' => '</div>',
457 - '#weight' => 30,
458 + '#weight' => 0,
459 );
460
461 // Wrapper for fieldset contents (used by ahah.js).
462 @@ -236,6 +392,10 @@
463 '#prefix' => '<div id="attach-wrapper">',
464 '#suffix' => '</div>',
465 );
466 +
467 + $form['attachments']['insert_other'] = array(
468 + '#value' => '<a onclick="open_fucking_window();">Insert an image from another article</a>',
469 + );
470
471 // Make sure necessary directories for upload.module exist and are
472 // writable before displaying the attachment form.
473 @@ -393,6 +553,8 @@
474 }
475
476 foreach ($node->files as $fid => $file) {
477 + // Make derivatives permanent
478 + db_query("UPDATE {files} f INNER JOIN {upload_derivative} u ON u.fid_parent = %d and f.fid = u.fid SET f.status = 1", $fid);
479 // Convert file to object for compatibility
480 $file = (object)$file;
481
482 @@ -431,6 +593,17 @@
483 unset($_SESSION['upload_files']);
484 }
485
486 +function _upload_delete_derivatives($fid) {
487 + $q = db_query("SELECT fid,filepath FROM {files} f WHERE EXISTS (SELECT * FROM {upload_derivative} u WHERE u.fid = f.fid AND u.fid_parent = %d)", $fid);
488 + while ($deriv_file = db_fetch_array($q)) {
489 + drupal_set_message("Deleted ".$deriv_file['filepath']);
490 + file_delete($deriv_file['filepath']);
491 + db_query("DELETE FROM {files} WHERE fid = %d", $deriv_file['fid']);
492 + }
493 + db_query("DELETE FROM {upload_derivative} WHERE fid_parent = %d", $fid);
494 + db_query('DELETE FROM {files} WHERE fid = %d', $fid);
495 +}
496 +
497 function upload_delete($node) {
498 $files = array();
499 $result = db_query('SELECT DISTINCT f.* FROM {upload} u INNER JOIN {files} f ON u.fid = f.fid WHERE u.nid = %d', $node->nid);
500 @@ -440,6 +613,7 @@
501
502 foreach ($files as $fid => $file) {
503 // Delete all files associated with the node
504 + _upload_delete_derivatives($fid);
505 db_query('DELETE FROM {files} WHERE fid = %d', $fid);
506 file_delete($file->filepath);
507 }
508 @@ -456,6 +630,7 @@
509
510 // if the file won't be used, delete it
511 if ($count < 2) {
512 + _upload_delete_derivatives($file->fid);
513 db_query('DELETE FROM {files} WHERE fid = %d', $file->fid);
514 file_delete($file->filepath);
515 }
516 @@ -491,6 +666,15 @@
517 $form['files'][$key]['filemime'] = array('#type' => 'value', '#value' => $file->filemime);
518 $form['files'][$key]['filesize'] = array('#type' => 'value', '#value' => $file->filesize);
519 $form['files'][$key]['fid'] = array('#type' => 'value', '#value' => $file->fid);
520 + if (image_get_info($file->filepath)) {
521 + $thumb_fid = db_result(db_query("SELECT fid FROM {upload_derivative} WHERE fid_parent = %d AND type = 'img.thumb'", $file->fid));
522 + if (!$thumb_fid) $thumb_fid = upload_make_derivatives($file);
523 + if ($thumb_fid) $thumb_url = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $thumb_fid));
524 + $form['files'][$key]['insertbutton'] = array('#type' => 'markup', '#value' =>
525 + '<button type="button" class="insertimg" id="'.file_create_url($file->filepath).'">Full sized</button>'.
526 + '<button type="button" class="insertthumb" id="'.file_create_url($thumb_url).'">Thumbnail</button>'
527 + );
528 + }
529 }
530 }
531
532 @@ -511,6 +695,7 @@
533 'path' => 'upload/js',
534 'wrapper' => 'attach-wrapper',
535 'progress' => array('type' => 'bar', 'message' => t('Please wait...')),
536 + 'method' => 'replaceAndUpdateHandlers',
537 ),
538 '#submit' => array('node_form_submit_build_node'),
539 );
540 @@ -527,7 +712,7 @@
541 * @ingroup themeable
542 */
543 function theme_upload_form_current(&$form) {
544 - $header = array('', t('Delete'), t('List'), t('Description'), t('Weight'), t('Size'));
545 + $header = array('', t('Delete'), t('List'), t('Description'), t('Weight'), t('Insert into text'), t('Size'));
546 drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');
547
548 foreach (element_children($form) as $key) {
549 @@ -539,6 +724,7 @@
550 $row[] = drupal_render($form[$key]['list']);
551 $row[] = drupal_render($form[$key]['description']);
552 $row[] = drupal_render($form[$key]['weight']);
553 + $row[] = drupal_render($form[$key]['insertbutton']);
554 $row[] = drupal_render($form[$key]['size']);
555 $rows[] = array('data' => $row, 'class' => 'draggable');
556 }

  ViewVC Help
Powered by ViewVC 1.1.2