Welcome Guest.   Make a donation to an author on the site December 22, 2014, 04:37:43 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Free DonationCoder.com Member Kit: Submit Request.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Inline attachment mod for SMF2.0b3  (Read 16403 times)
slinouille
Member
**
Posts: 6


View Profile Give some DonationCredits to this forum member
« on: April 09, 2008, 03:21:19 PM »

Hello all  smiley

Fist of all I'd like to thank mouser for this exceptionnal mod.
I've been using for a long time in my SMF1.x forum.

After some problems, I've decided to go to the SMF2.0b3, and I really needed to have this excellent mod to work on this new version of SMF.

So I've done some modification in order to adapt the orignal IA mod. If someone is interested, I can post here the modification to do.
Just ask !

Bye

Slin
Logged
mouser
First Author
Administrator
*****
Posts: 33,795



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: April 09, 2008, 03:24:01 PM »

Yes please post! (you could send me the updated file(s) as well if you don't mind! mouser@donationcoder.com) -- my smf skills are being forgotten so it will be useful when we upgrade smiley
Logged
slinouille
Member
**
Posts: 6


View Profile Give some DonationCredits to this forum member
« Reply #2 on: April 09, 2008, 03:48:19 PM »

Great  Thmbsup

I'm not a specialist of php or things like that I'm just a simple "guy that adapt things using his brain" ...  Wink

So here it is ... you'll need the original modification.xml file because I'll not write all code but jsut adaptations ;-) ... I'l send to mouser the modification_smf2.0b3 file (I've not modified the headers and things like that ... it's not my source code ... I respect the authors as much as I can)

in display.template.php

1. find
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. // Show the post itself, finally!
  2. echo '
  3. </div></td>
  4. </tr></table>
  5. ...

2. Select code until
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. ...
  2. // If we had unapproved attachments clean up.
  3. if ($last_approved_state == 0)
  4. echo '
  5. </fieldset>';
  6.  
  7. echo '
  8. </div>';
  9. }

3. Copy the code from original modification.xml file

4. modify PART 2 by
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. //---------------------------------------------------------------------------
  2. // PART 2 - original code
  3. // Show the post itself, finally!
  4. // ATTN: it's not clear if this mod interferes with the inline modificiation feature new to 1.1RC2 and 1.1RC3 (see last img src line below)
  5. echo '
  6. </div></td>
  7. </tr></table>
  8. <hr width="100%" size="1" class="hrcolor" />';
  9. if ($ignoring)
  10. echo ' <div id="msg_', $message['id'], '_ignored_prompt" style="display: none;">', $txt['ignoring_user'], '  <a href="#msg', $message['id'], '" onclick="return ignoreToggles[', $message['id'], '].toggle()">', $txt['show_ignore_user_post'], '</a></div>';
  11.  
  12. echo '
  13. <div class="post" id="msg_', $message['id'], '"', '>';
  14.  
  15. if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
  16. echo '
  17. <div style="margin: 2ex; padding: 1ex; border: 2px dashed #cc3344; color: black; font-weight: bold;">
  18. ', $txt['post_awaiting_approval'], '
  19. </div>';
  20. echo '
  21. ', $message['body'], '
  22. </div>', $message['can_modify'] ? '
  23. <img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="' . $txt['quick_modify'] . '" title="' . $txt['quick_modify'] . '" align="right" id="modify_button_' . $message['id'] . '" style="cursor: ' . ($context['browser']['is_ie5'] || $context['browser']['is_ie5.5'] ? 'hand' : 'pointer') . '; display: none;" onclick="oQuickModify.modifyMsg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
  24. </td>
  25. </tr>';
  26.  
  27.  
  28. // Now for the attachments, signature, ip logged, etc...
  29. echo '
  30. <tr id="msg_', $message['id'], '_footer">
  31. <td valign="bottom" class="smalltext" width="85%">
  32. <table width="100%" border="0" style="table-layout: fixed;"><tr>
  33. <td colspan="2" class="smalltext" width="100%">';
  34. //---------------------------------------------------------------------------

4. modify PART 4 by
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. //---------------------------------------------------------------------------
  2. // PART 4 - original code but MODIFIED to skip inlined images
  3. // Assuming there are attachments...
  4. if (!empty($message['attachment']))
  5. {
  6. echo '
  7. <hr width="100%" size="1" class="hrcolor" />
  8. <div style="overflow: auto; width: 100%;">';
  9. $last_approved_state = 1;
  10. foreach ($message['attachment'] as $attachment)
  11. {
  12. // Show a special box for unapproved attachments...
  13. if ($attachment['is_approved'] != $last_approved_state)
  14. {
  15. $last_approved_state = 0;
  16. echo '
  17. <fieldset>
  18. <legend>', $txt['attach_awaiting_approve'], '&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';sesc=', $context['session_id'], '">', $txt['approve_all'], '</a>]</legend>';
  19. }
  20.  
  21. //---------------------------------------------------------------------------

5. Modify last part starting by \\back to orginal code with this code
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. //---------------------------------------------------------------------------
  2. // Back to original code
  3. if ($attachment['is_image'])
  4. {
  5. if ($attachment['thumbnail']['has_thumb'])
  6. echo '
  7. <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 />';
  8. else
  9. echo '
  10. <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
  11. }
  12. echo '
  13. <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ';
  14.  
  15. if (!$attachment['is_approved'])
  16. echo '
  17. [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';sesc=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';sesc=', $context['session_id'], '">', $txt['delete'], '</a>] ';
  18. echo '
  19. (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
  20. }
  21.  
  22. echo '
  23. </div>';
  24. }
  25. //---------------------------------------------------------------------------


In Post.template.php file

7. After code
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. // What about smileys?
  2. if (!empty($context['smileys']['postform']))

insert the suggested code in modification.xml file.

8. Modify sentence
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. <select onchange="surroundText(this.options[this.selectedIndex].value,\'\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0; document.forms.', $context['post_form'], '.', $context['post_box_name'], '.focus(document.forms.', $context['post_form'], '.', $context['post_box_name'], '.caretPos);" style="margin-bottom: 1ex;">

by

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. <select onchange="surroundText(this.options[this.selectedIndex].value,\'\', document.getElementById(\''. $context['post_box_name'].'\')); this.selectedIndex = 0; document.forms.', $context['post_form'], '.', $context['post_box_name'], '.focus(document.forms.', $context['post_form'], '.', $context['post_box_name'], '.caretPos);" style="margin-bottom: 1ex;">

That's all folks ! Your favorite mod is back in your SMF2.0b3 forum  cheesy

Mouser, I'll send you the file tomorrow .. I need to sleep

Bye

SliN
Logged
slinouille
Member
**
Posts: 6


View Profile Give some DonationCredits to this forum member
« Reply #3 on: April 12, 2008, 06:14:21 AM »

Hello mouser !

I've created a clean "InlineAttachementMod" installer ;-)

Can I distribuate this update with your agreement?

Bye

SliN
« Last Edit: April 14, 2008, 06:58:57 AM by slinouille » Logged
MatthewSchenker
Participant
*
Posts: 24

View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: May 04, 2008, 08:24:36 AM »

Good Morning,
I just found this post (sorry, I posted a question about this elsewhere in the forum).
Has the new modification been developed for 2.0 beta?  I really need this modification -- it's become essential to my forum!!
Thanks,
Matthew
Logged
mouser
First Author
Administrator
*****
Posts: 33,795



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: May 04, 2008, 08:26:50 AM »

I must have missed this post originally.  Sorry slinouille!

You are welcome to distribute it as long as it's clear the original version was developed at DonationCoder.com and that you provide a clear link to this thread or some other relevant link on this site.

And please do post again if you improve it more or release new versions.

 thumbs up

-mouser
Logged
MatthewSchenker
Participant
*
Posts: 24

View Profile WWW Give some DonationCredits to this forum member
« Reply #6 on: May 04, 2008, 09:06:08 AM »

Mouser,
Excellent!  OK, now we just need the package!  I am not sure how to edit files.
How about it, slinouille?
Matthew
Logged
slinouille
Member
**
Posts: 6


View Profile Give some DonationCredits to this forum member
« Reply #7 on: May 04, 2008, 09:32:19 AM »

Hello guys!

Here it is!

I'm preparing another version quite different but based on the code provided by mouser ;-)

Mouser, tell me if this install satisfies you  smiley

Bye

* InlineAttachementMod_-_smf2.0b3_-_v0.1.zip (5.71 KB - downloaded 401 times.)
Logged
MatthewSchenker
Participant
*
Posts: 24

View Profile WWW Give some DonationCredits to this forum member
« Reply #8 on: May 04, 2008, 09:35:54 AM »

slinouille,
Thanks for the hard work on this!

I tried to install it on my 2.0 test forum.  Got this error:
The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

Matthew
« Last Edit: May 04, 2008, 09:37:44 AM by MatthewSchenker » Logged
MatthewSchenker
Participant
*
Posts: 24

View Profile WWW Give some DonationCredits to this forum member
« Reply #9 on: May 05, 2008, 05:56:37 AM »

Any ideas?  Has anyone been able to fix this problem?
Logged
slinouille
Member
**
Posts: 6


View Profile Give some DonationCredits to this forum member
« Reply #10 on: May 05, 2008, 08:13:13 AM »

Any ideas?  Has anyone been able to fix this problem?
Hello,

I've tried the mod on a fresh install of SMF2b3, and no error occurs.
You have probably done modification of display.template.php or post.template.php files  huh

Slin
Logged
slinouille
Member
**
Posts: 6


View Profile Give some DonationCredits to this forum member
« Reply #11 on: May 05, 2008, 08:41:45 AM »

Okay I've found why!
Because you're using 2.0 Beta 3.1 Public and not 2.0 Beta 3 Public

Please found the version updated here

Bye

SliN

* InlineAttachementMod_-_smf2_-_v0.2.zip (5.89 KB - downloaded 459 times.)
Logged
MatthewSchenker
Participant
*
Posts: 24

View Profile WWW Give some DonationCredits to this forum member
« Reply #12 on: May 05, 2008, 02:22:58 PM »

Okay I've found why!
Because you're using 2.0 Beta 3.1 Public and not 2.0 Beta 3 Public

Please found the version updated here

Hey, now it works!  Thanks for all your help.  I run a woodworking forum, and my members post about their projects all the time.  This modification is so important to us.

OK, that's one more thing that works in SMF 2.0!  Still waiting for the official release.

Matthew
Logged
ARMSoft
Participant
*
Posts: 1

View Profile Give some DonationCredits to this forum member
« Reply #13 on: October 14, 2008, 03:36:11 PM »

Hi there,

Seems that this mod is not for 2.0 4 Beta. Can someone who accomplished that give some tips or share the changed mod ?
Thnx.
Logged
kragno
Participant
*
Posts: 1

View Profile Give some DonationCredits to this forum member
« Reply #14 on: December 04, 2008, 07:16:50 AM »

Hello!.

I'm new here and even to SMF.

Have any idea if your mod is working even with 1.1.7 version? If not, what can be used instead?

Thank you very much,

Stefano
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.62s | Server load: 0.18 ]