Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Toggle Products Details »»
Toggle Products
Version: 1.01, by Mutt Mutt is offline
Developer Last Online: Mar 2013 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.7.1 Rating:
Released: 06-20-2008 Last Update: Never Installs: 5
Re-useable Code Code Changes  
No support by the author.

Toggle Products v1.01
Made by Mutt
06-21-08

------------------------
This lets you collapse the plugins at the product headers of the Plugin Manager. it makes it easy for you to flip thru your installed products and locate a plugin.

It now has "Expand All" & "Collapse All" links at the bottom of the page next to "Add New Plugin". Also after you save a plugin, when you are brought back to the main plugin page the product that you were working on is open.
------------------------
v1 initial release
v1.01 added [Expand All] & [Collapse All] links
------------------------

I have this running on 3.71

INSTALL

time for the bad news, there's no pretty product or plugin here. you have to edit forum/admincp/plugin.php in 2 places


find
Code:
	// stuff to handle the redirect
	define('CP_REDIRECT', 'plugin.php');
	print_stop_message('saved_plugin_successfully');
and replace it with
Code:
	// stuff to handle the redirect
	define('CP_REDIRECT', 'plugin.php?open='.$vbulletin->GPC['product']);
	print_stop_message('saved_plugin_successfully');

look for
Code:
				$prevgroup = $product['title'];
				print_description_row("$vbphrase[product] : " . $product['title'], 0, 4, 'tfoot');
replace it with
Code:
				if ($prevgroup) {
					echo "</tbody>";
					$allproducts.="','";
				}
				$allproducts.=$product[productid];
				$prevgroup = $product['title'];
				$button="<a href=\"#top\" target=\"_self\" onclick=\"toggle_group('".$product[productid]."'); return false;\"><img src=\"../cpstyles/vBulletin_3_Silver/cp_expand.gif\" title=\"Expand Group\" id=\"button_".$product[productid]."\" alt=\"\" border=\"0\"></a>";
				print_description_row("$button $vbphrase[product] : " . $product['title'], 0, 4, 'tfoot');
				echo '<tbody id="group_'.$product[productid].'" style="display: none;">';

look for
Code:
	print_submit_row($vbphrase['save_active_status'], false, 4);

	echo '<p align="center">' . construct_link_code($vbphrase['add_new_plugin'], "plugin.php?" . $vbulletin->session->vars['sessionurl'] . "do=add") . '</p>';
replace it with
Code:
	if ($group_by == 'product') {
		echo "</tbody>";
	}

	print_submit_row($vbphrase['save_active_status'], false, 4);

if ($group_by == 'product') {
	$controls = " <a href=\"#top\" target=\"_self\" onclick=\"expand_all_groups(1); return false;\">[ Expand Products ]</a> <a href=\"#top\" target=\"_self\" onclick=\"expand_all_groups(0); return false;\">[Collapse Products]</a>";
	$vbulletin->input->clean_array_gpc('r', array(
		'open' => TYPE_NOHTML
	));
	
	?>
	<script type="text/javascript">
	<!--
	var files = new Array('<?php echo $allproducts; ?>');
	<?php 
	if ($vbulletin->GPC['open']) {
		echo "open_close_group('".$vbulletin->GPC['open']."', 1)";
	}
	?>
	
	function expand_all_groups(doOpen)
	{ 
    	for (var i = 0; i < files.length; i++) {
			open_close_group(files[i], doOpen);
		}
	}
	
	function open_close_group(group, doOpen)
	{
		var curdiv = fetch_object("group_" + group);
		var curbtn = fetch_object("button_" + group);

		if (doOpen)
		{
			curdiv.style.display = "";
			curbtn.src = "../cpstyles/vBulletin_3_Silver/cp_collapse.gif";
			curbtn.title = "";
		}
		else
		{
			curdiv.style.display = "none";
			curbtn.src = "../cpstyles/vBulletin_3_Silver/cp_expand.gif";
			curbtn.title = "";
		}

	}
	
	function toggle_group(group)
	{
		var curdiv = fetch_object("group_" + group);

		if (curdiv.style.display == "none")
		{
			open_close_group(group, true);
		}
		else
		{
			open_close_group(group, false);
		}
	}
	
	//-->
	</script>
	<?php
}
	echo '<p align="center">' . construct_link_code($vbphrase['add_new_plugin'], "plugin.php?" . $vbulletin->session->vars['sessionurl'] . "do=add") . $controls .'</p>';

