Hi all,

I would like to use a pgn viewer which can be found on for example http://www.mychess.com/

Since I do not have alot of coding experience I am runing in difficulties including the script from above whithin drupal.

<H2> <FONT COLOR="Maroon">Polgar-Anand, 1999</FONT></H2>
    <APPLET code="ChessBoard.class" align="baseline" width="630" height="560">
      <PARAM name=pgngamefile value="Polgar-Anand.pgn">
    </APPLET>

As far as I understand the above applet it will look for the code APPLET code="ChessBoard.class" and as soon as it sees a pgn file like Polgar-Anand.pgn it will display that game in the viewer called by the applet code. In case there are more games available you will be able to select a game within the pgn viewer. See for examples at www.mychess.com

What I would like is having the option for noobs to create a new content type for example "chess analyses" which is having all that a normal node is having but additional an upload field where you can upload your pgn file or even a zip file with multiple pgn files (pgn viewer is able to read from zip file directly)

although I am familiar with CCK I do not know how to accomplish an upload file which makes sure that the file is put somewhere in order for the script to show it. Additionaly, somewhere the applet code must be placed but then again, how to make sure that every new node type "chess analyses" will work?

Any tips, hints, url's is very welcome.
P.S. wouldnt it be easy to create a simple module which integrates the pgn mychess viewer within Drupal? Ít would certainly make it more generally usable by all chesslovers around the world!

Comments

thbenda’s picture

Hello Tmanagement,

I am both a java/j2ee developper and a (low) rated chess player.
I integrate chessviewer 2.2 without any problems by creating a new content type and give it at least two fields.
This is the procedure to do the job.

Following the described method below:

0. Upload chessviewer2.2.zip from official website. It is a java applet so It will contains some *.class file.
0.1 Unzip them in a directory on your website. Ex: "/sites/all/libraries/chessviewer"

1. Create a new content type named "chessviewer22"

2. Create 2 fields at least :
2.1. an uploaded file field to upload a given pgn file;
2.2. a textarea field to insert the html applet call code;
2.3. (not necessary) another textarea field to insert a short description about the games in your pgn set.

3. Edit visibility to show the content type to your target user role. "chessgames"

4. Take a look on given examples (with *.html extensions) in the downloaded files.

5. Modify the html examples given by chessviewer to integrates it in drupal:
- add the codebase attribute and give it the path where you have unzipped your program. Here it will be "/sites/all/libraries/chessviewer" in applet anchor;
- modify the "pgngamefile" parameter value to give the uploaded PGN absolute path (you will see it on mouseover the uploaded file);
- add a parameter inside the applet to specify a size for pieces given with the chess game (40 in my case).

That's all, folks.
Everything will be ok if you have really understood the procedure I have described.
No developping knowledge necessary to do this. Just use your mind with my logic and it will work.
Other visualizers will follow the same principles until there are still java (not javascript) applets.

Please note your webusers must have the client JRE installed on every computer.
See official website of chessviewer for compatibility matrix.

Hope that helps.
Tell me if a video demo will be necessary.

Cheers.

pgn4web’s picture

malcolmp’s picture

I have written a custom module which provides a content type for uploading a pgn file and viewing it using ltpgnviewer (which is a javascript PGN viewer). I haven't uploaded it drupal.org yet, but If anyone else is interested in it, let me know, and I will.

progweb’s picture

Hi malcolmp, I would very much like to have a pgn viewer for drupal site. Hope you share your module. Thanks.

malcolmp’s picture

I have uploaded it here
http://popmalc.org.uk/home/node/253

Maybe if you find it useful I will figure how to get it uploaded to drupal.org

Micha1111’s picture

I have tested your module and it works fine !!

Some suggestions:

move original js_viewer to sites/all/libraries (not in module subfolder)
provide an admin form for some default values, i.e. size of iframe, button for board rotating, colors and so on

I hope you'll upload your module to drupal.org and maintain it
What about version for D7 ?

Example live site:
www.elmshorner-schachclub.de/node/8517 and other pages
(basic nodes 8510 and 8511 with links "nachspielen")

malcolmp’s picture

Good suggestions. I am thinking about upgrading my site to D7. I will let you know when I do.

malcolmp’s picture

Module is now uploaded to drupal.org with some updates, if you have git access
http://drupal.org/sandbox/malcolmp/1426274

Micha1111’s picture

Unfortunately I haven't git access

malcolmp’s picture

I am working on it. I need to go through a review process to get it uploaded as a proper module ...

malcolmp’s picture

Now a drupal 7 version at http://popmalc.org.uk/home/node/253
Getting it on drupal.org will take a while as there is a backlog.

malcolmp’s picture

Finally the review is complete and it is on drupal.org http://drupal.org/project/ltpgn