Thread: Calendar Enhancements - vB Event Forums
View Single Post
  #262  
Old 02-19-2007, 05:05 AM
thincom2000 thincom2000 is offline
 
Join Date: May 2006
Location: Bronx, NY
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In order to add attachments to your forum events (once the event is posted):

Create new plugin.

Product: Lv vB Event Forums
Title: Attachment Permissions
Hookname: showthread_post_start
Phpcode:
PHP Code:
$show['caneditattach'] = ($threadinfo['lv_vb_eventforums_eventid'] AND $forumperms $vbulletin->bf_ugp_forumpermissions['canpostattachment'] AND $vbulletin->userinfo['userid'] AND !empty($vbulletin->userinfo['attachmentextensions'])) ? true false

FILE EDIT: calendar.php

Find:
PHP Code:
        case 'edit':
        {
            
$_POST['do'] = 'edit';
        }
        break; 
Add underneath:
PHP Code:
        case 'attach':
        {
            
$eventpostid $db->query_first("
                SELECT firstpostid 
                FROM " 
TABLE_PREFIX "thread
                WHERE lv_vb_eventforums_eventid = 
$eventinfo[eventid]
            "
);

            
exec_header_redirect($vbulletin->options['bburl'] . '/editpost.php?p=' $eventpostid[firstpostid]);
        }
        break; 

TEMPLATE EDITS: editpost

Find:
Code:
<if condition="$show['deletepostoption']">
Add above:
Code:
<if condition="$attachments_only"><div style="visibility: hidden; position: absolute"></if>

Find:
Code:
$postpreview
Add underneath:
Code:
<if condition="$attachments_only"></div></if>

Find:
Code:
<form name="vbform" action="editpost.php?do=updatepost&amp;p=$postid" method="post"<if condition="!is_browser('webtv')"> onsubmit="return vB_Editor['$editorid'].prepare_submit(0, $vboptions[postminchars])"</if>>
Add underneath:
Code:
<if condition="$attachments_only"><div style="visibility: hidden; position: absolute"></if>

Find:
Code:
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">
		<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('newpost_options')"><img id="collapseimg_newpost_options" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_newpost_options].gif" alt="" border="0" /></a>
Add above:
Code:
<if condition="$attachments_only"></div></if>

Find:
Code:
<div class="panel">
		<div style="width:$stylevar[formwidth]" align="$stylevar[left]">
Add underneath:
Code:
<if condition="$attachments_only"><div style="visibility: hidden; position: absolute"></if>

Find:
Code:
$attachmentoption
Replace with:
Code:
<if condition="$attachments_only"></div></if>
	
				$attachmentoption
						
<if condition="$attachments_only"><div style="visibility: hidden; position: absolute"></if>

Find:
Code:
</div>
			</div>
			
			<div style="margin-top:$stylevar[cellpadding]px">
				<input type="submit" class="button" name="sbutton" value="$vbphrase[save_changes]" accesskey="s" tabindex="1" />
				<input type="submit" class="button" name="preview" value="$vbphrase[preview_changes]" accesskey="r" tabindex="1" />
<if condition="$attachments_only">
Replace with:
Code:
				<if condition="$attachments_only"></div></if>

				</div>
			</div>
			
			<div style="margin-top:$stylevar[cellpadding]px">
				<input type="submit" class="button" name="sbutton" value="$vbphrase[save_changes]" accesskey="s" tabindex="1" />
<if condition="$attachments_only"><div style="visibility: hidden; position: absolute"></if>
				<input type="submit" class="button" name="preview" value="$vbphrase[preview_changes]" accesskey="r" tabindex="1" />
<if condition="$attachments_only"></div></if>

TEMPLATE EDITS: calendar_showeventsbit

Find:
Code:
<div>$eventinfo[event]</div>
Add underneath:
Code:
		<if condition="$show['attachments']">
<br />
		<!-- attachments -->
			<div style="padding:$stylevar[cellpadding]px">
			
			<if condition="$show['thumbnailattachment']">
				<fieldset class="fieldset">
					<legend>$vbphrase[attached_thumbnails]</legend>
					<div style="padding:$stylevar[formspacer]px">
					$eventinfo[thumbnailattachments]
					</div>
				</fieldset>
			</if>
		
			<if condition="$show['imageattachment']">
				<fieldset class="fieldset">
					<legend>$vbphrase[attached_images]</legend>
					<div style="padding:$stylevar[formspacer]px">
					$eventinfo[imageattachments]
					</div>
				</fieldset>
			</if>
			
			<if condition="$show['imageattachmentlink']">
				<fieldset class="fieldset">
					<legend>$vbphrase[attached_images]</legend>
					<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
					$eventinfo[imageattachmentlinks]
					</table>
					</fieldset>
			</if>
			
			<if condition="$show['otherattachment']">
				<fieldset class="fieldset">
					<legend>$vbphrase[attached_files]</legend>
					<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
					$eventinfo[otherattachments]
					</table>
				</fieldset>
			</if>
			
			<if condition="$show['moderatedattachment']">
				<fieldset class="fieldset">
					<legend>$vbphrase[attachments_pending_approval]</legend>
					<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
					$eventinfo[moderatedattachments]
					</table>
				</fieldset>		
			</if>
			
			</div>
		<!-- / attachments -->
</if>

Find:
Code:
<if condition="$show['caneditevent']">
						<option value="edit">:: &nbsp; $vbphrase[edit_event]</option>
					</if>
Add underneath:
Code:
<if condition="$show['caneditattach']">
<option value="attach">:: &nbsp; Edit Attachments</option>
</if>

I think that's everything I did. In order to add attachments at the same time you create the event a LOT more edits were necessary and I didn't have the patience for it. Adding them after creation was good enough for me.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01124 seconds
  • Memory Usage 1,828KB
  • 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
  • (18)bbcode_code
  • (3)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