![]() | Register | FAQ | Members | Social Groups | User Map | Calendar | Search | Today's Posts | Mark Forums Read |
| EduGeek Joomla 1.5 Package Next generation joomla with our favourite edugeek templates. |
| | LinkBack | Thread Tools | Search this Thread | Language |
| Sponsored Links |
| | |
|
| | #3 (permalink) |
![]() Join Date: May 2007
Posts: 8
Thanks: 1
Thanked 1 Time in 1 Post
Rep Power: 0 | 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 |
| |
| | #4 (permalink) |
![]() Join Date: Jun 2005 Location: Lancashire
Posts: 1,295
Thanks: 51
Thanked 46 Times in 38 Posts
Rep Power: 16 | @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. Code: <?
/*
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: jbarthel@qualifire.de
---------------------------------------------------------------------
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 .= "<!-- QualiFIREs WebDirectory >>WDir<< Code starts here -->\n<div><br>\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<br>";
$wdo .= "Fileserver-Dir: $wd_path<br>";
$wdo .= "HTTP_HOST: " . $_SERVER['HTTP_HOST'] . "<br>";
$wdo .= "PHP_SELF: " . $_SERVER['PHP_SELF'] . "<br>";
$wdo .= "<hr>";
}
$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 .= "<span class=\"wdPath\">"
. " Path: <strong>" . $wd_http.$wd_PathParam. " </strong>"
. "</span><br /> <br>\n";
}
$wdo .= "<table>";
if(eregi("true",$plugin_cf['wdir']['show_colheader'])) {
$wdo .= "<tr>";
$wdo .= "<td colspan=\"3\" class=\"wdColHeader\">" . $plugin_tx['wdir']['txt_name'] . "</td>";
if(eregi("true",$plugin_cf['wdir']['show_size']))
$wdo .= "<td colspan=\"3\" class=\"wdColHeader\">" . $plugin_tx['wdir']['txt_size'] . "</td>";
if(eregi("true",$plugin_cf['wdir']['show_changed']))
$wdo .= "<td class=\"wdColHeader\">" . $plugin_tx['wdir']['txt_changed'] . "</td>";
if(eregi("true",$plugin_cf['wdir']['show_attributes']))
$wdo .= "<td colspan=\"2\" class=\"wdColHeader\">" . $plugin_tx['wdir']['txt_perms'] . "</td>";
$wdo .= "</tr>";
}
$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 .= "<tr>";
$wd_fext = "DIR";
$wdo .= "<td><img src=\"" . wd_FileIcon($wd_fext) . "\"></td><td></td>";
$wdo .= "<td>". $wd_fnames[$i] . "</td><td> </td>";
$wdo .= "<td></td><td> </td>";
//$wdo .= "<td>Dateiordner</td><td> </td>";
$wdo .= "<td>" . date("d.m.Y H:i:s", filemtime($fullname)) . "</td>";
$wdo .= "</tr>\n";
*/
} else {
$wdo .= "<tr>";
$wdo .= "<td><img src=\"" . wd_FileIcon($wd_fext) . "\"></td><td></td>";
$wdo .= "<td><a href=\"" .$wd_http . $wd_PathParam .$wd_fnames[$i]. "\" target=\"" . $plugin_cf['wdir']['open_mode'] . "\">". $wd_fnames[$i] . "</a></td>";
if(eregi("true",$plugin_cf['wdir']['show_size']))
$wdo .= "<td> </td><td align=\"right\">". number_format(filesize($fullname)/1024,0,',','.') . " KBytes</td><td> </td>";
$wd_total += filesize($fullname);
//$wdo .= "<td>".strtoupper($wd_fext)."-Datei</td><td> </td>";
if(eregi("true",$plugin_cf['wdir']['show_changed']))
$wdo .= "<td>" . date("d/m/Y", filemtime($fullname)) . "</td>";
if(eregi("true",$plugin_cf['wdir']['show_attributes'])) {
//$wdo .= "<td></td><td>".decoct(fileperms($fullname))."</td>";
$wdo .= "<td></td><td>".wd_FilePerms(decoct(fileperms($fullname)))."</td>";
}
$wdo .= "</tr>\n";
}
}
$wdo .= "</table><br>";
if(eregi("true",$plugin_cf['wdir']['show_summary'])) {
$fcount++;
$wdo .= "<span class=\"wdSummary\">"
. " " . $fcount . " " . $plugin_tx['wdir']['txt_files'] . ", " . number_format($wd_total,0,',','.') . " Bytes"
. "</span><br /> <br>\n";
}
if(eregi("true",$plugin_cf['wdir']['show_creator'])) {
$wdo .= "<div style=\"text-align: center; font-size: 0.75em; display: block\">";
} else {
$wdo .= "<div style=\"text-align: center; font-size: 0.75em; display: none\">";
}
$wdo .= "<br> <br><span style=\"border-top: 1px solid; padding-top: 2px; color:#666666;\"> Webdirectory plugin, Ver. " . wd_version() . " by <a href=\"http://www.qualifire.de/cmsimple\" target=\"_blank\">QualiFIRE</a> </span>";
$wdo .= "</div>";
$wdo .= "<br></div>";
$wdo .= "\n<!-- QualiFIREs WebDirectory >>WDir<< Code ends here -->\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 = "<table><tr>";
for ($i=3; $i<=5; $i++) {
$cOctAcc = intval(substr($fperms,$i,1));
if ($cOctAcc-4 >= 0) {
$cOctAcc -= 4;
$cChrAcc = "<td class=\"wdFilePerms\">R</td>";
} else {
$cChrAcc = "<td class=\"wdFilePerms\">-</td>";
}
if ($cOctAcc-2 >= 0) {
$cOctAcc -= 2;
$cChrAcc .= "<td class=\"wdFilePerms\">W</td>";
} else {
$cChrAcc .= "<td class=\"wdFilePerms\">-</td>";
}
if ($cOctAcc == 1) {
//$cOctAcc -= 2;
$cChrAcc .= "<td class=\"wdFilePerms\">X</td>";
} else {
$cChrAcc .= "<td class=\"wdFilePerms\">-</td>";
}
$cRet .= $cChrAcc;
$cRet .= "<td> </td>";
}
$cRet .= "</tr></table>";
return $cRet;
}
?>
|
| |
| The Following User Says Thank You to SimpleSi For This Useful Post: | ninja-lewis (02-06-2008) |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| school server support contract needed | z4ydi | Network and Classroom Management | 12 | 03-03-2008 09:11 AM |
| Microsoft School Agreement Help Needed. | ICTNUT | Educational Software | 4 | 12-06-2007 04:00 PM |
| Sending HTML Newsletters | Simcfc73 | Web Development | 13 | 01-03-2007 02:27 PM |
| Creating Newsletters (and general DTP-type stuff) | Ric_ | General Chat | 6 | 12-05-2006 08:19 AM |
| Bookmarks |
« Previous Thread
|
Next Thread »
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|









