coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: DomS on September 30, 2007, 09:32:55 PM

Title: length of custom fields
Post by: DomS on September 30, 2007, 09:32:55 PM
Hi all,


I was wondering: is there a simple solution to increase the max length of custom fields?

I'm starting a page on architecture and heraldry, where custom fields would be an excellent place to add some relevant information. Only the 256 (?) chars are too little, I've noticed.
(I'm using the current stable version plus plugins final_extract, backup, display fields)

PS: Thanks to everybody giving so much input here - I've spent nearly all of my Sunday browsing this forum and getting many hints and solutions for my little problems. :)


cheers,
DomS
Title: Re: length of custom fields
Post by: just_some_guy on September 30, 2007, 10:02:01 PM
I would suggest using a tool like phpmyadmin and edit the column to a higher varchar
Title: Re: length of custom fields
Post by: Joachim Müller on October 01, 2007, 08:25:31 AM
You might want to take a look at the plugin MiniCMS (http://forum.coppermine-gallery.net/index.php?topic=15543.0) as well.
Title: Re: length of custom fields
Post by: DomS on October 01, 2007, 11:13:48 AM
Thanks for your hints - I will have a look at MiniCMS when I get home.

Has anyone already altered the database entries successfully?
This would be only one half of the solution, because there is a form maxlength="255" in the entry form. I just can't find the proper file to edit and change this. :(
Title: Re: length of custom fields
Post by: DomS on October 02, 2007, 11:03:20 AM
I have now installed MiniCMS. If I understand this entry (http://cpg-contrib.org/board/index.php?topic=168.0) correct, it's not possible to display MiniCMS elements below the image details.

So I will have to use the custom fields instead.
I will try to find the max length entry again tonight - will let you know when I come up with a solution.
Title: Re: length of custom fields
Post by: DomS on October 03, 2007, 01:06:48 AM
I have found my completely working solution! :)

I changed the database column from varchar(255) to text, as 255 is the maximum varchar allows.
You have to enter "cpg14x_pictures" - "user1" (user2, user3, user4) and change from "varchar(255)" to "text", giving your desired amount of characters.
So I can enter my long comments into the database directly and they show up the way I want in the gallery.

Then I went again, looking for the right place to change maxlength="255" in the entry form, so it would allow me to make changes directly within the gallery interface.
The file to edit is "editOnePic.php" - lines 340-380 you'll find entries for all four custom fields: name="user2" maxlength="255".
Change "maxlength" according to the changes made in the database...

Works perfectly!

To add a little comfort, I changed the height of my now extended input fields by changing the same lines, adding rows="5" cols="40".


Thanks everybody for your help and ideas! Maybe this little change might be useful for another user one day.
Title: Re: length of custom fields
Post by: dwo on June 04, 2008, 09:43:24 AM
Does not work for me, unfortunately.
Title: length of custom fields
Post by: dwo on June 17, 2008, 04:11:42 PM
Hello.

I refer to this topic: http://forum.coppermine-gallery.net/index.php/topic,47267.0.html

As it did not work, I tried to figure out why.

Following was what I did:

First: in template.css integrate textarea {overflow: hidden;}
This prevents scrollbars and users writing long lines.

Then in upload.php line 159 choose the numer of rows, lines and the table width you desire  <textarea name="$name" rows="8" cols="20" class="textinput" style="width: 65%;"

Then on line 2543 change to following(textarea): $form_array[] = array($CONFIG['user_field4_name'], 'user4', 3, $CONFIG['max_img_desc_length']);  [/b]

The same things you have to change in editpics.php, because there users will change settings, too. See line 368 and line 75
array($CONFIG['user_field4_name'], 'user4', 2, $CONFIG['max_img_desc_length']),  [/b]


The change in the SQL to text remains the same. So you have to do it.

thanks, regards, Dietmar