Recently I had the need for CCK-fields in the previewlist (after uploading) to store extra information.
I noted in the source that it was planned for a future release. I could not wait so I created my own solution.

This little patch should work for regular fields you select in the configuration. Validation of the fields is done by the CCK-module.
If you still miss something let me know and I try to get out a new patch ASAP.

Comments

grandcat’s picture

You forgot to attach the patchfile ;)

Mesdag’s picture

StatusFileSize
new1.62 KB

Oops forgot to click the 'Attach button'. Here it is.

grandcat’s picture

Thanks, we'll check it.

a_lawry’s picture

Hi,

I've tried this patch. It works great for the admin user. The cck fields aren't showing up for my other roles which have permissions to edit content. Which permissions does the user need for the CCK fields to show up on this page? I have the content_permissions module enabled and have granted all permissions to the user.

The image can be uploaded and taxonomy fields show up to be edited just not CCK fields.

Thanks.

a_lawry’s picture

Disabling content_permissions made the fields show up.

Mesdag’s picture

I found the issue, content_field_form returns form elements that are checked with content permissions.
Because we put in a new field_name (field_x_), it cannot make a match against the field name as seen in permissions (field_x) and returns false, disabling the field.

Renaming the form field will cause overwritten fields after submit.
Renaming the form field after it is generated might be a temporary solution.

-or-

Create each form as fieldset with #tree, this should allow us to keep all field names as is, and looping over every image node becomes a lot easier. This means a major refactor of the images.previewlist.imagefield.inc
How this is going to work with validation I'm not 100% sure.

Ideas and suggestions are always welcome.

Mesdag’s picture

StatusFileSize
new22.34 KB

A bit late response but here is a patch that makes the fields appear according to access.
It pretty much restructures the form to use #tree.

While I was at it, I added a couple of codestyle fixes.

EndEd’s picture

The #7 patch is great :) Thanks

But in my case I use Conditional Fields a lot. I can let the user decide between a forced Select list of terms or a freetag if the Select list dont have a representative term of the image uploaded. This way the freetags can be revised by admins before put them on the forced list for others users.

This patch exposes the radio buttons that the Conditional Fields module use to let you choose between the select list or the freetags but it also expose the forced select list and the freetag Autocomplete widget. So it broken the Conditional Fields module behavior. Do you think it will be dificult to give support to this module in your patch?

adam_c’s picture

From the patch in #7, Im getting the error:

Fatal error: Unsupported operand types in C:\...\sites\all\modules\image_fupload\includes\images.previewlist.imagefield.inc on line 197

which is line:

$form[$image->fid] += (array) content_field_form($form, $form_state, $field);

Any idea what this is about?

Orjan’s picture

One of the fields to be filled in in my version has a default value taken as a Node Reference from URL, but with this module, it's set to nothing, so I still need to select the correct Node Reference for each uploaded image.

Is this something that is changeable on this module that can keep the default value picked from url?

dboeije’s picture

I've applied this patch, but it blanks out whenever you submit your captions by clicking 'done editing'.

However: it does upload the picture and attaches it to a node, but still one of my CCK-fields has to be filled in manually.

gstout’s picture

First of all let me say thank you for this patch and "Please lets get this into the dev branch"

I found a bug in this code and solved it. This will be my first code contribution to Drupal so it's a little exciting to me. I'd make a legitimate patch if I thought I could pull it off.

I received this error
"Fatal error: Cannot use string offset as an array in C:\sites\slidesite\sites\all\modules\contrib\image_fupload\includes\images.previewlist.imagefield.inc on line 359"

Turns out the $value is a string so I added the int type cast ($value = (int)$value;) and all started working.

      // Imagefield (CCK).
      foreach ($imagefield_fields as $key => $value) {
        $value = (int)$value;
        if (isset($image['imagefield_'. $value])) {
          $node->$image_field_name[0]['data'][$value] = $image['imagefield_'. $value];
        }
      }
grandcat’s picture

Perhaps you could provide a new patch linked to DEV branch?

gstout’s picture

I really wouldn't know how. If I did I would