please bear with me because it's been a loooong time since I released anything. if there's an easier way to do this, I'm all ears.

NOTE: toggle.js is a tiny chuck of javascript lifted from includes/adminfunctions_navpanel.php. if this is bad form, please let me know how to release this properly.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 06-21-2008, 03:23 PM
Stoebi Stoebi is offline
 
Join Date: Apr 2006
Location: Germany, Berlin
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi

*installed*

Wish:
What do you think about a Save & Reload options for plugins?
Reply With Quote
  #3  
Old 06-21-2008, 04:27 PM
Mutt's Avatar
Mutt Mutt is offline
 
Join Date: Nov 2001
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Stoebi View Post
Hi

*installed*

Wish:
What do you think about a Save & Reload options for plugins?

yeah, as I'm using it I realize that saving the current stat of toggles would be nice. should be easy enough to do. would just have to grab a little bit more of that javascript. will wait till I find out if what I lifted so far is allowable.

would like to add expand all & collapse all. will have to look into it
Reply With Quote
  #4  
Old 06-21-2008, 05:40 PM
Stoebi Stoebi is offline
 
Join Date: Apr 2006
Location: Germany, Berlin
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hope, that helps, code is from a friend of mine (Surviver):
Code:
    <script type="text/javascript">
    <!--
        function toggle_p_collapse(objid, un)
        {
            obj = fetch_object('collapseobj_' + objid);
            img = fetch_object('collapseimg_' + objid);
            cel = fetch_object('collapsecel_' + objid);

            if (!obj)
            {
                return false;
            }

            if (un)
            {
                obj.style.display = '';
                save_collapsed(objid, false);

                if (img)
                {
                    img_re = new RegExp("_collapsed\\.gif$");
                    img.src = img.src.replace(img_re, '.gif');
                }

                if (cel)
                {
                    cel_re = new RegExp("^(thead|tcat)(_collapsed)$");
                    cel.className = cel.className.replace(cel_re, '$1');
                }
            }
            else
            {
                obj.style.display = 'none';
                save_collapsed(objid, true);

                if (img)
                {
                    img_re = new RegExp("_alt\\.gif$");
                    img.src = img.src.replace(img_re, '_alt_collapsed.gif');
                }

                if (cel)
                {
                    cel_re = new RegExp("^(thead|tcat)$");
                    cel.className = cel.className.replace(cel_re, '$1_alt_collapsed');
                }
            }
                return false;
        }

        function collapse_all(un)
        {
            if (un)
            {
                for (var i in products)
                {
                    toggle_p_collapse(products[i], true);
                }
            }
            else
            {
                for (var i in products)
            {
                toggle_p_collapse(products[i], false);
            }
        }
            return false;
    }
    //-->
    </script>
Reply With Quote
  #5  
Old 06-21-2008, 10:30 PM
Mutt's Avatar
Mutt Mutt is offline
 
Join Date: Nov 2001
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks Stoebi

UPDATED

I updated the directions. it now has "Expand All" & "Collapse All" links at the bottom of the page next to "Add New Plugin". Also after you save a plugin, when you are brought back to the main plugin page the product that you were working on is open.

It still doesn't let you save your preferred open / closed state.

you'll have to uninstall & reinstall. no files need to be uploaded this time.
Reply With Quote
  #6  
Old 06-29-2008, 12:17 PM
Mutt's Avatar
Mutt Mutt is offline
 
Join Date: Nov 2001
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

worked fine in 3.72
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:49 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04180 seconds
  • Memory Usage 2,265KB
  • Queries Executed 21 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (7)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete