Great module - saved my bacon - http://www.imedstudios.com/labs/node/14

One thing I needed for my deployment was to turn off the AJAX flag set/unset. The reason is that I had other parts of the page that needed to update in response the flag state and doing the round trip normal page request was really the easiest way to make sure the entire page was updated.

There was no easy way I could find to turn off the inclusion of the Flag AJAX related JS. I could do some tricks in my theme $vars etc. but I was hoping for a quick check box in the flag configuration.

May I suggest adding such a feature to disable AJAX - it could be global or per flag - not sure what makes the most sense there. If I have time I'll try to at least write patch for a simple on/off global mode.

Because I was in a hurry I simply did

  if ($setup) {
    drupal_add_css(drupal_get_path('module', 'flag') .'/theme/flag.css');
    //drupal_add_js(drupal_get_path('module', 'flag') .'/theme/flag.js');
  }

in the flag.tpl.php

is there a better way? I tried moving flag.tpl.php to my custom theme but that didnt' work either.

CommentFileSizeAuthor
#7 Picture 1.png57.1 KBquicksketch
#6 Picture 12.png33.3 KBdldege

Comments

mooffie’s picture

This feature exists already: There's a "Link Display Type" fieldset in the flag configuration page. You can choose among "JavaScript toggle", "Normal", "Confirm". You want "Normal".

If I have time I'll try to at least [...]

The Admin UI lacks explanation. It doesn't explain why one should choose "Normal" instead of "Javascript toggle". You could invest your time in writing a patch that adds this explanation to that page.

mooffie’s picture

Status: Active » Fixed
dldege’s picture

Ha, figures I made it harder then it needed to be since I was in a hurry.

Thanks for the explanation.

dldege’s picture

Status: Fixed » Active

Actually, digging into this I don't see this option. I'm not using views - is this what you were referring to? I'm adding the link to the node myself with the following.

  $flag = flag_get_flag('webcast_register');
  if ($flag->user_access()) {
    $node->content['node_details']['#value'][] = array('#weight' => 6, '#value' => "<p><strong>Registration:</strong>&nbsp;" . flag_create_link('webcast_register', $node->nid). "</p>");    
  }

Looking at the code for what happens from the above I don't see an option to control the JS behavior. I'm still not versed enough in your modules code base though to suggest the right patch.

mooffie’s picture

I don't see this option

It's on the settings form for the flag. Where you set the allowed note types for this flag, user roles, labels, etc. etc. See the bottom of that form.

(To switch the link type via code, I think you can do $flag->link_type = 'normal'. The other possibilities are 'toggle' and 'confirm'.)

dldege’s picture

StatusFileSize
new33.3 KB

Sorry, I don't see this or the code options - could this be something in the D6 branch that has not been back ported?

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new57.1 KB

It's already there, even in Drupal 5. It might only be in the Development version, so it'll be in beta7 (or the final release when that happens).

mooffie’s picture

Oh. My apologies for misleading you, Dan. As Nathan pointed out, you have to use the 'dev' version.

mooffie’s picture

(Dan, when I asked for a patch it was to solve a documentation issue: #364709: Clarify "Flag link" option descriptions)

dldege’s picture

OK now were getting somewhere! :)

I'll switch over to the other issue to followup on documentation patch.

Status: Fixed » Closed (fixed)

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