hi There,

We created a module to easily add a chat widget for Casengo to drupal websites. Can it be reviewed?
Thanks a lot,
Thijs

PS. check www.casengo.com for more info on the casengo customer support tool.

Edit by gazoakley - please ensure you specify your project page/repository for review

Sandbox: http://drupal.org/sandbox/thijscasengo.com/1847868
Repository: http://git.drupal.org/sandbox/thijscasengo.com/1847868.git

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gazoakley’s picture

Title: needs review: Casengo Chat Widget » Casengo Chat Widget
gazoakley’s picture

Status: Needs review » Needs work

Hi thijs@casengo.com,

Thanks for submitting a project application for review. To help you track the status of your application you might want to enable email notifications for changes to your application:

http://drupal.org/project/issues/subscribe-mail/projectapplications

You might also want to participate in the review bonus program - this should help ensure your application is review quickly:

http://drupal.org/node/1410826

The PAReview tool identified issues which need addressing:

http://ventral.org/pareview/httpgitdrupalorgsandboxthijscasengocom184786...

  • It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
     
  • README.txt is missing, see the guidelines for in-project documentation.
     
  • You need to do some tidying - generally your .module files should be in the root of your repository (unless you also have submodules). There's also a ZIP file that probably shouldn't be there.
     
  • Remove all old CVS $Id tags, they are not needed anymore.
    casengo/casengo.module:2:// $Id:
    casengo/README.txt:1:$Id:
    casengo/plugins/casengo_context_reaction_add.inc:2:// $Id:
    

     

  • Run coder to check your style, some issues were found (please check the Drupal coding standards). Please review the link above for further information.
     
  • Drupal Code Sniffer has found some issues with your code (please check the Drupal coding standards). Please review the link above for further information.
     

Please check/fix these issues before changing the status back to "needs review"

parwan005’s picture

Hi,

here is my manual review to your code:-

1) Remove $Id$ , it is no longer required.
2) Your branch hai .zip file of your code. Please remove that.
3) Your module file and README.txt should also end with a new line.
4) Your info file contains ;Information added by drupal.org remove it, that will be added automatically.
5) Also please remove LICENSE.txt, it will be added automatically.
6) Please remove commented code from your module file.
7) In casengo_settings($form, &$form_state) i dont think parameters are required.

Also please remove master branch and make sure to fix your ventral issues here : http://ventral.org/pareview/httpgitdrupalorgsandboxthijscasengocom184786...

thijs@casengo.com’s picture

Hi Parwan005,

Thanks for the help.

I fixed them.. check the attachment..
only your 1st and 2nd i am not completely sure if i understand your points!

thanks again!
Thijs

thijs@casengo.com’s picture

Status: Needs work » Needs review
FileSize
3.62 KB

Hi All,

Attached is the modified version of the "Casengo contact widget".

Thank you in advance!

Thijs

fr3shw3b’s picture

Status: Needs review » Needs work

Hi,

First of all there are a lot of problems still identified by the online automated review tool:
http://ventral.org/pareview/httpgitdrupalorgsandboxthijscasengocom1847868git

One thing that is also very important is to change the master branch to a version specific branch, The link below tells you how to do this:

http://drupal.org/empty-git-master

Manual Review:

Remove the zip file and update the contents of the module with the contents of the zip file, and with Drupal you must only use the module root folder as cassengo_chat_widget and then all the files and functions use the name of the module instead of just casengo.
So it would look something like this:

-- casengo_contact_widget
---- plugins
------ casengo_contact_widget.context_reaction.inc
---- casengo_contact_widget.module
---- casengo_contact_widget.info
---- REAME.txt

With the contents of the Zip File:

In the plugin file you need to add doc blocks for the functions and their parameters.

Find a whole lot more info on creating Drupal modules here:

http://drupal.org/node/1074360

And could you state the version you're developing for in the issue, I assume it is Drupal 7?

thijs@casengo.com’s picture

Status: Needs work » Needs review

Hi All,

We fixed almost all issues according to the automated review tool and also issues mentioned in this thread:
http://ventral.org/pareview/httpgitdrupalorgsandboxthijscasengocom184786...

The only problem is that the tool is complaining about the "README.txt is missing", while actually its there. Does someone you know how we can fix this?

Thank you in advance!

Thijs

fr3shw3b’s picture

Status: Needs review » Needs work

Hello,

firstly the reason for this README.txt problem is because you have a nested folder, casengo_contact_widget in casengo_contact_widget, remove the nested folder and move the contents to the top level folder.

This is also most likely the reason why the PAReview tool gives no errors as well.

Secondly in the naming in the module must be consistent so all the files have the casengo_contact_widget and then all the hooks will have casengo_contact_widget_ as the hook. As well as this in custom variables you will need to use the consistent hook. Go here again to see what is required of Drupal modules:
http://drupal.org/node/361112

For all the hooks you use you must use Implements hook_page_alter() using page_alter as an example in the doc block as found below:
http://drupal.org/node/1354#hookimpl

You need a .install file which implements hook_uninstall() to remove the custom variables set using variable_del() such as casengo_code.

Although i say this you ought to avoid that casengo_code variable and use the theme layer through a theme function to generate this code and use a Javascript file which you include through drupal_add_js() to deal with all Javascript. You should also put this javascript in it's own js file.

In the info file you'll want to actually give a brief description of the widget in the description field as oppose to restating the name of the module.

In the README.txt there is something wrong with the encoding.

thijs@casengo.com’s picture

Status: Needs work » Needs review

Hi,

There were some fixes/addition that we just made:
- Fixing the "casengo_contact_widget in casengo_contact_widget" nested folder problem
- Adding "casengo_contact_widget" to the function names in the .module file
- Adding more description to the .info file

The automated review tool is now not complaining anymore (READEME.txt issue is also fixed). Regarding the the .install file, we saw in descriptions and some examples that it is used to create database tables and fields, most of the time. In our case this is not needed. So, is it necessary for us to still have a ".install" file in our module?

Thanks,

Thijs

fr3shw3b’s picture

Status: Needs review » Needs work

Hello,
Well yes but in your case you've created custom variables using variable_set so you have created fields in the table which you must remove on uninstall. The .install file use is because you need to use hook_uninstall() which can only be used in the install file.
The variables are:
cas_widget_domain
cas_widget_pos
cas_widget_label
cas_widget_theme
casengo_context
casengo_code

Example of using install file for hook_uninstall use:

<?php
/**
* @file
* File to uninstall custom variables.
*/

/**
* Implements hook_uninstall().
*/
function casengo_contact_widget_uninstall() {
  variable_del('cas_widget_domain');
  variable_del('cas_widget_pos');
  variable_del('cas_widget_label');
  variable_del('cas_widget_theme');
  // Add the rest of the variable_del() here.
}

As well as this I said it's worth avoiding creating a variable in the table called casengo_code and use the theme layer like below:
http://drupal.org/node/933976

thijs@casengo.com’s picture

Status: Needs work » Needs review

Hi Andre,

Thanks for the help so far. I added the "casengo_contact_widget.install" which will remove custom variables that I have set.

Thijs

fr3shw3b’s picture

Title: Casengo Chat Widget » Casengo Contact Widget
Status: Needs review » Needs work

Hello,

For the casengo_code variable it's best if you put the html through the theme layer using a theme function or template and the javascript in it's own javascript file.

As I said before you need a consistency in your naming conventions so instead of cas and casengo use casengo_contact_widget.

You need to remove all the variables declared by your module in the hook_uninstall, hence the comment Add the rest of the variables to delete at the bottom, my code was just a short example.

thijs@casengo.com’s picture

Status: Needs work » Needs review

Hi Andre,

In the module and install, I added all variables with "casengo_contact_widget_" in the beginning of each name.

We still have problem understanding how to use the theme layer. Is it really necessary to use in order to have this plugin approved?

Thijs

fr3shw3b’s picture

Status: Needs review » Needs work

Hello,

1. You don't seem to have committed your latest changes.

2. For the casengo_code explaining more in depth, When producing markup from a module it is crucial for it to be overridden by a themer so I advise looking here:
http://drupal.org/node/933976

And then implementing something along these lines:

Add theme function to your module file like so:

/**
 * Implements hook_theme().
 */
function casengo_contact_widget_theme() {
  return array(
    'casengo_contact_widget_markup' => array(
      'domain' => NULL,
      'label' => NULL,
      'pos' => NULL,
      'theme' => NULL,
    )
  );
}

Then add the theme function to create the output (In the javascript you will want to replace s and po with self explanatory names):

/**
 * Theme function for casengo page output.
 */
function theme_casengo_contact_widget_markup($variables) {
  extract($variables);
  // This will be the file containing the Javascript.
  drupal_add_js('(function() {  var po = document.createElement(\'script\'); po.type = \'text/javascript\'; po.async = true;
    po.src = \'//' . $cas_domain . '.casengo.com/apis/vip-widget.js?r=\'+new Date().getTime();
    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);
    })();');
  $output = '<!--Place this code where you want VIP widget to be rendered -->
  <div class="casengo-vipbtn"><!-- subdomain="' . $domain . '" group="" label="' . $label . '" position="' . $pos . '" theme="' . $theme . '" --></div>
 <!--Place this code after the last Casengo VIP widget -->'
  return $output;
}

Finally for this to work you want to create an array containing all these variables in a new function or in the widget add function which is returned, you could work it out.

Then in page alter you want this ($markup_variables is the result of the last thing I mentioned for you to work out how to go about it):

$page['page_bottom']['tns']['#markup'] = theme('casengo_contact_widget', $markup_variables);
thijs@casengo.com’s picture

Status: Needs work » Active
thijs@casengo.com’s picture

Status: Active » Needs review

Hi!

I have a question regarding adding a release node. I followed the directions to create release in Git but somehow it does not appear in the download section of the Casengo plugin.

Does somebody know how this can be fixed?

Thanks,
Thijs

aliaric’s picture

Seems module already pushed from sandbox to a project and issue should be closed.

fr3shw3b’s picture

Status: Needs review » Closed (fixed)

Closing as it is now a full project as aliaric stated.

fr3shw3b’s picture

Issue summary: View changes

Adding project page/repo