Drupal 7 is coming... This module can certainly easily be ported so why not.

Every test/patch are more than welcome.

Comments

nedjo’s picture

I think it would be good to remove the dependency on Javascript Tools for D7. I don't want to post a D7 version of Javascript Tools, mainly because over 7,000 sites are running the module and I can only assume they're doing so in error, having upgraded from D5 where it was used and thinking, I guess I need the D6 version.

gagarine’s picture

I will remove the Javascript Tools dependency also on D6. So I can keep the same base code...

It's now only used for managing cookie.

Two possibilities:
* create my own code for cookie
* switch to http://drupal.org/project/jquery_plugin

EDIT apparently jquery.cookie is in the core for D7 http://drupal.org/node/507072 NICE!

avo_liao’s picture

subscribing. I will be testing and will let you know of any issue

gagarine’s picture

Thanks it's always nice to have tester.

I will try to find some hours to port this project asap (around the next 2 weeks).

Anonymous’s picture

subscribing and I could help u testing it as well

Anonymous’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
StatusFileSize
new11.59 KB

I'm attaching an improved collapsiblock.js file. This one works.

Changes include:

In D7, all your js must be wrapped inside

(function($) {
  ...
}

And behaviors are set like this:

Drupal.behaviors.collapsiblock = { 
  attach: function(context) {
     ...
  }
};

Then finally in collapsiblock.module we save on submit:

$settings['block-' . $form_state['values']['module'] . '-' . $form_state['values']['delta']] = $form_state['values']['collapse_type'];

This doesn't work, because values can_be_like_this_with_underscores, while the CSS classes allways-have-hyphens. So the jQuery selectord fails to find its targets.

Solution in collapsiblock.module, do a str_replace:

$settings['block-' . str_replace('_', '-', $form_state['values']['module']) . '-' . str_replace('_', '-', $form_state['values']['delta']]) = $form_state['values']['collapse_type'];

(This is needed in more than one place!)

Then we need to add a check to remove an unwanted PHP notice error:

    if (isset($settings['block-' . str_replace('_', '-', $form['module']['#value']) . '-' . str_replace('_', '-', $form['delta']['#value'])])) {
      $default_value = $settings['block-' . str_replace('_', '-', $form['module']['#value']) . '-' . str_replace('_', '-', $form['delta']['#value'])] ? $settings['block-' . str_replace('_', '-', $form['module']['#value']) . '-' . str_replace('_', '-', $form['delta']['#value'])] : variable_get('collapsiblock_default_state', 1); 
    } else {
      $default_value = 1;
    }
    $form['collapsiblock']['collapse_type'] = array(
    	'#type' => 'radios',
    	'#title' => t('Block collapse behavior'),
    	'#options' => array(1 => t('None.'), 2 => t('Collapsible, expanded by default.'), 3 => t('Collapsible, collapsed by default.'), 4 => t('Collapsible, collapsed all the time.')),
    	'#default_value' => $default_value,
    );

And finally, after it works 1x, there is an error in the javscript cookie, parseJson function does not exist.
It should be:

  return cookieString ? $.parseJson(cookieString) : {};

$.parseJSON instead of Drupal.parseJson.

Now it works again in D7. Full improved package attached. I dont know yet how to work with GIT; so couldnt make a patch.

There is one more error though, a conflict with Google Analytics code. Can'T figure that out.

Anonymous’s picture

Status: Active » Needs review
Anonymous’s picture

StatusFileSize
new7.26 KB
new2.41 KB

Patches attached.

jamsilver’s picture

StatusFileSize
new6.78 KB

I've rerolled the above work following the standard procedure for making patches in Git. See attached.

jamsilver’s picture

getting rid of tags.

jamsilver’s picture

StatusFileSize
new6.07 KB

Actually - I'll roll the patch getting rid of the debug javascript at the top of the file too.

jamsilver’s picture

And without prefixes for those using drush make

tonycpsu’s picture

Subscribing

hawaiihasse’s picture

Subscribing

gagarine’s picture

Status: Needs review » Fixed

I just commit the patch #12 after some quick test. Big thanks to jamsilver and morningtime for them work. If you see any bug please open a new issue.

I think we can really soon release a stable version for D7.

Status: Fixed » Closed (fixed)

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