Moderation Form instead of images in Topic Display

Started by Kirby, November 14, 2004, 12:22:21 AM

Previous topic - Next topic

Kirby

I know there are a few people who don't like the moderation images (ex. Sticky/Lock buttons) in the topic display. I looked at MessageIndex's quick mod form and found a better way to represent those (similar to Invision's mod form). Add this somewhere in your Display.template.php, preferrably in the mod options function.
<form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" name="topicForm" style="margin: 0;">
<input type="hidden" name="topics[]" value="', $context['current_topic'] ,'">
<select name="qaction"', $context['can_move'] ? ' onchange="document.topicForm.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
<option value="" style="font-weight: bold;">Moderation Options</option>
', $context['can_remove'] ? '<option value="remove">Delete Topic</option>' : '', '
', $context['can_lock'] ? '<option value="lock">Lock Topic</option>' : '', '
', $context['can_sticky'] ? '<option value="sticky">Pin Topic</option>' : '', '
', $context['can_move'] ? '<option value="move">Move Topic to: </option>' : '', '
', $context['can_merge'] ? '<option value="merge">Merge Topic</option>' : '', '
</select>';
if ($context['can_move'])
{
echo '
<select id="moveItTo" name="move_to" disabled="disabled">';
foreach ($context['jump_to'] as $category)
foreach ($category['boards'] as $board)
{
if (!$board['is_current'])
echo '
<option value="', $board['id'], '"', !empty($board['selected']) ? ' selected="selected"' : '', '>', str_repeat('-', $board['child_level'] + 1), ' ', $board['name'], '</option>';
}
echo '
</select>';
}
echo '
        <input type="submit" class="forminput" value="', $txt['quick_mod_go'], '">
<input type="hidden" name="sc" value="' . $context['session_id'] . '" />
</form>';


Example:


(No that is not Invision, it is SMF... I just made an Invision skin for a forum that requested it)

A.M.A

Nice tip .. here how I did it, add the code above in Display.template.php after
function theme_show_mod_buttons()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;

put ( echo ' ) as the first line to the code above .. and finally delete it this:
$moderationButtons = array();

if ($context['can_move'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_move.gif" alt="' . $txt[132] . '" border="0" />' : $txt[132]) . '</a>';
if ($context['can_delete'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt[162] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_rem.gif" alt="' . $txt[63] . '" border="0" />' : $txt[63]) . '</a>';
if ($context['can_lock'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_lock.gif" alt="' . (empty($context['is_locked']) ? $txt['smf279'] : $txt['smf280']) . '" border="0" />' : (empty($context['is_locked']) ? $txt['smf279'] : $txt['smf280'])) . '</a>';
if ($context['can_sticky'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_sticky.gif" alt="' . (empty($context['is_sticky']) ? $txt['smf277'] : $txt['smf278']) . '" border="0" />' : (empty($context['is_sticky']) ? $txt['smf277'] : $txt['smf278'])) . '</a>';
if ($context['can_merge'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/merge.gif" alt="' . $txt['smf252'] . '" border="0" />' : $txt['smf252']) . '</a>';
if ($context['can_remove_poll'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';

if ($context['calendar_post'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/linktocal.gif" alt="' . $txt['calendar37'] . '" border="0" />' : $txt['calendar37']) . '</a>';

if ($context['can_remove_post'] && !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
$moderationButtons[] = $settings['use_image_buttons'] ? '<input type="image" name="submit" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/delete_selected.gif" alt="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" />' : '<a href="javascript:document.quickModForm.submit();" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');">' . $txt['quickmod_delete_selected'] . '</a>';

return implode($context['menu_separator'], $moderationButtons);
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Kirby

Thats actually how I did it too :P
QuoteAdd this somewhere in your Display.template.php, preferrably in the mod options function.
Thanks ^_^

codenaught

Nice change! I just am having problems with the move topic to: box. When I select that the box is not enabled, thus not letting me to click on it. Are you sure there is nothing wrong with that part of it?
Dev Consultant
Former SMF Doc Coordinator

Kirby

Thats odd... be sure to copy every bit of the code. I'm pretty sure the JavaScript is in there...

suren

Quote from: akabugeyes on November 14, 2004, 02:16:00 PM
Nice change! I just am having problems with the move topic to: box. When I select that the box is not enabled, thus not letting me to click on it. Are you sure there is nothing wrong with that part of it?

i'm getting the same error & also javascript error

Kirby

#6
Oops... replace document.topicForm.moveItTo with document.getElementById("moveItTo")

mytreo

How does one remove a poll or post the topic to calendar with this mod?

Thanks

Chris
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Kirby

It isn't in there yet, but my enhanced default theme has it (its a complete redo of what I posted).

mytreo

Ooh sounds good, so where is your enhanced default theme? :)
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Nidoking

Quote from: mytreo on January 17, 2005, 05:50:47 PM
Ooh sounds good, so where is your enhanced default theme? :)
Probably under construction.

Kirby

yeah, its under heavy construction and will have a whole bunch of old yabb se mods in it...

helenbpd

Kirby,

This is a fabulous mod.  One question, though - is there a way to hide the menu from anyone who can't use it (i.e., members & guests)?  I installed it, and when I log out and read as a guest, the dropdown is still there, albeit just with the option "moderation options", but the go! button is still there and clickable.  (Selecting it simply takes you back to the index.)

How to hide it to spare confusion to guests & members?  (Or did I install it incorrectly somehow?)

Thanks!

helenbpd

Fiddling with this a little more.

On my board (still RC2, based on default template), the

$context['can_remove']
had to be changed to
$context['can_delete']

Also, the Merge option doesn't work for me, either, & I'm not sure what to change.  It just returns me to the messages index with no intermediate page asking what to merge where.

Also, there doesn't seem to be a confirmation page built in, as there was with the buttons.  ("Do you really want to remove/sticky/etc this topic?") 

(I wish I knew PHP code or I'd just make these changes myself, sorry to bug you!  I don't want to totally mess things up by fiddling too much.)



Kirby

I'll get back to you on this... I really have improved over this one in my IPB theme/default "enhanced" theme and I'll put up the code soon.

helenbpd

Thanks Kirby!  I'll keep an eye out, it's a great mod idea.

Midgard

I need this script for ordering/sorting

-For memberslist
-For message index

rojamaia



hi everyone!

is there an update on this?  this looks like a good mod

Kirby


Eleglin

Where are the options for calendar post or remove polls ?!
It's not compatible with SMF 1.1 (or it doesn't work with my theme : it appears, but the options don't work) ...
Can someone enhance it for SMF 1.1.x, please ? It should be fine.
No support by PM or Mail.

Advertisement: