SimpleSi Posted May 26, 2008 Posted May 26, 2008 On all my non-EGJP sites, (all primaries BTW) I've employed a simple system of publishing the weekly newsletter. Head/School Sec writes it (in Word or Publisher) and then converts it to PDF (using a virtual PDF printer) into a folder On static sites, they run DirHTML which produces a list of all PDFs and then they FTP the html file list and the most recent PDF up to the website. http://www.whitefield-pri.lancs.sch.uk/pdfs/newsletters/newsletters.htm [edit]url corrected[/edit] On my CMSimple sites they just have to upload the PDF and I've a modified small PHP script that autogenerates the webpage with the PDFs linked on it Euxton CE Primary School - Newsletters Now, I could modify the CMSimple script and turn it into a joomla module but I'm wondering whether there is a better "joomla way" of achieving the end result - easy access to current and past newsletters for the parents and easy for Head/Sec to get them online, via normal joomla editing rather than using FTP? What methods is everyone else using? regards Simon 1
imullings Posted May 26, 2008 Posted May 26, 2008 We are just setting up a new archive using docman in Joomla. http://www.devizesschool.co.uk/news-letters/news-archives-4.htm We are also setting up a mailing list to point to the PDFs This is still in testing so is on a test site only http://testsite.devizesschool.co.uk/news/ Both are work in progress but are looking good Ian Mullings Devizes SChool IT Support 2
ninja-lewis Posted May 29, 2008 Posted May 29, 2008 SimpleSi, could you share the php script you use on the CMSimple sites to autogenerate the list of newsletters? I'm using CMS Made Simple and would like to do this too but there isn't an extension for CMSMS to do this yet. I'm not familiar with Joomla but CMS Made Simple allows editors to upload images and files from within the normal editing area, using file and image upload managers. I'd expect Joomla to have the same. It could be possible to use these to upload the PDFs to the specified folder and then just use your existing script to display the contents of that folder - I can't see any reason why your script would care how the files reached the folder it's watching. Lewis
SimpleSi Posted June 1, 2008 Author Posted June 1, 2008 @Lewis Here is the code to give a file listing using CMSimple The original code took a path and produce a nice file listing with icons. I modified it to only display items with a certain prefix (so I could reuse it on differnet pages - one for news one for policies etc) And I also added a parameter to do a sort e.g DD - date descending, (latest newsletter first on list) also does size of file e.g SD - size in descending order. /* CMSimple WDir plugin © 2006 - Joachim Barthel - www.qualifire.de/cmsimple/en --------------------------------------------------------------------- Disclaimer: No warranties at all, use on your own risk ! --------------------------------------------------------------------- Requirements: - CMSimple 2.5 is installed and running. - The plugin loader from cmsimpleplugins.svarrer.dk is installed and working ! --------------------------------------------------------------------- Feedback to: [email protected] --------------------------------------------------------------------- Version 0.1 beta 1 (03. June 2006) - Support for multilingual use - Enhancements of display - first options Version 0.1 beta 1a (04. June 2006) - Help files (en & de) - new option for summary Version 0.1 beta 2 (03. July 2006) - Slovak language support (Thanks to Martin Sereday) - Display of file attributes - Error trapping of wrong path - Formatting with CSS - Error on counting the files Version 0.1 beta 2a (26. July 2006) - Option for hidden files (starting with dot-character) Version 0.1 beta 3 (03. September 2006) - Show/Hide option for Size and Date columns - Open mode added Version modified by Simon Walters (SimpleSi) mod 1 28th April 2007 - Only display files starting with 2nd parameter - Sort into Reverse Date Order Version modified by Simon Walters (SimpleSi) mod 2 29th Nov 2007 - Only display files size in k - Display date in dd/mm/yyyy format */ function wd_Version() { return "0.3sw2 beta"; } // // simplesi change - 2 extra parameters added // function wd_list($wd_PathParam,$simplesi_FilePrefix,$simplesi_Sort) { GLOBAL $su, $sl, $plugin_cf, $plugin_tx, $pth, $plugin; //$wd_version = "0.1 beta 2a "; error_reporting(E_ALL); $wdo = ""; $wdo .= "\n \n"; if (substr($wd_PathParam,-1,1) <> "/") $wd_PathParam .= "/"; if (($wd_PathParam == "./") || ($wd_PathParam == "/")) $wd_PathParam = ""; if (substr($wd_PathParam,0,2) == "./") $wd_PathParam = substr($wd_PathParam,2); $wd_path = $pth['folder']['base'] . $wd_PathParam; if(eregi("true",$plugin_cf['wdir']['debug'])) { $wdo .= "Path-Parameter: $wd_PathParam "; $wdo .= "Fileserver-Dir: $wd_path "; $wdo .= "HTTP_HOST: " . $_SERVER['HTTP_HOST'] . " "; $wdo .= "PHP_SELF: " . $_SERVER['PHP_SELF'] . " "; $wdo .= ""; } $d = dir($wd_path); $wd_fnames = array(); $wd_ftypes = array(); // // simplesi change - 2 extra arrays added // $simplesi_dates = array(); $simplesi_sizes = array(); $fcount = 0; while (false !== ($entry = $d->read())) { if ($entry != "." && $entry != "..") { if ((eregi("true",$plugin_cf['wdir']['show_hiddenfiles'])) || (substr($entry,0,1) != '.')) { // // simplesi change - check if file prefix param is used // if (($simplesi_FilePrefix == "") || (substr(strtolower($entry),0,strlen($simplesi_FilePrefix)) == strtolower($simplesi_FilePrefix))) { $fcount++; array_push($wd_fnames, $entry); array_push($wd_ftypes, filetype($wd_path."/".$entry)); // // simplesi change - insert filetime and filesize into new arrays // array_push($simplesi_dates, filemtime($wd_path."/".$entry)); array_push($simplesi_sizes, filesize($wd_path."/".$entry)); } } } } $d->close(); $fcount--; $wd_lowfnames = array_map('strtolower', $wd_fnames); // // simplesi change - change file sort order if needed // $simplesi_Sort = $simplesi_Sort . " "; if (substr(strtolower($simplesi_Sort),0,1) == "d") { if (substr(strtolower($simplesi_Sort),0,2) == "dd") { array_multisort($simplesi_dates,SORT_DESC,$wd_ftypes, $wd_lowfnames, $wd_fnames); } else { array_multisort($simplesi_dates,SORT_ASC,$wd_ftypes, $wd_lowfnames, $wd_fnames); } } elseif (substr(strtolower($simplesi_Sort),0,1) == "s") { if (substr(strtolower($simplesi_Sort),0,2) == "sd") { array_multisort($simplesi_sizes,SORT_DESC,$wd_ftypes, $wd_lowfnames, $wd_fnames); } else { array_multisort($simplesi_sizes,SORT_ASC,$wd_ftypes, $wd_lowfnames, $wd_fnames); } } elseif ($simplesi_Sort == " ") { array_multisort($wd_ftypes, $wd_lowfnames, $wd_fnames); } $wd_http = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $wd_http = substr($wd_http,0,strrpos($wd_http,'/')+1); if (substr($wd_http,-4,4) == '/'.$sl.'/') $wd_http = substr($wd_http,0,strlen($wd_http)-3); if(eregi("true",$plugin_cf['wdir']['show_path'])) { $wdo .= "" . " Path: " . $wd_http.$wd_PathParam. " " . " \n"; } $wdo .= ""; if(eregi("true",$plugin_cf['wdir']['show_colheader'])) { $wdo .= ""; $wdo .= "" . $plugin_tx['wdir']['txt_name'] . ""; if(eregi("true",$plugin_cf['wdir']['show_size'])) $wdo .= "" . $plugin_tx['wdir']['txt_size'] . ""; if(eregi("true",$plugin_cf['wdir']['show_changed'])) $wdo .= "" . $plugin_tx['wdir']['txt_changed'] . ""; if(eregi("true",$plugin_cf['wdir']['show_attributes'])) $wdo .= "" . $plugin_tx['wdir']['txt_perms'] . ""; $wdo .= ""; } $wd_total = 0; for ($i = 0; $i <= $fcount; $i++) { $wd_fext = substr($wd_fnames[$i],strrpos($wd_fnames[$i],".")+1); //if (filetype($fullname) == "dir") $wd_fext = "DIR"; $fullname = $wd_path . "/" . $wd_fnames[$i]; if (filetype($fullname) == "dir") { /* $wdo .= ""; $wd_fext = "DIR"; $wdo .= "\"""; $wdo .= "". $wd_fnames[$i] . " "; $wdo .= " "; //$wdo .= "Dateiordner "; $wdo .= "" . date("d.m.Y H:i:s", filemtime($fullname)) . ""; $wdo .= "\n"; */ } else { $wdo .= ""; $wdo .= "\"""; $wdo .= "". $wd_fnames[$i] . ""; if(eregi("true",$plugin_cf['wdir']['show_size'])) $wdo .= " ". number_format(filesize($fullname)/1024,0,',','.') . " KBytes "; $wd_total += filesize($fullname); //$wdo .= "".strtoupper($wd_fext)."-Datei "; if(eregi("true",$plugin_cf['wdir']['show_changed'])) $wdo .= "" . date("d/m/Y", filemtime($fullname)) . ""; if(eregi("true",$plugin_cf['wdir']['show_attributes'])) { //$wdo .= "".decoct(fileperms($fullname)).""; $wdo .= "".wd_FilePerms(decoct(fileperms($fullname))).""; } $wdo .= "\n"; } } $wdo .= " "; if(eregi("true",$plugin_cf['wdir']['show_summary'])) { $fcount++; $wdo .= "" . " " . $fcount . " " . $plugin_tx['wdir']['txt_files'] . ", " . number_format($wd_total,0,',','.') . " Bytes" . " \n"; } if(eregi("true",$plugin_cf['wdir']['show_creator'])) { $wdo .= ""; } else { $wdo .= ""; } $wdo .= " Webdirectory plugin, Ver. " . wd_version() . " by QualiFIRE "; $wdo .= ""; $wdo .= " "; $wdo .= "\n\n"; return $wdo; } function wd_FileIcon($wd_fext) { GLOBAL $su, $sl, $plugin_cf, $plugin_tx, $pth, $plugin; $wd_FullPath = $pth['folder']['plugins']."wdir/images/" . strtoupper($wd_fext) . "icon.gif"; if (!file_exists($wd_FullPath)) $wd_FullPath = $pth['folder']['plugins']."wdir/images/" . "UFO" . "icon.gif"; return $wd_FullPath; } function wd_FilePerms($fperms) { $cRet = ""; for ($i=3; $i<=5; $i++) { $cOctAcc = intval(substr($fperms,$i,1)); if ($cOctAcc-4 >= 0) { $cOctAcc -= 4; $cChrAcc = "R"; } else { $cChrAcc = "-"; } if ($cOctAcc-2 >= 0) { $cOctAcc -= 2; $cChrAcc .= "W"; } else { $cChrAcc .= "-"; } if ($cOctAcc == 1) { //$cOctAcc -= 2; $cChrAcc .= "X"; } else { $cChrAcc .= "-"; } $cRet .= $cChrAcc; $cRet .= " "; } $cRet .= ""; return $cRet; } ?> 1
alonebfg Posted June 3, 2008 Posted June 3, 2008 there is a module in docman that will do that for you in joomla.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now