I've done some minor changes here to additionally support the attachment module. Inline module now works for both, upload module and attachment module at the same time. Although attachment module is disabled automatically if upload module is active, concurrent use of both modules works, too.
I've also moved some code away from the theming functions in favor of theme overriding functions. Please keep it always as simple as possible for designers to override these.
Plus, I've added the possibility for mime type based file icons if the theme is providing some. These have to be stored in a subfolder /mime
below your current theme directory.
Also added some remarks to functions.
Comment | File | Size | Author |
---|---|---|---|
#22 | inline.attachment.module.patch | 4.25 KB | sun |
#16 | inline_7.module | 14.89 KB | sun |
#14 | inline.attachment_5.patch | 9.26 KB | sun |
#12 | inline_6.module | 14.37 KB | sun |
#11 | inline.attachment_4.patch | 8.72 KB | sun |
Comments
Comment #1
suntypo
Comment #2
Bèr Kessels CreditAttribution: Bèr Kessels commentedYour forgot to provide a new patch that fixes the typo.
Comment #3
sunjust a typo in the issue title...
I assume for that no patch update is required...? ;)
Comment #4
sunDid anyone test this patch?
Comment #5
sunInlcuded patch now additionally takes into account:
$titl
... If a title is passed to inline now, this title always has precedence.$node->files
seems to be an array now. Already reported here. So the resulting$file
should always be returned as object. This was already done for attachments, but not for uploads.This patch has been tested with MySQL and PostGreSQL.
Comment #6
sunComment #7
sunInline module produced errors if there are no files attached to a node.
Attached patch takes this into account.
Now tested with Windows and Linux, MySQL and PostGreSQL and any combination of installed modules and files/attachments (upload module and attachment module).
Comment #8
sunAccording to Drupal style rules, inline module has to use CSS class
inline
in its output.Comment #9
sunRichard, are there any problems with this patch?
Comment #10
Richard Archer CreditAttribution: Richard Archer commentedNo, the problem is that I'm flat out like a lizard drinking.
I want to spend a good solid day on inline really soon. I want to get some of Bert's new syntax into the 4.7 branch of inline before too many people install it for 4.7. And there are several other patches that look good but need further analysis. And of course there's work to merge all these patches together.
I'll try to stay up late tonight or tomorrow and get the "ready" patches all committed.
Comment #11
sunReworked the display of file type icons. In short,
<a>(icon) Linktext</a>
is now
<a>(icon)</a> <a>Linktext</a>
[if a file type icon exists]or
<a>» Linktext</a>
[if no file type icon exists]Comment #12
sunAs requested by eric in http://drupal.org/node/64445 here is the comlete inline module with the patch already applied.
Comment #13
ec CreditAttribution: ec commentedSun, thank you for your file but there is still something wrong for me. I always got
NOT FOUND:
when I use [inline:my_file.xx], thought I know it works with the current inline cvs ! I may miss something ? Any idea ? regards, eric.PS : did I say I'm using it with a 471
Comment #14
sunComment #15
boriso CreditAttribution: boriso commentedthanks for all the good work Sun. However, things are getting a bit messy. I tried to patch the file, but got some problems. When I try to use the file ID, I get database errors, when I use the file name, the file name still shows up on the page (in addition to the given name). Maybe I did the patching wrongly? Perhaps you could provid with the latest version, everything already patched?
thanks in advance,
boris
Comment #16
sun@boriso: Patched version of working inline module attached.
Comment #17
Bèr Kessels CreditAttribution: Bèr Kessels commentedPatch fails.
Also: This patch tries to do too many things in one (which makes it very hard to maintain and review).
Lets try to solve the issues one at a time. Leave this issue for integration with attachement.module, move the preview issues etc to to other threads.
Comment #18
lisa CreditAttribution: lisa commentedPosts seem to indicate people are having problems with patch #5, 6 and 7. I just want to fix the problem that titles are not displaying as they should with Drupal 4.7.2. Instead of seeing title, file name is displayed.
When I specify a title like [file:myfile.pdf=mytitle], inline.module ignores title and provides a link like
it should be
Which patch should I apply to fix this? Patch 0?
Also, what is the difference between [file:myfile.pdf=mytitle] and [attachment:myfile.pdf=mytitle]? They seem to function the same?
Thanks.
Comment #19
sunThanks Bèr. I will update the patch and divide it into more than one issue shortly.
I'll try to find some time at the weekend.
Comment #20
ymcp CreditAttribution: ymcp commentedI just tried the "inline_7.module" patched module, and it does seem to fix the "title not shown" bug.
Spotted a little typo in the inline_filter_tips() text: "will be replaced by... file1.pdf.png" should be "file1.pdf".
I like the idea of the "{current_theme}/mime" folder containing little icons showing the file tye... must give it a try!
Comment #21
ymcp CreditAttribution: ymcp commentedTried it with a couple of icons. Looks great! Well done!
The only thing that I'm not so keen on is that when you use something like "[file:myfile.pdf=My File]", you get this:
I would prefer just this:
The file name is included in the pop-up "title" anyway, and the whole reason why I would want to use my own "title" is to hide what might be a nasty long filename.
Anyway, a quick bit off CSS soon fixed that:
It might be worth including a tip about this in the README.txt (and supplying a few demo icons) when this module is next released.
On the subject of icons - wouldn't it make more sense to have the "mime" folder as a sub-directory of this module rather than in the theme?
Not complaining though... I think this patch is a *great* improvement.
Comment #22
sunHere we go - I've separated all those new features to individual issues:
@ymcp: Bad description seems to be a bug of this new feature. I will analyze this shortly. But it looks like upload.module already provides
$file->description
while I'm trying to set it as the case arises. Mime type icon files have to be stored for each theme to allow different icons for different sites on a Drupal multi-site installation. Don't know if it would be a good idea to include default mime type icons with inline.module - because of copyright issues on the one hand and different looks for Drupal sites on the other hand (I'm not a fan of full-featured out-of-the-box designs regarding CMSs). Please post further comments regarding mime type icons in http://drupal.org/node/74622.@Bèr: All those offshoots are based on the current CVS now. But it won't be possible to patch inline.module with those patches step by step, since they are overlapping in some cases.
Comment #23
havran CreditAttribution: havran commentedBit. off topic but i have little idea. For simpler use inline module with TinyMCE editor i have use in my template.php this function:
<?php
/**
* Theme the attachments list. (from upload.module -> themeupload_form_current())
*/
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('Insert inline picture'));
foreach (element_children($form) as $key) {
// check if 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']);
// insert inline tag into textarea
if ($typ_image) {
$row[] = "insert image code";
}
else {
$row[] = '';
}
$rows[] = $row;
$counter++;
}
$output = theme('table', $header, $rows);
$output .= form_render($form);
return $output;
}
Maybe is there better way integrate this funcionality into inline.module?
Comment #24
havran CreditAttribution: havran commentedUps, sorry for this... Maybe someone can delete previous post?
This code simple add new column to attachements table with link for insert inline image code into textarea.
Comment #25
Bèr Kessels CreditAttribution: Bèr Kessels commentedThis looks very good. Let us dive into these issues one a time and get them reviewed and patched. (one a time).
I realise this is very suboptimal, but unfortunately another route does not really work right now. I mean: nearly all of the issues in here are from your hand, just updating the issue with latest heads :)
I would love to see the issues solved.
@Richard: I would like to discuss CVS access so that I can get the issues solved. There are a load of issues solved but waiting commits, for example: I fixed the previews.
Bèr
Comment #26
sun@havran: Please create a new issue for your feature request. Use this link: http://drupal.org/node/add/project_issue/inline/feature
Comment #27
sunMarking this issue as dependent on http://drupal.org/node/80170
Comment #28
sunAttachment module is dead and will not be developed further.