[mp_file] New commit checkbox initial value

Korchkidu - October 3, 2009 - 09:01
Project:Ubercart Marketplace
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Hi,

when having the "administer product features" permission, the commit checkbox appears only after clicking on the upload button. I believe it should be visible directly on the form to be more consistent between admin mode and normal user mode. Indeed, it is not required normally to click on the upload button to upload the file. Saving the form is sufficient.

Best regards.
K.
PS: thanks to those who ported the mp_file module from 5.x to 6.x. Great work!

#1

Korchkidu - October 6, 2009 - 14:03
Title:[mp_file] Commit checkbox not showing in admin mode» [mp_file] New commit checkbox initial value

The 'new commit checkbox' initial value is FALSE by default when creating a new file product. This is inconsistent as it introduce different behavior if you are a user and if you are an admin:

User:
1) Go to create a new file product;
2) Fill in the common fields;
3) Choose a file to upload; You are free from manually uploading the file;
4) Save node.

Admin:
1) Go to create a new file product;
2) Fill in the common fields;
3) Choose a file to upload; You MUST upload the file manually and check the commit checkbox.
4) Save node.

I propose a simple modification so that by defaut, the behavior is the same either you are a user or an admin. If you want to modify the default behavior, then you MUST upload the file and check/uncheck the commit checkbox.

function mp_file_widget_process($element, $edit, &$form_state, $form) {

  $element['data']['commit'] = array(
  '#type' => 'checkbox',
   '#title' => t('Commit file to product feature'),
    '#default_value' => FALSE,
// BEGIN CHANGES
    '#value' => variable_get('mp_file_allow_sellers_perm', FALSE),
// END CHANGES
  '#access' => user_access('administer product features')
);

  return $element;
}

Best regards.
K.

#2

Korchkidu - October 6, 2009 - 14:05
Status:active» needs review

#3

jbrodbeck - October 7, 2009 - 00:16

Korchkidu,

I have to play catch-up here. I saw the mp_file that wildkatana made and syndicateStorm modified, is this the version you are working on? Also, since it was never committed to the repository by turgrid, I can't say that it's formally supported yet.

However, if this is the case, I can definitely review the code and see if it's good to commit- all the while addressing whatever issues have been brought up concerning it.

#4

Korchkidu - October 7, 2009 - 06:00

I am working on the version posted in http://drupal.org/node/331415, message #52. Is there a way to be sure to work with the last dev version?

Best regards.
K.

#5

jorgerosa - November 8, 2009 - 20:59

Subscribing

#6

asak - November 10, 2009 - 08:12

@Korchkidu - there is another version over there, posted in comment #89. until something of the sort is committed we have no way of knowing we're working on the same version.

@jbrodbeck - +1 for committing this, as it does seem stable enough for a starter, just for the sake of continues hassle-free development.

and +1 for the change mentioned in comment #1 - haven't done much testing but it looks fine.

 
 

Drupal is a registered trademark of Dries Buytaert.