Download & Extend

Inline files in TinyMCE by click

Project:Inline
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:sun
Status:postponed

Issue Summary

For simpler use inline module with TinyMCE editor i have use in my template.php this function:

<?php
/**
* Theme the attachments list.
*/
function phptemplate_upload_form_current(&$form) {
 
$counter = 1;

 
$mime_type_array['image'] = array('image/jpeg','image/pjpeg','image/gif','image/png');

 
$header = array(t('Delete'), t('List'), t('Description'), t('Size'), t('Inline picture'));

  foreach (
element_children($form) as $key) {
   
// is image?
   
if (in_array($form[$key]['filemime']['#value'],$mime_type_array['image'])) {
     
$typ_image = true;
    }
    else {
     
$typ_image = false;
    }
   
$row = array();
   
$row[] = form_render($form[$key]['remove']);
   
$row[] = form_render($form[$key]['list']);
   
$row[] = form_render($form[$key]['description']);
   
$row[] = form_render($form[$key]['size']);
   
// if is image create link for insertting inline code
   
if ($typ_image) {
     
$row[] = "<a href=\"javascript:tinyMCE.execInstanceCommand('mce_editor_0','mceInsertContent',true,'[inline:".$counter."]')\">".t('insert code for image')."</a>";
    }
    else {
     
$row[] = '';
    }
   
$rows[] = $row;
  
   
$counter++;
  }
 
$output = theme('table', $header, $rows);
 
$output .= form_render($form);
  return
$output;
}
?>

This code simple add new column to attachements table with link for insert inline image code into textarea. Maybe is there better way integrate this funcionality into inline.module?

Comments

#1

havran, do you use upload.module (Drupal core) or attachment.module?

Is there a reason why you do not use image.module and img_assist.module with the provided drupalimage plugin for TinyMCE?

However, in general I like the idea of simply adding image uploads/attachments into a content by click. But I'd suggest this should be a contrib module for inline.

#2

I use upload.module from Drupal core.

IMHO using image module seems too complicated (for 'no computer' users). Too many options etc... I need only insert simple picture into user blog (or more pictures). For this is Inline way ideal for me. (like this blog spot How to work with new Enigma pages (in slovak language).

#3

Title:Use Inline module with TinyMCE» Inline files in TinyMCE by click
Version:4.7.x-1.x-dev» 6.x-2.x-dev
Component:User interface» Code

Better title.
A contrib module seems to be overhead for this. Instead this should be able to be activated through inline settings and maybe should get a access permission.
Will have a look on your code shortly.

#4

Assigned to:Anonymous» sun
Status:active» postponed
nobody click here