forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Comments => Topic started by: Marelo on May 24, 2005, 07:46:24 pm

Title: [MOD] Multiline Comments!
Post by: Marelo on May 24, 2005, 07:46:24 pm
Hi There,

I just downloaded Coppermine, and I'm enjoying a lot. But, at the very first contact, I noticed that I can't write multiline comments in the pictures...
So, I searched the forum, and found a topic with a guy asking this same question.

The comment field originally is single line, but when you edit the comment, it becames "multi lined".

If you edit your comment and type a new "multi lined" comment, the comment is inserted normally in the database, with the correct line breaks, although, the comment is displayed as a single line.

So, as I didn't found any solution for this, I made myself this modification,
Now, the comment field is always multiline (<textarea>) for adding / editing and the comment is displayed as they really are (with the line breaks...)


Files to edit:

displayimage.php
/themes/<YOUR THEME>/theme.php

1) Open file displayimage.php

1.1) Find:

Code: [Select]
'{MSG_BODY}' => &$comment_body,

1.2) Replace with:

Code: [Select]
'{MSG_BODY}' => nl2br(&$comment_body),

1.3) Find:

Code: [Select]
'{MSG_BODY_RAW}' => $row['msg_body'],

1.4) Replace with:

Code: [Select]
'{MSG_BODY_RAW}' => str_replace("<br />","\n",$row['msg_body']),

2) Open file /themes/<YOUR THEME>/theme.php

2.1) Find:

Code: [Select]
<input type="text" class="textinput" id="message" name="msg_body" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />

2.2) Replace with:

Code: [Select]
<textarea class="textinput" id="message" name="msg_body" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" maxlength="{MAX_COM_LENGTH}" style="width: 100%;" rows="2"></textarea>

Notice: If you use / allow your users to use more than one theme, so you have to do step 2) for each theme!...

Hope you enjoy and find this useful, as it was for me.

Comments and improvements are welcome!

PS: Sorry for my bad english!!
Title: Re: [MOD] Multiline Comments!
Post by: Joachim Müller on May 24, 2005, 10:10:44 pm
Thanks for your contribution.
@all: Marelo was refering to the mod Line breaks in comments (http://forum.coppermine-gallery.net/index.php?topic=11370.0)
Title: Re: [MOD] Multiline Comments!
Post by: Marelo on June 02, 2005, 04:00:27 pm
My pleasure! At your service!  ;)
Title: Re: [MOD] Multiline Comments!
Post by: protox on June 10, 2005, 04:34:48 pm
This hack didn't work with my coppermine like this .. I had to change your
Code: [Select]
'{MSG_BODY}' => nl2br(&$comment_body),into
Code: [Select]
'{MSG_BODY}' => nl2br($comment_body),without the " & " : no more errors;

btw thx alot for this trippy hack dood 8)
Title: Re: [MOD] Multiline Comments!
Post by: BlackAngel- on August 04, 2005, 10:01:17 pm
Hi there^^

Well, I applied the "hack" as I would like my visitors to write multi-line comments but unfortunately nothing changed ... T_T I still have a single-line field which does noch create line breaks or anything else. Have I done anything wrong?
I would really really like to add this feature so I would appreciate your help very much!^^

Title: Re: [MOD] Multiline Comments!
Post by: Joachim Müller on August 04, 2005, 10:02:46 pm
how are we suppossed to help without a link and a non-admin user account?
Title: Re: [MOD] Multiline Comments!
Post by: BlackAngel- on August 04, 2005, 10:41:48 pm
Oh, I'm very sorry GauGau ^^""""
... besides I managed to have the files working *jumps happily* ^0^ I just made there real stupid mistake to upload the files into the 2nd one of my two galleries and therefore the 1st one did not show any changes ... of course ^^""""""""""""""

Sorry for causing you so much trouble... (well, girls and technical stuff ^,^ ... you know ^.~)
Next time I will check both galleries of mine first, BEFORE posting *sneaks away*

Anyway, thanks for your quick answer^^
Title: Re: [MOD] Multiline Comments!
Post by: blitz boy on November 26, 2005, 10:34:00 am
Hello,

Anyone have an idea about how to add the multiline comment mod to 1.4? There is no instance of 'MSG' or '$comment' in displayimage.php, and the classic theme.php file is empty, so I'm a bit lost. Any help is appreciated.

EDIT: sorry, there are a couple instances of '$comments' in displayimage.php, but I'm not sure if/how they would apply to this mod. Thanks.
Title: Re: [MOD] Multiline Comments!
Post by: Nibbler on November 26, 2005, 04:44:23 pm
Here's the mod converted to a plugin for 1.4. Use the plugin manager from config to upload and install the attached file.

Updated to 1.1
Title: Re: [MOD] Multiline Comments!
Post by: MyWorld2k on December 18, 2005, 09:16:40 pm
Hello, how goes with this new plugin manager?
Title: Re: [MOD] Multiline Comments!
Post by: MrTeck on December 23, 2005, 06:55:30 pm
Hi Nibbler.
I'm getting double space in all line breaks :/
Im getting this:
Code: [Select]
This is a comment

with only one break

and I think the correct is:
Code: [Select]
This is a comment
with only one break

PS: I'm talking with cpg 1.4.2 (in all themes) + Multiline Plugin.

Tnx
Title: Re: [MOD] Multiline Comments!
Post by: Nibbler on December 23, 2005, 07:14:27 pm
That's odd. I've updated the plugin to v1.1
Title: Re: [MOD] Multiline Comments!
Post by: MrTeck on December 24, 2005, 02:17:43 pm
Now works perfect! :)
Tnx
Title: Re: [MOD] Multiline Comments!
Post by: ecto on December 25, 2005, 04:19:37 pm
Marelo and Nibbler; thanks for this nifty little plugin. Just found it and I'm using it now, works fine. One of those you just didn't know you needed until you found it :)
Title: Re: [MOD] Multiline Comments!
Post by: Joachim Müller on December 27, 2005, 07:36:55 am
created a separate thread for Nibbler's plugin: http://forum.coppermine-gallery.net/index.php?topic=25283.0
All questions regarding the plugin should go there.
Title: Re: [MOD] Multiline Comments!
Post by: spiros71 on April 24, 2006, 09:11:47 pm
Does this work with 1.4.5?
Title: Re: [MOD] Multiline Comments!
Post by: Nibbler on April 24, 2006, 09:25:37 pm
Should do.
Title: Re: [MOD] Multiline Comments!
Post by: spiros71 on April 26, 2006, 01:03:32 pm
And indeed it does, the one from http://forum.coppermine-gallery.net/index.php?topic=25283.0 though
Title: Re: [MOD] Multiline Comments!
Post by: wfs on August 20, 2006, 02:40:23 am
Hi Nibbler,

You said: "Here's the mod converted to a plugin for 1.4. Use the plugin manager from config to upload and install the attached file."

I can't find the plugin mgr in config.  Where is it exactly ?

thanks.

Title: Re: [MOD] Multiline Comments!
Post by: Nibbler on August 20, 2006, 12:23:16 pm
pluginmgr.php
Title: Re: [MOD] Multiline Comments!
Post by: wfs on August 21, 2006, 04:34:10 am
thank you.
Title: Re: [MOD] Multiline Comments!
Post by: Joachim Müller on August 21, 2006, 07:58:54 am
Coppermine manual: , section "4.14.3 The Plugin Manager (http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#plugin_manager)"  ::)
Title: Re: [MOD] Multiline Comments!
Post by: angeldevil on August 21, 2006, 11:48:37 am
Here's the mod converted to a plugin for 1.4. Use the plugin manager from config to upload and install the attached file.

Updated to 1.1

Hi Nibbler

In the first time I've installed yuor multiline comments V 1.0 plugin in cpg 1.4 whit Stramm modpack and all works fine

After I've installed a multiline comments V 1.1 and I've found a little incompatibility whit the subscribe/unscribe comments control of Stramm modpack:

in the write comment box below the pics, the clickable text (subscribe/unscribe) is disappeared

How to fix it?

Sorry for my poor english

best regards
Title: Re: [MOD] Multiline Comments!
Post by: Nibbler on August 21, 2006, 12:38:31 pm
You can't install more than one plugin that affects the same template or theme function. You'd need to merge the functionality of the two plugins manually.
Title: Re: [MOD] Multiline Comments!
Post by: angeldevil on August 22, 2006, 01:38:56 am
You can't install more than one plugin that affects the same template or theme function. You'd need to merge the functionality of the two plugins manually.

... no Nibbler, sorry, I've uninstalled the 1.0 version and after I've installed the 1.1 and the clickable text (subscribe/unscribe) is disappeared
Title: Re: [MOD] Multiline Comments!
Post by: Stramm on August 22, 2006, 07:22:48 am
angeldevil, I already told you that the 1.0 version of this plugin worked for you cause it's already modified to work with the modpack (as it's included into the modpack). To make version 1.1 compatible you'd have to have a look at codebase.php and add placeholders necessary for the modpack... it's like working with templates.
Title: Re: [MOD] Multiline Comments!
Post by: angeldevil on August 22, 2006, 08:29:20 pm
angeldevil, I already told you that the 1.0 version of this plugin worked for you cause it's already modified to work with the modpack (as it's included into the modpack). To make version 1.1 compatible you'd have to have a look at codebase.php and add placeholders necessary for the modpack... it's like working with templates.

OK but I,ve tryed without successful

TNX
Title: Re: [MOD] Multiline Comments!
Post by: DangRabbit on January 03, 2007, 04:05:50 am
thank you - I installed this and it worked great :)