Here is what I did :
Line 225 :
//Initialize variables
$mg->pics_tbl = $modx->db->config[’dbase’].".".$modx->db->config[’table_prefix’].$mg->mgconfig[’gtable’];
$descvalid = 0; // assume descriptions not supported
$custposvalid = 0; // assume that custom image ordering not supported
$context_idvalid= 0; // partir du principe que le lien vers le contexte n’est pas supporté
$filesizevalid= 0; // partir du principe que le poids du fichier n’est pas supporté
Then around line 418 I added my fields
// Ajout des champs customs pour soleil.info
if($context_idvalid==1)
$updateQueryString.=", descr=’".addslashes($_REQUEST[’context_id’.$i])."’"; // Ajout du lien vers le contexte
if($filesizevalid==1)
$updateQueryString.=", descr=’".addslashes($_REQUEST[’filesize’.$i])."’"; // Ajout de la taille de fichier
// Fin des modification pour l’ajout des champs custom
Around line 580 :
// Modification pour l’ajout du lien vers le contexte de l’image et du poids du fichier
$pic[’context_id’] = stripslashes($pic[’context_id’]);
$pic[’filesize’] = stripslashes($pic[’filesize’]);
// Modification pour l’ajout du lien vers le contexte de l’image et du poids du fichier
Of course then I had to edit managepicturetpl.html, and add the fields, since they are short fields (one is the ID of the document where the image can be seen "in context", the other the filesize manually added) :
<div class="shortfields">
ID: [+maxigallery.picture.id+]
<br />
[+maxigallery.strings.delete+]:
<input type="checkbox" name="[+maxigallery.fieldnames.delete+]" value="yes" title="[+maxigallery.strings.check_to_delete_this_picture+]"/>
<br />
[+maxigallery.strings.hide+]:
<input type="checkbox" name="[+maxigallery.fieldnames.hide+]" value="yes" title="[+maxigallery.strings.check_to_hide_this_picture+]" onClick="document.editform.[+maxigallery.fieldnames.modified+].value='yes'" [+maxigallery.picture.hide:is=`1`:then=`checked="checked"`+]/>
<br />
ID doc contexte <input type="text" size="4" name="[+maxigallery.fieldnames.context_id+]" id="[+maxigallery.fieldnames.context_id+]" onKeyDown="document.editform.[+maxigallery.fieldnames.modified+].value='yes'" value="[+maxigallery.picture.context_id+]"/><br />
<br />
Poids de l'image : <input type="text" size="8" name="[+maxigallery.fieldnames.filesize+]" id="[+maxigallery.fieldnames.filesize+]" onKeyDown="document.editform.[+maxigallery.fieldnames.modified+].value='yes'" value="[+maxigallery.picture.filesize+]"/><br />
[+maxigallery.strings.position+]:
<input type="text" size="3" name="[+maxigallery.fieldnames.position+]" id="[+maxigallery.fieldnames.position+]" onKeyDown="document.editform.[+maxigallery.fieldnames.modified+].value='yes'" value="[+maxigallery.picture.pos+]"/>
</div>
Then last but not least, I added the &context_idvalid=`1` &filesizevalid=`1`parameters, to make sure both fields would be used.
I must have done something wrong, because when I submit the data, it’s not inserted in the DB.
Maybe something to do with the way I created the fields in the DB ?
Is there anything to be aware of ?
Thanks !