mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-03-31 02:20:22 +02:00
Minimal module implementation emailbackup -> to be replaced by auto-generated module
This commit is contained in:
parent
5fcf353050
commit
448e1e569c
53
www/pages/content/emailbackup_edit.tpl
Normal file
53
www/pages/content/emailbackup_edit.tpl
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<!--<table border="0" width="100%">
|
||||||
|
<tr><td><table width="100%"><tr><td>[USER_CREATE]</td></tr></table></td></tr>
|
||||||
|
</table>-->
|
||||||
|
<style>
|
||||||
|
ul.ui-autocomplete {
|
||||||
|
/*padding-top:100px;*/
|
||||||
|
}
|
||||||
|
#trdummy {
|
||||||
|
height:0;
|
||||||
|
width:0;
|
||||||
|
overflow: hidden;
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!-- gehort zu tabview -->
|
||||||
|
<div id="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tabs-1">{|E-Mailaccount|}</a></li>
|
||||||
|
<!-- <li><a href="#tabs-3">{|Rechte|}</a></li> -->
|
||||||
|
</ul>
|
||||||
|
<!-- ende gehort zu tabview -->
|
||||||
|
|
||||||
|
<!-- erstes tab -->
|
||||||
|
<div id="tabs-1">
|
||||||
|
[MESSAGE]
|
||||||
|
<form enctype="multipart/form-data" action="" method="post" name="eprooform" id="usereditform">
|
||||||
|
[FORMHANDLEREVENT]
|
||||||
|
|
||||||
|
<table class="tableborder" border="0" cellpadding="3" cellspacing="0" width="100%">
|
||||||
|
<tbody>
|
||||||
|
<tr valign="top" colspan="3">
|
||||||
|
<td >
|
||||||
|
<fieldset><legend>{|E-Mailaccount|}</legend>
|
||||||
|
<table width="100%" border="0">
|
||||||
|
<tr><td>{|E-Mailadresse|}:*</td><td><input type="text" name="email" value="[EMAIL]" size="40"></td></tr>
|
||||||
|
<tr><td width="200">{|Angezeigter Name|}:</td><td><input type="text" name="angezeigtername" value="[ANGEZEIGTERNAME]" size="40"><i>{|Wird als Absendername angezeigt.|}</i></td></tr>
|
||||||
|
|
||||||
|
|
||||||
|
</table></fieldset>
|
||||||
|
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr valign="" height="" bgcolor="" align="" bordercolor="" class="klein" classname="klein">
|
||||||
|
<td width="" valign="" height="" bgcolor="" align="right" colspan="3" bordercolor="" classname="orange2" class="orange2">
|
||||||
|
<input type="submit" id="submit" name="submitemailbackup" value="Speichern" />
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
20
www/pages/content/emailbackup_list.tpl
Normal file
20
www/pages/content/emailbackup_list.tpl
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<div id="tabs">
|
||||||
|
<ul><li><a href="#tabs-1"></a></li></ul>
|
||||||
|
<div id="tabs-1">
|
||||||
|
[MESSAGE]
|
||||||
|
<div class="row">
|
||||||
|
<div class="row-height">
|
||||||
|
<div class="col-xs-12 col-sm-12 col-sm-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset>
|
||||||
|
<legend></legend>
|
||||||
|
[ACCOUNT_TABLE]
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
[POPUP]
|
231
www/pages/emailbackup.php
Normal file
231
www/pages/emailbackup.php
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||||
|
*
|
||||||
|
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||||
|
*
|
||||||
|
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||||
|
*
|
||||||
|
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||||
|
* to obtain the text of the corresponding license version.
|
||||||
|
*
|
||||||
|
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||||
|
|
||||||
|
Copyright (c) 2022 Xenomporio project
|
||||||
|
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Xentral\Components\Database\Exception\QueryFailureException;
|
||||||
|
|
||||||
|
class Emailbackup
|
||||||
|
{
|
||||||
|
function __construct($app, $intern = false)
|
||||||
|
{
|
||||||
|
$this->app=$app;
|
||||||
|
if($intern)return;
|
||||||
|
|
||||||
|
$this->app->ActionHandlerInit($this);
|
||||||
|
|
||||||
|
$this->app->ActionHandler("create","EmailbackupCreate");
|
||||||
|
$this->app->ActionHandler("delete","EmailbackupDelete");
|
||||||
|
$this->app->ActionHandler("edit","EmailbackupEdit");
|
||||||
|
$this->app->ActionHandler("list","EmailbackupList");
|
||||||
|
|
||||||
|
$this->app->DefaultActionHandler("list");
|
||||||
|
|
||||||
|
//$this->Templates = $this->GetTemplates();
|
||||||
|
|
||||||
|
$this->app->ActionHandlerListen($app);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Install()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
function EmailbackupList()
|
||||||
|
{
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=uservorlage&action=list","Übersicht");
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=uservorlage&action=history","Historie");
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=uservorlage&action=create","Neue Benutzervorlage anlegen");
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=einstellungen&action=list","Zurück zur Übersicht");
|
||||||
|
|
||||||
|
$this->app->YUI->TableSearch('ACCOUNT_TABLE','mailaccount_list',"show","","",basename(__FILE__), __CLASS__);
|
||||||
|
$this->app->Tpl->Parse('PAGE', "emailbackup_list.tpl");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static function TableSearch(&$app, $name, $erlaubtevars) {
|
||||||
|
switch ($name) {
|
||||||
|
case "mailaccount_list":
|
||||||
|
|
||||||
|
$allowed['mailaccount_list'] = array('list');
|
||||||
|
$heading = array('Adresse', 'Angezeigter Name','Ticket','Emailbackup', 'Menü');
|
||||||
|
$width = array('40%','50%', '10%');
|
||||||
|
|
||||||
|
$findcols = array('id','email', 'angezeigtername','ticket','emailbackup');
|
||||||
|
$searchsql = array('id','email', 'angezeigtername');
|
||||||
|
|
||||||
|
$defaultorder = 1;
|
||||||
|
$defaultorderdesc = 0;
|
||||||
|
|
||||||
|
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>"."<a href=\"index.php?module=emailbackup&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.png\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=emailbackup&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>"."</td></tr></table>";
|
||||||
|
|
||||||
|
$sql = "SELECT id, email, angezeigtername, CASE WHEN ticket=1 THEN 'Ja' ELSE '' END, CASE WHEN emailbackup=1 THEN 'Ja' ELSE '' END, id FROM emailbackup";
|
||||||
|
|
||||||
|
// $where = "m.geloescht = 0";
|
||||||
|
|
||||||
|
$groupby = "";
|
||||||
|
|
||||||
|
// $count = "SELECT count(DISTINCT id) FROM emailbackup WHERE $where";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$erg = false;
|
||||||
|
|
||||||
|
foreach($erlaubtevars as $k => $v)
|
||||||
|
{
|
||||||
|
if(isset($$v))$erg[$v] = $$v;
|
||||||
|
}
|
||||||
|
return $erg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function UservorlageDelete(): void
|
||||||
|
{
|
||||||
|
$id = (int)$this->app->Secure->GetGET('id');
|
||||||
|
|
||||||
|
$benutzervorlage = $this->app->DB->Select("SELECT bezeichnung FROM `uservorlage` WHERE id='$id' LIMIT 1");
|
||||||
|
$users = $this->app->DB->Select("SELECT `username` FROM `user` WHERE `vorlage` = '$benutzervorlage'");
|
||||||
|
$prefix = "\"";
|
||||||
|
if (!empty($users)) {
|
||||||
|
$usernames = "";
|
||||||
|
if (is_array($users)) {
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$usernames = $usernames.$prefix.$user[0]."\"";
|
||||||
|
$prefix = ", \"";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$usernames = $users;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">{|Benutzervorlage \"$benutzervorlage\" ist in Benutzung durch ".$usernames.".|}</div>");
|
||||||
|
} else {
|
||||||
|
$this->app->DB->Delete("DELETE FROM `uservorlage` WHERE `id` = '{$id}'");
|
||||||
|
$this->app->DB->Delete("DELETE FROM `uservorlagerights` WHERE `vorlage` = '{$id}'");
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Die Benutzervorlage \"$benutzervorlage\" wurde gelöscht.</div>");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->UservorlageList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function UservorlageCreate()
|
||||||
|
{
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=uservorlage&action=list","Zurück zur Übersicht");
|
||||||
|
|
||||||
|
$input = $this->GetInput();
|
||||||
|
$submit = $this->app->Secure->GetPOST('submituservorlage');
|
||||||
|
|
||||||
|
$error = '';
|
||||||
|
$maxlightuser = 0;
|
||||||
|
|
||||||
|
if($submit!='') {
|
||||||
|
|
||||||
|
if($input['bezeichnung']=='') {
|
||||||
|
$error .= 'Geben Sie bitte einen Vorlagennamen ein.<br>';
|
||||||
|
}
|
||||||
|
if($this->app->DB->Select("SELECT '1' FROM `uservorlage` WHERE bezeichnung='{$input['bezeichnung']}' LIMIT 1")=='1') {
|
||||||
|
$error .= "Es existiert bereits eine Vorlage mit diesem Namen";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($error!=='')
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">$error</div>");
|
||||||
|
else {
|
||||||
|
|
||||||
|
$id = $this->app->erp->CreateBenutzerVorlage($input);
|
||||||
|
|
||||||
|
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Die Benutzervorlage wurde erfolgreich angelegt.</div>");
|
||||||
|
header("Location: index.php?module=uservorlage&action=edit&id=$id&msg=$msg");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->SetInput($input);
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('ACTIVCHECKED',"checked");
|
||||||
|
$this->app->Tpl->Set('VORRECHTE',"<!--");
|
||||||
|
$this->app->Tpl->Set('NACHRECHTE',"-->");
|
||||||
|
$extra = '
|
||||||
|
if($(\'#hwtoken\').val() == \'4\' || $(\'#hwtoken\').val() == \'5\')
|
||||||
|
{
|
||||||
|
message = \'\';
|
||||||
|
}
|
||||||
|
';
|
||||||
|
$this->app->YUI->PasswordCheck('password', 'repassword', 'username', 'submit', $extra);
|
||||||
|
$this->app->Tpl->Parse('PAGE', "uservorlage_edit.tpl");
|
||||||
|
}
|
||||||
|
|
||||||
|
function EmailbackupEdit()
|
||||||
|
{
|
||||||
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
$this->app->Tpl->Set('ID', $id);
|
||||||
|
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=emailbackup&action=edit&id=$id","Details");
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=emailbackup&action=list","Zurück zur Übersicht");
|
||||||
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
$input = $this->GetInput();
|
||||||
|
$submit = $this->app->Secure->GetPOST('submitemailbackup');
|
||||||
|
|
||||||
|
// Input GET
|
||||||
|
if(is_numeric($id) && $submit!='') {
|
||||||
|
$error = '';
|
||||||
|
if ($input['bezeichnung']=='') {
|
||||||
|
$error .= 'Geben Sie bitte eine Bezeichnung ein.<br>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
$this->app->DB->Update(
|
||||||
|
sprintf(
|
||||||
|
"UPDATE `uservorlage`
|
||||||
|
SET bezeichnung='%s',
|
||||||
|
beschreibung='%s'
|
||||||
|
WHERE id=%d
|
||||||
|
LIMIT 1",
|
||||||
|
$input['bezeichnung'],
|
||||||
|
$input['beschreibung'],
|
||||||
|
$id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||||
|
}
|
||||||
|
} // END Input Get
|
||||||
|
|
||||||
|
$email = $this->app->DB->Select("SELECT email FROM `emailbackup` WHERE id='$id' LIMIT 1");
|
||||||
|
$angezeigtername = $this->app->DB->Select("SELECT angezeigtername FROM `emailbackup` WHERE id='$id' LIMIT 1");
|
||||||
|
$this->app->Tpl->Add('KURZUEBERSCHRIFT2',$email);
|
||||||
|
$this->app->Tpl->Add('EMAIL',$email);
|
||||||
|
$this->app->Tpl->Add('ANGEZEIGTERNAME',$angezeigtername);
|
||||||
|
|
||||||
|
$this->app->Tpl->Parse('PAGE', "emailbackup_edit.tpl");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function GetInput(): array
|
||||||
|
{
|
||||||
|
$input = array();
|
||||||
|
$input['EMAIL'] = $this->app->Secure->GetPOST('email');
|
||||||
|
$input['ANGEZEIGTERNAME'] = $this->app->Secure->GetPOST('angezeigtername');
|
||||||
|
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetInput($input)
|
||||||
|
{
|
||||||
|
$this->app->Tpl->Set('EMAIL', $input['email']);
|
||||||
|
$this->app->Tpl->Set('ANGEZEIGTERNAME', $input['angezeigtername']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user