Firefox PHP

Module: Custom Attachment Icons

Posted by Joe Curia 
I have completed v5.2.1.03 with the following changes:

- Bugfix: Added more checks for video links in the message body. Thanks go to Maurice Makaay and his regex for finding most video links from the BBCode Video module.

- Bugfix: Added final check for <img> html code. Thanks go to Maurice Makaay and his regex for finding most <img> code from the Embed Images module.

- Enhancement: If all fails and an [img] tag is detected with a url but no valid extension is found, flag it as an image.

CBiLL, this latest release should address the video issues you mentioned. Please let me know if you find other media that is not detected properly. Thanks.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Custom Attachment Icons
October 22, 2008 03:23AM
Quote
Azumandias
Had I been thinking when I first started coding this module, I would have simply copied large swaths of code from Maurice's embedding modules for the detection of media. I will look into how to get video detected properly (by means of the afore-mentioned copying most likely :-P)

EDIT: Yes, editing the mime_types.php file is how you can add new icons/types. You would first add:
$PHORUM["phorum_mod_custom_attachment_icons"]["extension_mime_types"] = array (
"ptrn" => "pattern",
Then:
$PHORUM["phorum_mod_custom_attachment_icons"]["mime_types"] = array (
"pattern" => "pattern.png",
Finally, upload pattern.png, and (if you want a different icon for multiple patterns in one post) multi_pattern.png to the images folder.


Thank you that worked!

I also added in english.php

$PHORUM["DATA"]["LANG"]["phorum_mod_custom_attachment_icons"]["pattern"] = "Pattern Attachments";

for the mouse over text on icon.


Again thank you so much and I hope you figure out the video part!


Bill
Quote
Azumandias
I have completed v5.2.1.03 with the following changes:

- Bugfix: Added more checks for video links in the message body. Thanks go to Maurice Makaay and his regex for finding most video links from the BBCode Video module.

- Bugfix: Added final check for <img> html code. Thanks go to Maurice Makaay and his regex for finding most <img> code from the Embed Images module.

- Enhancement: If all fails and an [img] tag is detected with a url but no valid extension is found, flag it as an image.

CBiLL, this latest release should address the video issues you mentioned. Please let me know if you find other media that is not detected properly. Thanks.


Yes the latest release fixed that video icon issues...

That was quick and thank you so much for making this module available!


Bill
Re: Module: Custom Attachment Icons
October 22, 2008 03:42AM
There are a few posts showing the paperclip icon instead of mult-camera icon so I am not sure why it doing this.

But I suspect it because the photo filename in those posts are named with a "ALL CAP" extension ---- example -> photoname.JPG which is causing the module not to detect it with an jpg extension and use the paperclip icon instead


Bill



......Edited to add this update ......

I went ahead and added this string in mime_types.php

"JPG" => "image/jpeg",

and that fixes this icon issue.




Also I noticed in the module admin area I am showing that there a upgrade available for this module but I am already using the newest module than it is shown here a c/p on what I am seeing

Custom Attachment Icons (version 5.2.1.03) - Upgrade Available (5.2.1.02)



Edited 3 time(s). Last edit at 10/22/2008 04:09AM by CBiLL.
Re: Module: Custom Attachment Icons
October 22, 2008 04:19AM
Hmm, guess I will have to double check that all searches are case-insensitive. Thanks for the bug report.

EDIT: Yep, in all the work I did on case-insensitive searches of the message body, I forgot to update the processing of message attachments. Doh. Bugfix now included in v5.2.1.03.

As for the module upgrade, because I wanted to leave mod dev's the freedom to create their own version patterns (ie 5.2.1, or 5.21, or 5-2-1, or whatever) my mod simply checks to see if the current version is the same as the online version. If not, it assumes an upgrade is available. This does cause a missflag for at most a day if you upgrade immediately to the newest version, as the online list of mods is only updated once a day.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald




Edited 2 time(s). Last edit at 10/22/2008 04:29AM by Azumandias.
Re: Module: Custom Attachment Icons
October 22, 2008 08:43PM
Other feature request if it possible ...

Is there a way to detect if someone paste a HTTP or URL addresses in their post and have it display the icon for URL (Globe with chain link same one in bbcode) on the subject line?


Also in flat view it only show the thread starter subject line not the reply posts to it so is it possible to show attachment icons to the thread starter subject line if there was something attached in any of the reply posts? Maybe make the icon clickable that clicking on it takes you to the reply post with the attachment?

Thank you for this great module!

Bill
Re: Module: Custom Attachment Icons
October 22, 2008 11:16PM
I'm not sure if I would find that last feature really useful in the user experience. What I certainly would not do is make the icons deeplink into the thread. It would only be possible to link to the first message with a link/file in it. Or maybe the last message with a file/link in it. There's not really a clear conclusive user action that has to be taken when such link is clicked. And that normally only raises confusion in my experience.

Something like the attachment file list module would make more sense IMO. So create a list of files/links on the thread's read page, where you can click to the exact related messages. Then it is perfectly clear to the user what is going on.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Custom Attachment Icons
October 23, 2008 07:24PM
Is the http or url in post icon possible then?

Bill
Re: Module: Custom Attachment Icons
October 23, 2008 07:35PM
Sorry, I have had my head deeply wrapped into the next mod I am working on and haven't even had time to come up for air :) I agree with Maurice that the idea of icons for all messages in a thread could quickly lead to a muddled and confusing interface.

I will add the url icon to my todo list. I should be able to get to it by this weekend but I don't want to lose track of the research I've done for my new mod, so no promises on the timeline.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Module: Custom Attachment Icons v5.2.1.04 - .ptrn, URL's, and Recent Messages
October 29, 2008 05:17PM
I have completed v5.2.1.04 of this mod with the following changes:

- Enhancement: Added template files for easier incorporation into Phorum templates.

- Enhancement: Added the ability to disable the warnings displayed if template files have not been edited. This is tied to the Phorum version so that new warnings will be created each time Phorum is upgraded.

- Enhancement: Added support for the Recent Messages module.

- Enhancement: Added support for the ptrn extension (with thanks to CBiLL for the icon and language code) and for recognizing generic URL's in the message body.

- Bugfix: Message attachments with capitalized extensions were not properly processed. Thanks go to Phorum user CBiLL for reporting this.

Please note: If you are upgrading from an earlier version of this module, your template edits will continue to work. However, I would suggest updating to the new template format to ensure compatibility with future upgrades. To do this, edit the list.tpl, list_threads.tpl, and read_threads.tpl files and change:
{IF MESSAGES->mod_cai->icons}
    {LOOP MESSAGES->mod_cai->icons}<img src="{MESSAGES->mod_cai->icons->url}" class="icon1616" title="{MESSAGES->mod_cai->icons->title}"  alt="{MESSAGES->mod_cai->icons->title}" /> {/LOOP}
{/IF}
{IF MESSAGES->mod_cai->show_clip}
    {IF MESSAGES->meta->attachments}<img src="{URL->TEMPLATE}/images/attach.png" class="icon1616" title="{LANG->Attachments}"  alt="{LANG->Attachments}" /> {/IF}
{/IF}
to read:
{INCLUDE "custom_attachment_icons::list_icons"}


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Sorry, only registered users may post in this forum.

Click here to login