CVS edit link for adaddinsane

I've been working on commercial Drupal sites for over 3 years - this is the first time I've had something which will be generally beneficial. In fact so beneficial that it is a known issue that won't be fixed until Drupal 8. (See link below.)

The Attachments module provides administrator and user with some additional tools for working with file attachments. Giving a clearer interface

* Delete or keep / Show or hide

The user interface for keeping or deleting file attachments has been a problem to users for a long time (see http://drupal.org/node/239800) and it's unlikely to get solved until Drupal 8. The problem is that it is not intuitive.

The Attachments module modifies the interface, as seen by the user, to make the process clearer. It removes the checkbox and replaces it with a button which displays the current action (Keep/Remove), it does the same to the "List" checkbox which is also unclear and displays "Show/Hide" instead.

The changes are implemented through jQuery (Progressive Enhancement) and do not change the underlying functionality.

* Permitted file extensions

The display of which files extensions are accepted on the upload page can be replaced by a new, configurable, display list.

Rather than just providing a simple list extensions can be grouped (such as by overall type: Image, Document, Spreadsheet and so on) and the extensions which belong to those groups can be set. So that when the attachment upload element is displayed a much clearer list of extensions is provided.

There is a default group for any extensions not covered in the groups.

This feature is implemented in the module itself and does not require jQuery to work.

* File upload limit

The ability to limit the size of individual file uploads, and also to limit the total file size limit per user already exists in Drupal. However this Attachments module provides the ability to specify a (configurable) limit to the number of files that can be uploaded per node. (On the example site this is set to 2.) When the limit is reached the upload element is replaced by a warning.

This feature is implemented in the module itself and does not require jQuery to work.

* File attachment display style

The final enhancement is to allow an alternate display style to the usual table format. You can select a list style for file attachments instead which displays the attachments as an unordered list. Currently the effect is global for all content types that have file attachments, but will be enhanced to be content-type specific.

This feature is implemented in the module itself and does not require jQuery to work.

* Example website

An example website is provided at: http://attachments.thewordsmith.net

You can log in as testuser1 to testuser5, the password is the same as the username, each user can create two pages and each page can have two attachments of less than 1Mb each. A block at the side displays the pages belonging to the current user so they can be accessed and changed.

Comments

adaddinsane’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new5.58 KB

Attachments module attached.

adaddinsane’s picture

StatusFileSize
new51.02 KB

I didn't mention that I've hung the settings page off the "File uploads" menu item, and I've attached a screenshot of what it looks like.

avpaderno’s picture

Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

adaddinsane’s picture

StatusFileSize
new21.33 KB

Additional image showing the button replacements for the checkboxes, and the new permitted file extensions display

adaddinsane’s picture

StatusFileSize
new5.94 KB

I've run the Coder module on my "attachments" module so it conforms to style better. New version attached.

avpaderno’s picture

Status: Needs review » Fixed
  1. function attachments_install() {
      $exts = array(
        'documents' => array('txt', 'doc', 'docx', 'odt', 'pdf', 'rtf'),
        'images' => array('gif', 'png', 'jpg', 'jpeg'),
        'spreadsheets' => array('xls', 'xlsx', 'ods'),
        'presentations' => array('ppt', 'pps', 'pptx', 'ppsx', 'odp'),
      ) ;
      variable_set(ATTACHMENTS_VAR_EXTENSIONS, $exts) ;
      variable_set(ATTACHMENTS_VAR_EXTENSION_SWITCH, TRUE) ;
      variable_set(ATTACHMENTS_VAR_OTHER_EXTS, 'others') ;
      variable_set(ATTACHMENTS_VAR_STYLE, 0) ;
      variable_set(ATTACHMENTS_VAR_MAX_FILES, 0) ;
    }
    

    Drupal variables are normally not set during the installation of the module; the reason to do that is to avoid to waste space in the database to contain a value that is the default value, which is the same value passed to variable_get(), and that will be returned from the function in the case the variable has not been set, yet.

  2. Creating a file to just contain the value of some constants is probably not the better solution. I would rather put those constants in the module file, in the case you need them in the installation file, it's enough to call drupal_load('module', 'attachments').
  3. The code should be better formatted. The space before the semicolon at the end of an instruction is not necessary, and the open curly bracket after the control statement is required (and it should be placed on the same line where the control statement is).

For the rest, the code is fine. I think the module will probably find many interested users.

Thank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

adaddinsane’s picture

Thank you. I appreciate it.

I will make the changes - though I prefer it my way :-)

I suffered terribly switching to double spaces - I really really prefer tabs and I think a space before the semicolon is far more aesthetic.

Hmmm, just to be mean, I might use a class to declare my constants instead - after all, it's far more secure than 'define'.

Well, maybe not. Anyway, thanks again.

I hope you're right about this one having some interest. But you wait till you see what's coming next... something that's been desperately wanted in Drupal for years. Some projects have been taking baby-steps towards it but currently it's just a joke on Drupal. Oh my, you just wait... tomorrow, the world! Mwha-ha-ha!

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes