vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [How-To] Create your own Inline Moderation (https://vborg.vbsupport.ru/showthread.php?t=120545)

Revan 07-06-2006 10:00 PM

[How-To] Create your own Inline Moderation
 
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 :p

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 :(

Jaxel 09-24-2009 06:28 PM

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.

Jaxel 09-28-2009 07:53 PM

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"


All times are GMT. The time now is 06:44 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.01250 seconds
  • Memory Usage 1,768KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (5)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete