ich bin gerade dabei mich in Contenido einzuarbeiten und finde das System wie es zur Zeit ist echt klasse. Macht ruhig weiter so.
Nun zu mir, ich bin dabei hier und da einige Punkte an meine Bedürfnisse anzupassen. Dabei habe ich bis jetzt ein einfaches Modul erstellt, das mir ermöglicht so ne Art Tooltipps und Links zu verwalten. Für jeden den es hier interessiert kann ich ja kurz mal schildern wie ich vorgegangen bin. Ach noch eins. Zur Verwaltung dieser Punkte musste ich am Backend zusätzliche Menüpunkte einfügen.
Was ist dazu nötig? Ich habe mich dabei an dem Aufbau des Empfänger Moduls orientiert.
1. ändern der lang_de.xml
<extra>
<main>Extras</main>
<newsletter>Newsletter</newsletter>
<mailing>Mailing</mailing>
<recipients>Empfänger</recipients>
<tooltipp>Tooltipps</tooltipp> <-- einfügen
</extra>
2. Includes/Templates
include.recipients_edit.php,
include.recipients_menu.php und
include.recipients_left_top.php
sowie die templates
template.recipient_edit.html
template.recipient_menu.html
template.recipientleft_top.html
kopieren und umbenennen (einfach recipient durch tooltipp ersetzen)
3. Ändern der cfg_language.de.inc.php
Auch hier kann man sich wieder an die Einträge mit 'recipients' orientieren, einfach kopieren und durch tooltipp ersetzen.
4. Ändern der config.php
in der config.php müssen die Templates angepasst werden hier muss man auch einen neuen Eintrag erstellen
5. Ändern der cfg_sql.inc.php
in der cfg_sql.inc.php muss der neue Präfix noch mitgeggeben werden
6. Fummel kram (!!!Achtung Eingriffe in die Datenbankstruktur)
eine Tabelle erstellen z.B. mit der Struktur
Code: Alles auswählen
CREATE TABLE con_tooltipp (
idtooltipp tinyint(6) unsigned NOT NULL auto_increment,
tipp mediumtext,
comment text,
address text,
idclient int(10) unsigned NOT NULL default '0',
idlang int(10) unsigned NOT NULL default '0',
deactivated int(1) NOT NULL default '0',
author varchar(32) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
lastmodified datetime NOT NULL default '0000-00-00 00:00:00',
onlylink int(1) NOT NULL default '0',
PRIMARY KEY (idtooltipp),
UNIQUE KEY idtipps (idtooltipp)
) TYPE=MyISAM;
in der Tabelle <präfix>_area
neuen Eintrag erstellen, BASIS ist auch hier wieder der recipient Eintrag,
in der Tabelle <präfix>_actions
neue Einträge erstellen, BASIS ist auch hier wieder der recipient Einträge,
in der Tabelle <präfix>_nav_sub
neuen Eintrag erstellen, BASIS ist auch hier wieder der recipient Eintrag,
hier muss die zuvor angegebene idarea mitgegeben werden
in der Tabelle <präfix>_files
fünf neue Einträge erstellen mit include.tooltipp_edit.php|main, include.tooltipp_left_top.php|main, include.tooltipp_edit.php
|main sowie functions.forms.php|inc und include.subnav_blank.php|main. Auch hier ist wieder die zuvor erstellte idarea einzutragen
in der Tabelle <präfix>_frame_files (Frame Zuweisung)
fünf neue Einträge mit der Zuweisung zu den erstellten idfile und idarea
in der Tabelle <präfix>_sequence
kann man dann noch nextId mitgeben --> neuer Eintrag mit dem Namen <präfix>_tooltipp und nexid auf eins setzen.
7. Templates und Includes anpassen
im Prinzip habe ich jedes vorkommen von 'recipients' ersetzt durch 'tooltipp', zudem wurde aber auch neue Tabellenfelder eingefügt und noch so ein paar andere Änderungen.
- template.tooltipp_edit.html (wurde nicht verändert)
- template.tooltipp_left_top.html (NEWRECIPIENT wurde durch TOOLTIPP ersetzt)
- template.tooltipp_menu.html (resipients, rcp und RCPNAME wurde durch TOOLTIPP bzw. tooltipp ersetzt)
bei den Includes ist es jetzt aber einfacher den Code zu zeigen:
include.tooltipp_edit.php,
Code: Alles auswählen
<?
/******************************************
* File : include.rights_overview.php
* Project : Contenido
* Descr : Displays rights
*
* Author : Timo A. Hummel
* Created : 30.04.2003
* Modified : 30.04.2003
*
* © four for business AG
*****************************************/
include_once ($cfg["path"]["classes"] . "class.user.php");
$userclass = new User();
$db2 = new DB_Contenido;
if(!$perm->have_perm_area_action($area,$action))
{
$notification->displayNotification("error", "Keine Berechtigung");
} else {
if ( !isset($tooltippid) && $action != "tooltipp_createtooltipp" )
{
$tpl->reset();
$tpl->set('s', 'CONTENTS', '');
$tpl->generate($cfg['path']['templates'] . $cfg['templates']['blank']);
} else {
if ($action == "tooltipp_createtooltipp" && $final == 1)
{
if ($deactivated == "deactivated")
{
$deactivated = 1;
} else {
$deactivated = 0;
}
if ($onlylink == "onlylink")
{
$onlylink = 1;
} else {
$onlylink = 0;
}
$newsrcpid = $db->nextid($cfg["tab"]["tooltipp"]);
$timestamp = date("Y-m-d H:i:s");
$sql = 'INSERT INTO
'.$cfg["tab"]["tooltipp"].'
SET
tipp="'.$tipp.'",
comment="'.$comment.'",
address="'.$address.'",
onlylink="'.$onlylink.'",
deactivated="'.$deactivated.'",
author="'.$auth->auth["uid"].'",
created="'.$timestamp.'",
lastmodified="'.$timestamp.'",
idclient="'.$client.'",
idlang="'.$lang.'",
idtooltipp = "'.$tooltippid.'"';
$db->query($sql);
$notification->displayNotification("info", "Änderungen gespeichert");
}
if (($action == "tooltipp_edittooltipp") && ($perm->have_perm_area_action($area, $action)))
{
if ($deactivated == "deactivated")
{
$deactivated = 1;
} else {
$deactivated = 0;
}
if ($onlylink == "onlylink")
{
$onlylink = 1;
} else {
$onlylink = 0;
}
$lastmodified = date("Y-m-d H:i:s");
$sql = 'UPDATE
'.$cfg["tab"]["tooltipp"].'
SET
tipp="'.$tipp.'",
comment="'.$comment.'",
address="'.$address.'",
onlylink="'.$onlylink.'",
deactivated="'.$deactivated.'",
lastmodified="'.$lastmodified.'"
WHERE
idtooltipp = "'.$tooltippid.'"';
$db->query($sql);
$notification->displayNotification("info", "Änderungen gespeichert");
}
$tpl->reset();
$sql = "SELECT
idtooltipp, tipp, comment, address, onlylink, deactivated, created, lastmodified, author
FROM
".$cfg["tab"]["tooltipp"]."
WHERE
idtooltipp = '".$tooltippid."'";
if ($action != "tooltipp_createtooltipp")
{
$db->query($sql);
}
if ($action != "tooltipp_createtooltipp")
{
$form = '<form name="tooltipp_edit" method="post" action="'.$sess->url("main.php?").'">
'.$sess->hidden_session().'
<input type="hidden" name="area" value="'.$area.'">
<input type="hidden" name="action" value="tooltipp_edittooltipp">
<input type="hidden" name="frame" value="'.$frame.'">
<input type="hidden" name="tooltippid" value="'.$tooltippid.'">
<input type="hidden" name="idlang" value="'.$lang.'">';
} else {
$form = '<form name="tooltipp_edit" method="post" action="'.$sess->url("main.php?").'">
'.$sess->hidden_session().'
<input type="hidden" name="area" value="'.$area.'">
<input type="hidden" name="action" value="tooltipp_createtooltipp">
<input type="hidden" name="final" value="1">
<input type="hidden" name="frame" value="'.$frame.'">
<input type="hidden" name="tooltippid" value="'.$tooltippid.'">
<input type="hidden" name="idlang" value="'.$lang.'">';
}
$db->next_record();
$tpl->set('s', 'JAVASCRIPT', $javascript);
$tpl->set('s', 'FORM', $form);
$tpl->set('s', 'BORDERCOLOR', $cfg["color"]["table_border"]);
$tpl->set('s', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('s', 'SUBMITTEXT', 'Änderungen speichern');
$tpl->set('s', 'CANCELTEXT', 'Änderungen verwerfen');
$tpl->set('s', 'CANCELLINK', $sess->url("main.php?area=$area&frame=4&tooltippid=$tooltipp"));
$tpl->set('d', 'CLASS', 'textw_medium');
$tpl->set('d', 'CATNAME', "Eigenschaft");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_header"]);
$tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', "Wert");
$tpl->next();
$tpl->set('d', 'CLASS', 'text_medium');
$tpl->set('d', 'CATNAME', "Tipp");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "tipp", $db->f("tipp"), 40, 255));
$tpl->next();
$tpl->set('d', 'CLASS', 'text_medium');
$tpl->set('d', 'CATNAME', "Kommentar");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "comment", $db->f("comment"), 40, 255));
$tpl->next();
$tpl->set('d', 'CLASS', 'text_medium');
$tpl->set('d', 'CATNAME', "Adresse");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "address", $db->f("address"), 40, 255));
$tpl->next();
$tpl->set('d', 'CLASS', 'text_medium');
$tpl->set('d', 'CATNAME', "Nur Link");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateCheckbox ("onlylink", "onlylink", $db->f("onlylink")));
$tpl->next();
$tpl->set('d', 'CLASS', 'text_medium');
$tpl->set('d', 'CATNAME', "Deaktiviert");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateCheckbox ("deactivated", "deactivated", $db->f("deactivated")));
$tpl->next();
if ($action != "tooltipp_createtooltipp")
{
$tpl->set('d', 'CLASS', 'text_medium');
$tpl->set('d', 'CATNAME', "Erzeugt");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', $db->f("created"));
$tpl->next();
$tpl->set('d', 'CLASS', 'text_medium');
$tpl->set('d', 'CATNAME', "Geändert");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', $db->f("lastmodified"));
$tpl->next();
$tpl->set('d', 'CLASS', 'text_medium');
$tpl->set('d', 'CATNAME', "Autor");
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD',
$userclass->getUsername($db->f("author")).
" (".
$userclass->getRealname($db->f("author")).
")");
$tpl->next();
}
# Generate template
$tpl->generate($cfg['path']['templates'] . $cfg['templates']['tooltipp_edit']);
}
}
?>
Code: Alles auswählen
<?php
/******************************************
* File : include.stat_left_top.php
* Project : Contenido 4.3
*
*
* Author : Timo A. Hummel
* Created : 29.04.2003
* Modified : 29.04.2003
*
* © four for business AG
******************************************/
$tpl->set('s', 'ID', 'oTplSel');
$tpl->set('s', 'CLASS', 'text_medium');
$tpl->set('s', 'OPTIONS', '');
$tpl->set('s', 'CAPTION', '');
$tpl->set('s', 'SESSID', $sess->id);
$tpl->set('s', 'ACTION', $select);
$tmp_mstr = '<a class="main" href="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
$area = "tooltipp";
$mstr = sprintf($tmp_mstr, 'right_top',
$sess->url("main.php?area=tooltipp&frame=3"),
'right_bottom',
$sess->url("main.php?area=tooltipp&frame=4&action=tooltipp_createtooltipp"),
"Tooltipp erstellen");
$tpl->set('s', 'TOOLTIPP', $mstr);
$tpl->generate($cfg['path']['templates'] . $cfg['templates']['tooltipp_left_top']);
?>
Code: Alles auswählen
<?
/******************************************
* File : include.stat_overview.php
* Project : Contenido
* Descr : Displays languages
*
* Author : Olaf Niemann
* Created : 23.04.2003
* Modified : 23.04.2003
*
* © four for business AG
*****************************************/
$tpl->reset();
$tpl->set('s', 'TOOLTIPPSTART',$tooltippStart);
$tpl->set('s', 'SID', $sess->id);
if (($action == "tooltipp_delete") && ($perm->have_perm_area_action($area, $action))) {
$sql = "DELETE FROM "
.$cfg["tab"]["tooltipp"].
" WHERE
idtooltipp = \"" .$tooltippid."\"";
$db->query($sql);
}
if (is_string($search) && strlen($search) > 0)
{
$limitSQL = "AND tipp LIKE '%$search%' OR comment LIKE '%$search%' OR address LIKE '%$search%' ";
} else {
$limitSQL = "";
}
$sql = "SELECT COUNT(*) FROM ".$cfg["tab"]["tooltipp"]." WHERE idclient='$client' AND idlang='$lang' $limitSQL ORDER BY tipp ASC";
$db->query($sql);
if ($db->next_record())
{
$numTooltipp = $db->f("COUNT(*)");
} else {
$numTooltipp = 0;
}
if (!is_numeric($limit) || $limit == 0)
{
$limit = 20;
}
$tpl->set('s', 'LIMITTO', $limit);
$howManyTooltipp = $limit;
if ($tooltippStart > $numTooltipp)
{
$tooltippStart = $numTooltipp-$howManyTooltipp;
}
if ($tooltippStart < 0)
{
$tooltippStart = 0;
}
$limitOptions = array(
10 => "10",
20 => "20",
50 => "50",
100 => "100");
$tpl2 = new Template;
$tpl2->set('s', 'NAME', 'limit');
$tpl2->set('s', 'CLASS', 'text_medium');
$tpl2->set('s', 'ID', 'limit');
$tpl2->set('s', 'OPTIONS', "onChange='tooltippChangeLimit()'");
foreach ($limitOptions as $key => $value)
{
if ($key == $limit)
{
$selected = "SELECTED";
} else {
$selected = "";
}
$tpl2->set('d', 'VALUE', $key);
$tpl2->set('d', 'CAPTION', $value);
$tpl2->set('d', 'SELECTED', $selected);
$tpl2->next();
}
$select = $tpl2->generate($cfg["path"]["templates"]. $cfg["templates"]["generic_select"],true);
if ($tooltippStart > 0)
{
$left = '<a href="'.$sess->url("main.php?area=$area&frame=2&limit=$limit&tooltippStart=".($tooltippStart-$howManyTooltipp)).'"><img border="0" src="images/pfeil_links.gif"></a>';
} else {
$left = '<img src="images/spacer.gif" width="9" height=15">';
}
if (($tooltippStart + $howManyTooltipp) < $numTooltipp)
{
$right = '<a href="'.$sess->url("main.php?area=$area&frame=2&limit=$limit&tooltippStart=".($tooltippStart+$howManyTooltipp)).'"><img border="0" src="images/pfeil_rechts.gif"></a>';
} else {
$right = '<img src="images/spacer.gif" width="9" height=15">';
}
$tpl->set('s', 'LEFT', $left);
$tpl->set('s', 'RIGHT', $right);
$tpl->set('s', 'LIMIT', $select);
$pageCount = ceil($numTooltipp / $limit);
$currentPage = ceil($tooltippStart / $limit)+1;
if ($numTooltipp > 0)
{
$tpl->set('s', 'PAGESPEC', 'Seite '. $currentPage .' / '.$pageCount);
} else {
$tpl->set('s', 'PAGESPEC', 'Keine Ergebnisse.');
}
$tpl->set('s', 'SEARCH', '<input type="text" name="search" class="text_medium" maxlen="256" size="16">');
$tpl->set('s', 'SEARCHSUBMIT', '<input type="image" onclick="tooltippStartSearch()" src="images/submit.gif" alt="Suche starten" title="Suche starten">');
$sql = "SELECT * FROM ".$cfg["tab"]["tooltipp"]." WHERE idclient='$client' AND idlang='$lang' $limitSQL ORDER BY tipp ASC";
$db->query($sql);
// Empty Row
$bgcolor = '#FFFFFF';
$tpl->set('s', 'PADDING_LEFT', '10');
if ($numTooltipp > 0)
{
$db->seek($tooltippStart);
}
$tooltippCount = 0;
while ($db->next_record())
{
$tooltippCount++;
if ($tooltippCount > $howManyTooltipp)
{
break;
}
$idtooltipp = $db->f("idtooltipp");
$tipp = $db->f("tipp");
$comment = $db->f("comment");
$address = $db->f("address");
// $author = $db->f("author");
$dark = !$dark;
if ($dark) {
$bgColor = $cfg["color"]["table_dark"];
} else {
$bgColor = $cfg["color"]["table_light"];
}
if ($deactivated)
{
$fontColor = '<font color="#A20000">';
} else {
$fontColor = '<font color="black">';
}
$tmp_mstr = '<a alt="'.$comment.'" title="'.$comment.'" href="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">'.$fontColor.'%s</font></a>';
$area = "tooltipp";
$mstr = sprintf($tmp_mstr, 'right_top',
$sess->url("main.php?area=$area&frame=3&tooltippid=$idtooltipp"),
'right_bottom',
$sess->url("main.php?area=$area&frame=4&tooltippid=$idtooltipp"),
$tipp);
if ($perm->have_perm_area_action('tooltipp',"tooltipp_delete") ) {
$deletebutton = "<a onClick=\"event.cancelBubble=true;check=confirm('Tooltipp ".$tipp ." wirklich löschen?'); if (check==true) { location.href='".$sess->url("main.php?area=tooltipp&action=tooltipp_delete&frame=$frame&tooltippid=$idtooltipp&del=")."#deletethis'};\" href=\"#\"><img src=\"".$cfg['path']['images']."delete.gif\" border=\"0\" width=\"13\" height=\"13\" alt=\"".$lngUpl["delfolder"]."\" title=\"".$lngUpl["deluser"]."\"></a>";
} else {
$deletebutton = "";
}
$tpl->set('d', 'HBGCOLOR', $cfg["color"]["table_header"]);
$tpl->set('d', 'BGCOLOR', $bgColor);
$tpl->set('d', 'TOOLTIPP', $mstr);
$tpl->set('d', 'COMMENT', $comment);
$tpl->set('d', 'DELETE', $deletebutton);
$tpl->next();
}
# Generate template
$tpl->generate($cfg['path']['templates'] . $cfg['templates']['tooltipp_menu']);
?>
Zusatz zum Standard CSS-Style oder wie auch immer
Code: Alles auswählen
div#tooltipp {POSITION: static;}
div#tooltipp a:hover {background: none;}
div#tooltipp a:hover {background: #FFFFF0; }
div#tooltipp a span {display: none;}
div#tooltipp a:hover span {display: block; text-decoration : none; position: absolute;top: 120px; left: 30px; width: 150px; padding: 5px; margin: 4px; z-index: 100;}
Code: Alles auswählen
<?php
if(!$perm) {
$tmp_content = "CMS_HTML[1]";
$link2 = mysql_pconnect("localhost","root","");
mysql_select_db("cont",$link2);
$sql_tipp = "select * from con_tooltipp";
$result_tipp = mysql_query($sql_tipp,$link2);
$row_tipp = mysql_numrows($result_tipp);
for ($i=0;$i<$row_tipp;$i++)
{
$result2_tipp = mysql_fetch_array($result_tipp);
$tippid = $result2_tipp["idtipps"];
$tipp = $result2_tipp["tipp"];
$comment = $result2_tipp["comment"];
$address = $result2_tipp["address"];
$onlylink = $result2_tipp["onlylink"];
$deactivated = $result2_tipp["deactivated"];
if ($deactivated == 0){
if ($onlylink == 0){
$default_struc_tipp = "<a href=\"$address\"><font color=\"black\">$tipp </font><span><table width=\"160\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\" style=\"border: 1pt solid black\"><tr height=\"20\"><td bgcolor=\"#c9c9c9\" height=\"20\"><div align=\"center\" style=\"border-bottom: 1pt solid black\"><b>$tipp</b></td></tr><tr height=\"25\"><td bgcolor=\"#ffffff\" height=\"25\"><i>$comment</i></td></tr></table></span></a>";
}
else{
$default_struc_tipp = "<a href=\"$address\"><font color=\"black\">$tipp </font></a>";
}
$tmp_content = str_replace($tipp,$default_struc_tipp,$tmp_content);
}
}
echo "<div id=\"tooltipp\";\">";
echo $tmp_content;
echo "</div>";
}
else
{
echo "CMS_HTML[1]";
}
?>
Das Ganze sieht auch noch nicht so schick aus, aber ich bin ja noch Newbie. Wenn mir einer sagen könnte wie ich meine Datenbank Connects ein wenig eleganter verfassen könnte, wäre ich dankbar.
P.S.: Bei der Struktur, wie hier oben beschrieben hat man die Möglichkeit Links als Tooltipps anzuzeigen oder einfach nur einen einfachen Link im Text zu setzen. Für Rückmeldungen, wie das ganze euch gefällt wäre ich dankbar.
Ich hoffe das ist alles so richtig. ....

Gruß Gandresch