Location: PHPKode > projects > Skrupel User Game Administration > editor.php
<?php
include ("./include/conf.inc.php");
include ("$basepfath/inc.conf.php");
include ("$usedpfath/include/header.inc.php");

if ($HTTP_GET_VARS["fu"]==1)
 {
 $inhalt="";
 if($id !="neu")
  {
  $sql="SELECT html_text FROM skrupel_usedcomm$what WHERE id='$id'";
  $result=mysql_query($sql);
  $row=mysql_fetch_array ($result);
  $inhalt=$row["html_text"];
  }
?>
<html>
<head>
<link REL="stylesheet" TYPE="text/css" HREF="<?=$usedurl?>/templates/toolbars.css">
<script LANGUAGE="JavaScript" SRC="include/js/dhtmled.js"></script>
<SCRIPT LANGUAGE="JavaScript" ID=clientEventHandlersJS>
var buttons = new Array();

// button objekt
function toolbar_button(cmd, element)
 {
 this.cmd=cmd;
 this.element=element;
 }

function get_text()
 {
 return tbContentElement.DOM.body.innerHTML;
 }

function window_onload()
 {
 // alle buttons in einem array speichern
 buttons[0] = new toolbar_button(DECMD_BOLD, document.body.all["bold"]);
 buttons[1] = new toolbar_button(DECMD_ITALIC, document.body.all["italic"]);
 buttons[2] = new toolbar_button(DECMD_UNDERLINE, document.body.all["underline"]);
 buttons[3] = new toolbar_button(DECMD_CUT, document.body.all["cut"]);
 buttons[4] = new toolbar_button(DECMD_COPY, document.body.all["copy"]);
 buttons[5] = new toolbar_button(DECMD_PASTE, document.body.all["paste"]);
 buttons[6] = new toolbar_button(DECMD_UNDO, document.body.all["undo"]);
 buttons[7] = new toolbar_button(DECMD_REDO, document.body.all["redo"]);
 buttons[8] = new toolbar_button(DECMD_JUSTIFYLEFT, document.body.all["justifyleft"]);
 buttons[9] = new toolbar_button(DECMD_JUSTIFYRIGHT, document.body.all["justifyright"]);
 buttons[10] = new toolbar_button(DECMD_JUSTIFYCENTER, document.body.all["justifycenter"]);
 buttons[11] = new toolbar_button(DECMD_ORDERLIST, document.body.all["orderlist"]);
 buttons[12] = new toolbar_button(DECMD_UNORDERLIST, document.body.all["unorderlist"]);
 buttons[13] = new toolbar_button(DECMD_OUTDENT, document.body.all["outdent"]);
 buttons[14] = new toolbar_button(DECMD_INDENT, document.body.all["indent"]);
 buttons[15] = new toolbar_button(DECMD_HYPERLINK, document.body.all["hyperlink"]);

 tbContentElement.documentHTML=document.all.html_text.value;
 }

// erspart den aufruf von unterschiedlichen Funktionen für jedes Kommando
function exec(commandID)
 {
 eval("tbContentElement.ExecCommand(DECMD_" + commandID + ");");
 tbContentElement.focus();
 }

function ParagraphStyle_onchange()
 {
 tbContentElement.ExecCommand(DECMD_SETBLOCKFMT, OLECMDEXECOPT_DODEFAULT, ParagraphStyle.value);
 tbContentElement.focus();
 }

function FontName_onchange()
 {
 tbContentElement.ExecCommand(DECMD_SETFONTNAME, OLECMDEXECOPT_DODEFAULT, FontName.value);
 tbContentElement.focus();
 }

function FontSize_onchange()
 {
 tbContentElement.ExecCommand(DECMD_SETFONTSIZE, OLECMDEXECOPT_DODEFAULT, parseInt(FontSize.value));
 tbContentElement.focus();
 }

// html code auf dem server speichern
function MENU_FILE_SAVE_onclick()
 {
 window.parent.submit_form(tbContentElement.DOM.body.innerHTML);
 }

function show_change()
 {
 var s;
 for (i=0; i<buttons.length; i++)
  {
  s = tbContentElement.QueryStatus(buttons[i].cmd);
 if (s == DECMDF_DISABLED || s == DECMDF_NOTSUPPORTED)
  {
  TBSetState(buttons[i].element, "gray");
  }
 else if (s == DECMDF_ENABLED  || s == DECMDF_NINCHED)
  {
  TBSetState(buttons[i].element, "unchecked");
  }
  else
   {
   TBSetState(buttons[i].element, "checked");
   }
  }
 s = tbContentElement.QueryStatus(DECMD_GETBLOCKFMT);
 if (s == DECMDF_DISABLED || s == DECMDF_NOTSUPPORTED)
  {
  ParagraphStyle.disabled = true;
  }
  else
   {
   ParagraphStyle.disabled = false;
   ParagraphStyle.value = tbContentElement.ExecCommand(DECMD_GETBLOCKFMT, OLECMDEXECOPT_DODEFAULT);
   }
 }
</script>

<script LANGUAGE="javascript" FOR="tbContentElement" EVENT="DisplayChanged">
return show_change();
</script>

</head>
<body onload="return window_onload()">
<div class="tbToolbar" ID="StandardToolbar">
 <div class="tbButton" ID="MENU_FILE_SAVE" TITLE="Speichern" LANGUAGE="javascript" onclick="return MENU_FILE_SAVE_onclick()">
  <img class="tbIcon" src="images/save.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbSeparator"></div>
 <div class="tbButton" ID="undo" TITLE="Rückgängig" LANGUAGE="javascript" onclick="return exec('UNDO')">
  <img class="tbIcon" src="images/undo.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="redo" TITLE="Wiederholen" LANGUAGE="javascript" onclick="return exec('REDO')">
   <img class="tbIcon" src="images/redo.gif" WIDTH="23" HEIGHT="22">
 </div>
</div>

<div class="tbToolbar" ID="FormatToolbar">
 <select ID="ParagraphStyle" class="tbGeneral" style="width:90" TITLE="Paragraph Format" LANGUAGE="javascript" onchange="return ParagraphStyle_onchange()">
    <option id=op1 value="Überschrift 1">Überschrift 1
    <option id=op2 value="Überschrift 2">Überschrift 2
    <option id=op3 value="Überschrift 3">Überschrift 3
    <option id=op4 value="Überschrift 4">Überschrift 4
    <option id=op5 value="Überschrift 5">Überschrift 5
    <option id=op6 value="Überschrift 6">Überschrift 6
    <option id=op7 value="Addresse">Addresse
    <option id=op8 value="Formatiert">Formatiert
    <option id=op9 value="Normal">Normal
 </select>
 <select ID="FontName" class="tbGeneral" style="width:137" TITLE="Font Name" LANGUAGE="javascript" onchange="return FontName_onchange()">
    <option value="Arial">Arial
    <option value="Tahoma">Tahoma
    <option value="Courier New">Courier New
    <option value="Times New Roman">Times New Roman
    <option value="Verdana">Verdana
 </select>
  <select ID="FontSize" class="tbGeneral" style="width:40" TITLE="Font Size" LANGUAGE="javascript" onchange="return FontSize_onchange()">
    <option value="1">1
    <option value="2">2
    <option value="3">3
    <option value="4">4
    <option value="5">5
    <option value="6">6
    <option value="7">7
 </select>
</div>

<div class="tbToolbar" ID="StandardToolbar">
 <div class="tbButton" ID="cut" TITLE="Ausschneiden" LANGUAGE="javascript" onclick="return exec('CUT')">
  <img class="tbIcon" src="images/cut.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="copy" TITLE="Kopieren" LANGUAGE="javascript" onclick="return exec('COPY')">
  <img class="tbIcon" src="images/copy.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="paste" TITLE="Einfügen" LANGUAGE="javascript" onclick="return exec('PASTE')">
  <img class="tbIcon" src="images/paste.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbSeparator"></div>
 <div class="tbButton" ID="bold" TITLE="Bold" TBTYPE="toggle" onclick="return exec('BOLD')">
  <img class="tbIcon" src="images/bold.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="italic" TITLE="Kursiv" TBTYPE="toggle" LANGUAGE="javascript" onclick="return exec('ITALIC')">
  <img class="tbIcon" src="images/italic.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="underline" TITLE="Unterstrichen" TBTYPE="toggle" LANGUAGE="javascript" onclick="return exec('UNDERLINE')">
  <img class="tbIcon" src="images/under.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbSeparator"></div>
 <div class="tbButton" ID="justifyleft" TITLE="Links ausrichten" TBTYPE="radio" NAME="Justify" LANGUAGE="javascript" onclick="return exec('JUSTIFYLEFT')">
  <img class="tbIcon" src="images/left.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="justifycenter" TITLE="Zentrieren" TBTYPE="radio" NAME="Justify" LANGUAGE="javascript" onclick="return exec('JUSTIFYCENTER')">
  <img class="tbIcon" src="images/center.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="justifyright" TITLE="Rechts ausrichten" TBTYPE="radio" NAME="Justify" LANGUAGE="javascript" onclick="return exec('JUSTIFYRIGHT')">
  <img class="tbIcon" src="images/right.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbSeparator"></div>
 <div class="tbButton" ID="orderlist" TITLE="Nummerierte Liste" TBTYPE="toggle" LANGUAGE="javascript" onclick="return exec('ORDERLIST')">
  <img class="tbIcon" src="images/numlist.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="unorderlist" TITLE="Aufzählung" TBTYPE="toggle" LANGUAGE="javascript" onclick="return exec('UNORDERLIST')">
  <img class="tbIcon" src="images/bullist.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbSeparator"></div>
 <div class="tbButton" ID="outdent" TITLE="Einzug verringern" LANGUAGE="javascript" onclick="return exec('OUTDENT')">
  <img class="tbIcon" src="images/deindent.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbButton" ID="indent" TITLE="Einzug vergrößern" LANGUAGE="javascript" onclick="return exec('INDENT')">
  <img class="tbIcon" src="images/inindent.gif" WIDTH="23" HEIGHT="22">
 </div>
 <div class="tbSeparator"></div>
 <div class="tbButton" ID="hyperlink" TITLE="Link" LANGUAGE="javascript" onclick="return exec('HYPERLINK')">
  <img class="tbIcon" src="images/link.gif" WIDTH="23" HEIGHT="22">
 </div>
</div>

<OBJECT classid="clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A" id=tbContentElement class=tbContentElement height=380 width=200></OBJECT>
<script LANGUAGE="Javascript" SRC="include/js/toolbars.js"></script>
<form name=form1>
<input type=hidden name=html_text value='<?= $inhalt ?> '>
</form>
</body>
</html>
<?
}
?>
Return current item: Skrupel User Game Administration