Download & Extend

Disable drag & drop for Office Hours fields (only)

Project:Office Hours
Version:7.x-1.x-dev
Component:User interface
Category:feature request
Priority:major
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi,
I am using this nice module on a site for a customer. Actually we have a problem with the drag & drop functionality, allowing i.e. to put Sunday after Tuesday, which is not useful for us and confuses the end users (people with little computer experience).
How can we remove it?

Thanks!

Comments

#1

it's just a simple question. Could someone try to answer?

#2

I have tried to find it. code says explicitly that it is turned off, but some lower level code re-activates it... - so, no luck yet.

#3

In facts I also found that part of code, where the draggable table function is commented out... but yes, there must be something else...

#4

Just commited a fix for this-
field module apparently changed handling and naming of the function and theming override didn't work as well. I used theme_register_alter to force OH's theme function.
The dev version should be updated soon.

#5

Status:active» fixed

#6

Category:support request» feature request
Status:fixed» needs work

That's nice!

But now the table header is out-of-sync. See attached screenshot.

AttachmentSize
Office_hours_widget.jpg 23.93 KB

#7

Priority:normal» major

The way you implemented this actually overrides ALL multiple value fields, not just those using the Office Hours field. Hence, it is now impossible to drag and drop other multiple value fields, like a multiple value text or node reference field, for example.

Another method of theming this form should be used—one that doesn't break other modules' fields.

#8

Title:Drag & Drop - possible to turn it off? » Disable drag & drop for Office Hours fields (only)

Here's a quick way to accomplish this. Basically, check if the field we are theming is an Office Hours field, and if not, use theme_field_multiple_value_form() to theme the field.

I also commented out the drupal_add_tabledrag() function, which is the real function which converts the table to a draggable table.

I'm not well-versed in the Field API, but I'm sure there's a better way to accomplish this.

AttachmentSize
office-hours.theme_.patch 968 bytes

#9

Ah, now I understand why I have this strangest thing in my system (see screenshot):
- a multivalue field, required, with the Required asterisk on the last row (which IS row[0] )
- my first-day of week is monday, so sunday (index 0) is shift to last place.

AttachmentSize
multivaluefield.jpg 16.25 KB

#10

Status:needs work» fixed

joelsteind's modification and other improvements have been comitted.
http://drupalcode.org/project/office_hours.git/commit/70a0bca

#11

Excellent, thanks!

#12

Status:fixed» closed (fixed)

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

nobody click here