4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: DennisRR on September 17, 2007, 10:27:25 PM

Title: radio buttons in admin back to no every time
Post by: DennisRR on September 17, 2007, 10:27:25 PM
In the admin panel, I have some additional fields and radio buttons. The zero in db_field_definitions didn't put the radio buttons standard on no (by having the zero) but thanks to this thread http://www.4homepages.de/forum/index.php?topic=12583.0 I managed to have them standard on zero/no anyway. However, when one option (or more) is tagged as a YES in the admin panel, it goes automatically back to NO the next time I'm editing an image. What's causing this? I have version 1.7.4

Dennis
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 17, 2007, 10:41:12 PM
1 - Please list all $additional_image_fields you create in includes/db_field_definitions.php file.
2 - You create fields in IMAGES_TABLE in phpmyadmin ? If yes, what is SQL command use ?
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 18, 2007, 01:19:00 AM
1.

$additional_image_fields['sale'] = array("Standard RF sale", "radio", 0);
$additional_image_fields['rm_photo'] = array("RM Request", "radio", 0);
$additional_image_fields['image_promotion'] = array("Promotion", "radio", 0);
$additional_image_fields['promopic'] = array("Add Promotion Pic", "radio", 0);
$additional_image_fields['price3'] = array('Price (euro)', "text", 0);

2.

I used this upload for each additional field to the database:

Code: [Select]
<?php

define
('ROOT_PATH''./');
include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'global.php');

$sql_data = array(
   
"ALTER TABLE `".IMAGES_TABLE."` ADD `promopic` tinyint (1) NOT NULL",
);

foreach (
$sql_data as $val){
if ($site_db->query($val)) {
 
  $log[$val] = "Succesfully updated Database";
}
else {
  $log[$val] = "<font color=\"red\">Error</font>";
  $error 1;
    }
}

if (!
$error) echo "Succesfully updated Database";
else echo 
"an Error occured";

?>

-------
PHP version: 4.4.6
Mysql: 4.1.22

Thanks for helping finding an answer. It's much appreciated.

Dennis, Sweden
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 18, 2007, 01:24:46 AM
Ok so these 4 for int:

Quote
$additional_image_fields['sale'] = array("Standard RF sale", "radio", 0);
$additional_image_fields['rm_photo'] = array("RM Request", "radio", 0);
$additional_image_fields['image_promotion'] = array("Promotion", "radio", 0);
$additional_image_fields['promopic'] = array("Add Promotion Pic", "radio", 0);

Quote
$additional_image_fields['price3'] = array('Price (euro)', "text", 0);

What type for this one in DB ? Is say text so is varchar ? ;)
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 18, 2007, 11:13:26 AM
In the database
Code: [Select]
$additional_image_fields['price3'] = array('Price (euro)', "text", 0);is called: varchar.

Should I change it to text in the database?

The radio button options in the admin panel are linked to the individual settings of a price for the picture.
(http://artinallofus.org/sample_adminpanel.jpg)

Dennis
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 18, 2007, 01:22:20 PM
Quote
Should I change it to text in the database?

text in phpmyadmin is for textarea in HTML.

Quote
The radio button options in the admin panel are linked to the individual settings of a price for the picture.

Is update in ACP - > Setting or you create self setting page / plugin page in ACP ?
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 18, 2007, 09:48:37 PM
The update is in ACP. Everything works like it should, except when the photographer of the site wants to edit a picture, the options of the additional field are set to zero (no). So he has to look in his papers what the old setting of the option was, to tag it as yes again, before hitting the 'save changes' button. After the initial save, it shows right, but as soon as you click on edit and going to the picture again, they're back to zero.

Dennis
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 19, 2007, 01:06:58 AM
This mean is no save right if click 'Save Changes' button. So, if go to edit images ... go to image and see view source for the additional image field ... what is say in view source of browser for this line ?
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 19, 2007, 03:12:56 PM
the view source for the additional fields in ACP are:

Code: [Select]
<td><p class="rowtitle">Standard RF sale</p></td>

<td><p><input type="radio" name="sale" value="1"> Yes&nbsp;&nbsp;&nbsp;
<input type="radio" name="sale" value="0" checked="checked"> No </p></td>
</tr><tr class="tablerow2">
<td><p class="rowtitle">RM Request</p></td>
<td><p><input type="radio" name="rm_photo" value="1"> Yes&nbsp;&nbsp;&nbsp;
<input type="radio" name="rm_photo" value="0" checked="checked"> No </p></td>
</tr><tr class="tablerow">
<td><p class="rowtitle">Promotion</p></td>

<td><p><input type="radio" name="image_promotion" value="1"> Yes&nbsp;&nbsp;&nbsp;
<input type="radio" name="image_promotion" value="0" checked="checked"> No </p></td>
</tr><tr class="tablerow2">
<td><p class="rowtitle">Add Promotion Pic</p></td>
<td><p><input type="radio" name="promopic" value="1"> Yes&nbsp;&nbsp;&nbsp;
<input type="radio" name="promopic" value="0" checked="checked"> No </p></td>
</tr><tr class="tablerow">
<td><p class="rowtitle">Price (euro)</p></td>

<td><p><input type="text" size="30" name="price3" value=""></p></td>
</tr>
<tr class="tablefooter">
<td colspan="2" align="center">
&nbsp;<input type="submit" value="   Save changes   " class="button"  onClick='showProgress()'>
<input type="reset" value="   Reset   " class="button">

I hope this is what you meant.

Dennis
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 19, 2007, 08:35:17 PM
Quote
I hope this is what you meant.

Yes, good work. ;)

