CVS edit link for garbanzito

I have created and tested a module which enables use of SurveyGizmo surveys within a Drupal site. I would like to contribute this module, and I plan to maintain it and respond to the module's issue queue so that others can use it and the community can improve the module. The module was developed with the support of SurveyGizmo.com, and as part of my work with Growing Venture Solutions. I look forward to the review this module will get as part of my CVS application.

I have been working with Drupal for over three years, and have gradually become a site architect and developer over the last 18 months. As a developer coming from other environments, I have worked hard to understand and embrace the Drupal community's goals and standards. I have other contributions planned.

Comments

garbanzito’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new8.39 KB

please review my module and application

garbanzito’s picture

Pre-emptively, here is a comparison with existing solutions. First of all, there is currently no Drupal module offering SurveyGizmo integration. Instead, a search of for "surveygizmo" on Drupal.org and Groups.drupal.org reveals that many users have included links to SurveyGizmo surveys in their posts, or mentioned SurveyGizmo as having features they'd like to have on a Drupal site. SurveyGizmo clearly appeals to some Drupal users as a way to conduct surveys.

A few modules offer ways to manage a narrower use-case of survey, for example:

http://drupal.org/project/priorities
http://drupal.org/project/quiz

Some modules address a more general use-case, but without the comprehensive tools SurveyGizmo provides:

The obsolete http://drupal.org/project/survey
http://drupal.org/project/webform

However I can find no modules that implement embedding or integration with any of the major online survey services.

[Edited by kiamlaluno to alter the links that were written using a Markdown syntax, which is not handled on d.o]

garbanzito’s picture

Pre-emptively, here is a more detailed description of the module. The SurveyGizmo module provides the following basic features:

1. An admin interface to enter a SurveyGizmo API key.
2. An admin interface to list surveys associated with the API key, selectively activate surveys for use with the site, and specify a path at which an activated survey can be presented.
3. Presentation of surveys on stand-alone pages.
4. An input filter which, when part of an available input format, enables JavaScript embedding of SurveyGizmo surveys within content.

avpaderno’s picture

Status: Needs review » Needs work
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.

As you reported links to projects that in someway allows to handle surveys, may you report the pro of using the proposed module versus using the existing projects?

garbanzito’s picture

Status: Needs work » Needs review

Sure -- the pro of using the proposed module is that it allows use of all of the features SurveyGizmo's hosted surveys provide on a survey presented to visitors as a part of a Drupal site. SuveyGizmo's features include very detailed survey construction, easy management of multiple surveys, complex survey logic, survey theming, and comprehensive reporting, all of which are designed to be accessible to people who are not Drupal developers nor architects. None of the the existing modules provides a compelling end-user package of this sort. Even combining several modules would not approximate the depth or ease of SurveyGizmo's tools. It seems unlikely that such a survey-builder package will soon evolve out of the existing Drupal modules.

There is also a use case where people may want to use a survey on multiple sites. With this module alone, the same survey may be embedded on several Drupal sites. With other tools available, the same survey could also be used on other non-Drupal sites. There is no Drupal module for deploying the same survey on many different sites, some of which are not Drupal sites.

As I mentioned above, many Drupal users, some of them very experienced, have linked to SurveyGizmo surveys or mentioned SurveyGizmo as having features they like. Some have even used SurveyGizmo for gathering information from the Drupal community, so SurveyGizmo's service seems to have a perceptible credibility within the Drupal community.

coltrane’s picture

Status: Needs review » Needs work

Looks great, and I love all the commenting!

Few things found under code inspection:

In the _surveygizmo_request() method of the surveygizmo_api class you use file_get_contents() and have a TODO to use a more graceful solution. How about using drupal_http_request()? This allows for easily checking the response code. You can also use http://api.drupal.org/api/function/drupal_query_string_encode/6 to build the query part.

In surveygizmo_present_survey() how about wrapping the $fail message in t() so it can be translated? You can pass the $sgid and $survey variables as arguments.

You don't need the check_plain() in surveygizmo_manage_survey() on 'Manage survey', but you could use t() so it's translatable.

I think you need a return; or exit; after using drupal_not_found() in the functions surveygizmo_form_manage_survey() and surveygizmo_manage_survey()

Arguments in the $embed_description on line 190 of surveygizmo_form_manage_survey() appear to not actually be used in the string. I don't see the replacement @format used.

I don't see any, but maybe I'm missing it, but is there anything stopping me from setting a survey to an existing system path, like 'admin' or 'node/add/page' ? I don't think this is a blocker though cause it's a bit difficult to check for all the system paths. You could see what Views does, if anything. This could be handled later once the module is on contrib.

There are a few text arguments to l() in surveygizmo_dashboard() that should be run through t().

greggles’s picture

is there anything stopping me from setting a survey to an existing system path, like 'admin' or 'node/add/page'

Pathauto handles that with the below code. I just tried to create a node with a pattern of "user/[title-raw]" and a node title of "register" and Pathauto silently refuses to create the alias. I'm not sure being silent is right, but at least we know that the check that Pathauto does works ;)

function _pathauto_path_is_callback($path) {
  $menu = menu_get_item($path);
  if (isset($menu['path']) && $menu['path'] == $path) {
    return TRUE;
  }
  return FALSE;
}

I guess something similar could work here as well.

garbanzito’s picture

StatusFileSize
new8.82 KB

Thanks for the review, Ben. And thanks for the tip, Greg -- turns out that was one of the first places I had looked for an example of path checking.

In the attached I believe I've addressed all the above concerns, but with a different tactic than suggested on the menu path checking.

To answer Ben's question, there is indeed nothing stopping someone with the 'administer surveygizmo' permission from usurping an existing system path. I think there are valid reasons one might want to render a survey at an existing path, perhaps on a temporary basis. This is borne out by the fact that neither Views nor the core Path module disallows usurping an existing path.

But the question led me to address two other issues:

1) I learned that I wasn't doing enough to delete unreferenced paths from the menu cache, so the code now has logic to detect changed/deleted paths and deactivate the old path;

2) a user with 'adminster surveygizmo' permission could override a system path to which they did not have access, so I've prevented that with an access check when validating the a path submission.

garbanzito’s picture

Status: Needs work » Needs review
coltrane’s picture

I've reviewed again, and installed and used the module and I believe garbanzito's app should be approved. As a coworker I don't want to RTBC but I do think it's RTBC status.

avpaderno’s picture

Assigned: Unassigned » avpaderno

I will review the code tomorrow morning (less than 24 hours from now).

avpaderno’s picture

Status: Needs review » Needs work
  1.   if (!$fail) {
        drupal_set_title(check_plain((string)$survey->title));
        $output = (string)$survey->js_embedingcode;
        $output .= (string)$survey;
      }
      else {
        drupal_set_title(check_plain($fail));
        $output = "<p>" . t("This survey is not configured or is no longer valid.") . "</p>";
      }
    

    Error messages, as other type of messages, are shown with drupal_set_message().

  2.   $form['presentation']['embed_token_description'] = array(
        '#value' => '<p><strong>' . t('Embedding') . ':</strong> ' . $embed_description . '</p>',
      );
    

    In this case, passing a single string to t() would give more context to who translates the strings. There are languages where the word embedding can be translated in different ways, depending on the context. Without such context, it would not be possible to translate the word correctly.

garbanzito’s picture

Status: Needs work » Needs review
StatusFileSize
new16.57 KB

Thanks. Took care of those items.

avpaderno’s picture

Status: Needs review » Fixed
require_once('surveygizmo.api.php');

The code doesn't work, as it's trying to load the file from the Drupal root directory, which is the current directory set by Drupal. If the file is always included, then it is better to merge it with the module file.

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.

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