Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications

Reply
 
Thread Tools
Unit Converter for DownloadsII Details »»
Unit Converter for DownloadsII
Version: 1.00, by Arcade Fire Arcade Fire is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: New Posting Features - Version: 4.0.2 Rating:
Released: 03-06-2010 Last Update: Never Installs: 38
Supported Template Edits
Re-useable Code Translations  

This template change is for the product


DownloadsII

by RS_Jelle

What makes this modification?

adds a unit conversion when a user upload a new file through a link. Thus, you can fill in box size in bytes, converted directly from larger units (Mb, Gb), preventing the box is empty on input size.


Instructions:

1. Open downloads2_file_addit template.
2.
Replaces all content by this:

Code:
<script type="text/javascript">
<!--
function uploading_file()
{
    if (document.getElementById('uploadfield').value != '' && document.getElementById('title').value != '')
    {
        document.getElementById('uploadbusy').style.display = 'block';
    }
}
//-->
</script>

<form class="vbform block" enctype="multipart/form-data" action="downloads.php?do=<vb:if condition="$_GET['do']=='edit'">edit&amp;id={vb:raw file.id}<vb:else />add</vb:if>" method="post" onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(this.title.value, {vb:raw vboptions.postminchars})">
    <vb:if condition="$show['errors']">
    <div class="blockbody errorblock">
        <h2 class="blockhead">{vb:rawphrase dl2_errors_occured_when_submitted}:</h2>
        <ul class="blockrow error">
            {vb:raw errorlist}
        </ul>
    </div>
    </vb:if>

    <h2 class="blockhead">{vb:raw dlcustomtitle}</h2>
    <div class="blockbody formcontrols">

        <div class="blockrow">
            <label for="title">{vb:rawphrase dl2_file_name}:</label>
            <div><input type="text" class="primary textbox" name="title" id="title" value="{vb:raw newfile.title}" maxlength="50" tabindex="1" /></div>
        </div>

        <div class="blockrow">
            <label for="dlauthor_ctrl">{vb:rawphrase dl2_author}:</label>
            <div id="dlauthor" class="popupmenu nomouseover noclick nohovermenu">
                <textarea class="primary textbox popupctrl" id="dlauthor_ctrl" name="author" rows="1" cols="50" tabindex="1">{vb:raw newfile.author}</textarea>
            </div>

            <vb:if condition="$vboptions['dl2namesugg'] != 'disabled'">
            <script type="text/javascript" src="clientscript/vbulletin_ajax_suggest.js?v={vb:raw vboptions.simpleversion}"></script>
            <script type="text/javascript">
            <!--
                dlauthor_sugg = new vB_AJAX_NameSuggest('dlauthor_sugg', 'dlauthor_ctrl', 'dlauthor');
                dlauthor_sugg.allow_multiple = <vb:if condition="$vboptions['dl2namesugg'] == 'multiple'">true<vb:else />false</vb:if>;
            //-->
            </script>
            </vb:if>
        </div>

        {vb:raw messagearea}

        <div class="blockrow">
            <label for="category">{vb:rawphrase dl2_category}:</label>
            <div>
                <select class="primary" name="category" id="category" tabindex="1">
                {vb:raw category_select}
                </select>
            </div>
        </div>

        <div class="blockrow">
            <label for="cb_pin"><input type="checkbox" name="pin" id="cb_pin" value="1" tabindex="1" {vb:raw pinned} /> {vb:rawphrase dl2_pinned}</label>
        </div>

    </div>

    <vb:if condition="$_GET['do'] == 'edit'">
    <h2 class="blockhead">{vb:rawphrase dl2_assign_new_uploader}</h2>
    <div class="blockbody formcontrols">

        <div class="blockrow">
            <label for="dlassign_ctrl">{vb:rawphrase dl2_new_uploader}:</label>
            <p class="description">{vb:rawphrase dl2_assign_new_match}</p>
            <div id="dlassign" class="popupmenu nomouseover noclick nohovermenu">
                <input type="text" class="textbox popupctrl" id="dlassign_ctrl" name="uploader" value="{vb:raw newfile.uploader}" tabindex="1" />
            </div>

            <vb:if condition="$vboptions['dl2namesugg'] == 'disabled'">
            <script type="text/javascript" src="clientscript/vbulletin_ajax_suggest.js?v={vb:raw vboptions.simpleversion}"></script>
            </vb:if>
            <script type="text/javascript">
            <!--
                snc = new vB_AJAX_NameSuggest('snc', 'dlassign_ctrl', 'dlassign');
            //-->
            </script>
        </div>

    </div>
    </vb:if>

    <h2 class="blockhead">{vb:rawphrase dl2_upload_or_link_to}</h2>
    <div class="blockbody formcontrols">

        <vb:if condition="$show['uploadfiles']">
        <div class="blockrow">
            <label for="uploadfield">{vb:rawphrase dl2_upload_a_file}:</label>
            <p class="description" id="uploadbusy" style="display:none"><img class="inlineimg" src="{vb:stylevar imgdir_misc}/progress.gif" alt="" /> {vb:rawphrase dl2_uploading_file_please_wait}</p>
            <vb:comment><input type="hidden" name="MAX_FILE_SIZE" value="{vb:raw inimaxattach}" /></vb:comment>
            <div><input type="file" class="primary textbox" name="upload" id="uploadfield" tabindex="1" /></div>
        </div>
        </vb:if>

        <vb:if condition="$show['linktofiles']">
        <div class="blockrow">
            <label for="link">{vb:rawphrase dl2_link_to_a_file}:</label>
            <div><input type="text" class="primary textbox" name="link" id="link" maxlength="250" tabindex="1" <vb:if condition="$newfile['link']">value="{vb:raw newfile.url}"</vb:if> /></div>
        </div>
        <div class="blockrow">
            <label for="size">{vb:rawphrase dl2_link_file_size}:</label>
            <div><input type="text" class="textbox" name="size" id="size" maxlength="10" tabindex="1" <vb:if condition="$newfile['link']">value="{vb:raw newfile.size}"</vb:if> /></div>
        </div>
                <div class="blockrow">
                         <div align="center"><font style='font-size: 30px;' face='Verdana, Arial, Helvetica, sans-serif'><b>Unit Converter</b></font><hr></div>
<p align="left">With this unit converter, you can go from bytes to gigabytes through Kbs. and Mbs. with a single click.</p>
<p align="left">It is very intuitive to use, enter the amount you want in the corresponding box and click the button underneath.
  <script language="JavaScript">
<!--

  function convert(f) {
    f.kb.value=Math.round(f.byte.value/1024*100000)/100000
    f.mb.value=Math.round(f.byte.value/1048576*100000)/100000
    f.gb.value=Math.round(f.byte.value/1073741824*100000)/100000
     
  }

function convertkb(f) {
    f.byte.value=Math.round(f.kb.value*1024*100000)/100000
    f.mb.value=Math.round(f.kb.value/1024*100000)/100000
    f.gb.value=Math.round(f.kb.value/1048576*100000)/100000
     
  }

function convertmb(f) {
    f.byte.value=Math.round(f.mb.value*1048576*100000)/100000
    f.kb.value=Math.round(f.mb.value*1024*100000)/100000
    f.gb.value=Math.round(f.mb.value/1024*100000)/100000
     
  }

function convertgb(f) {
    f.byte.value=Math.round(f.gb.value*1073741824*100000)/100000
    f.kb.value=Math.round(f.gb.value*1048576*100000)/100000
    f.mb.value=Math.round(f.gb.value*1024*100000)/100000
     
  }
  

// -->

</script>
</p>

<form>
  <div align="center">
    <table border="1" style="dashed" border-color="#ccc" bgcolor="#ffffff" cellpadding="3" cellspacing="3">
      <tr> 
        <td align="center"><font size="4" face="Arial, Helvetica, sans-serif">Byte</font></td>
        <td align="center"><font size="4" face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;Kilobyte&nbsp;&nbsp;</font></td>
        <td align="center"><font size="4" face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;Megabyte&nbsp;&nbsp;</font></td>
        <td align="center"><font size="4" face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;Gigabyte&nbsp;&nbsp;</font></td>

      </tr>
      <tr> 
        <td align="center"> 
          <input type="text" size="10"
        name="byte" value="0">
        </td>
        <td align="center"> 
          <input type="text" size="10"
        name="kb" value="0">
        </td>
        <td align="center"> 
          <input type="text" size="10"
        name="mb" value="0">

        </td>
        <td align="center"> 
          <input type="text" size="10"
        name="gb" value="0">
        </td>
      </tr>
      <tr> 
        <td align="center"> 
          <input type="button" name="B2" value="   &gt;   "
        onClick="convert(this.form)">
        </td>
        <td align="center"> 
          <input type="button" name="B22" value="   &lt; &gt;   "
        onClick="convertkb(this.form)">

        </td>
        <td align="center"> 
          <input type="button" name="B23" value="   &lt; &gt;   "
        onClick="convertmb(this.form)">
        </td>
        <td align="center"> 
          <input type="button" name="B24" value="   &lt;   "
        onClick="convertgb(this.form)">
        </td>
      </tr>
    </table>

  <br></div>
</form>
        </div>
        </vb:if>

    </div>
    <div class="blockfoot actionbuttons">
        <div class="group">
            <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
            <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
            <input type="submit" onclick="uploading_file()" class="button" name="submit" value="{vb:raw dlcustomtitle}" accesskey="s" tabindex="1" />
        </div>
    </div>
</form>
3. Click to Mark as Installed.


Screenshot:



Conflicts: "Add File" button doesn't work after installation (working on it)

Show Your Support

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

Comments
  #2  
Old 03-07-2010, 12:07 PM
Kolbi Kolbi is offline
 
Join Date: Mar 2009
Location: D - S?dbaden
Posts: 899
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice widget

But I guess not very needed...
A little notice would be enough I guess.

But thank yoU!
Reply With Quote
  #3  
Old 03-07-2010, 03:28 PM
synseal's Avatar
synseal synseal is offline
 
Join Date: Apr 2009
Posts: 334
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, this is actually very handy for my forum especially when linking to downloads.
Reply With Quote
  #4  
Old 03-07-2010, 03:48 PM
Arcade Fire's Avatar
Arcade Fire Arcade Fire is offline
 
Join Date: May 2008
Location: Menorca, Spain
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by synseal View Post
Thank you, this is actually very handy for my forum especially when linking to downloads.
Your welcome. This specially designed for that. When we link a file, we usually know their size in MB or GB and we have to look in other websites which is its size in bytes. This saves us having to find converters and makes it more convenient for our users, avoiding stop-sized box with no value. :up:
Reply With Quote
  #5  
Old 01-05-2011, 04:28 AM
Dr.osamA's Avatar
Dr.osamA Dr.osamA is offline
 
Join Date: Aug 2004
Location: Syrie
Posts: 979
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you good work

installed
Reply With Quote
  #6  
Old 01-05-2011, 12:28 PM
Arcade Fire's Avatar
Arcade Fire Arcade Fire is offline
 
Join Date: May 2008
Location: Menorca, Spain
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You?re welcome
Reply With Quote
  #7  
Old 01-24-2011, 05:11 AM
yin9 yin9 is offline
 
Join Date: Dec 2010
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Arcade Fire, works well in VB 4.1.0 PL2. Installed, 5 Stars.

Edit: Error, uninstalled.
Reply With Quote
  #8  
Old 03-10-2011, 06:38 AM
Raptor Raptor is offline
 
Join Date: Nov 2001
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works fine with vb4.1.2
Reply With Quote
  #9  
Old 03-12-2011, 03:52 PM
cnrr cnrr is offline
 
Join Date: Feb 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

very usefull. thank you but "Add File" button doesn't work after installation.
Reply With Quote
  #10  
Old 04-17-2011, 09:57 AM
Sai01 Sai01 is offline
 
Join Date: Dec 2004
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

add file button doesn't work after this installed
Reply With Quote
Reply

Thread Tools

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 06:45 PM.


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.05696 seconds
  • Memory Usage 2,338KB
  • Queries Executed 26 (?)
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)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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