Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Design and Graphics Discussions
  #1  
Old 05-16-2011, 11:54 PM
asdfadrian asdfadrian is offline
 
Join Date: May 2011
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom Attachment Field in NewPost and Display as Preview next to thread in Forum

I currently have made custom modified ForumDisplay.php and newthread.php

What I am asking how do I include a separate "Browse from computer" attachment input field into my newthread.php when a user is creating a thread like in the image below?

Here is my current Newthread.php. Boxed is the area I want to edit.


In place for the red box in the image displayed above I want to replace with the red box (the <Input> Fields with the Browse button) in the image below


Secondly how can I use the image in the custom attachment attached and display that as the image preview next to the forum thread title when browsing a forum? I want to achieve something that looks like this:
Attached Images
File Type: jpg forumdisplay.jpg (37.4 KB, 0 views)
File Type: png newthread.png (18.9 KB, 0 views)
File Type: png newattachment.PNG (10.6 KB, 0 views)
Reply With Quote
  #2  
Old 05-18-2011, 09:00 PM
asdfadrian asdfadrian is offline
 
Join Date: May 2011
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does anyone know?

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

At least someone tell me how to embed the newattachment.php above the tags when posting a new thread.

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

Below is the current PostNewThread bit that I have made along with the hook, however it doesnt show up properly stilll..

I know that the hooks for attachments being used in the attachment.php are as follows:
newattachment_attachsum
newattachment_complete
newattachment_start

However I do not know how to "include" the attachment variables into the newthread_form_complete hook below. How would I approach this problem?

Here is the plugin using the newthread_form_complete hook:
[PHP]eval('$uploadresource_icons = "' . fetch_template('uploadresource_icons') . '";');

Here is the modified post_newthread bit
PHP Code:
$postpreview

<form action="newthread.php?do=postthread&amp;f=$forumidmethod="post" name="vbform"<if condition="!is_browser('webtv')"onsubmit="return vB_Editor['$editorid'].prepare_submit(this.subject.value, $vboptions[postminchars])"</if>>

<
table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%" align="center">
<
tr>
    <
td class="tcat">
        <
span class="smallfont" style="float:$stylevar[right]"><strong>Resource Type</strong>: <a href="forumdisplay.php?$session[sessionurl]f=$foruminfo[forumid]">$foruminfo[title]</a></span>
        
Upload Icon
    
</td>
</
tr>
<
tr>
    <
td class="panelsurround" align="center">
    <
div class="panel">
        <
div style="width:$stylevar[formwidth]align="$stylevar[left]">

    
$human_verify

        
<!-- subject field -->
        <
table cellpadding="0" cellspacing="0" border="0" class="fieldset">
        <
tr>
            <if 
condition="$prefix_options">
                <
td class="smallfont">$vbphrase[prefix]:</td>
                <
td class="smallfont" colspan="3">$vbphrase[title]:</td>
            <else />
                <
td class="smallfont" colspan="4">$vbphrase[title]:</td>
            </if>
        </
tr>
        <
tr>
            <if 
condition="$prefix_options">
                <
td style="padding-right: 1px">
                    <
select name="prefixid" class="bginput">
                        <
option value="">$vbphrase[no_prefix_meta]</option>
                        
$prefix_options
                    
</select>
                </
td>
            </if>
            <
td>
                <
input type="text" class="bginput" name="subject" value="$subjectsize="40" maxlength="$vboptions[titlemaxchars]tabindex="1" />
            </
td>
            <
td>&nbspby $bbuserinfo[username]&nbsp;</td>
            <
td><img id="display_posticon" src="$selectedicon[src]alt="$selectedicon[alt]/></td>
        </
tr>
        </
table>
        <!-- / 
subject field -->

        <!-- 
message area -->
        <
div class="smallfont">Resource Description:</div>
        
$messagearea
        
<!-- / message area -->
        
        <!-- 
attachment area -->
        
$attachmentoption 
        
<!-- / attachment area -->
       
        
<
fieldset class="fieldset">
            <
legend>Upload Screenshot: </legend>
            
           <if 
condition="$show['attachoption']">
            <if 
