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-24 11:10:10.000000000 +0200
@@ -104,7 +104,21 @@ 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)
+ );
+ $form['advanced_forum_collapse_icons'] = array(
+ '#type' => 'radios',
+ '#title' => t('Use icons?'),
+ '#options' => array(t("Yes"), t("No")),
+ '#description' => t('Choose to use icons or not.'),
+ '#default_value' => variable_get('advanced_forum_collapse_icons', 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-24 11:10:10.000000000 +0200
@@ -58,6 +58,10 @@
color: white;
}
+#forum .container span, .container img { /*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-24 11:10:10.000000000 +0200
@@ -48,6 +48,11 @@ td.forum {
line-height: 1.2;
}
+#forum .container span, .container img { /*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-29 19:22:03.000000000 +0200
@@ -30,7 +30,71 @@
* @see template_preprocess_forum_list()
* @see theme_forum_list()
*/
+
+//collapsible container jQuery
+jquery_plugin_add("cookie");
+$containerN = 0; //There are N containers
+
+foreach ($forums as $child_id => $forum) //count containers
+ if ($forum->is_container) $containerN += 1;
+
+//This mess is done, because this is inline jQuery with html tag. XHTML does not allow
tags in inline jQuery.
+if(variable_get('advanced_forum_collapse_icons', 0) == 0) //0 if collapse icons are used, else text.
+{
+ $hide = '$("img#containerMode-COUNTER").attr("src", "sites/all/modules/advanced_forum/themes/advforum/images/minimize.gif")';
+ $show = '$("img#containerMode-COUNTER").attr("src", "sites/all/modules/advanced_forum/themes/advforum/images/maximize.gif")';
+}
+else
+{
+ $hide = '$("#containerMode-COUNTER").text("hide");'; //hide string - COUNTER will be replaced
+ $show = '$("#containerMode-COUNTER").text("show");';//show string - COUNTER will be replaced
+}
+
+for ( $counter = 1; $counter <= $containerN; $counter += 1)
+{
+ if(variable_get('advanced_forum_collapse_settings', 0) == 0) //if zero then collapse, else don't collapse.
+ //create Set Cookie string, which containers to collapse as default
+ $jQSetCookie .=
+ 'if($.cookie("container'.$counter.'") !== "expanded")
+ $.cookie("container'.$counter.'", "collapsed");
+ '."\n\t";
+ //create the toggle string
+ $jQtoggle .='$("#containerID-'.$counter.'").click(function(){
+ $(".forum-child-'.$counter.'").toggle()
+ if($.cookie("container'.$counter.'") !== "collapsed")
+ {
+ $.cookie("container'.$counter.'", "collapsed");
+ '.str_replace("COUNTER", $counter , $show).'
+ }
+ else
+ {
+ $.cookie("container'.$counter.'", "expanded");
+ '.str_replace("COUNTER", $counter , $hide).'
+ }
+ });'."\n\t";
+ //create the cookie string
+ $jQcookie .=
+ 'if ($.cookie("container'.$counter.'") == "collapsed")
+ {
+ $(".forum-child-'.$counter.'").hide();
+ '.str_replace("COUNTER", $counter , $show).'
+ }
+ else
+ '.str_replace("COUNTER", $counter , $hide).'
+ '."\n\t";
+}
+
+drupal_add_js ( //include the jQuery stuff, don't know if this is the correct place to put this?
+'
+$(document).ready(function()
+{
+ '."$jQSetCookie$jQtoggle$jQcookie".
+ 'return false;
+});',
+'inline'
+);
?>
+
| is_container) { - print 'colspan="4" class="container"'; + |
| is_container) {
+ print 'colspan="4" class="container" id="containerID-'.$container.'"';
} elseif ($forum->new_topics) {
// Special class when the forum has new topics for changing icon
print 'class="forum forum-list-new"';
@@ -76,7 +142,14 @@
* left-margin for indenting.
*/ ?>
', $forum->depth); ?>
-
+ name; ?> is_container)
+ {
+ if(variable_get('advanced_forum_collapse_icons', 0) == 0) //0 if collapse icons are used, else text.
+ print '
description): ?>
description; ?>
Only in advanced_forum-modif/themes/advforum/images: maximize.gif
Only in advanced_forum-modif/themes/advforum/images: minimize.gif
|