[COMMENT] /* +-------------------------------------------------------------------------- | Invision Board v1.3 | ======================================== | > mod_collapse function library | > Module written by Peter(Pit) | > Peter member at ibforen.de, Pit member at invisionize.com | > email: Peter@ibforen.de | +-------------------------------------------------------------------------- | > mod_collapse Module Version Number: 1.1.3 (2006-08-08) | > 2005 - 2006 by Peter +-------------------------------------------------------------------------- */ [COMMENT_END] [INTERFACE] 'title' => 'Collapse Categories', 'sub_title' => 'Zeigt oder verbirgt Kategorien', 'category' => 'Minor Mod', 'compatible' => 'Invision Power Board 1.3', 'version' => '1.2.0', 'author' => 'Peter', 'email' => 'Peter@ibforen.de', 'mod_token' => 'mod_collapse', [INTERFACE_END] [HISTORY] [b]1.2.0[/b] [list][*]Bugfix für Cookieproblem mit Subdomains Neuinstallation. Austausch aller Dateien, insbesondere html/mod_collapse.js und die Skindatei. [/list] [b]1.1.4[/b] [list][*]Bugfix für Cookieproblem unter Mozilla/Firefox Neuinstallation. Austausch aller Dateien. [/list] [b]1.1.3[/b] [list][*]Bugfix für Subforen (Schritt 2, Teil C) [/list] [b]1.1.2[/b] [list][*]Keine SQL-Abfragen zur Statistik, wenn Statistikbereich verborgen ist. [/list] [b]1.1.2[/b] [list][*]Keine SQL-Abfragen zur Statistik, wenn Statistikbereich verborgen ist. [/list] [b]1.1[/b] [list][*]Statistikbereich ist nun auch zusammenfaltbar [*]Beim Verbergen von Kategorien wird nicht mehr die Seite neu geladen, sondern die Sichtbarkeit der Kategorie per Javascript verändert [/list] [b]1.0[/b] [list][*]Zeigt oder verbirgt Kategorien und Subforen [*]Einstellungen werden in Cookies gespeichert [*]Verborgene Kategorien werden nicht geladen, um Bandbreite zu sparen [/list] [HISTORY_END] [SQL] [SQL_END] [CODE] [MOD_TOKEN] mod_collapse [FNAME] sources/Boards.php [STEP] [SEARCH] $stats_html = ""; [INSERT] //-- mod_collapse begin if ($std->my_getcookie("fstats_block") == "none" && !isset($ibforums->input['collapse_stats_s'])) { $stats_html = 1; } else { //-- mod_collapse end [MODE] insert_below [STEP] [SEARCH] if ($stats_html != "") { [INSERT] //-- mod_collapse begin } //-- mod_collapse end [MODE] insert_above [STEP] [SEARCH] if ($stats_html != "") { [INSERT] //-- mod_collapse begin global $HTTP_COOKIE_VARS; if (!$this->use_skin && file_exists(ROOT_PATH."Skin/{$ibforums->skin_id}/mod_collapse_skin.php")) { $this->collapse_html = $std->load_template('mod_collapse_skin'); $this->use_skin = true; } if (isset($ibforums->input['collapse_stats_s'])) { $std->my_setcookie("fstats_block", "", 1); $_COOKIE[$ibforums->vars['cookie_id'].'fstats_block'] = "block"; $HTTP_COOKIE_VARS[$ibforums->vars['cookie_id'].'fstats_block'] = "block"; } if (isset($ibforums->input['collapse_stats_h'])) { $std->my_setcookie("fstats_block", "none", 1); $_COOKIE[$ibforums->vars['cookie_id'].'fstats_block'] = "none"; $HTTP_COOKIE_VARS[$ibforums->vars['cookie_id'].'fstats_block'] = "none"; } $url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext']."?".$_SERVER['QUERY_STRING']; $url = preg_replace("`\&collapse_stats_.=\d*`", "", $url); if (($std->my_getcookie("fstats_block") == "none" || isset($ibforums->input['collapse_stats_h'])) && !isset($ibforums->input['collapse_stats_s'])) { $url .= "&collapse_stats_s=1"; if ($this->use_skin) { $this->output .= $this->collapse_html->stats_header_hide($url); $this->output .= $this->collapse_html->stats_footer(); } else { $html = $this->html->stats_header(); $col = "\n"; $col .= "\n"; $col .= "\n"; $col .= "\n"; $col .= "\n"; $col .= "\n
{$ibforums->lang['board_stats']}
\n"; $html = str_replace($ibforums->lang['board_stats'], $col, $html); $html = preg_replace("`(^.*)(\\2", $html); $this->output .= $html; $this->output .= preg_replace("`(^.*?)`is", "\\1\n", $this->html->stats_footer()); } } else if (TRUE) { $url .= "&collapse_stats_h=1"; if ($this->use_skin) { $this->output .= $this->collapse_html->stats_header_show($url); $this->output .= $stats_html; $this->output .= $this->collapse_html->stats_footer(); } else { $html = $this->html->stats_header(); $col = "\n"; $col .= "\n"; $col .= "\n"; $col .= "\n"; $col .= "\n"; $col .= "\n
{$ibforums->lang['board_stats']}
\n"; $html = str_replace($ibforums->lang['board_stats'], $col, $html); $html = preg_replace("`(^.*)(\\2", $html); $this->output .= $html; $this->output .= $stats_html; $this->output .= preg_replace("`(^.*?)`is", "\\1", $this->html->stats_footer()); } } else { //-- mod_collapse end [MODE] insert_below [STEP] [SEARCH] $this->output .= $this->html->stats_footer(); [INSERT] //-- mod_collapse begin } //-- mod_collapse end [MODE] insert_below [STEP] [SEARCH] function process_all_cats() { global $std, $DB, $ibforums; [INSERT] //-- mod_collapse begin global $HTTP_COOKIE_VARS; if (file_exists(ROOT_PATH."Skin/{$ibforums->skin_id}/mod_collapse_skin.php")) { $this->collapse_html = $std->load_template('mod_collapse_skin'); $this->use_skin = true; } if (isset($ibforums->input['collapse_s'])) { $std->my_setcookie("fc".$ibforums->input['collapse_s']."_block", "", 1); $_COOKIE[$ibforums->vars['cookie_id']."fc".$ibforums->input['collapse_s']."_block"] = "block"; $HTTP_COOKIE_VARS[$ibforums->vars['cookie_id']."fc".$ibforums->input['collapse_s']."_block"] = "block"; } if (isset($ibforums->input['collapse_h'])) { $std->my_setcookie("fc".$ibforums->input['collapse_h']."_block", "none", 1); $_COOKIE[$ibforums->vars['cookie_id']."fc".$ibforums->input['collapse_h']."_block"] = "none"; $HTTP_COOKIE_VARS[$ibforums->vars['cookie_id']."fc".$ibforums->input['collapse_h']."_block"] = "none"; } $url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext']."?".$_SERVER['QUERY_STRING']; $url = preg_replace("`\&collapse_.=\d*`", "", $url); $url = preg_replace("`\#col\d*$`", "", $url); //-- mod_collapse end [MODE] insert_below [STEP] [SEARCH] if ( $cat_data['state'] != 1 ) { continue; } [INSERT] //-- mod_collapse begin $hide_this_cat = $std->my_getcookie("fc{$cat_id}_block") == "none" && $ibforums->input['collapse_s'] != $cat_id; $this->output .= ""; $cat_data['collapse_url'] = $url."&collapse_s=".$cat_id."#col".$cat_id; if ($hide_this_cat) { if ($this->use_skin) { $this->output .= $this->collapse_html->CatHeader_Expanded_Hide($cat_data); } else { $html = $this->html->CatHeader_Expanded($cat_data); $html = preg_replace("`(.*"; $col_1 = "\n"; $col_1 .= "\n"; $col_1 .= "\n\n"; $col_2 .= "\n"; $col_2 .= "\n
"; $col_2 = "$pic
\n"; $match = "`(<\{CAT_IMG\}>.*?{$cat_data['name']}.*?<\/a>)`is"; if (!preg_match($match, $html)) $match = "`({$cat_data['name']}.*?<\/a>)`is"; $html = preg_replace($match, "$col_1\\1$col_2", $html); $this->output .= $html; } $this->output .= $this->html->end_this_cat(); } else { //-- mod_collapse end [MODE] insert_below [STEP] [SEARCH] if ($temp_html != "") { [INSERT] //-- mod_collapse begin $cat_data['collapse_url'] = $url."&collapse_h=".$cat_id."#col".$cat_id; if ($this->use_skin) { $this->output .= $this->collapse_html->CatHeader_Expanded_Show($cat_data); } else if (TRUE) { $html = $this->html->CatHeader_Expanded($cat_data); $html = preg_replace("`(.*"; $col_1 = "\n"; $col_1 .= "\n"; $col_1 .= "\n\n"; $col_2 .= "\n"; $col_2 .= "\n
"; $col_2 = "$pic
\n"; $match = "`(<\{CAT_IMG\}>.*?{$cat_data['name']}.*?<\/a>)`is"; if (!preg_match($match, $html)) $match = "`({$cat_data['name']}.*?<\/a>)`is"; $html = preg_replace($match, "$col_1\\1$col_2", $html); $this->output .= $html; } else //-- mod_collapse end [MODE] insert_below [STEP] [SEARCH] unset($temp_html); } $this->output .= $this->html->end_all_cats(); [INSERT] //-- mod_collapse begin } //-- mod_collapse end [MODE] insert_above [FNAME_END] [MOD_TOKEN] mod_collapse [FNAME] sources/Forums.php [STEP] [SEARCH] $fid = $ibforums->input['f']; [INSERT] //-- mod_collapse begin global $HTTP_COOKIE_VARS; if (file_exists(ROOT_PATH."Skin/{$ibforums->skin_id}/mod_collapse_skin.php")) { $this->collapse_html = $std->load_template('mod_collapse_skin'); $this->use_skin = true; } if (isset($ibforums->input['collapse_s'])) { $std->my_setcookie("fc".$ibforums->input['collapse_s']."_block", "", 1); $_COOKIE[$ibforums->vars['cookie_id']."fc".$ibforums->input['collapse_s']."_block"] = "block"; $HTTP_COOKIE_VARS[$ibforums->vars['cookie_id']."fc".$ibforums->input['collapse_s']."_block"] = "block"; } if (isset($ibforums->input['collapse_h'])) { $std->my_setcookie("fc".$ibforums->input['collapse_h']."_block", "none", 1); $_COOKIE[$ibforums->vars['cookie_id']."fc".$ibforums->input['collapse_h']."_block"] = "none"; $HTTP_COOKIE_VARS[$ibforums->vars['cookie_id']."fc".$ibforums->input['collapse_h']."_block"] = "none"; } $url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext']."?".$_SERVER['QUERY_STRING']; $url = preg_replace("`\&collapse_.=f\d*`", "", $url); $hide_this_cat = $std->my_getcookie("fcf{$fid}_block") == "none" && $ibforums->input['collapse_s'] != "f".$fid; $this->sub_output .= ""; $cat_data['collapse_url'] = $url."&collapse_s=f".$fid."#col".$fid; $cat_data['id'] = "f".$fid; if ($hide_this_cat) { if ($this->use_skin) { $cat_data['collapse_name'] = $ibforums->lang['forums']; $this->sub_output .= $this->collapse_html->CatHeader_Expanded_Hide($cat_data); } else { $html = $this->board_html->CatHeader_Expanded($cat_data); $html = preg_replace("`(.*"; $col_1 = "\n"; $col_1 .= "\n"; $col_1 .= "\n\n"; $col_2 .= "\n"; $col_2 .= "\n
"; $col_2 = "$pic
\n"; $match = "`(<\{CAT_IMG\}>.*?{$cat_data['name']}.*?<\/a>)`is"; if (!preg_match($match, $html)) $match = "`({$cat_data['name']}.*?<\/a>)`is"; $html = preg_replace($match, "$col_1\\1{$ibforums->lang['forums']}$col_2", $html); if (preg_match("`(.*?\s*\s*`is", $html)) { $html = preg_replace("`(.*?\s*\s*`is", "\\1", $html); } else { $html = preg_replace("`(.*)`is", "\\1", $html); } $this->sub_output .= $html; } $this->sub_output .= $this->board_html->end_this_cat(); } else { //-- mod_collapse end [MODE] insert_below [STEP] [SEARCH] if ($temp_html != "") { [INSERT] /*-- mod_collapse exclude begin [MODE] insert_below [STEP] [SEARCH] $this->sub_output .= $this->board_html->subheader(); [INSERT] -- mod_collapse exclude end */ //-- mod_collapse begin $this->sub_output .= ""; $cat_data['collapse_url'] = $url."&collapse_h=f".$fid."#col".$fid; if ($this->use_skin) { $cat_data['collapse_name'] = $ibforums->lang['forums']; $this->sub_output .= $this->collapse_html->CatHeader_Expanded_Show($cat_data); } else { $html = $this->board_html->CatHeader_Expanded($cat_data); $html = preg_replace("`(.*"; $col_1 = "\n"; $col_1 .= "\n"; $col_1 .= "\n\n"; $col_2 .= "\n"; $col_2 .= "\n
"; $col_2 = "{$ibforums->lang['forums']}$pic
\n"; $match = "`(<\{CAT_IMG\}>.*?{$cat_data['name']}.*?<\/a>)`is"; if (!preg_match($match, $html)) $match = "`({$cat_data['name']}.*?<\/a>)`is"; $html = preg_replace($match, "$col_1\\1$col_2", $html); $this->sub_output .= $html; } //-- mod_collapse end [MODE] insert_below [STEP] [SEARCH] unset($temp_html); $this->sub_output .= $this->board_html->end_all_cats(); [INSERT] //-- mod_collapse begin } //-- mod_collapse end [MODE] insert_above [FNAME_END] [MOD_TOKEN] mod_collapse [FNAME] sources/functions.php [STEP] [SEARCH] $ibforums->member['skin'] = $row['sid']; } [INSERT] //-- mod_collapse begin $col_js = "\n\n"; $col_js .= "\n\n"; $row['template'] = str_replace( "<% JAVASCRIPT %>", "<% JAVASCRIPT %>".$col_js, $row['template']); //-- mod_collapse end [MODE] insert_below [FNAME_END] [CODE_END] [COPY] Kopiere alle Dateien im Ordner [b]upload[/b] des Archivs in das Root-Verzeichnis deines Boards und behalte dabei die Struktur bei. [List] [*]html [arrow] html / containing mod_collapse.js [*]sources [arrow] sources [*]style_images/1 [arrow] style_images/1 / containing minus.gif and plus.gif Copy these images to all other image directories In style_images/1_arrow you will find two alternatives for the plus and minus. [/list] [COPY_END] [CUSTOMIZE] [size=4]Cookies[/size] Die Modifikation basiert auf den Gebrauch von Cookies. Falls Cookies vom Browser abgewiesen werden, kann die Modifikation nicht funktionieren. Ob Cookies zugelassen und akzeptiert werden, kann man an der Url im Adressfeld des Browsers erkennen: [quote] Falls dort die session_id [b]s=...[/b] angehängt ist, so werden Cookies abgewiesen. [/quote] [size=4]Anpassen des Skins[/size] Im Ordner Addons/Skin/s1 befindet sich die Datei mod_collapse_skin.php. Hier ist ein Ersatz der [b]Originalfunction CatHeader_Expanded(...)[/b]. Die neue Funktion fügt eine kleine Grafik zum Header jeder Kategorie hinzu, so dass die Kategorie durch Anklicken verborgen werden kann. Diese Datei kann angepasst und in den Skinordner ./Skin/sx kopiert werden . Nicht vergessen, ein Resynchronize via ACP durchzuführen. [CUSTOMIZE_END] [COMMENT_MOD] [COMMENT_MOD_END] [HISTORY_OLD] [HISTORY_OLD_END]