diff -urp advanced_forum/advanced_forum.module advanced_forum_modif/advanced_forum.module --- advanced_forum/advanced_forum.module 2008-06-10 05:21:48.000000000 +0200 +++ advanced_forum_modif/advanced_forum.module 2008-08-21 17:54:50.000000000 +0200 @@ -104,7 +104,14 @@ function advanced_forum_settings_page() '#description' => t('Choosing yes causes advanced forum to consider every comment a forum comment and attempt to theme it that way. Some changes to your theme may be required.'), '#default_value' => variable_get('advanced_forum_theme_all_comments',0), ); - + //collapsible container + $form['advanced_forum_collapse_settings'] = array( + '#type' => 'radios', + '#title' => t('Choose collapse state'), + '#options' => array(t("All collapsed"), t("None collapsed")), + '#description' => t('Choose initial collapse state of the forums.'), + '#default_value' => variable_get('advanced_forum_collapse_settings', 0) + ); // Send our form to Drupal to make a settings page return system_settings_form($form); } diff -urp advanced_forum/themes/advforum/advanced_forum.css advanced_forum_modif/themes/advforum/advanced_forum.css --- advanced_forum/themes/advforum/advanced_forum.css 2008-05-28 23:03:07.000000000 +0200 +++ advanced_forum_modif/themes/advforum/advanced_forum.css 2008-08-21 17:33:05.000000000 +0200 @@ -58,6 +58,10 @@ color: white; } +#forum .container span { /*collapsible forum*/ + cursor: pointer; +} + #forum td.container a { font-weight: bold; color: white; diff -urp advanced_forum/themes/advforum/advanced_forum-structure.css advanced_forum_modif/themes/advforum/advanced_forum-structure.css --- advanced_forum/themes/advforum/advanced_forum-structure.css 2008-05-28 23:03:07.000000000 +0200 +++ advanced_forum_modif/themes/advforum/advanced_forum-structure.css 2008-08-21 17:35:58.000000000 +0200 @@ -48,6 +48,11 @@ td.forum { line-height: 1.2; } +#forum .container span { /*collapsible container*/ + margin: 0 1em 0 0; + float: right; +} + #forum .description { padding-left: 0px; margin-left: 0; diff -urp advanced_forum/themes/advforum/advf-forum-list.tpl.php advanced_forum_modif/themes/advforum/advf-forum-list.tpl.php --- advanced_forum/themes/advforum/advf-forum-list.tpl.php 2008-05-13 06:15:55.000000000 +0200 +++ advanced_forum_modif/themes/advforum/advf-forum-list.tpl.php 2008-08-21 17:44:55.000000000 +0200 @@ -30,7 +30,32 @@ * @see template_preprocess_forum_list() * @see theme_forum_list() */ + +//collapsible container jQuery +$containerN = 0; + +foreach ($forums as $child_id => $forum) //count containers + if ($forum->is_container) $containerN += 1; + +//create the hideString, for which containers to hide (this should be made much smarter :-), so the user can specify which containers are collapsed at default). An array could specify container collapses. +if(variable_get('advanced_forum_collapse_settings', 0) == 0) //if zero then collapse, else don't collapse. + for ( $counter = 1; $counter <= $containerN; $counter += 1) //create the hide string + $jQhide .='$(\'.forum-child-'.$counter.'\').hide();'."\n\t"; + +for ($counter = 1; $counter <= $containerN; $counter += 1) //create the toggle string + $jQtoggle .='$(\'#containerID-'.$counter.'\').click(function(){$(\'.forum-child-'.$counter.'\').toggle()});'."\n\t"; + +drupal_add_js ( //include the jQuery stuff, don't know if this is the correct place to put this? +' +$(document).ready(function() +{ + '."$jQhide$jQtoggle". + 'return false; +});', +'inline' +); ?> +
| is_container) {
print 'colspan="4" class="container"';
@@ -76,7 +103,7 @@
* left-margin for indenting.
*/ ?>
', $forum->depth); ?>
-
+ name; ?> is_container) print " show/hide";?>
description): ?>
description; ?>
|