Page 1 of 5

[RC] Top Attachments

Posted: 06 Sep 2014, 11:16
by all4phone
Modification Name: Top Attachments
Current author: all4phone

Modification Description: The Top Attachments mod displays table on index board with most downloaded attachments.

IMPORTANT
This mod is't validated, so as always do not install on a live board!

NOTE
I noticed a serious bug: no display all attachments. Always one was omitted.
Bug fixed from version 0.1.0


Modification Version: 1.0.0
phpBB: 3.0.12
Installation level: Easy
Installation time: ~1 minute

Author notes:
Mod written on request in this topic: https://www.phpbb.com/community/viewtop ... &t=2163578
Credit:
Many thanks goes to Oyabun1, who helped develop this mod.
Thanks to FranckTH, for the idea.
Thanks goes to Sniper_E, who pointed me to right way to fix template file.
Thanks to ABDev, who optimized functions "cut".
Thanks to martin123456, who mobilized me to amend the template code.
Thanks goes to Татьяна5 and Pthelovod, who helped me with query optimization.

Features:
  • Top Attachments displays table on index (done - v 0.0.1)
  • ACP on/off MOD (done)
  • ACP control display top or bottom of board (done - v 0.0.2)
  • ACP control range of the number of displayed attachments (done - v 0.0.2)
  • Guests are not able to view Top Attachments (done - v 0.0.2)
  • Direct link to post containing each attachment (done - v 0.0.2)
  • Uploader name in view Top Attachments (done - v 0.0.2)
  • ACP control forum from attachments taken are (done - v 0.0.3)
  • ACP control function "cut" (when topic title or attachment name is too long) (done - v 0.0.6)
  • ACP control attachments extension (done - v 0.1.2)
  • ACP control various types of attachments extension (done - v 0.1.5)
  • Top Attachments displays table in each forum (on/off ACP) (done - v 0.2.0)
Available languages​​:
  • english
  • dutch (thanks to dmzx)
  • polish
  • russian (thanks to Pthelovod)[/i]
Supported styles:
  • prosilver
Demo: demo
Screenshots: screenshots

Demo Username: tester
Demo Password: 123456

Download: download

[BETA] Top Attachments

Posted: 06 Sep 2014, 22:20
by martin123456

Code: Select all

<div class="forumbg forumbg-table">
For prosilver
You should be using this

Code: Select all

<div class="forabg forabg-table">
in the attachments.html to get the styling right.
result
snapshot2.png
And this is missing from the install

Code: Select all

<!-- IF S_TOPA_ENABLE and S_TOPA_BOTTOM --><!-- INCLUDE attachments.html -->
Fixed errors
top_attachments_0_0_4.zip
(159.92 KiB) Downloaded 125 times

[BETA] Top Attachments

Posted: 07 Sep 2014, 16:03
by all4phone
martin123456 wrote:

Code: Select all

<div class="forabg forabg-table"> 
You're right, it looks much better ;) . Will be added to new version 0.1.0, thanks.
martin123456 wrote:And this is missing from the install

Code: Select all

<!-- IF S_TOPA_ENABLE and S_TOPA_BOTTOM --><!-- INCLUDE attachments.html --> 
Yes, was omitted in the version 0.0.3 but v 0.0.4 should contain this IF I think :?
Anyway, thanks for yours valuable suggestions :)

First post update to v 0.0.4
- fixed known bugs only

[BETA] Top Attachments

Posted: 08 Sep 2014, 11:25
by all4phone
First post updated to v 0.0.5

- fixed template file
- added function "cut" when topic title is too long (just for testing, ACP control soon...)


new download
new screenshot

[BETA] Top Attachments

Posted: 09 Sep 2014, 10:32
by all4phone
First post updated to v 0.0.6


- added function "cut_title" when topic title is too long
- added function "cut_file" when attachment name is too long


new download
new screenshot

[DEV] Top Attachments

Posted: 10 Sep 2014, 14:46
by all4phone
First post updated to v 0.1.0

- serious bug fixed

I noticed: no display all attachments. Always one was omitted.
Bug fixed from this version.


new download

[DEV] Top Attachments

Posted: 10 Sep 2014, 18:17
by all4phone
First post updated to v 0.1.1

- sorry, in v 0.1.0 wrong install_mod.xml, attachments.html and topa.css files

- demo of the current version (prosilver and SE Square)
- new download

[DEV] Top Attachments

Posted: 10 Sep 2014, 23:27
by martin123456
You have an edit missing as it shows like this on prosilver
12345.gif

Use this in the template file

Code: Select all

<div class="topa_copy2">
					<li class="row">
						<dl>
							<dt class="topa_uinf">
								<span class="topa_credit">{L_TOPA_CR}
									<a href="#" title="{L_TOPA_CREDIT_1}"><div class="topa_cr1"></div></a>&nbsp;
									<a href="#" title="{L_TOPA_CREDIT_2}"><div class="topa_cr1"></div></a>&nbsp;
									<a href="#" title="{L_TOPA_CREDIT_3}"><div class="topa_cr2"></div></a>&nbsp;
								</span>{TOPA_UINF}
							</dt>
						</dl>
					</li>
				</div>
Result the botom border stays there.
2.gif
Fixed file
top_attachments_0_1_1.zip
(158.7 KiB) Downloaded 129 times

[DEV] Top Attachments

Posted: 11 Sep 2014, 07:37
by Sniper_E
I use this template http://www.sniper-e.com/viewtopic.php?f=6&p=131#p128
Just downloaded your update, will check it out later.

[DEV] Top Attachments

Posted: 11 Sep 2014, 14:40
by all4phone
martin123456 wrote:You have an edit missing as it shows like this on prosilver
all4phone wrote:- sorry, in v 0.1.0 wrong install_mod.xml, attachments.html and topa.css files

- demo of the current version (prosilver and SE Square)
- new download
Sniper_E wrote:I use this template
You have omitted code part about of credit :)

Guys, this is mine latest code if you like ;) :
prosilver/template/attachments.html

Code: Select all

<div class="forabg">
    <div class="topa_copy">
        <div class="inner"><span class="corners-top"><span></span></span>
            <ul class="topiclist">
                <li class="header">
                    <dl>
                        <dt class="topa_head_1">{NUMBER_OF_ATTACH}&nbsp;{L_TOPA_MOST}</dt>
                        <dd class="topa_head_2">{L_TOPA_COUNTED}</dd>
                        <dd class="topa_head_3">{L_TOPA_SIZE}</dd>
                        <dd class="topa_head_4">{L_TOPA_TOTAL}</dd>
                        <dd class="topa_head_5">{L_TOPA_UPLOADED}</dd>
                        <dd class="topa_head_6">{L_TOPA_LOCATED}</dd>
                    </dl>
                </li>
            </ul>
            <ul class="topiclist forums">
        <!-- IF S_USER_LOGGED_IN and not S_IS_BOT -->
            <!-- BEGIN forum_attach -->
                <li class="row">
                    <dl class="topa_row">
                        <dt class="topa_row_1"> &nbsp; <img src="{T_IMAGESET_PATH}/icon_topic_attach.gif" alt="icon_topic_attach.gif" title="" />&nbsp;{forum_attach.ATTACH_NAME}<span class="topa_ext"> &nbsp; ({forum_attach.ATTACH_EXT})</span></dt>
                        <dd class="topa_row_2">{forum_attach.ATTACH_TOTAL}</dd>
                        <dd class="topa_row_3">{forum_attach.ATTACH_SIZE}</dd>
                        <dd class="topa_row_4">{forum_attach.ATTACH_VOLUME}</dd>
                        <dd class="topa_row_5">{forum_attach.ATTACH_POSTER}</dd>
                        <dd class="topa_row_6"> &nbsp; <a href="{forum_attach.ATTACH_LINK}" title="{L_TOPA_GO_TO}">{forum_attach.ATTACH_TITLE}</a></dd>
                    </dl>
                </li>
            <!-- BEGINELSE -->
                <li class="row">
                    <dl>
                        <dt class="topa_no_attach">{L_TOPA_NO_ATTACH}</dt>
                    </dl>
                </li>
            <!-- END forum_attach -->
        <!-- ELSE -->
                <li class="row">
                    <dl>
                        <dt class="topa_to_see">{L_TOPA_TO_SEE}: &nbsp;<a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a><!-- IF S_REGISTER_ENABLED -->&nbsp; or &nbsp;<a href="{U_REGISTER}">{L_REGISTER}    </a><!-- ENDIF --></dt>
                    </dl>
                </li>
        <!-- ENDIF -->
                <div class="topa_copy2">
                    <li class="row">
                        <dl>
                            <dt class="topa_uinf">
                                <span class="topa_credit">{L_TOPA_CR}
                                    <a href="#" title="{L_TOPA_CREDIT_1}"><div class="topa_cr1"></div></a>&nbsp;
                                    <a href="#" title="{L_TOPA_CREDIT_2}"><div class="topa_cr1"></div></a>&nbsp;
                                    <a href="#" title="{L_TOPA_CREDIT_3}"><div class="topa_cr2"></div></a>
                                </span>{TOPA_UINF}
                            </dt>
                        </dl>
                    </li>
                </div>
            </ul>
        <span class="corners-bottom"><span></span></span></div>
    </div>