Now, in admin/images.php file,

find:

Quote
$sql = "UPDATE ".IMAGES_TABLE."
            SET cat_id = $cat_id, user_id = $user_id, image_name = '$image_name', image_description = '$image_description', image_keywords = '$image_keywords', image_date = $image_date, image_active = $image_active, image_media_file = '$new_name', image_thumb_file = '$new_thumb_name', image_download_url = '$image_download_url', image_allow_comments = $image_allow_comments, image_downloads = $image_downloads, image_votes = $image_votes, image_rating = '$image_rating', image_hits = $image_hits".$additional_sql."
            WHERE image_id = $image_id";
    $result = $site_db->query($sql);

add after:

Code: [Select]
var_dump($result);

Save file and go to edit image and try again. When click 'Save images' button, a line show at top of page. Please post the full debug line and I check. ;)
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 19, 2007, 09:33:59 PM
Here it is:

Code: [Select]
bool(true) Image edited
It's not much but I hope it's helpful. Thanks again for your time.

Dennis
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 19, 2007, 09:35:03 PM
Hum ... bool true ... is mean is work for update table (+ additional image fields) ... if try on fresh folder of 4images (new database) ... is work ?
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 20, 2007, 12:55:54 AM
I'm not sure what you mean. Do you want me to create a whole new database?

D.
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 20, 2007, 01:33:16 AM
Quote
Do you want me to create a whole new database?

Yes and new fresh folder of 4images to see if same result with additional image fields ...
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 25, 2007, 11:13:33 PM
After having installed a fresh folder of 4images, the additional fields being set on zero in the db_field_definitions come up as yes in the ACP. I haven't implemented the solution to this as I mentioned earlier because that part worked well. But the rest seems to be okay. The options of the additional fields that I tagged yes, stay yes with the next time I edit a picture. Do I have to compare each page to see where the difference lies or do you know which file is responsible for it?

Dennis
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 25, 2007, 11:20:15 PM
The responsible file is admin/images.php file for this.
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 26, 2007, 12:08:51 PM
the file image.php in admin is now exactly the same as the original. Still there are some differences in the ACP. In 'adding images' the additional fields are missing, but not in 'editing images'.

I implemented the hack I found here:
http://www.4homepages.de/forum/index.php?topic=12583.0
to force the settings of the radio buttons of the additional fields to no but it doesn't work in the new version of 4images. (both are 1.7.4)

And finally, the radio buttons of the additional fields in the first version of 4images turn all to no again, no matter what the settings were before, when I edit the image again at a later time. In the fresh installation this does work well though.

Another difference I noticed that in the fresh version, the address field in the browser shows after the index, for example:
Code: [Select]
?sessionid=059c862e7d4d5441a6ebe541294d3790
In the first version, it shows nothing after the index
I have Pretty Urls installed.

It's becoming complicated!

Dennis
Title: Re: radio buttons in admin back to no every time
Post by: thunderstrike on September 26, 2007, 12:32:17 PM
Quote
Another difference I noticed that in the fresh version, the address field in the browser shows after the index, for example:

Please read this post for post session ID and how fix this:

http://www.4homepages.de/forum/index.php?topic=8802.0
Title: Re: radio buttons in admin back to no every time
Post by: DennisRR on September 26, 2007, 01:53:11 PM
Okay, no posting of a session id link. But I'm not experiencing any logging problems and I couldn't get access to the acp by pasting that part in the address field as I always logout after I'm done. Any other thoughts of where the problem of the additional field options could be?

Dennis