<script language="JavaScript">
function smilie(theSmilie) {
addText(" " + theSmilie, "", false, document.bbform);
}
function bbcode(theTag) {
var selectedText = getSelectedText(document.bbform);
addText("[" + theTag + "]" + selectedText + "[/" + theTag + "]", "", false, document.bbform);
}
function farbe(theTag) {
var selectedText = getSelectedText(document.bbform);
addText("[" + theTag + "]" + selectedText + "[/" + theTag + "]", "", false, document.bbform);
}
function addText(theTag, theClsTag, isSingle, theForm)
{
var isClose = false;
var message = theForm.message;
var set=false;
var old=false;
var selected="";
if(navigator.appName=="Netscape" && message.textLength>=0 ) { // mozilla, firebird, netscape
if(theClsTag!="" && message.selectionStart!=message.selectionEnd) {
selected=message.value.substring(message.selectionStart,message.selectionEnd);
str=theTag + selected+ theClsTag;
old=true;
isClose = true;
}
else {
str=theTag;
}
message.focus();
start=message.selectionStart;
end=message.textLength;
endtext=message.value.substring(message.selectionEnd,end);
starttext=message.value.substring(0,start);
message.value=starttext + str + endtext;
message.selectionStart=start;
message.selectionEnd=start;
message.selectionStart = message.selectionStart + str.length;
if(old) { return false; }
set=true;
if(isSingle) {
isClose = false;
}
}
if ( (myVersion >= 4) && is_ie && is_win) { // Internet Explorer
if(message.isTextEdit) {
message.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null){
if(theClsTag != "" && rng.text.length > 0)
theTag += rng.text + theClsTag;
else if(isSingle)
isClose = true;
rng.text = theTag;
}
}
else{
if(isSingle) isClose = true;
if(!set) {
message.value += theTag;
}
}
}
else
{
if(isSingle) isClose = true;
if(!set) {
message.value += theTag;
}
}
message.focus();
return isClose;
}
function getSelectedText(theForm) {
var message = theForm.message;
var selected = '';
if(navigator.appName=="Netscape" && message.textLength>=0 && message.selectionStart!=message.selectionEnd )
selected=message.value.substring(message.selectionStart,message.selectionEnd);
else if( (myVersion >= 4) && is_ie && is_win ) {
if(message.isTextEdit){
message.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null){
if(rng.text.length > 0) selected = rng.text;
}
}
}
return selected;
}
</script>
<table width="490" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="490" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/spacer.gif" width="5" height="5"></td>
</tr>
<tr>
<td background="images/main_topic_<?=$topicpic?>.gif" class="topic"><font color="<?=$topictext?>">NEWS HINZUFÜGEN </font></td>
</tr>
<tr>
<td>
<?
if($_GET['do'] == "add")
{
$ok = "0";
?>
<form method="POST" action="?p=admin_news_add&do=add_check" enctype="multipart/form-data" name="bbform" onsubmit="return validate(this)" onreset="resetAppletText()" style="margin: 0px;">
<table width="490" border="0" cellspacing="0" cellpadding="0" class="news_rahmen">
<tr>
<td width="100" class="admin_news_add_rahmen"><table width="100" border="0" cellspacing="5" cellpadding="0">
<tr>
<td><input class="allesleer" type="text" value="Titel:" /></td>
</tr>
</table></td>
<td class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td><input class="textfeld" name="titel" type="text" id="titel" maxlength="50" value="<?=$newsvorschautitel?>" /></td>
</tr>
</table></td>
<tr>
<td class="admin_news_add_rahmen"><table width="100" border="0" cellspacing="5" cellpadding="0">
<tr>
<td><input class="allesleer" type="text" value="Bild:" /></td>
</tr>
</table></td>
<td class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td><input class="textfeld" name="newsbild" type="text" maxlength="1000" value="<?=$newsvorschaubild?>" /></td>
</tr>
</table></td>
<tr>
<td class="admin_news_add_rahmen"><table width="100" border="0" cellspacing="5" cellpadding="0">
<tr>
<td><input class="allesleer" type="text" value="Quelle:" /></td>
</tr>
</table></td>
<td class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td><input class="textfeld" name="quelle" type="text" maxlength="1000" value="<?=$newsvorschauquelle?>" /></td>
</tr>
</table></td>
<tr>
<td valign="top" class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100" border="0" cellspacing="5" cellpadding="0">
<tr>
<td colspan="3"><input name="text2" type="text" class="allesleer" value="Smilies:" /></td>
</tr>
<tr>
<td align="center"><img src="images/smilies/ausrufezeichen.gif" border="0" onclick="smilie('-!- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/biggrin.gif" border="0" onclick="smilie('-:))- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/blink.gif" border="0" onclick="smilie('-Oo- ')" onmouseover="this.style.cursor='hand';" \></td>
</tr>
<tr>
<td align="center"><img src="images/smilies/cool.gif" border="0" onclick="smilie('-cool- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/dry.gif" border="0" onclick="smilie('-dry- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/fragezeichen.gif" border="0" onclick="smilie('-?- ')" onmouseover="this.style.cursor='hand';" \></td>
</tr>
<tr>
<td align="center"><img src="images/smilies/herz.gif" border="0" onclick="smilie('-herz- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/huh.gif" border="0" onclick="smilie('-huh- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/kotz.gif" border="0" onclick="smilie('-kotz- ')" onmouseover="this.style.cursor='hand';" \></td>
</tr>
<tr>
<td align="center"><img src="images/smilies/laugh.gif" border="0" onclick="smilie('-lach- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/mad.gif" border="0" onclick="smilie('-mad- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/mellow.gif" border="0" onclick="smilie('-mellow- ')" onmouseover="this.style.cursor='hand';" \></td>
</tr>
<tr>
<td align="center"><img src="images/smilies/ohmy.gif" border="0" onclick="smilie('-ohmy- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/pfeil.gif" border="0" onclick="smilie('-pfeil- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/rolleyes.gif" border="0" onclick="smilie('-roll- ')" onmouseover="this.style.cursor='hand';" \></td>
</tr>
<tr>
<td align="center"><img src="images/smilies/sad.gif" border="0" onclick="smilie('-sad- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/sleep.gif" border="0" onclick="smilie('-sleep- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/smile.gif" border="0" onclick="smilie('-:)- ')" onmouseover="this.style.cursor='hand';" \></td>
</tr>
<tr>
<td align="center"><img src="images/smilies/thief.gif" border="0" onclick="smilie('-thief- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/tongue.gif" border="0" onclick="smilie('-:P- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/unsure.gif" border="0" onclick="smilie('-unsure- ')" onmouseover="this.style.cursor='hand';" \></td>
</tr>
<tr>
<td align="center"><img src="images/smilies/wacko.gif" border="0" onclick="smilie('-wacko- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/wink.gif" border="0" onclick="smilie('-wink- ')" onmouseover="this.style.cursor='hand';" \></td>
<td align="center"><img src="images/smilies/wub.gif" border="0" onclick="smilie('-wub- ')" onmouseover="this.style.cursor='hand';" \></td>
</tr>
</table></td>
</tr>
</table></td>
<td valign="top" class="admin_news_add_rahmen"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="20"><img title="Fetter Textn" src="images/buttons/bbcode_fett.gif" border="0" onclick="bbcode('B')" onmouseover="this.style.cursor='hand';" \></td>
<td width="20"><img title="Kursiver Text" src="images/buttons/bbcode_kursiv.gif" border="0" onclick="bbcode('K')" onmouseover="this.style.cursor='hand';" \></td>
<td width="20"><img title="Unterstrichener Text" src="images/buttons/bbcode_unterstrichen.gif" border="0" onclick="bbcode('U')" onmouseover="this.style.cursor='hand';" \></td>
<td width="20"><img title="Durchgestrichener Text" src="images/buttons/bbcode_durchgestrichen.gif" border="0" onclick="bbcode('S')" onmouseover="this.style.cursor='hand';" \></td>
<td width="20"><img title="Oberstrichener Text" src="images/buttons/bbcode_oberstrichen.gif" border="0" onclick="bbcode('O')" onmouseover="this.style.cursor='hand';" \></td>
<td width="20"><img title="Blinkender Text" src="images/buttons/bbcode_blinkend.gif" border="0" onclick="bbcode('F')" onmouseover="this.style.cursor='hand';" \></td>
<td><select name="select" class="farben">
<option style="color:#FF0000" onclick="farbe('Rot')" selected="selected">Rot</option>
<option style="color:#0000FF" onclick="farbe('Blau')">Blau</option>
<option style="color:#009900" onclick="farbe('Grün')">Grün</option>
<option style="color:#E1E100" onclick="farbe('Gelb')">Gelb</option>
<option style="color:#00CECE" onclick="farbe('Türkis')">Türkis</option>
<option style="color:#FF00FF" onclick="farbe('Rosa')">Rosa</option>
</select></td>
<td> </td>
</tr>
<tr>
<td colspan="8"><textarea class="hugewindow" name="message"><?=$newsvorschaumessage?></textarea></td>
</tr>
</table></td>
<tr>
<td> </td>
<td><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td><input class="buttons" name="submit" type="submit" value="Eintragen" /></td>
<td><input name="ok" type="image" src="images/buttons/buttons_vorschau.gif" border="0" value="1" /></td>
<td width="100%"> </td>
</tr>
</table></td>
</table>
</form>
<?
}
if($_GET['do'] == "add_check")
{
?>
<?
{
$ok = $_POST['ok'];
if($ok == 0) {
$titel = $_POST['titel'];
$newsbild = $_POST['newsbild'];
$quelle = $_POST['quelle'];
$text = $_POST['message'];
if(empty($titel) || empty($message))
{
if(empty($titel)) print("<center><b>Kein Titel</b></center><br>");
if(empty($message)) print("<center><b>Kein Text</b></center><br>");
}
else
{
$timestamp = time();
$eintragen = mysql_query("INSERT INTO ".$dbprefix."news ( id , titel , timestamp , text , newsbild , quelle ) VALUES ('', '$titel', '$timestamp', '$text', '$newsbild', '$quelle')");
$eintragen = mysql_query("UPDATE ".$dbprefix."vorschau SET titel = '', bild = '', quelle = '', message = ''");
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=?p=admin_ok\" target=\"_self\">";
}
}
else
{
$titel = $_POST['titel'];
$bild = $_POST['newsbild'];
$quelle = $_POST['quelle'];
$message = $_POST['message'];
mysql_query("UPDATE ".$dbprefix."vorschau SET titel = '$titel', bild = '$newsbild', quelle = '$quelle', message = '$message'");
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=?p=admin_news_vorschau&do=vorschau \">";
}
}
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>