Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2012, 01:39 AM
Arrogant-One's Avatar
Arrogant-One Arrogant-One is offline
 
Join Date: Jul 2007
Location: Brisbane
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Special Mod Not Working Anymore

For the most part our upgrade from 3.6.7 to 4.1.12 went off without a hitch, but there was one casuality in particular. Our chess viewer.

It worked previously by someone attaching a pgn file to their post and it would automatically appear when the person pressed the post button and it would display in their post. But no longer.

Here is a picture of the chess board applet that would appear in a person's post:

http://chess.geniusprophecy.com/chess-viewer.html

Okay, so the instructions for installing this are here, close to the bottom of the page.

http://chesstuff.blogspot.ca/2008/11...er-deluxe.html

Now Viewer-Deluxe.jar is installed in my forum's root directory so I think the problem here is simply telling vBulletin that when someone attaches a pgn to their post, open it with Viewer-Deluxe.jar.

The million dollar question is how?
Reply With Quote
  #2  
Old 08-20-2012, 10:39 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Seems like you must have had some sort of modification to handle that. I guess what you'd need to do is somehow detect that someone is attaching that kind of file and insert code in the post to display the applet (as it says in the instructions you provided). Do you have any mod or plugin that maybe is installed but isn't working now? Or did you maybe make any code changes to the vb3 code?
Reply With Quote
  #3  
Old 08-20-2012, 03:27 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It does say you need to add code to that page for it to run - have you added it?
Reply With Quote
  #4  
Old 08-23-2012, 05:24 AM
Arrogant-One's Avatar
Arrogant-One Arrogant-One is offline
 
Join Date: Jul 2007
Location: Brisbane
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
It does say you need to add code to that page for it to run - have you added it?
Nope. And there is no pluggin either. The code was likely added previously when I outsourced my vBulletin jobs to others due to my lack of vB knowledge. Perhaps the code which had been added disappeared during the upgrade?

Do you by any chance know what template I need to add this code to?
Reply With Quote
  #5  
Old 08-23-2012, 11:24 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, I was thinking that you might have a plugin already installed, but which doesn't work with vb4. That might be easier since it might only need small changes.

I was about to say that it couldn't be done with template edits and that you probably need a plugin, but that might be wrong: you might be able to edit the postbit_attachment template and do something like:

Code:
<vb:if condition="$attachment['attachmentextension'] == 'pgn'">
// applet code from link above here
<APPLET archive="Viewer-Deluxe.jar" code="ChessBoard.class"
  codebase="/bin" width="631" height="560" mayscript="true">
  <PARAM name=PgnGameFile value="attachment.php?{vb:raw 
session.sessionurl}attachmentid={vb:raw attachment.attachmentid}&amp;d={vb:raw attachment.dateline}">
  <PARAM name=LightSquares value=F3DCC2>
  <PARAM name=DarkSquares value=DDA37B>
  <PARAM name=Background value=CCCCCC>
  <PARAM name=ImagesFolder value=images>
  <PARAM name=PuzzleMode value="off">
  Your browser is completely ignoring the &lt;APPLET&gt; tag!
</APPLET>
<vb:else />
// existing template code goes here
</vb:if>

Note that you need to keep the existing template code and make sure it ends up where the comment is. Also, you need to set the codebase= to point to where your Viewer-Deluxe.jar is (unless you actually do have it in a /bin directory).

BTW, I haven't tried it so I don't know if this works, but it's the best I can do without actually doing it myself.
Reply With Quote
  #6  
Old 08-23-2012, 11:27 PM
Arrogant-One's Avatar
Arrogant-One Arrogant-One is offline
 
Join Date: Jul 2007
Location: Brisbane
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the help guys. It is very much appreciated. I almost have this working, almost. Just need a little more help I think. Okay, the code I have used in the template is this:

Code:
<vb:if condition="$attachment['attachmentextension'] == 'pgn'">
<APPLET archive="Viewer-Deluxe.jar" code="ChessBoard.class"
  codebase="/httpdocs/pgn" width="631" height="560" mayscript="true">
  <PARAM name=PgnGameFile value="/httpdocs/pgn_games/1342828312.pgn">
  <PARAM name=LightSquares value=F3DCC2>
  <PARAM name=DarkSquares value=DDA37B>
  <PARAM name=Background value=CCCCCC>
  <PARAM name=ImagesFolder value=images>
  <PARAM name=PuzzleMode value="off">
  Your browser is completely ignoring the &lt;APPLET&gt; tag!
</APPLET>
<vb:else />
//<li>
	<img class="inlineimg" src="{vb:stylevar imgdir_attach}/{vb:raw attachment.attachmentextension}.gif" alt="{vb:rawphrase file_type_x, {vb:raw attachment.attachmentextension}}" />
	<a href="attachment.php?{vb:raw session.sessionurl}attachmentid={vb:raw attachment.attachmentid}&amp;d={vb:raw attachment.dateline}"<vb:if condition="$show['newwindow']"> target="_blank"</vb:if>>{vb:raw attachment.filename}</a> 