</div> 
and
prosilver/theme/topa.css

Code: Select all

/**
*
* @package - Top Attachments MOD
* @version $Id$
* @file                topa.css
* @copyright (c) 2014 all4phone (http://phpbbmods.cba.pl/)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
**/

/* header section */
li.header dt.topa_head_1 , li.row dt.topa_row_1{
    width: 27%
}
li.header dd.topa_head_2, li.header dd.topa_head_3, li.header dd.topa_head_4, li.header dd.topa_head_5, li.header dd.topa_head_6, li.row dd.topa_row_2, li.row dd.topa_row_3, li.row dd.topa_row_4, li.row dd.topa_row_5, li.row dt.topa_no_attach, li.row dt.topa_to_see, li.row dt.topa_uinf {
    text-align: center
}
li.header dd.topa_head_2, li.row dd.topa_row_2 {
    width: 6%
}
li.header dd.topa_head_3, li.header dd.topa_head_4, li.row dd.topa_row_3, li.row dd.topa_row_4 {
    width: 8%
}
li.header dd.topa_head_5, li.row dd.topa_row_5 {
    width: 15%
}
li.header dd.topa_head_6, li.row dd.topa_row_6 {
    width: 34%
}
/* row section */
dl.topa_row, li.row dt.topa_row_1 {
    font-size:11px
}
li.row dt.topa_row_1, li.row dd.topa_row_6 {
    padding: 4px 0 0 6px
}
span.topa_ext, dt.topa_uinf, dt.topa_uinf a {
    color:#809CB0
}
span.topa_ext {
    font-style:italic
}
li.row dt.topa_no_attach, li.row dt.topa_to_see {
    width:98%
}
/* copyright section */
li.row dt.topa_uinf {
    padding: 1px 0;
    width: 95%;
    font-size:10px
}
li.row dt.topa_uinf a, li.row dt.topa_uinf a:hover {
    font-weight:bold
}
li.row dt.topa_uinf a:hover{
    color:#105289
}
span.topa_credit {
    float:left;
    color:#91ACBF;
    font-style:italic;
    padding:0 0 1px 10px
}
div.topa_cr1, div.topa_cr2, div.topa_cr3 {
    background:#91ACBF;
    margin:2px 0 0 8px;
    width:6px;
    height:6px;
    float:right;
    border:1px solid #ccc
}
div.topa_copy2{
    opacity:0;
    height: 0px;
    -moz-transition-duration: 2s;
    -webkit-transition-duration: 2s; /* Safari */
    -o-transition-duration: 2s; /* Opera */
    transition-duration: 2s;
}
div.topa_copy:hover div.topa_copy2{
    opacity:1;
    height: 20px;
    -moz-transition-duration: 2s;
    -moz-transition-delay: 1s;
    -webkit-transition-duration: 2s; /* Safari */
    -webkit-transition-delay: 1s; /* Safari */
    -o-transition-duration: 2s; /* Opera */
    -o-transition-delay: 1s; /* Opera */
    transition-duration: 2s;
    transition-delay: 1s;
}