News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Attachments In Message

Started by slinouille, June 03, 2008, 04:02:21 AM

Previous topic - Next topic

drhamza

yeah, and please try to make it wysiwyg compatible, thanks a lot for the great mod... this one should be an essential feature in smf ;)

Bruno36

Hello!

An update is planned for SMF 2.0 RC2
Bruno36 the French
SMF 2.0.9

drhamza


alado


russ skinner

Bruno36,

That's great to hear.  Without doubt the most utilised mod on the forum I look after.

Any idea on timing?

Russ

drhamza

fixing the wysiwyg error would be awesome, and updating it to RC2 :D
great mod, should be added to the standard smf features in my opinion ;)

purper

I really would like this to be changed for RC2, but the autor is last seen june 25, 2009! :(
Someone else might wanna give this a try?

C4G-TK

Quote from: drhamza on December 04, 2009, 03:22:19 PM
great mod, should be added to the standard smf features in my opinion ;)

Quote from: purper on December 09, 2009, 12:03:46 PM
I really would like this to be changed for RC2, but the autor is last seen june 25, 2009! :(

Agreed x2

-img removed-

chadon

What makes SMF so great is all the mods available. What makes it so bad is when the mods' authors stop supporting them. :(

I also agree, if there is one mod that should be a standard feature, it's this one.

MATTEK

Quote from: drhamza on November 20, 2009, 08:19:00 AM
it's already updated :D

The link to mod does not say compatible with rc2 2.0
SMF 2.0.1

Like Comics, Books, Movies or T.V. Shows? Read about them here!!

C4G-TK

I'll try it.  Give me a second.

UPDATE
I get all edits in Display.template and Post.template showing errors when using 1.3.0 which is the most recent package.  Anyone else try?




Display.template code is changed to this:

// Assuming there are attachments...
if (!empty($message['attachment']))
{
echo '
<div id="msg_', $message['id'], '_footer" class="attachments smalltext">
<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', ';">';

$last_approved_state = 1;
foreach ($message['attachment'] as $attachment)
{
// Show a special box for unapproved attachments...
if ($attachment['is_approved'] != $last_approved_state)
{
$last_approved_state = 0;
echo '
<fieldset>
<legend>', $txt['attach_awaiting_approve'], '&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]</legend>';
}

if ($attachment['is_image'])
{
if ($attachment['thumbnail']['has_thumb'])
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
else
echo '
<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
}
echo '
<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ';

if (!$attachment['is_approved'])
echo '
[<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
echo '
(', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
}

// If we had unapproved attachments clean up.
if ($last_approved_state == 0)
echo '
</fieldset>';

echo '
</div>
</div>';
}





The edits code for Post.template has changed to this:

Edit 1:
foreach ($context['current_attachments'] as $attachment)
echo '
<dd class="smalltext">
<label for="attachment_', $attachment['id'], '"><input type="checkbox" id= "attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '</label>
</dd>';
echo '
</dl>';


Edit 2:
<input type="file" size="60" name="attachment[]" class="input_file" />';

Edit 3:
function addAttachment()
{
allowed_attachments = allowed_attachments - 1;
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" class="input_file" /><\' + \'/dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');

return true;
}





At least these are the TESTS that failed on my forum.


Quote from: drhamza on November 20, 2009, 08:19:00 AM
it's already updated :D

  So, I'm unsure how it could be updated.

-img removed-

drhamza

sorry, i thought it was already updated :$

C4G-TK

BTW, the edits I posted are what is IN RC2 and NOT the edits needed to be made in order for this to work in RC2. 


Quote from: C4G-TK on December 13, 2009, 09:14:57 PM
I'll try it.  Give me a second.

UPDATE
I get all edits in Display.template and Post.template showing errors when using 1.3.0 which is the most recent package.  Anyone else try?




Display.template code is changed to this:

// Assuming there are attachments...
if (!empty($message['attachment']))
{
echo '
<div id="msg_', $message['id'], '_footer" class="attachments smalltext">
<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', ';">';

$last_approved_state = 1;
foreach ($message['attachment'] as $attachment)
{
// Show a special box for unapproved attachments...
if ($attachment['is_approved'] != $last_approved_state)
{
$last_approved_state = 0;
echo '
<fieldset>
<legend>', $txt['attach_awaiting_approve'], '&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]</legend>';
}

if ($attachment['is_image'])
{
if ($attachment['thumbnail']['has_thumb'])
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
else
echo '
<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
}
echo '
<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ';

if (!$attachment['is_approved'])
echo '
[<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
echo '
(', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
}

// If we had unapproved attachments clean up.
if ($last_approved_state == 0)
echo '
</fieldset>';

echo '
</div>
</div>';
}





The edits code for Post.template has changed to this:

Edit 1:
foreach ($context['current_attachments'] as $attachment)
echo '
<dd class="smalltext">
<label for="attachment_', $attachment['id'], '"><input type="checkbox" id= "attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '</label>
</dd>';
echo '
</dl>';


Edit 2:
<input type="file" size="60" name="attachment[]" class="input_file" />';

Edit 3:
function addAttachment()
{
allowed_attachments = allowed_attachments - 1;
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" class="input_file" /><\' + \'/dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');

return true;
}





At least these are the TESTS that failed on my forum.


Quote from: drhamza on November 20, 2009, 08:19:00 AM
it's already updated :D

  So, I'm unsure how it could be updated.

-img removed-

purper

Quote from: chadon on December 13, 2009, 08:45:00 PM
What makes SMF so great is all the mods available. What makes it so bad is when the mods' authors stop supporting them. :(

I also agree, if there is one mod that should be a standard feature, it's this one.

well, the great thing about mods being available is that everyone can edit and modify them. So maybe someone is able to convert it to RC2? Unfortunately I have no knowledge about php etc. so I rely on smarter members of Simple Machines forum?

C4G-TK

Did anybody update this yet and care to share what they did to make it work on RC2?

-img removed-

ChaosEnergy

i am stuck in one line...i m no coder, so i copied/pasted...but the post.template area is to much for my no knowledge
hope somebody will find...

i can surely send my current edits
i know which line is wrong..but all others are ok...
Chaos Empire ®

Spoogs

This may help for an RC2 version http://custom.simplemachines.org/mods/index.php?mod=2285
I dont use the mod so not sure how similar it may or may not be

kai920

Quote from: C4G-TK on December 31, 2009, 06:47:46 PM
Did anybody update this yet and care to share what they did to make it work on RC2?

I'll be trying to make this work for RC2, stay tuned. Any testers willing to test it out once I 'fix' up the package?

C4G-TK

Quote from: kai920 on January 08, 2010, 12:57:29 AM
Quote from: C4G-TK on December 31, 2009, 06:47:46 PM
Did anybody update this yet and care to share what they did to make it work on RC2?

I'll be trying to make this work for RC2, stay tuned. Any testers willing to test it out once I 'fix' up the package?

sure, I'm home sick with a cold this week, so I'll be around off and on.

-img removed-

kai920

#59
Here's a first attempt, using the attached install.xml it should install on a fresh RC2 install properly.

One problem I've noticed so far, maybe you can help debug... when I click "more attachments" the second time I start seeing multiple (more attachments) links. I've attached a screenshot.

Let me know what other problems you find.

edit Updated with new install.xml that takes care of above issue.

PS. I've created a RC2 compatible package, but am I allowed to re-distribute it?

Advertisement: