topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 7:46 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Inline attachment mod for SMF2.0b3  (Read 58693 times)

slinouille

  • Member
  • Joined in 2008
  • **
  • Posts: 6
    • View Profile
    • Donate to Member
Inline attachment mod for SMF2.0b3
« on: April 09, 2008, 03:21 PM »
Hello all  :)

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

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #1 on: April 09, 2008, 03:24 PM »
Yes please post! (you could send me the updated file(s) as well if you don't mind! [email protected]) -- my smf skills are being forgotten so it will be useful when we upgrade :)

slinouille

  • Member
  • Joined in 2008
  • **
  • Posts: 6
    • View Profile
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #2 on: April 09, 2008, 03:48 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" ...  ;)

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
Code: PHP [Select]
  1. // Show the post itself, finally!
  2. echo '
  3.                                                                 </div></td>
  4.                                                         </tr></table>
  5. ...

2. Select code until
Code: PHP [Select]
  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
Code: PHP [Select]
  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
Code: PHP [Select]
  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
Code: PHP [Select]
  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
Code: PHP [Select]
  1. // What about smileys?
  2.         if (!empty($context['smileys']['postform']))

insert the suggested code in modification.xml file.

8. Modify sentence
Code: PHP [Select]
  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

Code: PHP [Select]
  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  :D

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

Bye

SliN

slinouille

  • Member
  • Joined in 2008
  • **
  • Posts: 6
    • View Profile
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #3 on: April 12, 2008, 06:14 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 AM by slinouille »

MatthewSchenker

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 24
    • View Profile
    • Festool Owners Group
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #4 on: May 04, 2008, 08:24 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

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #5 on: May 04, 2008, 08:26 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.

 :up:

-mouser

MatthewSchenker

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 24
    • View Profile
    • Festool Owners Group
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #6 on: May 04, 2008, 09:06 AM »
Mouser,
Excellent!  OK, now we just need the package!  I am not sure how to edit files.
How about it, slinouille?
Matthew

slinouille

  • Member
  • Joined in 2008
  • **
  • Posts: 6
    • View Profile
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #7 on: May 04, 2008, 09:32 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  :)

Bye

MatthewSchenker

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 24
    • View Profile
    • Festool Owners Group
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #8 on: May 04, 2008, 09:35 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 AM by MatthewSchenker »

MatthewSchenker

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 24
    • View Profile
    • Festool Owners Group
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #9 on: May 05, 2008, 05:56 AM »
Any ideas?  Has anyone been able to fix this problem?

slinouille

  • Member
  • Joined in 2008
  • **
  • Posts: 6
    • View Profile
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #10 on: May 05, 2008, 08:13 AM »
Any ideas?  Has anyone been able to fix this problem?
-MatthewSchenker (May 05, 2008, 05:56 AM)
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

slinouille

  • Member
  • Joined in 2008
  • **
  • Posts: 6
    • View Profile
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #11 on: May 05, 2008, 08:41 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

MatthewSchenker

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 24
    • View Profile
    • Festool Owners Group
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #12 on: May 05, 2008, 02:22 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

ARMSoft

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #13 on: October 14, 2008, 03:36 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.

kragno

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #14 on: December 04, 2008, 07:16 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

yangma2005

  • Participant
  • Joined in 2015
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #15 on: January 08, 2015, 11:10 PM »
i am install smf at my server, but i want to attachment image inline the post, would you talk me how can i use your script?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Inline attachment mod for SMF2.0b3
« Reply #16 on: January 08, 2015, 11:28 PM »
With smf2 there is another official mod in the smf repository that supports inline attachments, using same techniques -- the one we use here is out of date.  Get the good one on the smf website.