Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
Attachment Browser (v2.1 beta testing) Details »»
Attachment Browser (v2.1 beta testing)
Version: 1.00, by CarCdr CarCdr is offline
Developer Last Online: Mar 2007 Show Printable Version Email this Page

Version: 3.0.1 Rating:
Released: 07-02-2004 Last Update: Never Installs: 23
 
No support by the author.

List/Search Attachment Files

List, filter/search, sort, etc. for attachments files. Respects forum permissions. Supports limiting search to a single forum or a list of forums. Also, a separate attachment summary page is available.

Any problems raised in this thread have been fixed. For new features in version 2, see below under Version 2 for "New" entries.

Standard page navigation is supported to go to last page, prev, next, etc.

Sorts, ascending or descending, are supported for:
  • two levels of sorting, for example, by user name and then by file name.
  • Sort, either level, on these fields:
    • date/time
    • user name
    • forum
    • file name
    • file extension
    • file size
    • # of downloads
  • the default sort is date/time (most recent first)
Searching/filtering
  • All criteria is entered on a collapsable form at the top of the page.
  • Search/filter criteria supported are:
    • user name ('*' wildcards allowed)
    • file name ('*' wildcards allowed),
    • file extension ('*' wildcards allowed)
    • userid or list of userid's
    • forumid or list of forumid'
    • attached before N days ago,
    • attached after N days ago
  • Single click filtering by user name, forum name or document type.

Changes pending for version 2.1
  1. New Added usergroup access checking.
    Two configuration variables can be set to either (a) allow access to a set of usergroup or (b) disallow access for a set of usergroup id's.
  2. New Query performance improved.
    Performance for sites with many thousands of attachments is significantly improved. The single most time consuming aspect of such a script is the MySQL query for 'COUNT(*)' to get the number of attachments matching the selection criteria and access permissions. By including only those JOIN's that are required, depending on the columns being accessed, the ORDER BY, and the WHERE clauses, we improve performance of both retrievals. There is still one case where the row retrieval could be slow: when the user requests that the output be sorted by forum title.
  3. New List attachments added since last visit.
  4. New Added a debugging setting to display timing information.
  5. Change Various other performance improvements that will be detailed when released.

Version 2:
  1. New A separate attachment summary page was added.
    Page provides overall summary, summary by forum, and summary by extension.
    This introduces two new templates: attbro_SUMMARY and attbro_summary_categorybit.
    This page is accessed from a new link at the top of the main page.

  2. New Now uses $vbphrase for phrases.
    You can AdminCP-install custom phrases to override the defaults.

  3. New We respect forum permissions.
    To have an entry listed, the user needs 'CANVIEW' and 'CANGETATTACHMENT'
    access and a password if required. Also, $_FORUMOPTIONS[active] and
    $_FORUMOPTIONS[cancontainthreads] must be on and the forum must not
    be a link redirect.

  4. New List forum name with each entry.

  5. New Now supports sorting by forum name; just like any other
    sort, for first- or second-level sort.

  6. New Quick filtering for a single forum, by clicking the
    '[Filter]' link next to a forum name to search only that forum, similar to
    clicking the link next to the user name in our previous version.

  7. New Allow one or more forumid's to be specified as a filter on the Display Options
    form. The "Forum ID" form field may be one or more ID's separated by spaces or commas.
    The "[Filter]" link next to forum names uses this as well to add a Forum ID to the
    current selection criteria.

  8. New Allow one or more userid's to be specified as a filter on the Display Options
    form. The "User ID" form field may be one or more ID's separated by spaces or commas.

  9. New Forums can be explicitly exluded via the URL parameter
    "exclude_forums=LIST", where LIST is one or more forumid's separated
    by spaces or commas. This will eventually be an AdminCP option.

  10. Bug: Checks deletion log so that deleted posts are not included.

  11. Feature/Change: The filter 'sel_userid=NNN' no longer disallows other
    filter criteria. It's treated like any other filter -- combined with other selection
    criteria. Only one of 'sel_userid=NNN' or 'sel_username=XXX' can be specified.
    Userid takes precedence. This change also applies to 'sel_forumid=XXX'.

  12. Change: We use MySQL "LIMIT X,N" syntax to only retrieve the records
    we need to fill the requested page. This should provide some performance gain
    when building pages for high page numbers.

  13. Change: Renamed '[Downloads]' link next to user name to '[Filter]'.

  14. Change: Renamed 'Downloads' in listing header to '$vbphrase[views]'.

  15. Change: Renamed URL parameter 'userid=NNN' to 'sel_userid=NNN'.

  16. Change: Since we now need forum information for every page, we
    always query using all the JOINS -- user, post, thread, forum, deletionlog.

  17. Change: Exclude attachements whose 'postid' is zero. Thanks to
    Pitman for this one, who suggested: "About the private attachments: Since
    they don't have a postid, wouldn't "AND postid !=0" work in the query or
    whatever? If so, that should also fix the problem that some may have with
    attachment names and all showing but no attachment really there yet (like when
    somebody is posting a new attachment and have not yet clicked Submit New
    Thread or Submit Reply)?
    "
  18. Bug: Fix mismatched <td></td> in attbro_FORM template that caused
    page to leak past the right margin.
  19. Phrase changes:
    • New 'stars_allowed' for reminders on form.
    • New 'Filter' for '[Filter]' links
    • New 'Count' for summary page.
    • New 'Attachment_Summary'.
    • No longer use 'Select_Type'.
v 1.1:
  • Added .php to all attachment_browser references in template links.
  • Added forgotten class="tcat" to first table row for headings.
v 1.2:
  • Feature: Enabled display of file type icons and the ability to click
    said icons to recall us to list only files of that type (extension).
    We look for icons using "$stylevar[imgdir_attach]/$extension.gif".
  • Bug: Make "Show attachment ID" on form be remembered across calls.
  • Bug: Make sure "userid=XXX" is passed in links for page navigation when
    listing a single user's downloads.
  • Feature: If we are showing the attachment ID, then always force it below the
    row number with '<br />'.
  • Performance: Performance of 'COUNT(*)' query greatly imporved for case where
    we do not need to reference tables other than 'attachment'. Testing
    on our server shows speed improvement around 6x better. This small
    optimization controlled via "$sqlCountRequiredJoins".

----------------------------

To search in a single forum: use the single click [Filter] next to any forum name on a page or enter the forumid on the "Display Options" form.
To search only in a selected list of forums: Enter a comma-separated list of forumid's in "Display Options".

You can AdminCP-install custom templates to override our defaults ones.
You can AdminCP-install custom phrases to override the defaults -- all
references in templates are to "$vbphrase[XXX]".

If you do not want to change the default templates or phrases, then there are
no other files to install -- just put this one in the main '/forum' directory.
If you want to modify the default templates, copy them from this file and
install them as usual. We will notice when there are installed templates to
override our defaults. The same applies to phrases.

We only list forums that the user has permissions to view and get attachments,
for attachments that are visible and not from deleted posts.

We do 2 queries: (1) get the total COUNT of accessible attachments matching
the selection criteria and (2) retrieve enough rows to fill the requested page.

If you follow a link on one of our pages to download an attachment, view a
user profile, or view the original post, then the normal access checks will
apply, as these links simply invoke standard vBulletin files.

The templates referenced are: attbro_MAIN, attbro_FORM, attbro_ERROR,
attbro_attachbit, attbro_SUMMARY and attbro_summary_categorybit. The default
templates and phrases are defined in this file. Look for '$MyDefaultTemplates'
and '$MyDefaultPhrases'.

For example, if we had a template named 'attbro_example', it will appear in
this file as:

$MyDefaultTemplates['attbro_example'] = '
LINE 1 OF TEMPLATE
LINE 2 OF TEMPLATE

';


To install a custom version, just copy the LINES
and install it under the template name attbro_example.
----------------------------
This extension is free, and will remain free.

Cheers, CarCdr

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #62  
Old 08-03-2004, 10:52 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It doesn't matter where the attachments are stored.

Yes, you can limit access to the mod to certain user groups.

15,000 attachments... hmmm. Would you be willing to beta test the new release:
https://vborg.vbsupport.ru/showpost.php?p=539692

PM me an e-mail address and I will send you the new script.

Cheers
Reply With Quote
  #63  
Old 08-04-2004, 10:54 AM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would be interested to hear from folks who run with a large number of attachments (more than 2,000) to give me some feedback on timing. Please PM me if you are willing to test the new version. Thank you.

Changes queued-up for version 2.1
  1. New Query performance improved.
    Performance for sites with many attachments is significantly improved. The
    single most time consuming aspect of the script is the MySQL query for
    'COUNT(*)' to get the number of attachments matching the selection criteria
    and access permissions. By including only those JOIN's that are required,
    depending on the columns being accessed, the ORDER BY, and the WHERE clauses,
    we improve performance of both retrievals. There is still one case where
    the row retrieval could be slow: when the user requests that the output be
    sorted by forum title.
  2. New Added usergroup access checking.
    Two variables can be used to either (a) allow access to a set of usergroup
    or (b) disallow access for a set og usergroup id's. To set permissions,
    find the line containing "// Usergroup permissions:" and read the detailed
    instructions.
  3. New List attachments added since last visit.
    The new URL parameter "getnew=1" will list attachments added since your last
    visit. Examples for links you could set up:
    attachment_browser.php?getnew=1
    attachment_browser.php?getnew=1&sel_forumid=8,13
  4. New Added debugging setting for timing.
    Specify "debug_queries=1" in the URL to get timing information for the page.
  5. Change The default for the second-level sort is "none".
    This provides a small performance increase when the user does not want
    a second-level sort. Also, we changed the sorter not to try a second-level
    sort if the first-level sort is by attached time stamp.
  6. Fix Include forums that are not active.
    These are accessible if URL is know, so just make normal forum
    access checks.
----------------
ps: If the 'COUNT(*)' retrieval is just too slow to support sites with many thousands of attachments, then we will need an option to skip getting the count. Note that the query to get 'COUNT(*)' is not as simple as you might think. As a minimum (not incuding special search values from the Display Options form), it must deal with forum permissions, attachment 'visible', as well as check the post table for 'visible' and post deletions.

With such an option enabled, the page would not include the number of accessible/matching attachments and would not have normal page navigation. For the page navigation, since we do not know how many there are, the best we could do is support "Next Page" when we know that there is *at least one* more attachment not on the current page.
Reply With Quote
  #64  
Old 08-19-2004, 11:05 PM
Smitty's Avatar
Smitty Smitty is offline
 
Join Date: Sep 2002
Location: Southern Ohio
Posts: 385
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know what's happening with this, but I hope it continues. I just installed and it's very nice.

Question: I want the search box to be 'Open' by default. How can I do that?
Reply With Quote
  #65  
Old 08-28-2004, 01:08 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Smitty
I don't know what's happening with this, but I hope it continues. I just installed and it's very nice.

Question: I want the search box to be 'Open' by default. How can I do that?
Thanks. I only noticed your post today.

Right, by default, the search form is displayed "collapsed" when the page is loaded. This would be a good option to have in the next release.

For now, what you can do is make two changes to the template 'attbro_FORM' (I did not test this).

Change this line:
<img id="collapseimg_attbro_disp_opts" src="$stylevar[imgdir_button]/collapse_thead_collapsed.gif" alt="" border="0" /></a>&nbsp;

to this:
<img id="collapseimg_attbro_disp_opts" src="$stylevar[imgdir_button]/collapse_thead.gif" alt="" border="0" /></a>&nbsp;

(removed the characters highlighted in red)

Then, a few lines down from that, change this line:
<tbody id="collapseobj_attbro_disp_opts" style="display:none; ">

to this:

<tbody id="collapseobj_attbro_disp_opts" style="">
Reply With Quote
  #66  
Old 08-28-2004, 02:08 PM
Smitty's Avatar
Smitty Smitty is offline
 
Join Date: Sep 2002
Location: Southern Ohio
Posts: 385
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks - I'll check it out tonight. It's not a REAL big issue, but you know how it goes. Some folks don't look so closely and miss the 'open' link (I renamed the phrase on mine to better point it out).

The biggest problem I have, actually, is checking things people upload for the file name. Many people upload stuff like 'document.doc' so the search feature has a limited function. However, I have gone in and renamed a lot of atttachments - I have to 'edit' the thread - download and rename the attachment, unattach the file in the post, and reupload the renamed file. And I watch to make sure new attachments have an appropriate name.

I rename threads a lot as well, but I do that mostly for search engines. I started doing that last December, along with some other SEO 'stuff' and my rankings, and traffic, have significantly improved.
Reply With Quote
  #67  
Old 08-28-2004, 03:51 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
The biggest problem I have, actually, is checking things people upload for the file name. Many people upload stuff like 'document.doc' so the search feature has a limited function. However, I have gone in and renamed a lot of atttachments - I have to 'edit' the thread - download and rename the attachment, unattach the file in the post, and reupload the renamed file. And I watch to make sure new attachments have an appropriate name.
Yeah, I have had to do that a couple of times. I wonder how difficult it would be to add a "Rename" function to the browser for administrators? The attachment name is stored only in one place, so it should be very easy.
Reply With Quote
  #68  
Old 09-19-2004, 02:50 PM
fiber1's Avatar
fiber1 fiber1 is offline
 
Join Date: Jun 2004
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very nice hack, but I am confused how to get the file icons to show. If someone could help It would be apreciated.

Thanks CarCdr!

fiber
Reply With Quote
  #69  
Old 09-22-2004, 12:24 AM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK - I was researching why my board and a clients board would not show the attachment icons on the attachment listing display: and eventually found it.

This modification need only be applied by those who have altered their $stylevar[imgdir_attach] to a absolute path, this modification will need to be made.

In attachment_browser.php, Find:
Code:
function ICON_FILE_EXISTS($extension) {
	global $stylevar;
	static $attbro_icon_present;

	if (empty($attbro_icon_present["$extension"]))
		$attbro_icon_present["$extension"] = (file_exists("$stylevar[imgdir_attach]/$extension.gif"));

	return $attbro_icon_present["$extension"];
}
Replace with:
Code:
function ICON_FILE_EXISTS($extension) {
	global $stylevar;
	static $attbro_icon_present;

	if (empty($attbro_icon_present["$extension"]))
		$attbro_icon_present["$extension"] = (file_exists($_SERVER['DOCUMENT_ROOT']."$stylevar[imgdir_attach]/$extension.gif"));

	return $attbro_icon_present["$extension"];
}
HTH y'all...
Reply With Quote
  #70  
Old 09-22-2004, 01:07 AM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Natch.

So, how do you suggest I conditionalize this so that no patch need be applied (i.e., in a future version of this hack).

What does your "$stylevar[imgdir_attach]" look like?
Reply With Quote
  #71  
Old 09-22-2004, 01:15 AM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

/forums/images/attach for my main style - but I think you will find that this folder will exist on all installations: the difficulty is determining the location of forumroot from $_SERVER['DOCUMENT_ROOT'] on all installs...
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 09:55 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.05911 seconds
  • Memory Usage 2,328KB
  • Queries Executed 25 (?)
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
  • (2)bbcode_code
  • (2)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
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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_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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete