[MOD] Multiline Comments! [MOD] Multiline Comments!
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

[MOD] Multiline Comments!

Started by Marelo, May 24, 2005, 07:46:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marelo

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:


'{MSG_BODY}' => &$comment_body,


1.2) Replace with:


'{MSG_BODY}' => nl2br(&$comment_body),


1.3) Find:


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


1.4) Replace with:


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


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

2.1) Find:


<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:


<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!!

Joachim Müller

Thanks for your contribution.
@all: Marelo was refering to the mod Line breaks in comments

Marelo

My pleasure! At your service!  ;)

protox

This hack didn't work with my coppermine like this .. I had to change your
'{MSG_BODY}' => nl2br(&$comment_body),
into
'{MSG_BODY}' => nl2br($comment_body),
without the " & " : no more errors;

btw thx alot for this trippy hack dood 8)
Latest shot from " Les disséqueurs de société " :

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fx-poz.org%2Fcpmfetch%2Fcfimageget.php%3Fcmd%3Dlast&hash=6c9ccde658006a5ed432bbbd56630302b3cb9b7d)

BlackAngel-

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!^^


Joachim Müller

how are we suppossed to help without a link and a non-admin user account?

BlackAngel-

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^^

blitz boy

#7
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.

Nibbler

#8
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

MyWorld2k

Hello, how goes with this new plugin manager?

MrTeck

Hi Nibbler.
I'm getting double space in all line breaks :/
Im getting this:

This is a comment

with only one break


and I think the correct is:

This is a comment
with only one break


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

Tnx

Nibbler

#11
That's odd. I've updated the plugin to v1.1

MrTeck


ecto

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 :)

Joachim Müller

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.

spiros71


Nibbler


spiros71


wfs

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.


Nibbler