Thread: BB Code Enhancements - BB Code [table]
View Single Post
  #671  
Old 12-05-2010, 11:32 AM
mawby mawby is offline
 
Join Date: Jun 2004
Location: Wiltshire, England
Posts: 145
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've had this installed since the early 3.8 days and I've got this working for vB4.1.0 with sorting still enabled. It's very hacky though so if you're not confident with hacking files then please don't follow these instructions as I offer no support for this - it is simply a list of things I did to get it working.

1) I added the items to additional.css as instructed here.

2) I edited the "link sorttable javascript in <head>-section" plugin to remove the IMGDIR_BUTTON reference, resulting in...

PHP Code:
if(($vbulletin->options['stg_table_options']&64)&&in_array(THIS_SCRIPT, array('announcement','calendar','editpost''newreply','newthread','private','showpost','showthread','usernote'))){
    
$output str_replace('</head>',"\t".'<style type="text/css">'."\n\t\tspan.sortarrow {position:absolute;}\n\t\tspan.sortarrow img {border:0;}\n\t\ta.sortheader {text-decoration:none; display:block; width:100%;}\n\t</style>\n\t".'<script type="text/javascript">'."\n\t".'</script>'."\n\t".'<script type="text/javascript" src="clientscript/sorttable.js"></script>'."\n".'</head>',$output);

3) I edited the clientscript/sorttable.js file and replace the IMGDIR_BUTTON references with hard coded paths, so this...

Code:
	if (span.getAttribute("sortdir") == 'down') {
		ARROW = '&nbsp;<img src="' + IMGDIR_BUTTON + '/sortasc.gif" />';
		newRows.reverse();
		span.setAttribute('sortdir','up');
	} else {
		ARROW = '&nbsp;<img src="' + IMGDIR_BUTTON + '/sortdesc.gif" />';
		span.setAttribute('sortdir','down');
	}
...becomes this on my site...

Code:
        if (span.getAttribute("sortdir") == 'down') {
                ARROW = '&nbsp;<img src="images/buttons/sortasc.png" />';
                newRows.reverse();
                span.setAttribute('sortdir','up');
        } else {
                ARROW = '&nbsp;<img src="images/buttons/sortdesc.png" />';
                span.setAttribute('sortdir','down');
        }
3) I edited the "parse vBCode table" plugin to remove the thead class reference, so...

PHP Code:
        #if a head is specified, make it
        
if($bbcode_table['head']['enabled']==true){
            
$table_head '<thead class="thead"><tr><th'.implode('</th><th',$table_head).'</th></tr></thead>';
        }else{
            
$table_head '';
        } 
...becomes...

PHP Code:
        #if a head is specified, make it
        
if($bbcode_table['head']['enabled']==true){
            
$table_head '<thead><tr><th'.implode('</th><th',$table_head).'</th></tr></thead>';
        }else{
            
$table_head '';
        } 
4) Within the same plugin I had to add the restore class to the table tag, so...

PHP Code:
        if (strlen($bbcode_table['css']['table'])>0){
            
$table_html '<table class="stg_table tborder stg_table_'.$bbcode_table['css']['table'];
        }else{
            
$table_html '<table class="stg_table tborder';
        } 
...becomes...

PHP Code:
        if (strlen($bbcode_table['css']['table'])>0){
            
$table_html '<table class="stg_table tborder restore stg_table_'.$bbcode_table['css']['table'];
        }else{
            
$table_html '<table class="stg_table tborder restore';
        } 
5) I ran the option: AdminCP -> Maintenance -> Update Counters -> Rebuild Post Cache

I want to reiterate, the above is simply what I've done to my site to get it working with the sort. I make no guarantee that it is the correct way to fix this or that it will work for anyone else.

With that said, I hope the above proves useful to someone.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01668 seconds
  • Memory Usage 1,809KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (5)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete