Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[How-To] Create your own Inline Moderation
Revan's Avatar
Revan
Join Date: Jan 2004
Posts: 1,671

Started doing my first if...else chain in 2004, and released my first major vBulletin modification in August 2004 with the first version of the RPG Integration Hack.

Norway
Show Printable Version Email this Page Subscription
Revan Revan is offline 07-06-2006, 10:00 PM

This How-To will only work with the upcoming Beta 5 or RC1 or whatever they decide to name it. It will not work with Beta 4, because of this thread.

Wouldn't it be cool to have your own Inline Moderation? Of course it would. Especially if you paginate your results, you might want to mark multiple items across pages.

You don't need to understand AJAX in order to find this guide useful. Hell I don't know much AJAX, I'm just good at tinkering with code until it works

Im assuming you know how to create and submit forms, so I won't go into details on how to alter the example form in order to make it work with your hack.

Make sure your php file has the "inlinemod" phrasetype included.
  1. HTML Code:
    <form action="l2cp.php" method="post" id="banmanageform">
    The one thing you should know about this form is that the l2cp.php or whatever you decide to put there, is the file that will handle your inline moderation. vBulletin uses inlinemod.php for this purpose.
  2. In order to get the fancy dropdown menu, put this in the bit where you have the class="thead":
    HTML Code:
    <if condition="$show['popups']">
                    <td class="vbmenu_control" id="imod" align="center" title="$vbphrase[moderation]"><script type="text/javascript"> vbmenu_register('imod'); </script></td>
                <else />
                    <td class="tcat" align="center">
                        <input type="checkbox" name="allbox" id="checkall_all" title="$vbphrase[check_uncheck_all]" onclick="inlineMod.check_all()" />
                    </td>
                </if>
    Then a little later somewhere put this:
    HTML Code:
    <if condition="$show['popups']">
        <div class="vbmenu_popup" id="imod_menu" style="display:none" align="$stylevar[left]">
            <table cellpadding="4" cellspacing="1" border="0">
    <tr><td class="thead">$vbphrase[l2cp_from_this_page]</td></tr>
    <tr><td class="vbmenu_option" onclick="inlineMod.check_all(true)">$vbphrase[select_all]</td></tr>
    <tr><td class="vbmenu_option" onclick="inlineMod.check_all(false)" id="arse">$vbphrase[deselect_all]</td></tr>
    <tr><td class="vbmenu_option" onclick="inlineMod.check_all('invert')">$vbphrase[invert_selection]</td></tr>
    
    </table>
        </div>
    </if>
  3. Put this wherever you want it to appear:
    HTML Code:
    <strong>$vbphrase[moderation]</strong><br />
                <select name="do">
                    <optgroup label="$vbphrase[option]">
                        <option value="someaction">$vbphrase[somephrase]</option>
                    </optgroup>
                </select><input type="submit" class="button" id="inlinego" value="$vbphrase[go]" />
                <input type="hidden" name="s" value="$session[sessionhash]" />
                </div>
                <script type="text/javascript" src="clientscript/vbulletin_inlinemod.js?v=$vboptions[simpleversion]"></script>
                <script type="text/javascript">
                <!--
                inlineMod = new vB_Inline_Mod('inlineMod', 'post', 'banmanageform', '$vbphrase[go_x]', 'productname_inline');
                //-->
                </script>
    This has a ton of things to explain.
    First of all, the select is what determines what action the script should do.
    Secondly, theres the new vB_Inline_Mod(). That's used to instantiate the JS class. The first parameter is the varname, in this case inlineMod. Next you'll have whether or not this is a thread or a post, you have to leave it at post. Next is the form name like you defined above, then the vbphrase for the go (0) button, then the cookiename. You can make that anything you want, just make sure its unique.
  4. The final bit here is the checkbox that'll mark the result bit, so in your repeating template put this:
    HTML Code:
    <input type="checkbox" name="plist[$idvar]" id="plist_$idvar" style="vertical-align:middle; padding:0px; margin:0px 0px 0px 5px" />
    The only thing you need to change here is the $idvar. That can be anything such as {$result[userid]} or whatever.

That should do the trick
Feel free to ask if there's anything you find unclear, I was in sort of a hurry and Im not very good at explaining
Reply With Quote
  #2  
Old 09-24-2009, 06:28 PM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm having trouble with this guide... these are my templates:

FORM:
Code:
<form action="videoajax.php" method="post" id="videoComments">

<a name="comments" />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="thead" width="100%">
		$vbphrase[comments]
	</td>
<if condition="$show['popups']">
	<td class="vbmenu_control" id="imod" align="center" title="$vbphrase[moderation]"><script type="text/javascript"> vbmenu_register('imod'); </script></td>
<else />
	<td class="tcat" align="center">
		<input type="checkbox" name="allbox" id="checkall_all" title="$vbphrase[check_uncheck_all]" onclick="inlineMod.check_all()" />
	</td>
</if>
</tr>
<tr valign="top">
	<td class="alt1" colspan="2"><div id="vidCommentsAll">
		<ol class="list_no_decoration alt1 block_row" id="message_list">$commentbits</ol>
	</div></td>
</tr>
</table>

<div id="vidPageselAll">$pagenav</div>

<div align="right">
	<strong>$vbphrase[moderation]</strong>
	<select name="do">
	<optgroup label="$vbphrase[option]">
		<option value="deletecomments">Delete Comments</option>
	</optgroup>
	</select>
	<input type="submit" class="button" id="inlinego" value="$vbphrase[go]" />
	<input type="hidden" name="s" value="$session[sessionhash]" />
	<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
	<script type="text/javascript" src="clientscript/vbulletin_inlinemod.js?v=$vboptions[simpleversion]"></script>
	<script type="text/javascript">
	<!--
	inlineMod = new vB_Inline_Mod('inlineMod', 'post', 'videoComments', '$vbphrase[go_x]', 'videocomments_inline');
	//-->
	</script>
</div>

<if condition="$show['popups']">
	<div class="vbmenu_popup" id="imod_menu" style="display:none" align="$stylevar[left]">
	<table cellpadding="4" cellspacing="1" border="0">
		<tr><td class="thead">$vbphrase[moderation]</td></tr>
		<tr><td class="vbmenu_option" onclick="inlineMod.check_all(true)">$vbphrase[select_all]</td></tr>
		<tr><td class="vbmenu_option" onclick="inlineMod.check_all(false)" id="arse">$vbphrase[deselect_all]</td></tr>
		<tr><td class="vbmenu_option" onclick="inlineMod.check_all('invert')">$vbphrase[invert_selection]</td></tr>
	</table>
	</div>
</if>

<script type="text/javascript" src="clientscript/vbulletin_ajax_videocomment.js"></script>

</form>
BIT:
Code:
<li id="vcomment$comment[videocommentid]" class="floatcontainer">
<if condition="$comment['avatarurl']">
	<div class="fixed_width_avatar">
		<if condition="$comment['postuserid']"><a href="member.php?$session[sessionurl]u=$comment[postuserid]"></if><img src="$comment[avatarurl]" class="alt2 avatar"<if condition="$comment['avatarwidth']"> width="$comment[avatarwidth]"</if><if condition="$comment['avatarheight']"> height="$comment[avatarheight]"</if> border="0" alt="$comment[username]" /><if condition="$comment['postuserid']"></a></if>
	</div>
	<div class="visitor_message_avatar_margin">
</if>
	<div class="tborder info_bar">
		<div class="alt2 smallfont">
<if condition="$show['deletionlink']"><input type="checkbox" class="inlinemod_checkbox" name="clist[$comment[videocommentid]]" id="clist_$comment[videocommentid]" /></if>
			<div class="visitor_message_date"><a href="$video[url]">$video[title]</a> @ $comment[date], <span class="time">$comment[time]</span></div>
			<if condition="$comment['postuserid']">
				<a href="member.php?$session[sessionurl]u=$comment[postuserid]">$comment[musername]</a>
			<else />
				<phrase 1="$comment[musername]">$vbphrase[guest_x]</phrase>
			</if>
		</div>
	</div>

	<div id="vcomment_text_$comment[videocommentid]" class="visitor_message_body">
		$comment[message]
	</div>

	<ul class="list_no_decoration controls">
		<if condition="$show['deletionlink']">
			<li class="smallfont"><a href="video.php?$session[sessionurl]do=deletecomment&amp;commentid=$comment[videocommentid]">$vbphrase[delete_video_comment]</a></li>
		</if>
	</ul>
<if condition="$comment['avatarurl']">
	</div>
</if>
</li>
Two problems...

1 - class="floatcontainer" should change to class="floatcontainer inlinemod" when a bit is checked... it doesn't here...

2 - selections are not saved on page-switch; or added to the "Go (0)" count on the submit form.

Please take a look at my code and tell me what I am missing.
Reply With Quote
  #3  
Old 09-28-2009, 07:53 PM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Found another issue... the drop-down menu doesn't work. If I hit "select all", it doesn't select anything.

--------------- Added [DATE]1254172453[/DATE] at [TIME]1254172453[/TIME] ---------------

Figured It Out!

Code:
<script type="text/javascript">
<!--
inlineMod = new vB_Inline_Mod('inlineMod', 'post', 'banmanageform', '$vbphrase[go_x]', 'productname_inline');
//-->
</script>
I changed 'post' to 'vmessage' and now it works!

--------------- Added [DATE]1254173076[/DATE] at [TIME]1254173076[/TIME] ---------------

Wait... actually, there is still an error...

Selections are not saved on page-switch; or added to the "GO" count"
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 01:53 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.03663 seconds
  • Memory Usage 2,240KB
  • Queries Executed 18 (?)
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
  • (3)bbcode_code
  • (5)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (3)postbit_onlinestatus
  • (3)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