git clone --branch 7.x-1.x sergey-serov@git.drupal.org:sandbox/sergey-serov/1986160.git popup_announcement
cd popup_announcement

The module provides a pop-up announcement in the pretty colorbox overlay which will appear for the site visitor on the first, second and fifth visit to the site (customable). If interval between http requests is more than one hour, these are two different visits.

  • The announcement may be with html.
  • The announcement will appear on the colorbox overlay.
  • Announcement added to the site as a block - it make possible to use flexible visibility settings to define pages where announcement will appear.
  • On the configure page it is possible to define, on which visit the announcement will appear. By default on the first, second and fifth visit.
  • After 90 days records about visits become old and automatically are removed from the database.

http://drupal.org/sandbox/sergey-serov/1986160

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxsergey-serov1986160git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

linwiz’s picture

In addition to comment #1, you're using the master branch. You should switch to a version specific branch, see http://drupal.org/empty-git-master. You also need to add the git clone command to your summary.

sergey-serov’s picture

Status: Needs work » Needs review
rafalenden’s picture

Hi Sergey, instead of using hardcoded HTML in function popup_announcement_create_announcement() you should use theme function providing possibility to override it or at least attach JS as Drupal behavior.
It's also possible using theme functions in JS files, http://drupal.org/node/171213.

rafalenden’s picture

Status: Needs review » Needs work
Dalay’s picture

Hi, Sergey.

file popup_announcement.install:

  • There is no need to use variable_set() in popup_announcement_install(). variable_get() will return default value, even if the variable does not exist.
  • Add indexes in popup_announcement_schema().
geraldmelendez’s picture

Since the major code problems have been pointed out I'll focus on documentation.

Clarify the following in the Read Me file and on the project page:

  • That it provides only a single message/pop-up multiple times
  • That it may not work properly if blocks are cached
  • That it is added to the site as a block
  • The user must go to the Blocks page to configure the message
  • Add a Configuration section to the Read Me file with steps

In the configuration form replace
Number of visits when announcement will be appear
with
Number of visits when announcement will appear.

Only numbers separate by ,
with
Only numbers separate by commas.

My humble opinion:
I feel that this functionality should be implemented on the client side rather than querying the database. For example, a js script can check a visit count cookie and activate the welcome message, such as I did here: http://www.duckydeals.com

sergey-serov’s picture

Title: [D7] Pop-up anoouncement » [D7] Pop-up announcement
Status: Needs work » Needs review

rafal.enden, Dalay, geraldmelendez - thank you for your attention.

I added theme functions in module and index in schema, and made changes in docs.

Dalay, I decided to stay variable_set() in popup_announcement_install() because default values will be good in configure form (so will be access only after editing this form) - so in other function it is possible use variable_get() without default value every time.

k3vin_nl’s picture

I didn't find any technical issues with your module. But I do think it would be much more user friendly it the popup message could be edited in a text editor, instead of just plain text.

sergey-serov’s picture

K3vin, thank you for a good idea!

federiko_’s picture

Status: Needs review » Needs work

Good module.
I installed it and configure it. I although tested theme function to change background and it worked well.

Here are some comments :

.install l.76 : "was requsted" >>> "requested"

.module :
Why do you use time() function and not Drupal constant REQUEST_TIME ?
(see https://drupal.org/node/190417#comment-6697632)

suggestion

- in module configuration form it would be great that if we let empty the field "Number of visits when announcement will appear" the pop-up appears at every visit.

sergey-serov’s picture

Status: Needs work » Needs review

federiko_, thank you a lot for your attention.
I added this possibility to show announcement at every visit if corresponding field is empty. And made another your recommendations of course!

_timpatrick’s picture

Status: Needs review » Needs work

Hi Sergey-Serov:

Nice module - I can see this being quite useful.
An automatic code review of your module showed no errors.
Looking at your module manually:

popup_announcement.install

  • In function popup_announcement_uninstall() you should call variable_del() to delete the variables you set and not run a delete query on the variable database.

popup_announcement.module

  • In function theme_popup_announcement_create_announcement(), you should use a template file to store the HTML and not hard-code it into the function.

Other than those two issues I can't see anything else of serious concern.

sergey-serov’s picture

Status: Needs work » Needs review

Good day, _timpatrick!
Thank you a lot for your review.

I made all your recommendation with cognitive benefit of themselves!

chrisfree’s picture

Status: Needs review » Needs work

[manual review]

  • README.txt could has some spelling errors (announcement in line 25)
  • README.txt says that block caching might cause issues with this module's functionality. Is this still true even though the block is set to *DRUPAL_NO_CACHE*? If so, might be worth investigation which scenarios could cause this. Or at the very least, list them in the readme.
  • popup_announcement.js @file comment should say "Primary" instead of "Primarily"
  • minor code styling inssues in popup_announcement.js (spacing in properties in lin 15 and 18).
  • after much clicking and configuration, clearing session table, etc. I was unable to get this module to show any overlay. In console, I was able to verify that the JS behavior and settings weren't being added. Not sure what I'm missing here. Even tried forcing it to display on every page load. Block caching was disabled as well. Seems related to condtions in popup_announcement_create_block()

I think this module has a some good use cases and I'd likely use it if I could get it working. Nice work, looking forward to clearing up how to get this running.

chrisfree’s picture

Issue summary: View changes

Add command for git clone

sergey-serov’s picture

Status: Needs work » Needs review

Dear chrisfree.
Thank you for your detailed review.
I made some editing in popup_announcement_create_block() and tested it.
One moment - if we leave field "Number of visits when announcement will appear" blank - announcement appear every one visit only one time. Not "to display on every page load". It will be very obtrusive.
It is not related with cache - there really stay *DRUPAL_NO_CACHE* in block properties. I corrected README.txt.

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

In popup_announcement.install instead of setting initial values for your variables, just provide a default when you call variable_get() in popup_announcement_block_configure(). You have that for the height and width, but you can do it for the other variables too. Also provide defaults in popup_announcement_create_block().

Instead of exploding strings like "1,2,5" to manage your settings, consider using a plain array with serialize() and unserialize() instead.

No major problems found.

----
Top Shelf Modules - Enterprise modules from the community for the community.

mlncn’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, sergey-serov!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a full project.

As noted by other reviewers, while it may be nicer from the developer perspective to set a variable and not have to include its default in variable_get(), variable_get() should always have a default. In theory one should be able to delete everything in the variables table and the site will still run on defaults, and in practice someone may delete some variables. So please remove the variable_set in install and stick defaults into variable_get(). This gets much nicer in Drupal 8!

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, 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.

And thanks to the awesome reviewers: linwiz, rafal.enden, Dalay, geraldmelendez, K3vin, federiko_, chrisfree, _timpatrick, and kscheirer!

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

add description of new feature