This module provides field wich can be displayed as timer/countdown. Module uses 2 jQuery plugins: County and jQuery Countdown.
This module allow to set an entity property as the target date (for example, properties 'created' and 'changed' of node entity). Also formatter of field have many options to configure the appearance of field.

Project Page

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/sergei_brill/2040519.git field_timer

Reviews of other projects
https://drupal.org/node/2083831#comment-7836717
https://drupal.org/node/2070535#comment-7822397
https://drupal.org/node/2072377#comment-7833373

Support from Acquia helps fund testing for Drupal Acquia logo

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://pareview.sh/pareview/httpgitdrupalorgsandboxsergei_brill2040519git

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.

sergei_brill’s picture

Status: Needs work » Needs review

Fixed.

balajidharma’s picture

Status: Needs review » Needs work

I did a manual review of your module and my commends

$settings_form['granularity'] = array(
        '#type' => 'select',
        '#title' => t('Granularity'),
        '#options' => array(1 => 1,2 => 2,3 => 3,4 => 4,5 => 5,6 => 6,7 => 7),
        '#default_value' => $settings['granularity'],
      );

      return $settings_form;
$settings_form['significant'] = array(
        '#type' => 'select',
        '#title' => t('Significant'),
        '#options' => array(
          0 => 0,
          1 => 1,
          2 => 2,
          3 => 3,
          4 => 4,
          5 => 5,
          6 => 6,
          7 => 7,
        ),
        '#default_value' => $settings['significant'],
      );

In '#options' array you just use range() function. ( like range(0,7); )

sergei_brill’s picture

Status: Needs work » Needs review

Thanks for review.
Fixed.

chester_martin’s picture

hi sergei,

I did a manual review of your module. Here's some thoughts:

General:
Seems like an exciting module and I can see some use cases right away. Great with the API possibility to define new entity timestamps.

Code
Loos neat and tidy. Pareview (http://pareview.sh/pareview/httpgitdrupalorgsandboxsergeibrill2040519git) gave 1 error: unused variable $name.

In .info file you probably don't need to state fields as dependency since drupal requires it.

Installation & configuration
Worked like expected. README.txt gives guidance.

Display
I can't get the javascript-files to load. I've downloaded them and put them in the stated folders in the libraries folder. Is it just me or does someone else have this problem?

sergei_brill’s picture

Thanks for review chester_martin.

I can't get the javascript-files to load. I've downloaded them and put them in the stated folders in the libraries folder. Is it just me or does someone else have this problem?

What do you mean? How can I reproduce the problem?

chester_martin’s picture

I don't know, really. I followed your instructions about downloading the javascript-files and putting them in the folders inside sites/all/libraries. But if no one else has this problem then it might just be my installation. I'll test with a different installation and report back to you.

trrroy’s picture

Everything worked for me except one field display option. If I change the Display Format to "County" then I see all zeros on the page and there's a javascript error "Uncaught TypeError: Object #

has no method 'countdown' field_timer.js?25" Another item that I noticed is that the name of the module seems to be field_timer but on the Modules page it is shown as Timer Field. It would be helpful to have them be the same. Thanks! I'm looking forward to using this module.
sergei_brill’s picture

to chester_martin:
thx, I fixed some issues.

to trrroy:
thanks for reveiw.

If I change the Display Format to "County" then I see all zeros on the page

County do not provides timers, only countdown. So, if time is passed, it displays zeros.

there's a javascript error "Uncaught TypeError: Object # has no method 'countdown' field_timer.js?25"

fixed

sergei_brill’s picture

Issue tags: +PAreview: review bonus

added PAReview: review bonus tag

artem_sylchuk’s picture

Status: Needs review » Needs work
  1. There is another module with such functionality - https://drupal.org/project/field_countdown. What's the difference between it and your module and why should your module be used instead of last one?
  2. Coding standarts (js file) http://pareview.sh/pareview/httpgitdrupalorgsandboxsergeibrill2040519git.
  3. Use REQUEST_TIME instead of time() - function field_timer_field_formatter_view() (lines: 212, 219, 227).
  4. You should use placeholders for t() in field_timer_field_instance_settings_form() (lines: 602, 608, 614)
  5. If you want to use link that goes outside the site, you should use 'absolute' => TRUE option for l() in function field_timer_field_formatter_view() (line 258).
sergei_brill’s picture

Status: Needs work » Needs review

Thanks for review.

1. My module use 2 other jquery plugins to display countdown/timer. My module provides some option to customize the countdown/timer. Unlike the field_countdown, field_timer can display both countdown and timer (if jquery plugin supports this feature). Any date from entity can be used as end date for countdown or as start date for timer. If user wants just install and use countdown, he can use field_countdown. If user needs timer, if he wants to customize timer or countdown, he should use field_timer.

2-5 fixed.

alexmoreno’s picture

Hi Sergei,

looks perfectly fine with me, but I think you have to add in your module description a "Similar modules" section, and paste this explanation.

Thank you.

alexmoreno’s picture

FileSize
21.14 KB

It's a minor/silly thing, but the link in the git clone is wrong. It should be:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/sergei_brill/2040519.git field_timer

I installed the dependencies (date and library) and proceeded with the module installation. Both, county and jquery.countdown.

Once done, i created a new field in an article content type, and added a new content. The field is displayed, but not as a clock timer, I do not know if this is right or if I should modify something in my templates:

timerfield: 
-1 day 23 hours

I think the documentation should clarify adding as point 4: "Add a new field in your desire content type."

Thanks for your effort with this module Sergei.

alexmoreno’s picture

Status: Needs review » Needs work
alexmoreno’s picture

Issue summary: View changes

Added review list

sergei_brill’s picture

Thanks for review.

The field is displayed, but not as a clock timer, I do not know if this is right or if I should modify something in my templates:

The module provides 3 formatters for the field - simple text (default formatter), County and jQuery Countdown. Since libraries are not required, default formatter is simple text. I'll add detailed description about this thing

alexmoreno’s picture

But, where do I select/change this? In the content type?

sergei_brill’s picture

admin/structure/types/manage/article/display

alexmoreno’s picture

FileSize
15.95 KB

ok, I have selected the Countdown and what I get is :

timerfield:
1 day 3 hours

but no js or countdown itself. I have probably done something wrong, but it looks like the libraries not being loaded. In fact:

  • field-timer.css
  • field-timer.js

are not being loaded, as they are not the 3rd party libraries:

  • county.js
  • jquery.countdown

After clearing the cache, just in case, nothing changed.

I attach screenshot if it helps.

Thank you Sergei

sergei_brill’s picture

Status: Needs work » Needs review

I just tested the module on a clean drupal installation. And it works fine for me.
Are you sure you changed the formatter? On the screenshot is 'Text' formatter.
Check libraries folder. May be drupal has no permissions to access the library.

Thank you urwen

alexmoreno’s picture

FileSize
36.05 KB

this is what I have Sergei, have a look. Are you sure I don't have to add anything? Simply adding the libraries the field theme should change?

alexmoreno’s picture

FileSize
19.72 KB

second screenshot

alexmoreno’s picture

FileSize
19.31 KB

and third one

sergei_brill’s picture

Simply adding the libraries the field theme should change?

No, it should not. You have to change the field formatter. On the first screenshot change 'Text' to 'County' or 'jQuery Countdown'. Than the field will be displayed as you expect.

alexmoreno’s picture

I have not this option Sergei, it just displays text, when I click in format :-(. Permissions maybe?

sergei_brill’s picture

yes, may be. Check paths and permissions for libraries directories.

alexmoreno’s picture

needs review

alexmoreno’s picture

sorry, wrong place :-(

stockunlocks’s picture

Hello sergei,

When installing the "Timer Field" module, I started with a basic Drupal installation configured for another module that I was testing. However, when going to enable your module, I noticed that it Requires: Libraries and Date_popup (Date) when viewing from /admin/modules.

Yeah, I know, most people already have these installed. I just happened to not need them for what I was doing at the time.

It's true that these are dependencies in field_timer.info, thus the reason for the requirement showing up as noted above.

Just as a suggestion, maybe you can include a "REQUIREMENTS" section in your README.txt which indicates these additional modules.

It might also be useful to include a link to these required modules on your project page as well.

As stated in the "Module documentation guidelines" (https://drupal.org/node/161085)

The README.txt file should repeat the synopsis on the project page on Drupal.org.

You may also reference "README files" at https://drupal.org/node/447604

Other than that, your other supplied instructions in the README.txt allowed me to install everything else just fine.

Adding the Timer Field to an existing Content type was straightforward.

For my installation, I went to /admin/structure/types/manage/product/display and made the FORMAT change to "County", saved and refreshed my content and all was good.

Made the next FORMAT change to "jQuery Countdown" and ditto, worked well.

Screenshots included below:

Thanks!

alexmoreno’s picture

ok, so sorry. I have had some time to test it again, and i found my problem (silly me). I was placing the libraries foler in sites/libraries, instead of sites/all/libraries. Sorry Sergei :-(.

Some things about your code.

1. I would advice you to split your .module, adding a .inc file. The .module should only contain hooks, all the rest of functions should be in the inc file.

2. Functions like that one: field_timer_field_formatter_view

are too big, some people would say that it is not following coding standards if it is bigger than 30, 40 or 50 lines. You can probably split the functionality in several functions.

3. You are still having some minor issues in the pareview tool, no big deal anyway:
http://pareview.sh/pareview/httpgitdrupalorgsandboxsergeibrill2040519git

4. the .php function should be named using Drupal conventions: field_timer.api.inc, and I'd placed it with the other .inc which I advice you to create in a includes folder.

5. As you need to use third libraries, I would add a message in case that this libraries are not detected, so the user will see very quickly why something is not working (like it happen to myself).

6. Add some comments in the middle of your functions. It is good for third developers, but it is great for you too when you have to review your code months or years later.

Thank you for your effort Sergei.

klausi’s picture

Status: Needs review » Postponed (maintainer needs more info)

https://drupal.org/project/field_countdown

This sounds like a feature that should live in the existing field_countdown project. Module duplication and fragmentation is a huge problem on drupal.org and we prefer collaboration over competition. Please open an issue in the field_countdown issue queue to discuss what you need. You should also get in contact with the maintainer(s) to offer your help to move the project forward. If you cannot reach the maintainer(s) please follow the abandoned project process.

If that fails for whatever reason please get back to us and set this back to "needs review".

klausi’s picture

Status: Postponed (maintainer needs more info) » Needs work

Oops, just saw that you already explained differences to the existing module in #12. Please add that to your project page, so that users can make an educated choice between similar modules. And checkout https://drupal.org/node/997024 to improve your project page.

sergei_brill’s picture

Status: Needs work » Needs review

to urwen
1. There is only 2 functions which are not hooks. I don't think it is better to move 100 line to another file. If it is requirement from a documentation, please, provide a link.

2. Yes, I know the function it too large. I plan to use theme hooks next version. I splitted the function for now.

3. Fixed.

4. I'm afraid you are wrong. See https://drupal.org/node/161085. The file is a part of documentation, it describe hooks provided by module, it doesn't provide any functionality.

5. The message was added (see _field_timer_county_formatter() for example). Since module can work without these libraries, I don't display any messages. If there is no a library, it just do not add related formatter. This feature allows admin to avoid installation of unneccessary libraries. For example, admin want to use only County and don't want to install jQuery Countdown. If I want to make the libraries required I should add hook_requirements.

6. I added some comments.

to darrellhenry and klausi
I changed README.txt and project page.

Thanks for review.

alexmoreno’s picture

Thanks for your changes and explanations Sergei.

drupalfan79’s picture

I created a timer field with default value, when I add a node, it shows warning:

Notice: A non well formed numeric value encountered in field_timer_field_widget_form() (line 111 of F:\wamp\www\location\sites\all\modules\field_timer\field_timer.module).

It works well without default value.

drupalfan79’s picture

Status: Needs review » Needs work
sergei_brill’s picture

Status: Needs work » Needs review

Thanks for review drupalfan79. The bug fixed.

drupalfan79’s picture

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

On your project page "wich" should be "which".
Thanks for adding a "Similar Projects" section to your project page, can you describe the differences a little more? Why would a user choose your module instead of one of the others? Or which use cases does your module handle that the others don't.
Your module is named "Field Timer" but in the .info file it's named "Timer Field" - pick one :)

The module looks good though, and those don't seem like major problems.

Thanks for your contribution, sergei_brill!

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

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 get 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.

Thanks to the dedicated reviewer(s) as well.

----
Top Shelf Modules - Crafted, Curated, Contributed.

kscheirer’s picture

Status: Reviewed & tested by the community » Fixed

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

Anonymous’s picture

Issue summary: View changes

fix git link