({vb:raw attachment.filesize}<vb:if condition="$show['views']">, {vb:rawphrase x_views, {vb:raw attachment.counter}}</vb:if>)
</li>
</vb:if>
The line that is causing the problem is this:

<PARAM name=PgnGameFile value="/httpdocs/pgn_games/1342828312.pgn">

Now presumably when someone attaches a pgn file, it gets saved in the FTP in this directory:

/httpdocs/pgn_games/

And 1342828312 is one of many pgn files saved there. With the above template it displays this particular pgn file, but not the one I tried uploading through Manage Attachments. I tried amending this line of the template to just

/httpdocs/pgn_games/

But that didn't work. Any ideas?
Reply With Quote
  #7  
Old 08-24-2012, 05:21 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So what I posted above didn't work? I was hoping that would take the actual attachment path and use that. Remember that the applet runs in the user's browser, so you want that to be the url path and not the path in your server's file system.

Can you link to a post that has a pgn file attached? I poked around you site but couldn't find one.
Reply With Quote
  #8  
Old 08-24-2012, 07:39 AM
Arrogant-One's Avatar
Arrogant-One Arrogant-One is offline
 
Join Date: Jul 2007
Location: Brisbane
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
So what I posted above didn't work? I was hoping that would take the actual attachment path and use that. Remember that the applet runs in the user's browser, so you want that to be the url path and not the path in your server's file system.

Can you link to a post that has a pgn file attached? I poked around you site but couldn't find one.
Sure.

Here is one:

http://www.ozchess.com.au/showthread...6825#post56825

Its post #2 (there are only 2 posts in this thread).

And I tried to use the code you provided but wasn't sure what to do with this:

// applet code from link above here

so I deleted that, because I think everything you had below this line was the applet code.

I think maybe the problem is this. The pgn attachments, everytime one was attached to a post before the upgrade, it would be saved in the FTP in

/httpdocs/pgn_games

The pgn I attached today did not get saved there. I don't know where in the FTP it would have been saved, but perhaps if all pgn attachments would be saved here, then maybe the code above would work?
Reply With Quote
  #9  
Old 08-24-2012, 10:51 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You were right, that comment can be removed - in html it'll just show up in the output. But anyway, what I meant was the line I had calling attachment.php. I know that doesn't look like a pgn file name, but it should return the pgn file data when called, so it should work like one. In fact, you can see that's just the code copied from the href attribute in the original template.

The uploaded attachments are saved either in the db or the file system. You can go to the attachment manager in the adminCP to see which one you have it set for, and what path they're saved to. I think the normal configuration is to have it set to a path that is not available directly via the web server, because if they were it would bypass the permission system. So that's why attachment.php is used (and also, if attachments are stored in the db that's the only way to get them).

Another thought I had - if you copy the original template code and put it above or below the applet code (or remove the <vb:else /> and put the <vb:if> .. </vb:if> around just the applet code), you can display the usual link to download the file as well as the applet.
Reply With Quote
  #10  
Old 08-24-2012, 12:05 PM
Arrogant-One's Avatar
Arrogant-One Arrogant-One is offline
 
Join Date: Jul 2007
Location: Brisbane
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
You were right, that comment can be removed - in html it'll just show up in the output. But anyway, what I meant was the line I had calling attachment.php. I know that doesn't look like a pgn file name, but it should return the pgn file data when called, so it should work like one. In fact, you can see that's just the code copied from the href attribute in the original template.

The uploaded attachments are saved either in the db or the file system. You can go to the attachment manager in the adminCP to see which one you have it set for, and what path they're saved to. I think the normal configuration is to have it set to a path that is not available directly via the web server, because if they were it would bypass the permission system. So that's why attachment.php is used (and also, if attachments are stored in the db that's the only way to get them).


Another thought I had - if you copy the original template code and put it above or below the applet code (or remove the <vb:else /> and put the <vb:if> .. </vb:if> around just the applet code), you can display the usual link to download the file as well as the applet.
Thanks for that. The problem seems to be this. Before the upgrade, pgn files would be saved on the FTP database here:

/httpdocs/pgn_games/1291890606.pgn

Now they are being saved somewhere else. Is there a way where I can find out where that somewhere else is?

In the Admin CP > Attachment Storage Type >

It says:

Code:
Attachments are currently being stored in the database
Action	Move Items from Database into File System
And it doesn't give me any options to change that. But I think if I can find out where pgn files are now being saved, I can fix this.
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 12:50 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.04739 seconds
  • Memory Usage 2,264KB
  • Queries Executed 11 (?)
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_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)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_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