condition="$show['attachfile']">
$vbphrase[upload_file_from_your_computer]
                    <
table cellpadding="0" cellspacing="$stylevar[formspacer]width="100%" border="0">
                    <
tr valign="bottom">
                        <
td>
                            <
input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach/>
                            
$attachinput
                        
</td>
                        <
td align="$stylevar[right]"><input type="submit" class="button" name="upload" value="$vbphrase[upload]style="width:70px" onclick="return verify_upload(this.form);" /></td>
                    </
tr>
                    </
table>
            </if>
       </if>
</
fieldset>
                
        <if 
condition="$show['tag_option']">
        <
fieldset class="fieldset" style="margin-top: $stylevar[cellpadding]px">
            <
legend>Resource Keywords Tags</legend>
            <
div style="padding:$stylevar[formspacer]px">
                <
div>Input in the field below as many keywords/tags describing your resource. <br>
                
$vbphrase[separate_tags_using_comma]</div>
                <
span id="tag_add"><input type="text" class="bginput" name="taglist" id="tag_add_input" value="$newpost[taglist]size="50" tabindex="1" />
                </
span>
                <if 
condition="$show['tags_remain']"><div><phrase 1="$tags_remain">$vbphrase[you_may_add_x_tags_to_thread]</phrase>
                </
div></if>
                
        </
div>
        

            <if 
condition="$show['popups']">
                <
div id="tag_add_menu" class="vbmenu_popup" style="display:none"></div>
                <
script type="text/javascript" src="clientscript/vbulletin_ajax_tagsugg.js?v=$vboptions[simpleversion]"></script>
                <
script type="text/javascript">
                <!--
                
vbmenu_register('tag_add'true);
                
tag_add_comp = new vB_AJAX_TagSuggest('tag_add_comp''tag_add_input''tag_add');
                
tag_add_comp.allow_multiple true;
                
tag_add_comp.set_delimiters('$tag_delimiters');
                
//-->
                
</script>
            </if>
        </
fieldset>
        </if>
        
         <if 
condition="$show['member']">
                <
fieldset class="fieldset">
                    <
legend>Resource Subscription</legend>
                    <
table cellpadding="0" cellspacing="$stylevar[formspacer]border="0">
                    <
tr>
                        <
td>$vbphrase[notification_type]:<br /><select name="emailupdate" tabindex="1">
                            <
option value="9999" $emailchecked[9999]>$vbphrase[do_not_subscribe]</option>
                            <
option value="0" $emailchecked[0]>$vbphrase[no_email_notification]</option>
                            <
option value="1" $emailchecked[1]>$vbphrase[instant_email_notification]</option>
                            <
option value="2" $emailchecked[2]>$vbphrase[daily_email_notification]</option>
                            
                        </
select></td>
                        <if 
condition="$show['subscribefolders']"><td>$vbphrase[folder]:<br /><select name="folderid" tabindex="1">$folderbits</select></td></if>
                    </
tr>
                    </
table>
                </
fieldset>

                </if>
                
       
    </
div>
    </
div>

    <
div style="margin-top:$stylevar[cellpadding]px">
        <
input type="hidden" name="s" value="$session[sessionhash]/>
        <
input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]/>
        <
input type="hidden" name="f" value="$forumid/>
        <
input type="hidden" name="do" value="postthread" />
        <
input type="hidden" name="posthash" value="$posthash/>
        <
input type="hidden" name="poststarttime" value="$poststarttime/>
        <
input type="hidden" name="loggedinuser" value="$bbuserinfo[userid]/>
        <
input type="submit" class="button" name="sbutton" id="{$editorid}_save" value="Upload Resource" accesskey="s" tabindex="1" />
        <
input type="submit" class="button" name="preview" value="$vbphrase[preview_post]accesskey="r" tabindex="1" />
    </
div>
    </
td>
</
tr>
</
table>


<if 
condition="$show['additional_options']">
<
br />

<
table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%" align="center">
<
thead>
    <
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>
            
Submission Rules: </td>
    </
tr>
</
thead>
<
tbody id="collapseobj_newpost_options" style="$vbcollapse[collapseobj_newpost_options]">
    <
tr valign="top">
        <
td class="panelsurround" align="center">
        <
div class="panel">
            <
div style="width:$stylevar[formwidth]align="$stylevar[left]">

                <if 
condition="$show['podcasturl']">
                <!-- 
podcast stuff -->
                <
fieldset class="fieldset">
                    <
legend></legend>
                </
fieldset>
                <!-- / 
podcast stuff -->
                </if>

                <if 
condition="$show['misc_options']">
                <
fieldset ><legend></legend>
                    <
legend><h3>Rule Number 1No Copy and Paste</h3></legend>
                    
We do not accept any copy and paste imagesAll images must be the uploader's created content.
                    <legend><h3>Rule Number 2: Author'
s Consent</h3></legend>
                   
Please do not edit any material that is not yours without the authors permissionConsent from the owner of the material must be approved before uploading.
                </
fieldset>
                </if>
            </
div>
            </
div>

            <
div style="margin-top:$stylevar[cellpadding]px">
                <
input type="submit" class="button" name="sbutton" value="$vbphrase[submit_new_thread]accesskey="s" tabindex="1" />
                <
input type="submit" class="button" name="preview" value="$vbphrase[preview_post]accesskey="r" tabindex="1" />
            </
div>
        </
td>
    </
tr>
</
tbody>
</
table>
</if>

</
form>

<
br /> 
--------------- Added [DATE]1305764832[/DATE] at [TIME]1305764832[/TIME] ---------------

Update:

Using the hook newattachment_complete:
PHP Code:
eval('$inlineattachment = "' fetch_template('inclineattachment') . '";'); 
I have modified the newattachment style bit and added it to my own custom "inlineattachment" template below:
PHP Code:
<script type="text/javascript">
<!--

    function 
verify_upload(formobj)
    {
        var 
haveupload false;
        for (var 
i=0formobj.elements.lengthi++)
        {
            var 
elm formobj.elements[i];
            if (
elm.type == 'file' || elm.type == 'text')
            {
                if (
elm.value != "")
                {
                    
haveupload true;
                }
            }
        }

        if (
haveupload)
        {
            
obj fetch_object("uploading");
            
obj.style.display "";
            return 
true;
        }
        else
        {
            
alert("$vbphrase[select_a_file_to_attach]");
            return 
false;
        }
    }

<if 
condition="$show['updateparent']">
    if (
typeof window.opener.vB_Attachments != 'undefined')
    {
        
window.opener.vB_Attachments.reset();
        
$new_attachlist_js
    
}
</if>

//-->
</script>

<
form enctype="multipart/form-data" action="newattachment.php?do=manageattach&amp;p=$postidname="newattachment" method="post">
<
input type="hidden" name="s" value="$session[sessionhash]/>
<
input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]/>
<
input type="hidden" name="do" value="manageattach" />
<
input type="hidden" name="t" value="$threadid/>
<
input type="hidden" name="f" value="$forumid/>
<
input type="hidden" name="p" value="$postid/>
<
input type="hidden" name="poststarttime" value="$poststarttime/>
<
input type="hidden" name="editpost" value="$editpost/>
<
input type="hidden" name="posthash" value="$posthash/>

<
table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%">
    <if 
condition="$show['errors']">
        <
tr>
            <
td class="thead">$vbphrase[upload_errors]</td>
        </
tr>
        
$errorlist
    
</if>
        <
tr>
        <
input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach/>
            
$attachinput
        
</td>
              <
td align="$stylevar[right]"><input type="submit" class="button" name="upload" value="$vbphrase[upload]style="width:70px" onClick="return verify_upload(this.form);" />
             </
td>
        </
tr>
</
table>

</
form
Still nothing.. Someone please help me.

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

Bump.
Reply With Quote
  #3  
Old 05-20-2011, 02:38 AM
asdfadrian asdfadrian is offline
 
Join Date: May 2011
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Uhmmmm, anyone? Please help me!
Reply With Quote
Reply

Thread Tools
Display Modes

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 09:41 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.03833 seconds
  • Memory Usage 2,364KB
  • Queries Executed 14 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)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
  • (3)postbit
  • (3)postbit_attachment
  • (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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete