With the date_popup widget, the time selector gives you one option for every minute in the day. the Date Popup element allows the increment to be customized; we just need somewhere to set it in the user interface.

Comments

les lim’s picture

Assigned: Unassigned » les lim
Status: Active » Needs review
StatusFileSize
new2.83 KB

Patch attached.

jonathan1055’s picture

This looks useful. Thanks for the patch, I will give it a try.

Jonathan

jonathan1055’s picture

Status: Needs review » Needs work

This is a nice enhancement, thanks for coding it. Basically it all works fine, but here are a few modifications that you may like to consider:

  1. Do we need the textfield to be size=5? I would say size=3 and maxlength=3, as realistically users will not need more than three digits.
  2. Can you change Minutes to lower case m, as it is effectively following on the same sentence after the numbers.
  3. I think the description text could be improved. No need to say 'scheduler' and remove the X. How about "Restrict time entry options to specific minute increments."
  4. Also it would be helpful to give a link to the Date popup config, as that is where the textfield is changed to a timepicker. How about
        '#description' => t('Restrict time entry options to specific minute increments. The timepicker type is set from !link.', array('!link' => l('Date Popup configuration','admin/config/date/date_popup'))),
    

I only tested this with the built-in jQuery timepicker provided by Date Popup. Have you tried it with the wvega-timepicker option?

Jonathan

jonathan1055’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new3.49 KB

Four months have passed, so I thought I would pick this up and make the changes I suggested. In addition, the entry field is disabled if the timepicker is set to 'none' i.e. plain text entry.

The patch is against the code in git as of 7th Dec, which is newer than the -dev version of 18th Nov shown on project page.

Jonathan

pfrenssen’s picture

Assigned: les lim » Unassigned
Status: Needs review » Fixed

This is a good addition, this can clear up confusion for content editors on websites that have their cron running e.g. every 15 minutes. Committed to 7.x-1.x: commit 8d75bbeeb. Thanks!!

jonathan1055’s picture

Status: Fixed » Needs work

Just found a slight problem with this. If the value is blanked out in the the Scheduler admin settings then the minutes cannot be changed at all in the time-picker.

  '#element_validate' => array('element_validate_integer_positive'),

I would have thought that the above validation would not allow a blank to be saved. I guess our options would be either to validate and not allow blank, or set #required to true, or simply reset to the default of 1 minute.

Any other ideas?

pfrenssen’s picture

Woops! Let's make it required and default to "1" if it is not previously filled in, that seems like the best solution to me. I'll roll a patch, I have some time now.

pfrenssen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.2 KB

Made the field required, and make sure it defaults to "1", even if the setting has previously been submitted using an empty string.

jonathan1055’s picture

StatusFileSize
new770 bytes

If we have #required then we also should specify the default in the description and explain in more detail why the field is required. As it is a new option the admin might just erase it thinking they do not want to use it.

An alternative is just to change blank to 1 in the submit handler. Saves the admin having to do anything, and shows immediately that 1 is the default if you erase and save. Patch attached.

pfrenssen’s picture

Status: Needs review » Fixed

Fine by me! I updated the comment to explain the "why" in addition to the "what" and committed to 7.x-1.x: commit 64ed6abc99. Thanks!!

Status: Fixed » Closed (fixed)

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