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

Reply
 
Thread Tools
Close / Open Thread Via Quick Reply Details »»
Close / Open Thread Via Quick Reply
Version: 2008.05.25, by Viper007Bond Viper007Bond is offline
Developer Last Online: Dec 2017 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 3.7.0 Rating:
Released: 05-22-2008 Last Update: 05-24-2008 Installs: 32
Template Edits
Re-useable Code Translations  
No support by the author.

I wanted to be able to close and open threads as I left my reply via the quick reply box, so I wrote this little template mod.




Features
  • Checkbox at the bottom of the quick reply box to toggle the current status. Only shows up for people with proper permissions.
  • Javascript is used to update the reply buttons (to change them from "Reply" to "Closed" and visa-versa).
  • Javascript is used to change the text next to the checkbox saying what will happen when you reply.

Installation


It's a fairly easy install and only requires editing one template (SHOWTHREAD), and importing a product (for the language phrases). The following instructions are for the default theme, but custom themes will probably be really similiar.

Download and install the product. This will create the new language phrases so you can translate this hack to your liking.

Then open up "SHOWTHREAD" and find this code. It's for the top reply button.

HTML Code:
	<if condition="$show['largereplybutton']">
		<td class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$FIRSTPOSTID" rel="nofollow"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" /></if></a></td>
	<else />

You will need to give both the open (reply.gif) and the closed (threadclosed.gif) <img> tags a new CSS class called "replybutton" so that the Javascript can update them.

So for the default theme, that would result in this:

HTML Code:
	<if condition="$show['largereplybutton']">
		<td class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$FIRSTPOSTID" rel="nofollow"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" class="replybutton" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" class="replybutton" /></if></a></td>
	<else />

Now do the same thing for the bottom reply button (same HTML).


Now we need to add the new code to the bottom of the quick reply box (same template).

Find this code which is the HTML for the "quote message in post" checkbox:

HTML Code:
							<label for="qr_quickreply"><input type="checkbox" name="quickreply" value="1" id="qr_quickreply" accesskey="w" tabindex="4" />$vbphrase[quote_message_in_reply]</label>
						</div>
					</fieldset>

After that (and before what is probably a </div>), add all of this:

HTML Code:
<if condition="$show['openclose']">
					<fieldset class="fieldset" style="margin:$stylevar[formspacer]px 0px 0px 0px">
						<legend>$vbphrase[viper_opencloseqr_thread_management]</legend>
						<div style="padding:3px">
							<div>
								<label for="cb_openclose"><input type="checkbox" name="openclose" value="1" id="cb_openclose" tabindex="1" /><span id="qr_openclosestatus"><if condition="$show['closethread']">$vbphrase[viper_opencloseqr_close_thread]<else />$vbphrase[viper_opencloseqr_open_thread]</if></span></label>
							</div>
						</div>
					</fieldset>

					<script type="text/javascript">
					/* <![CDATA[ */

						// Current thread status recorder
						var viperThreadOpen = <if condition="$show['closethread']">true<else />false</if>;

						// Run the custom function when the quick reply form is submitted
						YAHOO.util.Event.addListener(document.getElementById("qrform"), "submit", viperQuikyReply);

						// Do some stuff when the form is submitted
						function viperQuikyReply() {

							var viperOpenCloseCheckbox = document.getElementById("cb_openclose");
							var viperQRTextareaChars = document.getElementById("vB_Editor_QR_textarea").value.length;
							var viperReplyButtonIMG;

							// If the checkbox wasn't checked or the message was too short (simple check), abort
							if ( viperOpenCloseCheckbox.checked == false || viperQRTextareaChars == 0 || viperQRTextareaChars < $vboptions[postminchars] ) return;

							// Uncheck the checkbox
							viperOpenCloseCheckbox.checked = false;

							// Change the text and set the reply button image filename
							if ( viperThreadOpen == true ) {
								document.getElementById("qr_openclosestatus").innerHTML = "$vbphrase[viper_opencloseqr_open_thread]";
								viperReplyButtonIMG = "threadclosed.gif";
								viperThreadOpen = false;
							} else {
								document.getElementById("qr_openclosestatus").innerHTML = "$vbphrase[viper_opencloseqr_close_thread]";
								viperReplyButtonIMG = "reply.gif";
								viperThreadOpen = true;
							}

							// Get all reply buttons via the new class
							var replybuttons = YAHOO.util.Dom.getElementsByClassName("replybutton", "img");

							// Loop through each reply button and change it's image URL
							var i;
							for (i in replybuttons) {
								replybuttons[i].src = "$stylevar[imgdir_button]/" + viperReplyButtonIMG;
							}
						}

					/* ]]> */
					</script>
</if>

Save and you're all done!


Oh, and don't forget to mark this as installed!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
desifunz1

Comments
  #12  
Old 05-25-2008, 09:57 AM
Magnumutz's Avatar
Magnumutz Magnumutz is offline
 
Join Date: Feb 2006
Location: Romania
Posts: 731
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok... so i installed this thing yesterday, when it only had template edits... now do i have to install the product as well?
Reply With Quote
  #13  
Old 05-25-2008, 04:50 PM
Ben E Lou Ben E Lou is offline
 
Join Date: Dec 2007
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How about the ability to stick and unstick in Quick Reply as well?
Reply With Quote
  #14  
Old 05-25-2008, 05:03 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How about a text file with the instructions in case it ever needs to be re-installed?
Reply With Quote
  #15  
Old 05-26-2008, 08:27 AM
Viper007Bond's Avatar
Viper007Bond Viper007Bond is offline
 
Join Date: Oct 2006
Location: Portland, OR, USA
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Magnumutz View Post
Ok... so i installed this thing yesterday, when it only had template edits... now do i have to install the product as well?
Make the template changes described in my above post (it's the differences between my original hack posting and the current hack posting) and then import the product to create the translation phrases. That's all the product is -- no plugins, hooks, or anything.

Quote:
Originally Posted by Ben E Lou View Post
How about the ability to stick and unstick in Quick Reply as well?
Sure, why not.

Quote:
Originally Posted by Boofo View Post
How about a text file with the instructions in case it ever needs to be re-installed?
Can't just visit this page or copy/paste?

I'll make one anyway though.
Reply With Quote
  #16  
Old 05-26-2008, 10:55 AM
Magnumutz's Avatar
Magnumutz Magnumutz is offline
 
Join Date: Feb 2006
Location: Romania
Posts: 731
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately, it looks that your product is not letting me completely use the quick reply.

Instead of showing my message after i post something... it doesn't show.
Reply With Quote
  #17  
Old 05-31-2008, 02:18 AM
Viper007Bond's Avatar
Viper007Bond Viper007Bond is offline
 
Join Date: Oct 2006
Location: Portland, OR, USA
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Magnumutz View Post
Unfortunately, it looks that your product is not letting me completely use the quick reply.

Instead of showing my message after i post something... it doesn't show.
Odd. You sure you modified the template correctly?
Reply With Quote
  #18  
Old 05-31-2008, 05:45 AM
Magnumutz's Avatar
Magnumutz Magnumutz is offline
 
Join Date: Feb 2006
Location: Romania
Posts: 731
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, i'm positive... however, i've got the older version installed on another board and it works perfect.
Could i get the instructions to the older installation?
Reply With Quote
  #19  
Old 05-31-2008, 09:21 AM
Viper007Bond's Avatar
Viper007Bond Viper007Bond is offline
 
Join Date: Oct 2006
Location: Portland, OR, USA
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Magnumutz View Post
Yes, i'm positive... however, i've got the older version installed on another board and it works perfect.
Could i get the instructions to the older installation?
Older as in the one I originally posted here? It's the same thing as now, it just had hardcoded text in English.

Although if you're talking about the VERY original code from months ago, that can be found here: https://vborg.vbsupport.ru/showthread.php?t=142968
Reply With Quote
  #20  
Old 06-15-2008, 08:13 AM
Midnightfs Midnightfs is offline
 
Join Date: May 2008
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Fantastic! THANKS!
Reply With Quote
  #21  
Old 07-03-2008, 04:04 AM
C138 Kaysone C138 Kaysone is offline
 
Join Date: Jun 2008
Location: NC
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is a bit difficult for me, need help
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 05:14 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06196 seconds
  • Memory Usage 2,330KB
  • Queries Executed 27 (?)
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
  • (4)bbcode_html
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete