Joomla for Sailwave

So I'm building a new website for the club. Its using J! 2.5 and I know there are a good number of sailing clubs that use joomla for their sites, yet there is no good way to handle SW results in J!. For those of you who don't know J! its a content management system a bit like WordPress. It takes its content from a database, not static files.

The two/three choices most people make are:
- Upload the html from Sailwave to a folder on the site. Add links to each file from Joomla.
- Upload the html from Sailwave and wrap the html using the wrapper component (puts it in an iframe)
- Copy the html from SW into an 'article' in Joomla.

All three are clunky and need some form of intervention on the Joomla side. There is a Joomla SW Component being created... but I'm in-patient...

I looked at EasyFile Module for Joomla to see if it might work but it links to the file automatically which is a +1 compared to manually linking, but it doesn't wrap it in the site style.

So I decided to write something myself. Now I could have created a formal J! component to do the job, but for speed I went for a JUMI application. Jumi is a free (as in beer and speech) J! component that lets you add your own PHP (and various other) bits of code. I created a Jumi 'ap' called Results and uploaded the code below. Added my sailwave files to a directory called /results in my public_html folder. (make sure yopu have it as a sub directory so that you can't ammend the url and browse any other directories!)

Then just point a menu at your Jumi Ap. Thats pretty much it. You just need your ROs to set the correct file path (e.g. /home/site/publich_html/results/2012 Results/Open Meetings/Regatta.html ) and the site will provide a directory called 2012 Results which is clickable, the Open Meetings then Regatta and clicking Regatta opens the sailwave file in the website.

Our site is not yet live so I can't link to it yet but thought I'd share while it was in my head!

Only snag I can see is it wont produce SEF URLs unless you write a routing plugin for it. Not sure I need it to. Also wont allow joomla's own search component to search it.

<?php
     $dir = "/results"; //must be a sub-directory within joomla to prevent people viewing joomla root files!
     echo "<a href='javascript:history.go(-1)'>&lt;&nbsp;Back</a><br/>";

if ( JRequest::getString( 'result','' )) { //if result (rather than resultS) is set its a file to show
   if ( JRequest::getString( 'results','' ) ) {
     $path = JPATH_BASE . $dir . JRequest::getString( 'results','' );
   } else {
     $path = JPATH_BASE. $dir;
   }
   if ( strpos ( $path , "." )=== false) {
   readfile ($path ."/". JRequest::getString( 'result','' ));
   } else {
   die ("You are not authorised to access this folder.");
   }
} else { //not a file so must be to list a directory content

   if (JRequest::getString( 'results','' ) ) {
     $path = JPATH_BASE . $dir . JRequest::getString( 'results','' );
   } else {
     $path = JPATH_BASE . $dir ;
   }
   if ( strpos ( $path , "." )=== false) {
     // do nothing
   } else {
     die ("You are not authorised to access this folder.");
   }
   if ($handle = opendir($path)) {
     echo "<ul>";
     while (false !== ($entry = readdir($handle))) { //loop through each file in the directory
         if ($entry != "." && $entry != "..") { //skip parent etc
             if (is_dir($path."/".$entry)) { //link to another directory
                $link = JRoute::_("?results=".JRequest::getString( 'results','' )."/".$entry);
                echo "<li><a href='".$link."'>".$entry."</a></li>";
             } else { //link to a file
                $name = implode('.', explode('.', $entry, -1)); //don't want the file extension in the URL.
                if ($name != "") {
                    $link = JRoute::_("?result=".$entry."&results=".JRequest::getString( 'results','' ));
                    echo "<li><a href='".$link."'>".$name."</a></li>";
                }
             }
         }
     }
     closedir($handle);
     echo "</ul>";
   }
}
?>

Hi,

I’m the guy creating the Joomla sailwave component.

I have it live on one site, but there are still a few snags to iron out before I can launch ‘officially’

It’s going to be free (or at least a basic version, maybe a commercial one with extra features later, but that’s some way down the line.

You appear to have some good Joomla knowledge, and I’ve been a bit too busy to make the final sprint for launch.

If you’re interested in collaborating, perhaps with creating the SEF router, drop me an email off-list and we can talk.

Cheers

Keith

···

From: sailwave@yahoogroups.com [mailto:sailwave@yahoogroups.com] On Behalf Of yahoo@wittongilbert.free-online.co.uk
Sent: 05 November 2012 00:09
To: sailwave@yahoogroups.com
Subject: [sailwave] Joomla for Sailwave

So I’m building a new website for the club. Its using J! 2.5 and I
know there are a good number of sailing clubs that use joomla for their
sites, yet there is no good way to handle SW results in J!. For those
of you who don’t know J! its a content management system a bit like
WordPress. It takes its content from a database, not static files.

The two/three choices most people make are:

  • Upload the html from Sailwave to a folder on the site. Add links to
    each file from Joomla.
  • Upload the html from Sailwave and wrap the html using the wrapper
    component (puts it in an iframe)
  • Copy the html from SW into an ‘article’ in Joomla.

All three are clunky and need some form of intervention on the Joomla
side. There is a Joomla SW Component being created… but I’m
in-patient…

I looked at EasyFile Module for Joomla to see if it might work but it
links to the file automatically which is a +1 compared to manually
linking, but it doesn’t wrap it in the site style.

So I decided to write something myself. Now I could have created a
formal J! component to do the job, but for speed I went for a JUMI
application. Jumi is a free (as in beer and speech) J! component that
lets you add your own PHP (and various other) bits of code. I created a
Jumi ‘ap’ called Results and uploaded the code below. Added my sailwave
files to a directory called /results in my public_html folder. (make
sure yopu have it as a sub directory so that you can’t ammend the url
and browse any other directories!)

Then just point a menu at your Jumi Ap. Thats pretty much it. You
just need your ROs to set the correct file path (e.g.
/home/site/publich_html/results/2012 Results/Open Meetings/Regatta.html
) and the site will provide a directory called 2012 Results which is
clickable, the Open Meetings then Regatta and clicking Regatta opens the
sailwave file in the website.

Our site is not yet live so I can’t link to it yet but thought I’d
share while it was in my head!

Only snag I can see is it wont produce SEF URLs unless you write a
routing plugin for it. Not sure I need it to. Also wont allow joomla’s
own search component to search it.

<?php $dir = "/results"; //must be a sub-directory within joomla to prevent people viewing joomla root files! echo "< Back
"; if ( JRequest::getString( 'result','' )) { //if result (rather than resultS) is set its a file to show if ( JRequest::getString( 'results','' ) ) { $path = JPATH_BASE . $dir . JRequest::getString( 'results','' ); } else { $path = JPATH_BASE. $dir; } if ( strpos ( $path , "." )=== false) { readfile ($path ."/". JRequest::getString( 'result','' )); } else { die ("You are not authorised to access this folder."); } } else { //not a file so must be to list a directory content if (JRequest::getString( 'results','' ) ) { $path = JPATH_BASE . $dir . JRequest::getString( 'results','' ); } else { $path = JPATH_BASE . $dir ; } if ( strpos ( $path , "." )=== false) { // do nothing } else { die ("You are not authorised to access this folder."); } if ($handle = opendir($path)) { echo "
    "; while (false !== ($entry = readdir($handle))) { //loop through each file in the directory if ($entry != "." && $entry != "..") { //skip parent etc if (is_dir($path."/".$entry)) { //link to another directory $link = JRoute::_("?results=".JRequest::getString( 'results','' )."/".$entry); echo "
  • ".$entry."
  • "; } else { //link to a file $name = implode('.', explode('.', $entry, -1)); //don't want the file extension in the URL. if ($name != "") { $link = JRoute::_("?result=".$entry."&results=".JRequest::getString( 'results','' )); echo "
  • ".$name."
  • "; } } } } closedir($handle); echo "
"; } } ?>