CVS edit link for RavenHursT

I have written a Gallery Assist "Extras" module that allows someone to utilize the awesome back-end gallery management of the Gallery Assist Project but gives the option to view galleries with the exquisite Galleria jQuery plugin.

This is my first Drupal Module and I'm sure there's some formatting/code review issues with it. Please give me the opportunity to learn and contribute more to the Drupal community by maintaining this module!

Comments

RavenHursT’s picture

Title: RavenHursT [ravenhurst] » RavenHursT [ravenhurst] - Gallery Assist Galleria Module Contribution
Status: Postponed (maintainer needs more info) » Needs review
Issue tags: +gallery assist
StatusFileSize
new178.6 KB

Here is the compressed module.

avpaderno’s picture

Title: RavenHursT [ravenhurst] - Gallery Assist Galleria Module Contribution » RavenHursT [ravenhurst]
Status: Needs review » Needs work
Issue tags: -gallery assist +Module review

Hello, and thank you for applying for a CVS account. I am adding the review tags, and somebody will report what needs to be changed.

As per requirements, the motivation should include more than two sentences of features, and a comparison with the existing solutions.

RavenHursT’s picture

My apologies.

The current Gallery Assist module is a wonderful implementation for back-end administration of large photo galleries. But the front-end display options seem lacking.

The current front end view for GA nodes is a listing of images in a gallery along with a paginator. This is fine for basic applications but with the recent explosion of jQuery-driven visual effects, there needs to be a solution that will allow for not only easy management of large galleries, but also a means of displaying those galleries to users utilizing the rich effects that are now available for the myriad of jQuery gallery plugins available to thes global front-end developer community.

This module attempts, in a small and humble way, to address that solution. The Galleria plugin is one of the most efficient and visually appealing gallery solutions out there and it only makes sense to have it as an option to display galleries through. It is also HIGHLY customizable with a rich "theme" layer to it's front-end code allowing for the future expansion of this module to allow for limitless front-end gallery visual effects.

In future versions of this module I would like to include new Galleria "themes" to allow for these different front-end experiences for users of Drupal sites as well as create something that will allow Drupal site developers and themers a simple way to enrich the media section of their Drupal sites.

RavenHursT’s picture

Status: Needs work » Needs review
RavenHursT’s picture

Could someone please review this? Or tell me what else I need to do to get this project going? It's been over a week now... :-(

cafuego’s picture

Status: Needs review » Needs work

The module's info file should not contain a version string. Drupals packaging system would handle that.

I'm not convinced you should call drupal_set_message() or watchdog() in the install and uninstall hooks, I'm pretty sure notifications there are handled internally, as is the management of the system table. You can remove your hook_install() implementation completely and leave only the variable_del() call in the uninstall hook.

Can you use a more descriptive array key than 00001 in _gag_settings_form?

What happens when a user enters -200 as height or width in the settings form? Perhaps you should add a validate handler as well.

The code could do with a tiny bit of cleanup, that's mostly an issue of spacing though. Sometimes you use if(...){ and sometimes if (...) { I believe the latter is the preferred Drupal Way™ ;-)

In the js file, some indenting uses tabs and some uses spaces. Pick one, pick spaces ;-)

Do you maintain the $Id tags manually? CVS requires only $Id$ and inserts revision info automatically.

Finally... you're including an external jQuery library (customdata). If any other modules also include this, they may end up clashing... would it be worth adding a separate jQuery Customdata module and having GAG depend on it?

awolfey’s picture

Status: Needs work » Needs review

In uninstall you don't need to worry about the system table. Uninstalling will do that on its own.
Same for clearing the cache, I'm pretty sure.
I think you can have the external js libraries go in sites/all/libraries. They probably do not qualify to be included in Drupal's repo anyway.
It looks like you left your site's url in the tpl file.
The tpl also needs an id tag at the top.

RavenHursT’s picture

Cool.. thanks guys.. I'll do some updates..

RavenHursT’s picture

StatusFileSize
new3.58 KB

Alrighty:

Here's a new zip with the updates suggested above along with a few others to correct some bugs etc...

Thanks

RavenHursT’s picture

StatusFileSize
new3.65 KB

Corrected Admin form validation

RavenHursT’s picture

StatusFileSize
new179.35 KB

Added libraries dependency to the .info file.

RavenHursT’s picture

StatusFileSize
new3.66 KB

Oops... forgot to delete some stuff... cleaned up...

awolfey’s picture

Status: Needs review » Reviewed & tested by the community

This looks ready to go to me. I worked with RavenHursT on fixing some minor problems. I did not actually test it.

RavenHursT’s picture

StatusFileSize
new3.64 KB

Renamed jquery.gag.js to gag.js

avpaderno’s picture

Status: Reviewed & tested by the community » Needs review
HedgeMage’s picture

Status: Needs review » Reviewed & tested by the community

This looks good.

I haven't tested, but the only change since awolfey reviewed was the rename RavenHursT described, and between our two pairs of eyes we should have (hopefully) noticed anything major.

avpaderno’s picture

Status: Reviewed & tested by the community » Needs work
  1. function gag_settings_submit(&$form, $form_state) {
      variable_set('gag_enable', $form_state['values']['gag_enable']);
      variable_set('gag_height', $form_state['values']['gag_height']);
      variable_set('gag_width', $form_state['values']['gag_width']);
    }
    function gag_settings_validate($form, &$form_state){
      if($form_state['values']['gag_height'] < 60 || !is_numeric($form_state['values']['gag_height']))
        form_set_error('gag_height', t('Height must be larger than 60 and cannot be "auto".'));
      if((!is_numeric($form_state['values']['gag_width']) && $form_state['values']['gag_width'] != 'auto') || (is_numeric($form_state['values']['gag_width']) && $form_state['values']['gag_width'] < 60))
        form_set_error('gag_width', t('Width must be larger than 60 or "auto".'));
    }
    

    There should be an empty line between functions.
    The sentence 'Height must be larger than 60 and cannot be "auto". should be changed (must be higher than is probably better).

  2. The module implements hook_uninstall(), but it doesn't delete all the variables it defines.
  3. The arguments for gag_preprocess_node(&$vars, $hook) are not correct; Drupal passes only the first argument.
  4. gag_gallery_assist_display_list() is not a theme function, but outputs HTML tags.
RavenHursT’s picture

StatusFileSize
new3.65 KB

I've corrected the first three issues kiamlaluno noted above, but is #4 really not a themeable function? Why does it say so in the GA module? If it really isn't, why is it outputting a html tags in the following and how should I fix it ?

gallery_assist_list_display.inc, line 440:

<?php
/**
 * Theme the Gallery Assist Container as list.
 *
 * @ingroup themeable
 */
function theme_gallery_assist_display_list($pager, $boxes, $conf, $type = 'gallery_assist') {
  
  $output  = '<!-- Gallery Assist container -->'."\n";
  $output .= '    <div id="gallery-container-'. $conf['nid'] .'" class="'. $type .' gallery-container '. $conf['op'] .'  container-justify-'. $conf['container_justify'] .' container-justify-'. $conf['container_justify'] .' clear-block"'. $conf['$my_attr'] .'>'."\n";
  $output .= $conf['pager_position'] == 'top' || $conf['pager_position'] == 'both' ? $pager : '';
  $output .= $boxes;
  $output .= $conf['pager_position'] == 'bottom' || $conf['pager_position'] == 'both' ? $pager : '';
  $output .= '    </div>'."\n";
  $output .= '    <!-- End of Gallery Assist container -->'."\n";

  return  $output;
}
?>

Thanks for the review kiamlaluno.

RavenHursT’s picture

Status: Needs work » Needs review

Setting back to NR..

avpaderno’s picture

In Drupal, a theme function is a function with a name that starts with theme_, which is registered in a hook_theme() implementation; theme_gallery_assist_display_list() is a theme function, but gag_gallery_assist_display_list() is not.

RavenHursT’s picture

So do I just need to rename the function?

cafuego’s picture

I expect you might even need to rename it to theme_gag_gallery_assist_display_list() and register the function in a hook_theme() implementation.

avpaderno’s picture

cafuego is right; plus, you also need to change how the function is called.
Theme functions are never called directly; they are usually called as theme('image', <parameters>).

jcmc’s picture

Status: Needs review » Needs work

Hello RavenHursT,

the best is, you remove the last function from the script. It is not declared in the hook_theme() and is not called or used.

To learn and know how theme functions should be written or called visit the Default theme implementations api.

Regards
Juan Carlos

RavenHursT’s picture

Status: Needs work » Needs review
StatusFileSize
new3.6 KB

Ok... I removed that last function.. not sure why that was in there.. I think it was something I forgot to delete.. oops... Should be good for review again...

RavenHursT’s picture

jcmc’s picture

Hello RavenHursT,

- you should insure that your scripts are free from console.log() or dsm() - calls etc.
see line 40 from gag.js console.log( this.settings.width);

- In the hook_theme you initialize the template with the name gag_display.
Rename the template to gag-display
Rename the file galleria.tpl.php to gag-display.tpl.php

Regards
Juan Carlos

avpaderno’s picture

Status: Needs review » Needs work

I am changing the status as per previous comment.

RavenHursT’s picture

Status: Needs work » Needs review
StatusFileSize
new3.59 KB

I've made the changes above. Setting back to NR..

jcmc’s picture

Hello Kiam,

points from #28 fixed as expected.

Regards
Juan Carlos

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » Fixed

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.

RavenHursT’s picture

Woohoo! Thanks Kiam!

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
Status: Closed (fixed) » Fixed

I am giving credits to the users who participated in this issue.

Status: Fixed » Closed (fixed)

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