vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Attachment Browser (v2.1 beta testing) (https://vborg.vbsupport.ru/showthread.php?t=66800)

Pitman 07-06-2004 05:21 AM

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)?

CarCdr 07-06-2004 09:00 AM

Quote:

Originally Posted by Pitman
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)?

Good idea. Change will be in the next upload. Thank you.

CarCdr 07-06-2004 10:43 AM

Here is a preview of the changes being tested for version 2 of attachment_browser. Comments are welcomed.
  1. Bug: We handle forum permissions, except for forum passwords. To have an entry listed, the user needs 'CANVIEW' and 'CANGETATTACHMENT' on a forum. Also, the forum must be '$_FORUMOPTIONS[cancontainthreads]'. This introduces another query to get the list of forums.

  2. Feature: List forum name with each entry.

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

  4. Feature: Allow one or more forumid's to be specified as a filter on the form. The "Forum ID" form field may be one or more ID's separated by spaces or commas.

  5. Feature: Allow one or more userid's to be specified as a filter on the form. The "User ID" form field may be one or more ID's separated by spaces or commas.

  6. Feature: 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. Bug: Checks deletion log so that deleted posts are not included.

  8. Feature: Filter 'sel_userid=NNN' no longer disallows other filter criteria. It's treated like any other filter -- it is simply combined with other selection criteria. This also applies to 'sel_forumid=XXX'. For user filtering, only one of 'sel_userid=NNN' or 'sel_username=XXX' can be specified. Userid takes precedence.

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

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

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

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

  13. 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)?"

Pitman 07-07-2004 01:48 AM

I know that this hack uses templates of some sort, but is there any possibility of maybe using the regular templates in later versions? It would be much easier to modify and customize to your own taste without worrying about messing up an entire PHP file trying to modify stuff.

Thanks :)

CarCdr 07-07-2004 02:03 AM

Quote:

Originally Posted by Pitman
I know that this hack uses templates of some sort, but is there any possibility of maybe using the regular templates in later versions? It would be much easier to modify and customize to your own taste without worrying about messing up an entire PHP file trying to modify stuff.

Thanks :)

Sure. But you will not mess up a PHP file. Copy them from the PHP file, leaving the file unchanged, then install them as you would any template. The program will notice that you have installed templates to override the default. See the comments in the first post for more details.

The advantage here, is that for those who have no desire to modify the templates, there is nothing to do but install the single file. For others, it's a simple matter to install overriding templates.

Pitman 07-07-2004 02:20 AM

Yeah, and that is a great idea... it would be so much easier for me to modify everything from the same place though without having to actually modify the file each time I want to change something. Thanks for the "Sure" though :D

CarCdr 07-07-2004 10:43 AM

Quote:

Originally Posted by Pitman
without having to actually modify the file each time

:) BUT... you do not have to modify the file. You copy out the templates. What is the difference between copying the templates from a text file named foo.php and a text file named templates.txt?

Here is a look at the smallest template in the file:

PHP Code:

$MyDefaultTemplates['attbro_ERROR'] = '
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
    <title>$vboptions[bbtitle] - $attbro_PHRASES[attachment_browser]</title>
$headinclude
</head>
<body>
$header
$navbar

<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:3px">
$attbro_error
</table>

<br /><br /><br /><br />
$footer
</body>
</html>
'


Copy the lines of the template (not including the enclosing single quotes of course), modify it as you wish, then install the template attbro_ERROR.

The functionality I am trying to offer here is to save the effort for those who would choose not to modify the templates, while adding no effort for those who need to modify them.

If I provided a file templates.txt, all I would do is copy them out for you.

I have fun with such discussions Pitman, so do not think for a second I am trying to preach. Anyway, this is all rather academic given the low level of interest in an attachment lister/browser. The number of sites using attachments for pseudo document management, as we do on our site, is obviously very small. Now my users are asking for search capability within the attached files, for .txt, .doc, and .pdf. It never ends... :) Cheers.

ps: In the pending version 2, the templates can be copied out of the file without the need to replace the single-quote occurences of \' with ' per the v1 instructions, so it is now a straight copy as it would be from any text file containing templates.

highlander_RD 07-13-2004 07:04 AM

Any news about the new release 2.0?
cheers

CarCdr 07-13-2004 10:34 AM

Quote:

Originally Posted by highlander_RD
Any news about the new release 2.0?
cheers

I have been testing it, slowly but surely... Also added some other features not mentioned. The forum selection stuff works well.

Given the low-level of interest here, I admit that I let it slip down my list of things to do. I will get around to uploading soon.

Cheers, CarCdr

Version 2 Changes:
  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 handle forum permissions.
    To have an entry listed, the user needs 'CANVIEW' and 'CANGETATTACHMENT'
    access. 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. 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'.

highlander_RD 07-13-2004 11:59 AM

It's perfect.
If you want me to test the "beta" 2.0 release on my forum, I'd be very glad.
Just give me a PM or an email with attached the php.
Thanks a lot!

highlander_RD 07-19-2004 03:58 PM

mmmm...
I guess you didn't read my PM...

CarCdr 07-19-2004 04:48 PM

Quote:

Originally Posted by highlander_RD
mmmm...
I guess you didn't read my PM...

And here I thought it was you. :) I sent you the code via e-mail last week.

I'll send a followup PM to you.

PixelFx 07-20-2004 08:31 PM

is it possible for me to beta test 2.0 ? :)

CarCdr 07-27-2004 06:43 PM

Version 2 uploaded with screenshots.

https://vborg.vbsupport.ru/showthread.php?p=528801

Among other new features, it includes forum support, including searching by forum and permission support.

CarCdr

SIINSI 08-02-2004 11:34 PM

I uploaded the file but, it doesn't load :( I gave it a good 10 minutes. Any ideas?

I have about 16,000 attachments and use 804 Mb. for attachments. Is this the problem?

EDIT It finally loaded after a long, long while. Is that normal?

Miguel

CarCdr 08-03-2004 12:34 AM

16,000 attachments hey. Hmmm... the browser only makes two queries, one to get the count of attachments you have access to (i.e., MySQL "COUNT(*)) and the other to load a page worth of attachment information.

Also, it does not retrieve the actual content, so the rows retrieved are quite small.

We have about 400 attachments and it loads very quickly.

I'd like to add a debug parameter that you could use to get feedback on what is taking so long. That way, you could get back to me about where it is eating the time.

SIINSI 08-03-2004 01:33 AM

Sure, just let me know what I need to do. It looks like a very useful tool. I f I could speed it up, I'd be a happy man :)

It said I had 772 Pages of attachments. If that matters.

Thanks,
Miguel

CarCdr 08-03-2004 10:43 AM

Quote:

Originally Posted by SIINSI
Sure, just let me know what I need to do. It looks like a very useful tool. I f I could speed it up, I'd be a happy man :)

It said I had 772 Pages of attachments. If that matters.

Thanks,
Miguel

The 772 pages is just the count you get for 1400 attachents at the default of 20 per page. Like I said, it only retrieves the actual attachment table rows for the target page. I assume you were getting just the first page, so it would be retrieving the first 20 rows. We'll time the two queries to see which one is so slow. I expect it is the "count(*)" query.

If this is the case, one alternative is to not to the page navigation stuff, thereby obviating the need to do the "count(*)" query. One would only retrieve the target page plus one extra to see if there is a next page.

Other ideas folks?

CarCdr 08-03-2004 03:12 PM

I have made some optimizations to attachment_browser to improve the speed of the queries.
  1. Only include a table JOIN if it is really required.
    We look at a query before running it to determine which tables to join. Before, we would always include all tables in addition to attachment: user, post, thread, forum.
  2. Do not use a forum table JOIN.
    Got rid of references to 'forum.forumid' and 'forum.title'. Retrieve the forumid from the thread table join, which we likely need anyway for checking thread.forumid. Retrieve the forum titles for the page after the fact using the forum cache. The only time we need the forum table JOIN is when user request a sort by forum title.
  3. Include forum access check only if required.
    The check for "thread.forumid IN (Accessible-Forumids)" is included only if required -- only if user does not have access to all forums.
  4. Be default, there is no sub-sort (i.e., 2nd-level sort)
As a result, the two queries do run faster for default display.

Query #1: The 'COUNT(*)' query runs anywhere from 20% faster to 5 times faster (MySQL caching must explain this huge range.) This was by far the slower of the two queries.

Query #2: The row retrieval query to get the rows for the target page runs about 9% faster, but that is not so important as it was the fast query anyway.

PM me an e-mail and I'll send you the new version. Once we agree that things still work properly and you verify the performance increase, I will post the new version here.

Cheers

Theater 08-03-2004 08:25 PM

Hello,

Long time lurker, but decided to register since this modification interests me. My community has over 15,000 attachments with over 5.5Gb of data. I converted to file storage format to save on my server load. So I was wondering if this modification would work since I've done that? Also, is there a way to limit access to the mod itself? Like say, only grant access to a paid subscription member, moderator, or administrator specific?

CarCdr 08-03-2004 10:52 PM

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

CarCdr 08-04-2004 10:54 AM

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.

Smitty 08-19-2004 11:05 PM

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?

CarCdr 08-28-2004 01:08 PM

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. :o

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="">

Smitty 08-28-2004 02:08 PM

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.

CarCdr 08-28-2004 03:51 PM

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.

fiber1 09-19-2004 02:50 PM

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

Natch 09-22-2004 12:24 AM

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...

CarCdr 09-22-2004 01:07 AM

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?

Natch 09-22-2004 01:15 AM

/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...

SpankMe 10-25-2004 05:37 AM

Quote:

Originally Posted by CarCdr
How about this? For graphic files, a small icon is displayed that you can pass your cursor over to get the thumbnail to display, either through image swapping or some crafty DHTML. This would be the same thumbnail displayed for any attachment (i.e., size-wise), since the source of the pic would come from the standard 'attachment.php' thumbnail code.

Easier still I think, from an implementation standpoint, would be a popup window.

Let's see if anyone else is interested.

Cheers

How about a separate page display showing thumbnails in columns and rows with just basic info. Useful if you can't remember anything about where you saw the image, just what it looked like.

SpankMe 10-25-2004 06:12 AM

Also very useful when you want to keep an eye on what type of images are being posted when there is just too much posting being done to check them all. Not that I mind nudy images being posted on my sites, just to make sure nothing too extreme is being attached.

u2page 10-25-2004 12:38 PM

Could you please tell me what/how I need to input to exclude certain forums from appearing on the report?

Thanks.

SpankMe 10-30-2004 10:56 AM

For those that are interested, here is a modified version on this hack to just show rows and columns of jpg thumbnails with basic info.

Lionel 11-07-2004 11:39 PM

Can we also display the thumbs for images?

CarCdr 11-08-2004 03:16 AM

I will get back to you this week. I need to upload the latest version as it has been tested enough now I think.

I will review thread for outstanding questions and also review the mod from SpankMe for jpg thumbnails to see if it might be included in the standard upload.

Cheers

CarCdr 11-08-2004 03:17 AM

Quote:

Originally Posted by Lionel
Can we also display the thumbs for images?

I presume you are asking this of SpankMe Lionel?

(Hmmm... I'll bet you do not see those three words directed at you very often. :) )

Lionel 11-08-2004 05:25 AM

Quote:

Originally Posted by CarCdr
I presume you are asking this of SpankMe Lionel?

(Hmmm... I'll bet you do not see those three words directed at you very often. :) )

You know? I did a search for thumbs and that returned nothing. And thumbnails was just above me :speechless:

u2page 11-11-2004 09:49 PM

*bump*

Quote:

Originally Posted by u2page
Could you please tell me what/how I need to input to exclude certain forums from appearing on the report?

Thanks.


shiva 12-21-2004 05:44 AM

Hmm, very nice, pretty much what I wanted. Big thank you, but wondering about when v2.1 was available? The download is listed at 2.0.


All times are GMT. The time now is 11:32 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.02336 seconds
  • Memory Usage 1,896KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete