Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2   Go Down

Author Topic: [MOD] Multiline Comments!  (Read 36915 times)

0 Members and 1 Guest are viewing this topic.

Marelo

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 2
[MOD] Multiline Comments!
« 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!!
« Last Edit: November 27, 2005, 09:03:39 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [MOD] Multiline Comments!
« Reply #1 on: May 24, 2005, 10:10:44 pm »

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

Marelo

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 2
Re: [MOD] Multiline Comments!
« Reply #2 on: June 02, 2005, 04:00:27 pm »

My pleasure! At your service!  ;)
Logged

protox

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 49
  • Digital Photographer
    • x-poz
Re: [MOD] Multiline Comments!
« Reply #3 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)
Logged
Latest shot from " Les disséqueurs de société " :

(http://x-poz.org/cpmfetch/cfimageget.php?cmd=last)

BlackAngel-

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • *~..MA-S..~*
Re: [MOD] Multiline Comments!
« Reply #4 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!^^

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [MOD] Multiline Comments!
« Reply #5 on: August 04, 2005, 10:02:46 pm »

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

BlackAngel-

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • *~..MA-S..~*
Re: [MOD] Multiline Comments!
« Reply #6 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^^
Logged

blitz boy

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: [MOD] Multiline Comments!
« Reply #7 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.
« Last Edit: November 26, 2005, 10:39:47 am by blitz boy »
Logged

Nibbler

  • Guest
Re: [MOD] Multiline Comments!
« Reply #8 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
« Last Edit: December 23, 2005, 07:24:27 pm by Nibbler »
Logged

MyWorld2k

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: [MOD] Multiline Comments!
« Reply #9 on: December 18, 2005, 09:16:40 pm »

Hello, how goes with this new plugin manager?
Logged

MrTeck

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: [MOD] Multiline Comments!
« Reply #10 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
Logged

Nibbler

  • Guest
Re: [MOD] Multiline Comments!
« Reply #11 on: December 23, 2005, 07:14:27 pm »

That's odd. I've updated the plugin to v1.1
« Last Edit: December 23, 2005, 07:24:14 pm by Nibbler »
Logged

MrTeck

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: [MOD] Multiline Comments!
« Reply #12 on: December 24, 2005, 02:17:43 pm »

Now works perfect! :)
Tnx
Logged

ecto

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 144
    • My very incomplete gallery
Re: [MOD] Multiline Comments!
« Reply #13 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 :)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [MOD] Multiline Comments!
« Reply #14 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.
Logged

spiros71

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 68
    • Greek translation
Re: [MOD] Multiline Comments!
« Reply #15 on: April 24, 2006, 09:11:47 pm »

Does this work with 1.4.5?

Nibbler

  • Guest
Re: [MOD] Multiline Comments!
« Reply #16 on: April 24, 2006, 09:25:37 pm »

Should do.
Logged

spiros71

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 68
    • Greek translation
Re: [MOD] Multiline Comments!
« Reply #17 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

wfs

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 95
Re: [MOD] Multiline Comments!
« Reply #18 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.

Logged

Nibbler

  • Guest
Re: [MOD] Multiline Comments!
« Reply #19 on: August 20, 2006, 12:23:16 pm »

pluginmgr.php
Logged
Pages: [1] 2   Go Up
 

Page created in 0.027 seconds with 21 queries.