möchte hier an dieser Stelle mal mein Modul "MOD_IFRAME_PICKER" posten.
Es handelt sich dabei um die Version 0.2 alpha, und wurde mit mit der Version 4.4.4 und dem letzten Snapshot getestet.
Folgende Konfigurationfelder gibt es im Backend:
- Dateiauswahl
- HTTP-Input
- IFRAME-WIDTH
- IFRAME-HEIGHT
- IFRAME-BORDER
Für die Dateiauswahl muß im UPLOAD-Ordner des Mandanten ein Verzeichniss "iframedata" vorhanden sein. Falls ihr ein anderen Pfad haben wollt, dann ändert sowohl im INPUT wie auch im OUTPUT die Variabel $moddir.
Das Modul verwendet folgende CMS-Variabeln bzw. Values:
4000
4001
4002
4003
4006
Folgende sind für eine Zukünftige Version reserviert:
4004
4005
Wenn ihr andere braucht, ändert dies bitte im Input und Outputbereich.
Hinweis: Im Input-Bereich werden sowohl die CMS_VARs wie auch die CMS_VALUES am Anfang zentral konfiguriert !!!! Somit wird die Konfiguration im Code an den oberen Bereichen der zwei Modulbereiche gehalten.
Das Modul setzte ich im Intranetbereich erfolgreich ein, um PDFs, Exceltabellen, Worddokumente und andere Intranetseiten im IFRAME anzuzeigen.
Dennoch weise ich darauf hin, das sich das Modul im ALPHA Stadium befindet.
Bitte Bugreports hier im Thread posten.
So, kommen wir nun zum Code:
MODUL-BESCHREIBUNG
Code: Alles auswählen
/***********************************************
* CONTENIDO MODUL
*
* Modulname : MOD_IFRAME_PICKER
* Modulversion : 0.2 alpha
* Author : Stefan Bürk
* Kontakt : Email: webmaster@skyblader.org
* Copyright : Bundeswehr - Stab 7. Panzerdivision, Stefan Bürk
* C-Version : 4.4
* Created : 26-04-2004
* Modified : 30-06-2004
*
* Beschreibung :
*
* Dieses Modul zeigt in einem IFRAME im Frontend entweder
* eine ausgewählte Datei aus UPLOAD Verzeichnis ODER
* eine eingegebene HTTP-Adresse an.
*
* Dieses Modul ist noch im frühen Entwicklungsstadium
* und noch mit vielen unabgefangenen Fehlerquellen
* behaftet.
*
************************************************/
30.06.2004
=======
in Im Inputbereich des Modules die Texte und Auswahl- bzw. Eingabefelder auf BackEnd-CSS-Klassen
umgestellt, um eine einheitlichere BackEnd-Konfigurationsseite zu erhalten.
28.06.2004
==========
out IFRAME-HEIgHT, IFRAME-WIDTH und IFRAME-BORDER werden bei der
erzeugung eines IFRAMES im Output nun berücksichtigt.
Überprüfung und ein ggf. setzen von Standartwerten wird nur
rundimär durchgeführt.
in Einstellungsmöglichkeiten für IFRAME-HEIGHT, IFRAME-WIDTH und
IFRAME-FRAMEBORDER eingebunden.
26.04.2004
==========
out Anzeige für "sky_selected_file" und "sky_iframe_httpinput" und
die Umwandlung in ein entsprechendes IFRAME erstellt.
in Auswahloption für "sky_selected_file" und "sky_iframe_httpinput"
und deren Speicherung in entsprechende CMS_VALUE[x] erstellt
INPUT
Code: Alles auswählen
$moddir = "iframedata/";
// VALUES
$sky_selectedfile = "CMS_VALUE[4000]";
$sky_iframe_width = "CMS_VALUE[4001]";
$sky_iframe_height = "CMS_VALUE[4002]";
$sky_iframe_border = "CMS_VALUE[4003]";
$sky_iframe_style = "CMS_VALUE[4004]"; // not used till yet
$sky_iframe_class = "CMS_VALUE[4005]"; // not used till yet
$sky_iframe_httpinput = "CMS_VALUE[4006]";
// VARIABLES
$sky_selectedfile2 = "CMS_VAR[4000]";
$sky_iframe_width2 = "CMS_VAR[4001]";
$sky_iframe_height2 = "CMS_VAR[4002]";
$sky_iframe_border2 = "CMS_VAR[4003]";
$sky_iframe_style2 = "CMS_VAR[4004]"; // not used till yet
$sky_iframe_class2 = "CMS_VAR[4005]"; // not used till yet
$sky_iframe_httpinput2 = "CMS_VAR[4006]";
// starting Modul Options Table
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">";
// ################################################################################################
// START FileChoose
// ################################################################################################
/* based on contenido internal upl function */
function sky_listdir_recursive ($currentdir, $startdir=NULL, $files=array(), $depth=-1, $pathstring="")
{
$depth++;
$unsorted_files = array();
if (chdir ($currentdir) == false)
{
return;
}
// remember where we started from
if (!$startdir) {
$startdir = $currentdir;
}
$d = opendir (".");
//list the files in the dir
while ($file = readdir ($d)) {
if ($file != ".." && $file != ".") {
$unsorted_files[] = $file;
}
}
if (is_array($unsorted_files)) sort($unsorted_files);
$sorted_files = $unsorted_files;
if(is_array($sorted_files)) {
foreach ($sorted_files as $file) {
if ($file != ".." && $file != ".") {
if ((filetype(getcwd()."/".$file) == "dir") &&
(opendir(getcwd()."/".$file) !== false)) {
$a_file['name'] = $file;
$a_file['depth'] = $depth;
$a_file['pathstring'] = $pathstring.$file.'/';;
$files[] = $a_file;
// If $file is a directory take a look inside
$files = sky_listdir_recursive (getcwd().'/'.$file, getcwd(), $files, $depth, $a_file['pathstring']);
} else {
// If $ file is not a directory then do nothing
$a_file['name'] = $file;
$a_file['depth'] = $depth;
$a_file['pathstring'] = $pathstring;
$files[] = $a_file;
}
}
}
}
closedir ($d);
chdir ($startdir);
return $files;
}
echo " <tr valign=\"top\">
<td class=\"text_medium\">Datei auswählen:</td>
<td class=\"text_medium\">
<select class=\"text_medium\" name=\"".$sky_selectedfile2."\">";
if ( $sky_selectedfile = "--KEIN--" )
{
echo " <option value=\"--KEIN--\" selected=\"selected\">-- KEIN --</option>";
}
else
{
echo " <option value=\"--KEIN--\">-- KEIN --</option>";
}
$sql = 'SELECT frontendpath FROM ' . $cfg["tab"]["clients"].' WHERE idclient = "'.$client.'"';
$db->query( $sql );
$db->next_record();
$l_upldir = $db->f("frontendpath");
function blub ( $vid , $vtxt)
{
echo '<option value="'.$vid.'">'.$vtxt.'</option>';
}
$sky_uploaddir = $cfgClient[$client]["upl"]["path"] . $moddir;
$sky_files = sky_listdir_recursive ( $sky_uploaddir , getcwd() );
if ( is_array($sky_files) )
{
// Array ( [0] => Array ( [name] => cms [depth] => 0 [pathstring] => cms/ )
while (list($lkey, $lvalue) = each ($sky_files))
{
if ( file_exists($sky_uploaddir.$lvalue['pathstring'].$lvalue['name']))
{
if ( $sky_selectedfile == $lvalue['pathstring'].$lvalue['name'] )
{
echo '<option value="'.$lvalue['pathstring'].$lvalue['name'].'" selected="selected">'.$lvalue['pathstring'].$lvalue['name'].'</option>';
}
else
{
echo '<option value="'.$lvalue['pathstring'].$lvalue['name'].'">'.$lvalue['pathstring'].$lvalue['name'].'</option>';
}
}
}
}
echo " </select>
</td>
</tr>";
// ################################################################################################
// End File Choose
// ################################################################################################
// ################################################################################################
// START HTTPInput
// ################################################################################################
echo " <tr valign=\"top\">";
echo " <td class=\"text_medium\">HTTP Link:</td>";
echo " <td class=\"text_medium\">";
echo " <input type=\"text\" class=\"text_medium\" name=\"".$sky_iframe_httpinput2."\" value=\"".$sky_iframe_httpinput."\"> ";
echo " <br>";
echo " Hinweis: HTTP-Link wird nur berücksichtigt, wenn als Dokument <b>-- KEIN --</b> ausgewählt wurde !";
echo " </td>";
echo " </tr>";
// ################################################################################################
// END HTTPInput
// ################################################################################################
// ################################################################################################
// START IFRAME-WIDTH
// ################################################################################################
echo " <tr valign=\"top\">";
echo " <td class=\"text_medium\">IFRAME-Width:</td>";
echo " <td class=\"text_medium\">";
echo " <input type=\"text\" class=\"text_medium\" name=\"".$sky_iframe_width2."\" value=\"".$sky_iframe_width."\"> ";
echo " </td>";
echo " </tr>";
// ################################################################################################
// END IFRAME-WIDTH
// ################################################################################################
// ################################################################################################
// START IFRAME-HEIGHT
// ################################################################################################
echo " <tr valign=\"top\">";
echo " <td class=\"text_medium\">IFRAME-Height:</td>";
echo " <td class=\"text_medium\">";
echo " <input type=\"text\" class=\"text_medium\" name=\"".$sky_iframe_height2."\" value=\"".$sky_iframe_height."\"> ";
echo " </td>";
echo " </tr>";
// ################################################################################################
// END IFRAME-HEIGHT
// ################################################################################################
// ################################################################################################
// START IFRAME-BORDER
// ################################################################################################
echo " <tr valign=\"top\">";
echo " <td class=\"text_medium\">IFRAME-Border:</td>";
echo " <td class=\"text_medium\">";
echo " <input type=\"text\" class=\"text_medium\" name=\"".$sky_iframe_border2."\" value=\"".$sky_iframe_border."\"> ";
echo " </td>";
echo " </tr>";
// ################################################################################################
// END IFRAME-BORDER
// ################################################################################################
// closing Module Options Table
echo "</table>";
OUTPUT
Code: Alles auswählen
<?php
// Lese ausgewählte Datei aus.
$moddir = "upload/iframedata/";
$sky_selected_file = "CMS_VALUE[4000]";
$sky_iframe_width = "CMS_VALUE[4001]";
$sky_iframe_heiht = "CMS_VALUE[4002]";
$sky_iframe_border = "CMS_VALUE[4003]";
$sky_iframe_style = "CMS_VALUE[4004]"; // not used till yet
$sky_iframe_class = "CMS_VALUE[4005]"; // not used till yet
$sky_iframe_httpinput = "CMS_VALUE[4006]";
// Arbeite Einstellungsvariabeln ab
// ###################################################################################
// START - IFRAME-WIDTH
if ( strlen($sky_iframe_width) > 0 )
{
$ls_iframe_width = $sky_iframe_width;
}
else
{
$ls_iframe_width = "100%";
}
// END - IFRAME-WIDTH
// ###################################################################################
// ###################################################################################
// START - IFRAME-HEIGHT
if ( strlen($sky_iframe_height) > 0 )
{
$ls_iframe_height = $sky_iframe_height;
}
else
{
$ls_iframe_height = "100%";
}
// END - IFRAME-HEIGHT
// ###################################################################################
// ###################################################################################
// START - IFRAME-BORDER
if ( strlen($sky_iframe_border) > 0 )
{
$ls_iframe_border = $sky_iframe_border;
}
else
{
$ls_iframe_border = "1";
}
// END - IFRAME-BORDER
// ###################################################################################
// check for NO FILE Selected
if ( $sky_selected_file != "--KEIN--" )
{
// using selected file
// überprüfe ob ausgewählte Datei noch existiert
if ( file_exists( $moddir.$sky_selected_file ) )
{
// erzeuge IFrame Ausgabecode
echo '<iframe src="'.$moddir.$sky_selected_file.'" width="'.$ls_iframe_height.'" height="'.$ls_iframe_width.'" frameborder="'.$ls_iframe_border.'">';
echo '<p>Ihr Browser unterstützt keine IFrames. Bitte aktualisieren Sie ihren Browser.</p>';
echo '</iframe>';
}
else
{
// using HTTP Input
echo '<iframe src="'.$sky_iframe_httpinput.'" width="'.$ls_iframe_height.'" height="'.$ls_iframe_width.'" frameborder="'.$ls_iframe_border.'">';
echo '<p>Ihr Browser unterstützt keine IFrames. Bitte aktualisieren Sie ihren Browser.</p>';
echo '</iframe>';
}
}
else
{
// using HTTP Input
echo '<iframe src="'.$sky_iframe_httpinput.'" width="'.$ls_iframe_height.'" height="'.$ls_iframe_width.'" frameborder="'.$ls_iframe_border.'">';
echo '<p>Ihr Browser unterstützt keine IFrames. Bitte aktualisieren Sie ihren Browser.</p>';
echo '</iframe>';
}
?>
gruß
Stefan