Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?
        require_once "../Online-Shop/connect2.php";
        require_once "../includes/system/getUsers.php";
        
        $users=getUsers();
        
        if ($_POST)
        {
                if($_POST[users])
                {
                        $msg_ID = time();
                        foreach($_POST[users] as $user)
                        {
                                $query = "
                                        insert into
                                                systemtermine
                                        (
                                                msg_ID,
                                                faelligkeit,
                                                prioritaet,
                                                zielgruppe,
                                                ueberschrift,
                                                nachricht,
                                                CMS_Access_ID,
                                                deeplink,
                                                erstellt_am,
                                                erstellt_von,
                                                letzte_Aenderung_am,
                                                letzte_Aenderung_von                                            
                                        )
                                        values
                                        (
                                                '".$msg_ID."',
                                                '".$_POST[faelligkeit]."',
                                                '".$_POST[prioritaet]."',
                                                '".$user."',
                                                '".$_POST[ueberschrift]."',
                                                '".$_POST[nachricht]."',
                                                '".$_POST[CMS_Access_ID]."',
                                                '".$_POST[deeplink]."',
                                                NOW(),
                                                '".$PHP_AUTH_USER."',
                                                NOW(),
                                                '".$PHP_AUTH_USER."'
                                        )
                                ";
                                $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
                        }
                        ?><script language="JavaScript">window.close();</script><?
                }
                else
                {
                        $errorMSG = "Bitte Addressaten angeben!";
                }
        }
?>
<html>
<head>
<title>Systemnachricht erstellen</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="../checkDate.js"></script>
<script language="JavaScript">
<!--
function checkAllUsers()
{
        with (document.forms[0]) {
                for (i=0; i < elements.length; i++) {
                        if (elements[i].type == "checkbox") {
                                elements[i].checked=true;
                        }
                }
        }
}

function revertSelection()
{
        with (document.forms[0]) {
                for (i=0; i < elements.length; i++) {
                        if (elements[i].type == "checkbox") {
                                elements[i].checked = 1 ^ elements[i].checked;
                        }
                }
        }
}

function checkDeeplink()
{
        with (document.forms[0].elements["deeplink"]) {
                if (value == "") { value = opener.location.href; }              
        }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value += newText;
}
//-->
</script>
<style>
body
{
        margin:10px;
        background-color:       #<?=$webs[bgcolor_seite];?>;
}

.links
{
        background-color:       #<?=$webs[bgcolor_links];?>;
        color:                          #<?=$webs[font_color_links];?>;
        font-family:            Arial, Helvetica, sans-serif;
        font-weight:            bold;
        font-size: 12px
}

.rechts
{
        background-color:       #<?=$webs[bgcolor_rechts];?>;
        color:                          #<?=$webs[font_color_rechts];?>;
        font-family:            Arial, Helvetica, sans-serif;
        font-size: 12px
}

.errorMSG
{
        background-color:       #FFFFFF;
        color:                          #FF0000;
        font-family:            Arial, Helvetica, sans-serif;
        font-weight:            bold;
        font-size: 12px

}
</style>
</head>

<body onLoad="checkDeeplink()">
<form action="<?=$self;?>" method=POST>
  <table border="1" cellspacing="0" cellpadding="2" align="center">
    <tr> 
      <td colspan="4" class="links">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="links">Nachricht erstellen: </td>
            <td align="right"><span class=errorMSG><?=$errorMSG;?></span></td>
          </tr>
        </table>
        <span class=errorMSG> </span></td>
      <td class="links"> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td class="links">An:&nbsp;&nbsp;</td>
            <td align="right" class="links" nowrap="nowrap"> 
              <input type="button" value="Alle" onClick="checkAllUsers()">
              <input type="button" value="Auswahl umkehren" onClick="revertSelection()">
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr> 
      <td class="links">F&auml;llig: </td>
      <td class="rechts"> 
        <input type="text" name="faelligkeit" value="<?=$_POST[faelligkeit];?>" onFocus="if (this.value=='') {this.value=now('09:00:00')};this.select();">
      </td>
      <td class="links">Priorit&auml;t: </td>
      <td class="rechts" align="center"> 
        <select name="prioritaet">
                        <? foreach (array("A","B","C") as $nr => $option) { ?>
                        <option value=<?=$nr; if (($_POST[prioritaet] == $nr) or ((!$_POST[prioritaet]) and ($nr==1))) {echo " selected";} ?>><?=$option?></option>
                        <? } ?>
        </select>
      </td>
      <td rowspan="5" valign="top" class="rechts"> 
        <?
        foreach($users as $ID => $user)
        {
?>
        <input type="checkbox" name="users[]" value="<?=$ID;?>" <? if (array_search($PHP_AUTH_USER, $users) == $ID) { echo " checked"; } ?>>
        <?=$user;?>
        <br>
        <?
        }
?>
      </td>
    </tr>
    <tr> 
      <td class="links">&Uuml;berschrift: </td>
      <td colspan="3" class="rechts"> 
        <input type="text" name="ueberschrift" value="<?=$_REQUEST[ueberschrift];?>" style="width:100%">
      </td>
    </tr>
    <tr> 
      <td valign="top" class="links">Nachricht: <br>
            <?
        $query="select * from web_settings where shops_ID = 1 and ID > 249 and ID < 300 order by Rang";
        $result = mysql_query ($query) or mail("admin@weban.de","Fehler in bestell_mail_variablen.php","Benutzer: ".$PHP_AUTH_USER."\n".mysql_errno().": ".mysql_error()."<hr>$query<hr>","from: content-management");
        while($zeile=mysql_fetch_assoc($result)) 
        { ?>
            <a  class="links" href="#" onClick="MM_setTextOfTextfield('nachricht','','<?=$zeile[Inhalt];?> (<?=$PHP_AUTH_USER?>)\n')"><?=$zeile[Name];?></a><br>
        <? }
        ?>
      </td>
      <td colspan="3" class="rechts" valign="top"> 
        <textarea name="nachricht" rows="15" cols="55"><?=$_POST[nachricht];?></textarea>
      </td>
    </tr>
    <tr> 
      <td class="links">Deeplink:</td>
      <td align="right" colspan="3" class="links">
        <input type="text" name="deeplink" value="<?=$_POST[deeplink];?>" style="width:100%">
          </td>
    </tr>
    <tr> 
      <td align="right" colspan="4" class="links"> 
        <input type="hidden" name="CMS_Access_ID" value="<?=array_search($PHP_AUTH_USER, $users);?>">
        <input type="submit" name="Abschicken" value="Abschicken">
        <input type="reset" name="Zur&uuml;cksetzen" value="Zur&uuml;cksetzen">
      </td>
    </tr>
  </table>
</form>
</body>
</html>