<?php

namespace Tables;

class Fop_mail_host_box {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function getDefaults() { 
    
    
    // --- BLOCK: main ---
    
	// erstellt ein leeres Objekt zum Befüllen mit Daten oder als Default fürs Create-Formular
	$data = ['user' => '',
		'password' => '',
		'from_name' => '',
		'from_address' => null,
		'email_server' => null,
		'syncdate' => time(),
		'trash_dir' => null,
		'spam_dir' => null,
		'sent_dir' => null,
		'status' => '',
		'signature' => '',
		'zustand' => '0'];
	return $data;
	
    
  }

  public static function deleteConfirmAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		

		
		/* Sanitizer */

		

		
	}
	
    // --- BLOCK: access-itemlist-fop_mail_host_box-delete ---
    
		// ID-Liste neu aufbauen und nur die übrig lassen, die auch erlaubt sind
		$id_ = new \FOP\IDList($id);
		$id = new \FOP\IDList();
		foreach (\FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('fop_mail_host_box').' WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND ' . $id_->toSQL(qi('ID')))->fetchAll(\PDO::FETCH_COLUMN) AS $id_sub) {
			$id->push($id_sub);
		}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (true) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-a-move_fop_mail_host_box_dir_mailbox ---
    
		if (isset($_POST['move_fop_mail_host_box_dir_mailbox'])) {
			\Types\Fop_mail_host_box::validate($_POST['value_fop_mail_host_box_dir_mailbox']);
			$_POST['value_fop_mail_host_box_dir_mailbox'] = \FOP\Sanitizers::null_filter($_POST['value_fop_mail_host_box_dir_mailbox']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('fop_mail_host_box_dir').' SET '.qi('mailbox').' = ' . \FOP\Database::quote($_POST['value_fop_mail_host_box_dir_mailbox']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('mailbox').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('fop_mail_host_box_dir').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('mailbox').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\Fop_mail_host_box_dir::deleteConfirmURL2(['id' => new \FOP\IDList($remaining), 'from' => $_POST['from']]) . '#snack:Einige Elemente waren nicht verschiebbar');
			} else {
				header('Location: ' . $_POST['from']);
			}
			die();
		}
	
    // --- BLOCK: main-2:save-a-move_fop_mail_host_box_draft_mailbox ---
    
		if (isset($_POST['move_fop_mail_host_box_draft_mailbox'])) {
			\Types\Fop_mail_host_box_send::validate($_POST['value_fop_mail_host_box_draft_mailbox']);
			$_POST['value_fop_mail_host_box_draft_mailbox'] = \FOP\Sanitizers::null_filter($_POST['value_fop_mail_host_box_draft_mailbox']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('fop_mail_host_box_draft').' SET '.qi('mailbox').' = ' . \FOP\Database::quote($_POST['value_fop_mail_host_box_draft_mailbox']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('mailbox').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('fop_mail_host_box_draft').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('mailbox').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\Fop_mail_host_box_draft::deleteConfirmURL2(['id' => new \FOP\IDList($remaining), 'from' => $_POST['from']]) . '#snack:Einige Elemente waren nicht verschiebbar');
			} else {
				header('Location: ' . $_POST['from']);
			}
			die();
		}
	
    // --- BLOCK: main-2:save-a-move_fop_mail_host_box_share_mailbox ---
    
		if (isset($_POST['move_fop_mail_host_box_share_mailbox'])) {
			\Types\Fop_mail_host_box::validate($_POST['value_fop_mail_host_box_share_mailbox']);
			$_POST['value_fop_mail_host_box_share_mailbox'] = \FOP\Sanitizers::null_filter($_POST['value_fop_mail_host_box_share_mailbox']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('fop_mail_host_box_share').' SET '.qi('mailbox').' = ' . \FOP\Database::quote($_POST['value_fop_mail_host_box_share_mailbox']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('mailbox').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('fop_mail_host_box_share').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('mailbox').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\Fop_mail_host_box_share::deleteConfirmURL2(['id' => new \FOP\IDList($remaining), 'from' => $_POST['from']]) . '#snack:Einige Elemente waren nicht verschiebbar');
			} else {
				header('Location: ' . $_POST['from']);
			}
			die();
		}
	
    // --- BLOCK: main-2:save-main ---
    /* view */
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['no'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Fop_mail_host_box::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		if (isset($_POST['yes'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from'] && strrpos($_POST['fop-from'], 'insert_param') !== false) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Fop_mail_host_box::deleteURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = [];
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo(_('confirmdelete')); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(_('confirmdelete')); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(_('confirmdelete')); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<form
									
									action="<?php echo \TablesRouter\Fop_mail_host_box::deleteConfirmURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
								 
								id="cardform-wf_fop_mail_host_box_deleteConfirm"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_fop_mail_host_box_deleteConfirm" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'constraints',
										'title' => _(''),
										'order' => '200', // 200 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'wf:fop_mail_host_box:deleteConfirm\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['constraints']);
										?><div class='fop-delete-constraints'><?php
	$foundProblems = false;
	
		$items = \FOP\Database::query('SELECT '.qi('ID').' AS '.qi('ID').', '.qi('ID').' AS '.qi('desc').' FROM '.qi('fop_mail_host_box_dir').' WHERE ' . $id->toSQL(''.qi('mailbox').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletioncascade') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\Fop_mail_host_box_dir::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('emaildirectory_singular')) . ' ' . $item['desc'])) . '</a>';
				
			echo '<br>';
		}
		if (count($items)) {
			
			
				echo htmlentities(_('deletemove'));
				?>: <div style="display: inline-block;" class="novalidate"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Fop_mail_host_box::renderEditfop_mail_host_box_dir_mailbox_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box%26colinsert=value_fop_mail_host_box_dir_mailbox%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box%26colinsert=value_fop_mail_host_box_dir_mailbox%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_fop_mail_host_box_dir_mailbox" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			
			echo '<hr><br>';
		}
	
		$items = \FOP\Database::query('SELECT '.qi('ID').' AS '.qi('ID').', '.qi('ID').' AS '.qi('desc').' FROM '.qi('fop_mail_host_box_share').' WHERE ' . $id->toSQL(''.qi('mailbox').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletioncascade') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\Fop_mail_host_box_share::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Freigabe')) . ' ' . $item['desc'])) . '</a>';
				
			echo '<br>';
		}
		if (count($items)) {
			
			
				echo htmlentities(_('deletemove'));
				?>: <div style="display: inline-block;" class="novalidate"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Fop_mail_host_box::renderEditfop_mail_host_box_share_mailbox_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box%26colinsert=value_fop_mail_host_box_share_mailbox%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box%26colinsert=value_fop_mail_host_box_share_mailbox%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_fop_mail_host_box_share_mailbox" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			
			echo '<hr><br>';
		}
	
		$items = \FOP\Database::query('SELECT '.qi('ID').' AS '.qi('ID').', '.qi('ID').' AS '.qi('desc').' FROM '.qi('fop_mail_host_box_draft').' WHERE ' . $id->toSQL(''.qi('mailbox').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletioncascade') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\Fop_mail_host_box_draft::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('draft')) . ' ' . $item['desc'])) . '</a>';
				
			echo '<br>';
		}
		if (count($items)) {
			
			
				echo htmlentities(_('deletemove'));
				?>: <div style="display: inline-block;" class="novalidate"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Fop_mail_host_box::renderEditfop_mail_host_box_draft_mailbox_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_send%26colinsert=value_fop_mail_host_box_draft_mailbox%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_send%26colinsert=value_fop_mail_host_box_draft_mailbox%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box_send", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_fop_mail_host_box_draft_mailbox" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			
			echo '<hr><br>';
		}
	
?></div><?php
										\EasyEditor\FormFeature::pop();
										$features['constraints']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_fop_mail_host_box_deleteConfirm_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if (true) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="no" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">cancel</i><?php echo(_('no')); ?></button><?php } ?>
									&nbsp;<?php if ((!$foundProblems)) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="yes" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">delete</i><?php echo(_('yes')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_fop_mail_host_box_deleteConfirm_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?><?php echo htmlentities(_('confirmdelete')) . ' (' . $id->count() . '× ' . _('emailmailbox_singular') . ')'; ?><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Afop_mail_host_box%3AdeleteConfirm&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=wf%3Afop_mail_host_box%3AdeleteConfirm&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_fop_mail_host_box_deleteConfirm')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_fop_mail_host_box_deleteConfirm input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function viewAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!(!\FOP\User::getIsGuest())) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		

		
		/* Sanitizer */

		

		
	}
	
    // --- BLOCK: fetch ---
    
	\FOP\I18n::ensureIsLoaded();
	$row = self::view($id);

    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (!isset($_POST['ok'])) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-clone-prepare ---
    
		$data = self::view($id);
	
    // --- BLOCK: main-2:save-main ---
    /* view */
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['ok'])) {
			
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . (isset($id) && is_string($id) ? preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']) : $_POST['fop-from']));
			} else {
				if ($to = (isset($_GET['popup']) ? \FOP\Util::getCurrentBaseurl().'jscloser.php?action=popup' : \FOP\Session::getPayload('dv-fop_mail_host_box')['from'] ?? null)) {
					header('Location: ' . $to);
					die();
				}
				if (!\TablesRouter\Fop_mail_host_box::indexAccess()) {
					if (!\FOPRouter\Index::indexAccess()) {
						header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null]));
						die();
					}
					header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null]));
					die();
				}
				header('Location: ' . \TablesRouter\Fop_mail_host_box::indexURL2(['popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = self::view($id); // TODO: klären, wer die Funktion bereitstellt (momentan crud/view.fop)
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT '.qi('fop_mail_host_box').'.'.qi('from_address').' AS description FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('%s'))); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<?php
	if ($dv = \FOP\Session::getPayload('dv-fop_mail_host_box')) { ?>
	<?php if (isset($dv['prev'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['prev'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_left</i>
	</a><?php } ?>
	<a href="<?php echo htmlentities($dv['from']); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">view_list</i>
	</a>
	<?php if (isset($dv['next'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['next'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_right</i>
	</a><?php } ?><?php } ?><span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT '.qi('fop_mail_host_box').'.'.qi('from_address').' AS description FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('%s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<?php
	if ($dv = \FOP\Session::getPayload('dv-fop_mail_host_box')) { ?>
	<?php if (isset($dv['prev'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['prev'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_left</i>
	</a><?php } ?>
	<a href="<?php echo htmlentities($dv['from']); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">view_list</i>
	</a>
	<?php if (isset($dv['next'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['next'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_right</i>
	</a><?php } ?><?php } ?><span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT '.qi('fop_mail_host_box').'.'.qi('from_address').' AS description FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('%s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<form
									
									action="<?php echo \TablesRouter\Fop_mail_host_box::viewURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_fop_mail_host_box_view"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_fop_mail_host_box_view" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								<?php \DataView\Fop_mail_host_box_share_mailbox::renderScript($id); ?><?php \DataView\Fop_mail_host_box_dir_mailbox::renderScript($id); ?>
									<?php
									$features = [];
									if ((true) && (!\FOP\User::getIsGuest()) && (true)) {
									$feature = [
										'id' => 'fop_mail_host_box_share_mailbox_table',
										'title' => _('Freigaben'),
										'order' => '500-100', // 500-100 (50)
										'mode' => 'tab', // tab (50)
										'position' => 'full', // 
										'collapsed' => 0, // 0 (51) / 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if ((true) && (!\FOP\User::getIsGuest()) && (true)) {
									$feature = [
										'id' => 'fop_mail_host_box_dir_mailbox_table',
										'title' => _('directory'),
										'order' => '500-100', // 500-100 (50)
										'mode' => 'tab', // tab (50)
										'position' => 'full', // 
										'collapsed' => 0, // 0 (51) / 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true || true || true || true || true || true || true || true || true || true || true || true || true)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'wf:fop_mail_host_box:view\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if ((true) && (!\FOP\User::getIsGuest()) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['fop_mail_host_box_share_mailbox_table']);
										?>
	<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
	<div id="fop_mail_host_box_share_mailbox-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadfop_mail_host_box_share_mailbox()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\Fop_mail_host_box_share_mailbox::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['fop_mail_host_box_share_mailbox_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if ((true) && (!\FOP\User::getIsGuest()) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['fop_mail_host_box_dir_mailbox_table']);
										?>
	<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
	<div id="fop_mail_host_box_dir_mailbox-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadfop_mail_host_box_dir_mailbox()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\Fop_mail_host_box_dir_mailbox::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['fop_mail_host_box_dir_mailbox_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_fop_mail_host_box_view_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'>
		<?php if (true && $data['operation::view'] == 1 && $data['operation::edit'] == 1 && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('editbtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Fop_mail_host_box::editURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>mode_edit</i> <?php echo(_('editbtn')); ?></a><?php } ?>&nbsp;<?php if (true) { ?><button onclick="$(this).closest('form').find('.mdl-textfield__error:visible').hide();
		$('[required]').removeAttr('required');
	" type="submit" name="ok" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">check</i><?php echo(_('ok')); ?></button><?php } ?>
									&nbsp;
		<?php if (true && $data['operation::view'] == 1 && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('activate/deactivate mailbox')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Fop_mail_host_box::mailboxSyncURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>power_settings_new</i> <?php echo(_('activate/deactivate mailbox')); ?></a><?php } ?>&nbsp;
		<?php if (true && $data['operation::send'] == 1 && $data['operation::view'] == 1 && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('sendmail')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Fop_mail_host_box_draft::createURL2(['column_mailbox' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>send</i> <?php echo(_('sendmail')); ?></a><?php } ?>&nbsp;
		<?php if ($data['operation::delete'] == 1 && $data['operation::delete'] == 1 && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('deletebtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Fop_mail_host_box::deleteConfirmURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null, 'from' => $_GET['from'] ?? \FOP\Session::getPayload('dv-fop_mail_host_box')['from'] ?? null])); ?>"><i class='material-icons'>delete</i> <?php echo(_('deletebtn')); ?></a><?php } ?></div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_fop_mail_host_box_view_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true || true || true || true || true || true || true || true || true || true || true || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_fopuser_" id="column_fopuser_">
		<!-- Feld "owner": fopuser_ -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="fopuser_"><?php echo(_('owner')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description, ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('canView').' FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['fopuser_']);
	$mitglied_result = \FOP\Database::query($sql);
	if ($mitglied_row = $mitglied_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($mitglied_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, true);\" href=\"" . \TablesRouter\Mitglied::viewURL($data['fopuser_'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"mitglied\" data-id=\"".htmlentities($mitglied_row['ID'])."\">";echo htmlentities($mitglied_row['description']);if ($mitglied_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('') ?: '-');
	}
	
?>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_user" id="column_user">
		<!-- Feld "user": user -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="user"><?php echo(_('user')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['user']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_password" id="column_password">
		<!-- Feld "password": password -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="password"><?php echo(_('password')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities('*****'); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_from_name" id="column_from_name">
		<!-- Feld "displayname": from_name -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="from_name"><?php echo(_('displayname')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['from_name']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_from_address" id="column_from_address">
		<!-- Feld "E-Mail": from_address -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="from_address"><?php echo(_('E-Mail')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span class='overflow-text'><a onclick="event.stopPropagation();<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>event.preventDefault(); window.open_over(document.baseURI + 'Tables/Fop_mail_host_box_draft/create?to=' + encodeURIComponent(this.href.substr(7)) + '&popup&from=' + encodeURIComponent(document.baseURI + 'jscloser.php?action=popup&close')); <?php } ?>
" href="<?php echo ('mailto:' . htmlentities(($data['from_address']))); ?>"><?php echo htmlentities($data['from_address']); ?></a></span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_server" id="column_email_server">
		<!-- Feld "emailhost": email_server -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_server"><?php echo(_('emailhost')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', '.qi('fop_mail_host').'.'.qi('name').' AS description, ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('canView').' FROM '.qi('fop_mail_host').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['email_server']);
	$fop_mail_host_result = \FOP\Database::query($sql);
	if ($fop_mail_host_row = $fop_mail_host_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($fop_mail_host_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\Fop_mail_host::viewURL($data['email_server'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"fop_mail_host\" data-id=\"".htmlentities($fop_mail_host_row['ID'])."\">";echo htmlentities($fop_mail_host_row['description']);if ($fop_mail_host_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('') ?: '-');
	}
	
?>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_syncdate" id="column_syncdate">
		<!-- Feld "earliest synchronization date": syncdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="syncdate"><?php echo(_('earliest synchronization date')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities(($data['syncdate']) ? strftime(_('dateformat_php2'), intval($data['syncdate'])) : ''); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_trash_dir" id="column_trash_dir">
		<!-- Feld "trash folder": trash_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="trash_dir"><?php echo(_('trash folder')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS description, ((COALESCE((SELECT (CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('1IDxgk3w').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('fop_mail_host_box').' '.qi('1IDxgk3w').' WHERE '.qi('1IDxgk3w').'.'.qi('ID').' = '.qi('fop_mail_host_box_dir').'.'.qi('mailbox').' LIMIT 1), FALSE))) AS '.qi('canView').' FROM '.qi('fop_mail_host_box_dir').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['trash_dir']);
	$fop_mail_host_box_dir_result = \FOP\Database::query($sql);
	if ($fop_mail_host_box_dir_row = $fop_mail_host_box_dir_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($fop_mail_host_box_dir_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\Fop_mail_host_box_dir::viewURL($data['trash_dir'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"fop_mail_host_box_dir\" data-id=\"".htmlentities($fop_mail_host_box_dir_row['ID'])."\">";echo htmlentities($fop_mail_host_box_dir_row['description']);if ($fop_mail_host_box_dir_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('-') ?: '-');
	}
	
?>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_spam_dir" id="column_spam_dir">
		<!-- Feld "Spam": spam_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="spam_dir"><?php echo(_('Spam')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS description, ((COALESCE((SELECT (CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('1IDxgk3w').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('fop_mail_host_box').' '.qi('1IDxgk3w').' WHERE '.qi('1IDxgk3w').'.'.qi('ID').' = '.qi('fop_mail_host_box_dir').'.'.qi('mailbox').' LIMIT 1), FALSE))) AS '.qi('canView').' FROM '.qi('fop_mail_host_box_dir').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['spam_dir']);
	$fop_mail_host_box_dir_result = \FOP\Database::query($sql);
	if ($fop_mail_host_box_dir_row = $fop_mail_host_box_dir_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($fop_mail_host_box_dir_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\Fop_mail_host_box_dir::viewURL($data['spam_dir'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"fop_mail_host_box_dir\" data-id=\"".htmlentities($fop_mail_host_box_dir_row['ID'])."\">";echo htmlentities($fop_mail_host_box_dir_row['description']);if ($fop_mail_host_box_dir_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('-') ?: '-');
	}
	
?>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_sent_dir" id="column_sent_dir">
		<!-- Feld "sent folder": sent_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="sent_dir"><?php echo(_('sent folder')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS description, ((COALESCE((SELECT (CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('1IDxgk3w').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('fop_mail_host_box').' '.qi('1IDxgk3w').' WHERE '.qi('1IDxgk3w').'.'.qi('ID').' = '.qi('fop_mail_host_box_dir').'.'.qi('mailbox').' LIMIT 1), FALSE))) AS '.qi('canView').' FROM '.qi('fop_mail_host_box_dir').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['sent_dir']);
	$fop_mail_host_box_dir_result = \FOP\Database::query($sql);
	if ($fop_mail_host_box_dir_row = $fop_mail_host_box_dir_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($fop_mail_host_box_dir_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\Fop_mail_host_box_dir::viewURL($data['sent_dir'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"fop_mail_host_box_dir\" data-id=\"".htmlentities($fop_mail_host_box_dir_row['ID'])."\">";echo htmlentities($fop_mail_host_box_dir_row['description']);if ($fop_mail_host_box_dir_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('-') ?: '-');
	}
	
?>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_status" id="column_status">
		<!-- Feld "Status": status -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="status"><?php echo(_('Status')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['status']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_signature" id="column_signature">
		<!-- Feld "signature": signature -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="signature"><?php echo(_('signature')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
<div ng-non-bindable class='fop-textarea' >
<?php echo \FOP\Util::SanitizeUserHtml($data['signature']); ?>
</div>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_zustand" id="column_zustand">
		<!-- Feld "Zustand": zustand -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="zustand"><?php echo(_('Zustand')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php echo htmlentities(\Types\Zustand_box::toString($data['zustand'])); ?>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Afop_mail_host_box%3Aview&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=wf%3Afop_mail_host_box%3Aview&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_fop_mail_host_box_view')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_fop_mail_host_box_view input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="focus-supersearch">
		<script type='text/javascript'>
			$(function () {
				var focusfield = $('#supersearch');
				if (focusfield.length) {
					focusfield[0].focus();
					focusfield[0].select();
				}
			});
		</script>
	
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function createAction($column_email_server = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		if ((!isset($_POST['cancel']))) \Types\Fop_mail_host::validate($_POST['email_server']);
		if (((false)) && (!isset($_POST['cancel']))) \Types\Fop_mail_host_box_dirMailbox::validate($_POST['trash_dir']);
		if (((false)) && (!isset($_POST['cancel']))) \Types\Fop_mail_host_box_dirMailbox::validate($_POST['spam_dir']);
		if (((false)) && (!isset($_POST['cancel']))) \Types\Fop_mail_host_box_dirMailbox::validate($_POST['sent_dir']);

		if (((false))) if (isset($_POST['fop_mail_host_box_share_mailbox_mailbox'])) foreach ($_POST['fop_mail_host_box_share_mailbox_mailbox'] AS $i => $val)
			if ($_POST['fop_mail_host_box_share_mailbox'][$i] != '0') \Types\Fop_mail_host_box::validate($val);
		if (isset($_POST['fop_mail_host_box_share_mailbox_fopuser'])) foreach ($_POST['fop_mail_host_box_share_mailbox_fopuser'] AS $i => $val)
			if ($_POST['fop_mail_host_box_share_mailbox'][$i] != '0') \Types\Mitglied::validate($val);
		/* Sanitizer */

		$_POST['password'] = \Types\Password::encryptSymmetric($_POST['password']);
		$_POST['from_address'] = \FOP\Sanitizers::no_text($_POST['from_address']);
		if ((!isset($_POST['cancel']))) $_POST['email_server'] = \FOP\Sanitizers::null_filter($_POST['email_server']);
		$_POST['syncdate'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['syncdate']);
		if (((false)) && (!isset($_POST['cancel']))) $_POST['trash_dir'] = \FOP\Sanitizers::null_filter($_POST['trash_dir']);
		if (((false)) && (!isset($_POST['cancel']))) $_POST['spam_dir'] = \FOP\Sanitizers::null_filter($_POST['spam_dir']);
		if (((false)) && (!isset($_POST['cancel']))) $_POST['sent_dir'] = \FOP\Sanitizers::null_filter($_POST['sent_dir']);
		$_POST['signature'] = \FOP\Sanitizers::htmlentities_decode($_POST['signature']);

		if (((false))) if (isset($_POST['fop_mail_host_box_share_mailbox_mailbox'])) foreach ($_POST['fop_mail_host_box_share_mailbox_mailbox'] AS $idx => $val) $_POST['fop_mail_host_box_share_mailbox_mailbox'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['fop_mail_host_box_share_mailbox_fopuser'])) foreach ($_POST['fop_mail_host_box_share_mailbox_fopuser'] AS $idx => $val) $_POST['fop_mail_host_box_share_mailbox_fopuser'][$idx] = \FOP\Sanitizers::null_filter($val);
	}
	
    // --- BLOCK: access-item-fop_mail_host-select ---
    
		if ($column_email_server !== null && \FOP\Database::query('SELECT '.(\FOP\User::getIsGuest() ? 'false' : 'true').' FROM '.qi('fop_mail_host').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($column_email_server))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (!isset($_POST['cancel'])) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-main ---
    
		$defaults = \Tables\Fop_mail_host_box::getDefaults();
		$defaults['user'] = $_POST['user'];
		$defaults['password'] = $_POST['password'];
		$defaults['from_name'] = $_POST['from_name'];
		$defaults['from_address'] = $_POST['from_address'];
		$defaults['syncdate'] = $_POST['syncdate'];
		$defaults['signature'] = $_POST['signature'];
		if ((!isset($_POST['cancel']))) $defaults['email_server'] = $_POST['email_server'];
		if (((false)) && (!isset($_POST['cancel']))) $defaults['trash_dir'] = $_POST['trash_dir'];
		if (((false)) && (!isset($_POST['cancel']))) $defaults['spam_dir'] = $_POST['spam_dir'];
		if (((false)) && (!isset($_POST['cancel']))) $defaults['sent_dir'] = $_POST['sent_dir'];
		if (((false))) $defaults['status'] = $_POST['status'];
		if (((false))) $defaults['zustand'] = $_POST['zustand'];
		// TableItemAccess für PHP auswerten
		
		$id = \Tables\Fop_mail_host_box::create($defaults);
	
    // --- BLOCK: main-2:save-main-list-fop_mail_host_box_share_mailbox ---
    
		// List Save
		if (isset($_POST['fop_mail_host_box_share_mailbox_ID'])) foreach ($_POST['fop_mail_host_box_share_mailbox_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['fop_mail_host_box_share_mailbox'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\Fop_mail_host_box_share::getDefaults();
				\Tables\Fop_mail_host_box_share::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['mailbox'] = $id;
				$subdata['fopuser'] = $_POST['fop_mail_host_box_share_mailbox_fopuser'][$i];
				$subdata['type'] = $_POST['fop_mail_host_box_share_mailbox_type'][$i];
				$subdata['ID'] = $_POST['fop_mail_host_box_share_mailbox_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['fop_mail_host_box_share_mailbox'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\Fop_mail_host_box_share::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\Fop_mail_host_box_share::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['fop_mail_host_box_share_mailbox'][$i] != '0') {
				// noch keine ID: erstellen
				if ((!\FOP\User::getIsGuest())) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\Fop_mail_host_box_share::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['cancel'])) {
			
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . (isset($id) && is_string($id) ? preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']) : $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Fop_mail_host_box::indexURL2(['popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		if (isset($_POST['save'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from'] && strrpos($_POST['fop-from'], 'insert_param') !== false) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				if (!\TablesRouter\Fop_mail_host_box::viewAccess($id)) {
					if (!\TablesRouter\Fop_mail_host_box::indexAccess()) {
						header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
						die();
					}
					header('Location: ' . \TablesRouter\Fop_mail_host_box::indexURL2(['popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
					die();
				}
				header('Location: ' . \TablesRouter\Fop_mail_host_box::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = \Tables\Fop_mail_host_box::getDefaults();
	
    // --- BLOCK: main-4:load-main-list-fop_mail_host_box_share_mailbox ---
    
		$fop_mail_host_box_share_mailbox = [];
		
	
    // --- BLOCK: main-4:load-override ---
    
		$hidden = [];
		if (isset($column_email_server)) {
			
			$hidden['email_server'] = $column_email_server;
			$data['email_server'] = $column_email_server;
		}
	
    // --- BLOCK: main-4:load-~sanitize ---
    
		\Tables\Fop_mail_host_box::sanitizeDefaults($data, true);
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo(sprintf(_('create %s'), _('emailmailbox_singular'))); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(sprintf(_('create %s'), _('emailmailbox_singular'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(sprintf(_('create %s'), _('emailmailbox_singular'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<form
									
									action="<?php echo \TablesRouter\Fop_mail_host_box::createURL2(['popup' => $_GET['popup'] ?? null]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_fop_mail_host_box_create"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_fop_mail_host_box_create" ng-init="form = <?php echo htmlentities(json_encode(['from_name' => $data['from_name'], 'from_address' => $data['from_address'], 'ID' => $data['ID'], 'user' => $data['user']]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || true || true || true || true || true || ((false)) || true || ((false)) || false || (!isset($_POST['cancel'])) || ((false)) && (!isset($_POST['cancel'])) || ((false)) && (!isset($_POST['cancel'])) || ((false)) && (!isset($_POST['cancel'])))) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) ? 'true' : '0')
											 .'||'. '0' .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. (((false)) && (!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. (((false)) && (!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. (((false)) && (!isset($_POST['cancel'])) ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (!\FOP\User::getIsGuest()) && (false || true)) {
									$feature = [
										'id' => 'fop_mail_host_box_share_mailbox',
										'title' => _('Freigaben'),
										'order' => 'z-fop_mail_host_box_share_mailbox', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'wf:fop_mail_host_box:create\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_fop_mail_host_box_create_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if (true) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="save" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">save</i><?php echo(_('save')); ?></button><?php } ?>
									&nbsp;<?php if (true) { ?><button onclick="$(this).closest('form').find('.mdl-textfield__error:visible').hide();
		$('[required]').removeAttr('required');
	" type="submit" name="cancel" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">cancel</i><?php echo(_('cancel')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_fop_mail_host_box_create_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || true || true || true || true || true || ((false)) || true || ((false)) || false || (!isset($_POST['cancel'])) || ((false)) && (!isset($_POST['cancel'])) || ((false)) && (!isset($_POST['cancel'])) || ((false)) && (!isset($_POST['cancel'])))) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_user" id="column_user">
		<!-- Feld "user": user -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['user'])) { echo ' fop-disabled'; } ?>">
		<label for="user"><?php echo(_('user')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['user'])) { echo ' fop-disabled"><input type="hidden" name="user" value="' . htmlentities($hidden['user']); }
		?>">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  ng-model='form[&apos;user&apos;]' ng-trim='false' ng-revalidate class="mdl-textfield__input"  required='required'  type="text" name="user"  value="<?php echo htmlentities($data['user']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_password" id="column_password">
		<!-- Feld "password": password -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['password'])) { echo ' fop-disabled'; } ?>">
		<label for="password"><?php echo(_('password')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['password'])) { echo ' fop-disabled"><input type="hidden" name="password" value="' . htmlentities($hidden['password']); }
		?>">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input" type="password" name="password"  required='required'  id="password" value="<?php echo htmlentities($data['password']); ?>"/><label class="mdl-textfield__label" for="password"><?php echo(_('password')); ?></label><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_from_name" id="column_from_name">
		<!-- Feld "displayname": from_name -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['from_name'])) { echo ' fop-disabled'; } ?>">
		<label for="from_name"><?php echo(_('displayname')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['from_name'])) { echo ' fop-disabled"><input type="hidden" name="from_name" value="' . htmlentities($hidden['from_name']); }
		?>">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  ng-model='form[&apos;from_name&apos;]' ng-trim='false' ng-revalidate class="mdl-textfield__input"  required='required'  type="text" name="from_name"  value="<?php echo htmlentities($data['from_name']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_from_address" id="column_from_address">
		<!-- Feld "E-Mail": from_address -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['from_address'])) { echo ' fop-disabled'; } ?>">
		<label for="from_address"><?php echo(_('E-Mail')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['from_address'])) { echo ' fop-disabled"><input type="hidden" name="from_address" value="' . htmlentities($hidden['from_address']); }
		?>">
		<div class="mdl-textfield mdl-js-textfield"><input ng-model='form[&apos;from_address&apos;]' class="mdl-textfield__input" type="email" name="from_address"  required='required'  id="from_address" value="<?php echo htmlentities($data['from_address']); ?>"/><label class="mdl-textfield__label" for="from_address"><?php echo(_('email')); ?></label>  <span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>&nbsp;
			<div id="infofrom_address" class="cardforminfo icon material-icons">info</div>
			<div class="mdl-tooltip" for="infofrom_address"><?php echo(_('Bitte richtige EMail-Adresse und NICHT den Alias eintragen')); ?></div>
		
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_server" id="column_email_server">
		<!-- Feld "emailhost": email_server -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['email_server'])) { echo ' fop-disabled'; } ?>">
		<label for="email_server"><?php echo(_('emailhost')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['email_server'])) { echo ' fop-disabled"><input type="hidden" name="email_server" value="' . htmlentities($hidden['email_server']); }
		?>">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Fop_mail_host::renderEditform_wf_fop_mail_host_box_create_email_serverAction($data['email_server'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Fop_mail_host::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host%26colinsert=email_server%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host%26colinsert=email_server%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_syncdate" id="column_syncdate">
		<!-- Feld "earliest synchronization date": syncdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['syncdate'])) { echo ' fop-disabled'; } ?>">
		<label for="syncdate"><?php echo(_('earliest synchronization date')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['syncdate'])) { echo ' fop-disabled"><input type="hidden" name="syncdate" value="' . htmlentities($hidden['syncdate']); }
		?>">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="syncdate" type="text" name="syncdate" value="<?php echo ($data['syncdate']) ? strftime(_('dateformat_php2'), intval($data['syncdate'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php if (((false)) && (!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_trash_dir" id="column_trash_dir">
		<!-- Feld "trash folder": trash_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['trash_dir'])) { echo ' fop-disabled'; } ?>">
		<label for="trash_dir"><?php echo(_('trash folder')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['trash_dir'])) { echo ' fop-disabled"><input type="hidden" name="trash_dir" value="' . htmlentities($hidden['trash_dir']); }
		?>">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"mbox": form[&apos;ID&apos;]}' endpoint='Tables/Fop_mail_host_box_dir/renderEditform_wf_fop_mail_host_box_create_trash_dir' condition=''><?php
	\Tables\Fop_mail_host_box_dir::renderEditform_wf_fop_mail_host_box_create_trash_dirAction($data['trash_dir'], ['mbox' => $data['ID']], '');
?></span> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box_dir::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=trash_dir%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_mailbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=trash_dir%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box_dirMailbox&deps_fop_mail_host_box_dir_mbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?php if (((false)) && (!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_spam_dir" id="column_spam_dir">
		<!-- Feld "Spam": spam_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['spam_dir'])) { echo ' fop-disabled'; } ?>">
		<label for="spam_dir"><?php echo(_('Spam')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['spam_dir'])) { echo ' fop-disabled"><input type="hidden" name="spam_dir" value="' . htmlentities($hidden['spam_dir']); }
		?>">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"mbox": form[&apos;ID&apos;]}' endpoint='Tables/Fop_mail_host_box_dir/renderEditform_wf_fop_mail_host_box_create_spam_dir' condition=''><?php
	\Tables\Fop_mail_host_box_dir::renderEditform_wf_fop_mail_host_box_create_spam_dirAction($data['spam_dir'], ['mbox' => $data['ID']], '');
?></span> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box_dir::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=spam_dir%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_mailbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=spam_dir%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box_dirMailbox&deps_fop_mail_host_box_dir_mbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?php if (((false)) && (!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_sent_dir" id="column_sent_dir">
		<!-- Feld "sent folder": sent_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['sent_dir'])) { echo ' fop-disabled'; } ?>">
		<label for="sent_dir"><?php echo(_('sent folder')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['sent_dir'])) { echo ' fop-disabled"><input type="hidden" name="sent_dir" value="' . htmlentities($hidden['sent_dir']); }
		?>">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"mbox": form[&apos;ID&apos;]}' endpoint='Tables/Fop_mail_host_box_dir/renderEditform_wf_fop_mail_host_box_create_sent_dir' condition=''><?php
	\Tables\Fop_mail_host_box_dir::renderEditform_wf_fop_mail_host_box_create_sent_dirAction($data['sent_dir'], ['mbox' => $data['ID']], '');
?></span> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box_dir::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=sent_dir%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_mailbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=sent_dir%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box_dirMailbox&deps_fop_mail_host_box_dir_mbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?php if (((false))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_status" id="column_status">
		<!-- Feld "Status": status -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['status'])) { echo ' fop-disabled'; } ?>">
		<label for="status"><?php echo(_('Status')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['status'])) { echo ' fop-disabled"><input type="hidden" name="status" value="' . htmlentities($hidden['status']); }
		?>">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="status"  value="<?php echo htmlentities($data['status']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_signature" id="column_signature">
		<!-- Feld "signature": signature -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['signature'])) { echo ' fop-disabled'; } ?>">
		<label for="signature"><?php echo(_('signature')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['signature'])) { echo ' fop-disabled"><input type="hidden" name="signature" value="' . htmlentities($hidden['signature']); }
		?>">
		
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	
	<textarea ng-non-bindable rows="22" cols="50" name="signature" class="html-html"><?php echo htmlentities($data['signature']); ?></textarea>
	</div>
	</div>
	</div><?php if (((false))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_zustand" id="column_zustand">
		<!-- Feld "Zustand": zustand -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label<?php if (isset($hidden['zustand'])) { echo ' fop-disabled'; } ?>">
		<label for="zustand"><?php echo(_('Zustand')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content<?php
			if (isset($hidden['zustand'])) { echo ' fop-disabled"><input type="hidden" name="zustand" value="' . htmlentities($hidden['zustand']); }
		?>">
		<div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="selectdropdown mdlext-selectfield__select" name='zustand' id='zustand'><option value='0'<?php if ($data['zustand'] == 0) {echo " selected";}?>><?php echo(_('Verbindung nicht möglich')); ?></option><option value='1'<?php if ($data['zustand'] == 1) {echo " selected";}?>><?php echo(_('Aktiviert')); ?></option><option value='2'<?php if ($data['zustand'] == 2) {echo " selected";}?>><?php echo(_('Deaktiviert')); ?></option><option value='3'<?php if ($data['zustand'] == 3) {echo " selected";}?>><?php echo(_('Wartet auf erste Synchronisation')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (!\FOP\User::getIsGuest()) && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['fop_mail_host_box_share_mailbox']);
										?><span id='fop_mail_host_box_share_mailbox' class='mdl-cell mdl-cell--12-col mdl-grid' >
	
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card">
	
	<div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Freigaben')); ?></div>
	<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone" style="overflow: auto; max-height: calc(100vh - 300px)">
		<table class='mdl-data-table mdl-js-data-table mdl-shadow--2dp table-dense table-editable'>
			<thead>
				<tr >
					<th class='mdl-data-table__cell--non-numeric'>-</th>
					
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Benutzer')); ?></th>
						<?php } ?>
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Berechtigung')); ?></th>
						<?php } ?>
				</tr>
			</thead>
			<tbody>
				<?php
				foreach ($fop_mail_host_box_share_mailbox AS $row) {
					self::createListFop_mail_host_box_share_mailboxAction($row, $data);
				}
				if (!\FOP\User::getIsGuest()) { ?>
				<tr class='wfl-create'>
					<td colspan='42' class='mdl-data-table__cell--non-numeric'>
					  
				<button type='button' class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var tr = $(this).closest(".wfl-create"); $.get("Tables/Fop_mail_host_box/createListFop_mail_host_box_share_mailbox?_&column_email_server=<?php echo htmlentities(\FOP\Util::urlencode($column_email_server)); ?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); h.find("input:not([type=hidden]),textarea").first().focus(); }); event.stopPropagation();'><i class="material-icons">add</i> <?php echo(sprintf(_('add %s'), _('Freigabe'))); ?></button>
					  
					</td>
				</tr>
				<?php } ?>
			</tbody>
		</table>
	</div>
	</div>
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['fop_mail_host_box_share_mailbox']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										$(function(){
											// bei Änderungen: prüfen, ob Form geändert wurde
											var formData = $('#cardform-wf_fop_mail_host_box_create').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-wf_fop_mail_host_box_create').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-wf_fop_mail_host_box_create').on('submit', function () {
												document.body.onbeforeunload = undefined;
											});
											<?php if ($upbar_collapsed) {
												?>$('#fop-bar-mainbutton').click();<?php
											} ?>
											$('#fop-bar-mainbutton').click(function () {
												setTimeout(function () {
													setCFF('upbar', 'collapsed', $('#fop-bar-container').is(':visible') ? 0 : 1);
												}, 440); /* perfect timing for fadeOut */
											});
										});
										
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Afop_mail_host_box%3Acreate&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=wf%3Afop_mail_host_box%3Acreate&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_fop_mail_host_box_create')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_fop_mail_host_box_create input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function editAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		$data = self::view($id);
		/* Validatoren */
		
		if ((!isset($_POST['cancel']))) \Types\Fop_mail_host::validate($_POST['email_server']);
		if ((!isset($_POST['cancel']))) \Types\Fop_mail_host_box_dirMailbox::validate($_POST['trash_dir']);
		if ((!isset($_POST['cancel']))) \Types\Fop_mail_host_box_dirMailbox::validate($_POST['spam_dir']);
		if ((!isset($_POST['cancel']))) \Types\Fop_mail_host_box_dirMailbox::validate($_POST['sent_dir']);

		if (((false))) if (isset($_POST['fop_mail_host_box_share_mailbox_mailbox'])) foreach ($_POST['fop_mail_host_box_share_mailbox_mailbox'] AS $i => $val)
			if ($_POST['fop_mail_host_box_share_mailbox'][$i] != '0') \Types\Fop_mail_host_box::validate($val);
		if (isset($_POST['fop_mail_host_box_share_mailbox_fopuser'])) foreach ($_POST['fop_mail_host_box_share_mailbox_fopuser'] AS $i => $val)
			if ($_POST['fop_mail_host_box_share_mailbox'][$i] != '0') \Types\Mitglied::validate($val);
		/* Sanitizer */

		$_POST['password'] = \Types\Password::encryptSymmetric($_POST['password']);
		$_POST['from_address'] = \FOP\Sanitizers::no_text($_POST['from_address']);
		if ((!isset($_POST['cancel']))) $_POST['email_server'] = \FOP\Sanitizers::null_filter($_POST['email_server']);
		$_POST['syncdate'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['syncdate']);
		if ((!isset($_POST['cancel']))) $_POST['trash_dir'] = \FOP\Sanitizers::null_filter($_POST['trash_dir']);
		if ((!isset($_POST['cancel']))) $_POST['spam_dir'] = \FOP\Sanitizers::null_filter($_POST['spam_dir']);
		if ((!isset($_POST['cancel']))) $_POST['sent_dir'] = \FOP\Sanitizers::null_filter($_POST['sent_dir']);
		$_POST['signature'] = \FOP\Sanitizers::htmlentities_decode($_POST['signature']);

		if (((false))) if (isset($_POST['fop_mail_host_box_share_mailbox_mailbox'])) foreach ($_POST['fop_mail_host_box_share_mailbox_mailbox'] AS $idx => $val) $_POST['fop_mail_host_box_share_mailbox_mailbox'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['fop_mail_host_box_share_mailbox_fopuser'])) foreach ($_POST['fop_mail_host_box_share_mailbox_fopuser'] AS $idx => $val) $_POST['fop_mail_host_box_share_mailbox_fopuser'][$idx] = \FOP\Sanitizers::null_filter($val);
	}
	
    // --- BLOCK: access-item-fop_mail_host_box-edit ---
    
		if ($id !== null && \FOP\Database::query('SELECT '.(\FOP\User::getIsGuest() ? 'false' : 'true').' FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (!isset($_POST['cancel'])) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-clone-prepare ---
    
		$data = self::view($id);
	
    // --- BLOCK: main-2:save-main ---
    
		$data_edit = [];
		$data_edit['user'] = $_POST['user'];
		$data_edit['password'] = $_POST['password'];
		$data_edit['from_name'] = $_POST['from_name'];
		$data_edit['from_address'] = $_POST['from_address'];
		$data_edit['syncdate'] = $_POST['syncdate'];
		$data_edit['signature'] = $_POST['signature'];
		if ((!isset($_POST['cancel']))) $data_edit['email_server'] = $_POST['email_server'];
		if ((!isset($_POST['cancel']))) $data_edit['trash_dir'] = $_POST['trash_dir'];
		if ((!isset($_POST['cancel']))) $data_edit['spam_dir'] = $_POST['spam_dir'];
		if ((!isset($_POST['cancel']))) $data_edit['sent_dir'] = $_POST['sent_dir'];
		if (((false)) && ($data['status::canEdit'] == 1)) $data_edit['status'] = $_POST['status'];
		if (((false)) && ($data['zustand::canEdit'] == 1)) $data_edit['zustand'] = $_POST['zustand'];
		self::edit($id, $data_edit);
		if (isset($data_edit['ID'])) {
			$id = $data_edit['ID'];
		}
	
    // --- BLOCK: main-2:save-main-list-fop_mail_host_box_share_mailbox ---
    
		// List Save
		if (isset($_POST['fop_mail_host_box_share_mailbox_ID'])) foreach ($_POST['fop_mail_host_box_share_mailbox_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['fop_mail_host_box_share_mailbox'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\Fop_mail_host_box_share::getDefaults();
				\Tables\Fop_mail_host_box_share::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['mailbox'] = $id;
				$subdata['fopuser'] = $_POST['fop_mail_host_box_share_mailbox_fopuser'][$i];
				$subdata['type'] = $_POST['fop_mail_host_box_share_mailbox_type'][$i];
				$subdata['ID'] = $_POST['fop_mail_host_box_share_mailbox_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['fop_mail_host_box_share_mailbox'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\Fop_mail_host_box_share::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\Fop_mail_host_box_share::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['fop_mail_host_box_share_mailbox'][$i] != '0') {
				// noch keine ID: erstellen
				if ((!\FOP\User::getIsGuest())) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\Fop_mail_host_box_share::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['cancel'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Fop_mail_host_box::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		if (isset($_POST['save'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Fop_mail_host_box::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = self::view($id); // TODO: klären, wer die Funktion bereitstellt (momentan crud/view.fop)
	
    // --- BLOCK: main-4:load-main-list-fop_mail_host_box_share_mailbox ---
    
		$fop_mail_host_box_share_mailbox = [];
		array_push($fop_mail_host_box_share_mailbox, ...\Tables\Fop_mail_host_box::loadEditFop_mail_host_box_share_mailboxItems($id ?? null));
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT '.qi('fop_mail_host_box').'.'.qi('from_address').' AS description FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('edit %s'))); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT '.qi('fop_mail_host_box').'.'.qi('from_address').' AS description FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('edit %s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT '.qi('fop_mail_host_box').'.'.qi('from_address').' AS description FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('edit %s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<form
									
									action="<?php echo \TablesRouter\Fop_mail_host_box::editURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_fop_mail_host_box_edit"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_fop_mail_host_box_edit" ng-init="form = <?php echo htmlentities(json_encode(['from_name' => $data['from_name'], 'from_address' => $data['from_address'], 'ID' => $data['ID'], 'user' => $data['user']]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || true || true || true || true || true || ((false)) && ($data['status::canEdit'] == 1) || true || ((false)) && ($data['zustand::canEdit'] == 1) || false || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])))) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) && ($data['status::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) && ($data['zustand::canEdit'] == 1) ? 'true' : '0')
											 .'||'. '0' .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true)) {
									$feature = [
										'id' => 'fop_mail_host_box_share_mailbox',
										'title' => _('Freigaben'),
										'order' => 'z-fop_mail_host_box_share_mailbox', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'wf:fop_mail_host_box:edit\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_fop_mail_host_box_edit_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if (true) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="save" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">save</i><?php echo(_('save')); ?></button><?php } ?>
									&nbsp;<?php if (true) { ?><button onclick="$(this).closest('form').find('.mdl-textfield__error:visible').hide();
		$('[required]').removeAttr('required');
	" type="submit" name="cancel" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">cancel</i><?php echo(_('cancel')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_fop_mail_host_box_edit_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || true || true || true || true || true || ((false)) && ($data['status::canEdit'] == 1) || true || ((false)) && ($data['zustand::canEdit'] == 1) || false || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])))) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_user" id="column_user">
		<!-- Feld "user": user -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="user"><?php echo(_('user')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  ng-model='form[&apos;user&apos;]' ng-trim='false' ng-revalidate class="mdl-textfield__input"  required='required'  type="text" name="user"  value="<?php echo htmlentities($data['user']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_password" id="column_password">
		<!-- Feld "password": password -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="password"><?php echo(_('password')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input" type="password" name="password"  required='required'  id="password" value="<?php echo htmlentities($data['password']); ?>"/><label class="mdl-textfield__label" for="password"><?php echo(_('password')); ?></label><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_from_name" id="column_from_name">
		<!-- Feld "displayname": from_name -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="from_name"><?php echo(_('displayname')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  ng-model='form[&apos;from_name&apos;]' ng-trim='false' ng-revalidate class="mdl-textfield__input"  required='required'  type="text" name="from_name"  value="<?php echo htmlentities($data['from_name']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_from_address" id="column_from_address">
		<!-- Feld "E-Mail": from_address -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="from_address"><?php echo(_('E-Mail')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input ng-model='form[&apos;from_address&apos;]' class="mdl-textfield__input" type="email" name="from_address"  required='required'  id="from_address" value="<?php echo htmlentities($data['from_address']); ?>"/><label class="mdl-textfield__label" for="from_address"><?php echo(_('email')); ?></label>  <span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>&nbsp;
			<div id="infofrom_address" class="cardforminfo icon material-icons">info</div>
			<div class="mdl-tooltip" for="infofrom_address"><?php echo(_('Bitte richtige EMail-Adresse und NICHT den Alias eintragen')); ?></div>
		
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_server" id="column_email_server">
		<!-- Feld "emailhost": email_server -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_server"><?php echo(_('emailhost')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Fop_mail_host::renderEditform_wf_fop_mail_host_box_edit_email_serverAction($data['email_server'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Fop_mail_host::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host%26colinsert=email_server%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host%26colinsert=email_server%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_syncdate" id="column_syncdate">
		<!-- Feld "earliest synchronization date": syncdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="syncdate"><?php echo(_('earliest synchronization date')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="syncdate" type="text" name="syncdate" value="<?php echo ($data['syncdate']) ? strftime(_('dateformat_php2'), intval($data['syncdate'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_trash_dir" id="column_trash_dir">
		<!-- Feld "trash folder": trash_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="trash_dir"><?php echo(_('trash folder')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"mbox": form[&apos;ID&apos;]}' endpoint='Tables/Fop_mail_host_box_dir/renderEditform_wf_fop_mail_host_box_edit_trash_dir' condition=''><?php
	\Tables\Fop_mail_host_box_dir::renderEditform_wf_fop_mail_host_box_edit_trash_dirAction($data['trash_dir'], ['mbox' => $data['ID']], '');
?></span> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box_dir::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=trash_dir%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_mailbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=trash_dir%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box_dirMailbox&deps_fop_mail_host_box_dir_mbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_spam_dir" id="column_spam_dir">
		<!-- Feld "Spam": spam_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="spam_dir"><?php echo(_('Spam')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"mbox": form[&apos;ID&apos;]}' endpoint='Tables/Fop_mail_host_box_dir/renderEditform_wf_fop_mail_host_box_edit_spam_dir' condition=''><?php
	\Tables\Fop_mail_host_box_dir::renderEditform_wf_fop_mail_host_box_edit_spam_dirAction($data['spam_dir'], ['mbox' => $data['ID']], '');
?></span> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box_dir::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=spam_dir%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_mailbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=spam_dir%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box_dirMailbox&deps_fop_mail_host_box_dir_mbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_sent_dir" id="column_sent_dir">
		<!-- Feld "sent folder": sent_dir -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="sent_dir"><?php echo(_('sent folder')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"mbox": form[&apos;ID&apos;]}' endpoint='Tables/Fop_mail_host_box_dir/renderEditform_wf_fop_mail_host_box_edit_sent_dir' condition=''><?php
	\Tables\Fop_mail_host_box_dir::renderEditform_wf_fop_mail_host_box_edit_sent_dirAction($data['sent_dir'], ['mbox' => $data['ID']], '');
?></span> &nbsp;	<?php if (\TablesRouter\Fop_mail_host_box_dir::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=sent_dir%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_mailbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_mail_host_box_dir::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=fop_mail_host_box_dirMailbox%26colinsert=sent_dir%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_mail_host_box_dirMailbox&deps_fop_mail_host_box_dir_mbox=" + encodeURIComponent($(this).scope().$eval("form[\&apos;ID\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['status::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_status" id="column_status">
		<!-- Feld "Status": status -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="status"><?php echo(_('Status')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="status"  value="<?php echo htmlentities($data['status']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_signature" id="column_signature">
		<!-- Feld "signature": signature -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="signature"><?php echo(_('signature')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	
	<textarea ng-non-bindable rows="22" cols="50" name="signature" class="html-html"><?php echo htmlentities($data['signature']); ?></textarea>
	</div>
	</div>
	</div><?php if (((false)) && ($data['zustand::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_zustand" id="column_zustand">
		<!-- Feld "Zustand": zustand -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="zustand"><?php echo(_('Zustand')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="selectdropdown mdlext-selectfield__select" name='zustand' id='zustand'><option value='0'<?php if ($data['zustand'] == 0) {echo " selected";}?>><?php echo(_('Verbindung nicht möglich')); ?></option><option value='1'<?php if ($data['zustand'] == 1) {echo " selected";}?>><?php echo(_('Aktiviert')); ?></option><option value='2'<?php if ($data['zustand'] == 2) {echo " selected";}?>><?php echo(_('Deaktiviert')); ?></option><option value='3'<?php if ($data['zustand'] == 3) {echo " selected";}?>><?php echo(_('Wartet auf erste Synchronisation')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['fop_mail_host_box_share_mailbox']);
										?><span id='fop_mail_host_box_share_mailbox' class='mdl-cell mdl-cell--12-col mdl-grid' >
	
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card">
	
	<div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Freigaben')); ?></div>
	<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone" style="overflow: auto; max-height: calc(100vh - 300px)">
		<table class='mdl-data-table mdl-js-data-table mdl-shadow--2dp table-dense table-editable'>
			<thead>
				<tr >
					<th class='mdl-data-table__cell--non-numeric'>-</th>
					
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Benutzer')); ?></th>
						<?php } ?>
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Berechtigung')); ?></th>
						<?php } ?>
				</tr>
			</thead>
			<tbody>
				<?php
				foreach ($fop_mail_host_box_share_mailbox AS $row) {
					self::editListFop_mail_host_box_share_mailboxAction($row, $data);
				}
				if (!\FOP\User::getIsGuest()) { ?>
				<tr class='wfl-create'>
					<td colspan='42' class='mdl-data-table__cell--non-numeric'>
					  
				<button type='button' class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var tr = $(this).closest(".wfl-create"); $.get("Tables/Fop_mail_host_box/editListFop_mail_host_box_share_mailbox?_&id=<?php echo htmlentities(\FOP\Util::urlencode($id)); ?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); h.find("input:not([type=hidden]),textarea").first().focus(); }); event.stopPropagation();'><i class="material-icons">add</i> <?php echo(sprintf(_('add %s'), _('Freigabe'))); ?></button>
					  
					</td>
				</tr>
				<?php } ?>
			</tbody>
		</table>
	</div>
	</div>
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['fop_mail_host_box_share_mailbox']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										$(function(){
											// bei Änderungen: prüfen, ob Form geändert wurde
											var formData = $('#cardform-wf_fop_mail_host_box_edit').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-wf_fop_mail_host_box_edit').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-wf_fop_mail_host_box_edit').on('submit', function () {
												document.body.onbeforeunload = undefined;
											});
											<?php if ($upbar_collapsed) {
												?>$('#fop-bar-mainbutton').click();<?php
											} ?>
											$('#fop-bar-mainbutton').click(function () {
												setTimeout(function () {
													setCFF('upbar', 'collapsed', $('#fop-bar-container').is(':visible') ? 0 : 1);
												}, 440); /* perfect timing for fadeOut */
											});
										});
										
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Afop_mail_host_box%3Aedit&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=wf%3Afop_mail_host_box%3Aedit&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_fop_mail_host_box_edit')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_fop_mail_host_box_edit input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function mailboxSyncAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-item-fop_mail_host_box-view ---
    
		if (\FOP\Database::query('SELECT (CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('fop_mail_host_box').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		$res = \FOP\Database::query('SELECT zustand, hoststr FROM fop_mail_host_box WHERE '.qi('ID').'  = ' .\FOP\Database::quote($id). ' LIMIT 1')->fetch(\PDO::FETCH_ASSOC);	
		if(!$res) throw new \Exception('noMailboxError');
		$hoststr = $res['hoststr'];
		($mbox = \Tables\Fop_mail_host_box_dir::imap_open($id, '', '')) ? ($check = imap_mailboxmsginfo($mbox)) : ($check = NULL);
		if(!$check){
			//imap_close($mbox);
			\FOP\Database::query('UPDATE fop_mail_host_box SET zustand = 0, status = ' . \FOP\Database::quote(implode(', ', imap_errors() ?: [])). ' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id));
			header('Location: ' . \TablesRouter\Fop_mail_host_box::viewURL2(['id' => $id]) .'#snack:Connection%20failed!');
			return;
		} elseif ((($res['zustand'] == 0) || $res['zustand'] == 2) || ($res['zustand'] == NULL) || ($res['zustand'] == 3)) {
			$list = imap_getmailboxes($mbox, $hoststr, '*');
			if (is_array($list)) {
				foreach ($list as $key => $val) {
					$dir = \FOP\Imap::extractDirName($hoststr, utf8_encode(imap_utf7_decode($val->name)));
					$h = \Tables\Fop_mail_host_box_dir::createMailDirectory($val, $check, $id, $dir);
				}
				\FOP\Database::query('UPDATE fop_mail_host_box SET zustand = 1, root_dir = ' . \FOP\Database::quote(substr(strrchr(utf8_encode(imap_utf7_decode($check->Mailbox)), '}'), 1)) . ', delimiter = ' . \FOP\Database::quote($list[0]->delimiter) . ' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id));
				header('Location: ' . \TablesRouter\Fop_mail_host_box::viewURL2(['id' => $id]) . '#snack:Connection%20succeed!');
			}
			imap_close($mbox);
			return;
		} else {
 			\FOP\Database::query('UPDATE fop_mail_host_box SET zustand = 2 WHERE '.qi('ID').' = ' . \FOP\Database::quote($id));	
			header('Location: ' . \TablesRouter\Fop_mail_host_box::viewURL2(['id' => $id]) . '#snack:Connection%20deactivated!');
			imap_close($mbox);
			return;
		}
	
    
  }

  public static function loadCreateFop_mail_host_box_share_mailboxItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT \'\' AS '.qi('ID').', '.qi('fop_mail_host_box_share').'.'.qi('mailbox').', '.qi('fop_mail_host_box_share').'.'.qi('fopuser').', '.qi('fop_mail_host_box_share').'.'.qi('type').',
			('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('canDelete').'
			FROM '.qi('fop_mail_host_box_share').' 
			WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND '.qi('fop_mail_host_box_share').'.'.qi('mailbox').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

		foreach($items as &$item) {
		}
		return $items;
	
    
  }

  public static function loadEditFop_mail_host_box_share_mailboxItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT '.qi('fop_mail_host_box_share').'.'.qi('ID').' AS '.qi('ID').', '.qi('fop_mail_host_box_share').'.'.qi('mailbox').', '.qi('fop_mail_host_box_share').'.'.qi('fopuser').', '.qi('fop_mail_host_box_share').'.'.qi('type').',
			('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('canDelete').'
			FROM '.qi('fop_mail_host_box_share').' 
			WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND '.qi('fop_mail_host_box_share').'.'.qi('mailbox').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

		foreach($items as &$item) {
		}
		return $items;
	
    
  }

  public static function fetchFop_mail_host_box_draft_answer_contentSignature_defaultDynamicwf_fop_mail_host_box_draft_answer_contentSignature_defaultDynamicAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.qi('fop_mail_host_box').'.'.qi('signature').') FROM '.qi('fop_mail_host_box').' WHERE ((CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('fop_mail_host_box').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END)) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchFop_mail_host_box_draft_forward_contentSignature_defaultDynamicwf_fop_mail_host_box_draft_forward_contentSignature_defaultDynamicAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.qi('fop_mail_host_box').'.'.qi('signature').') FROM '.qi('fop_mail_host_box').' WHERE ((CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('fop_mail_host_box').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END)) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchFop_mail_host_box_draft_create_contentSignature_defaultDynamicwf_fop_mail_host_box_draft_create_contentSignature_defaultDynamicAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.qi('fop_mail_host_box').'.'.qi('signature').') FROM '.qi('fop_mail_host_box').' WHERE ((CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('fop_mail_host_box').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END)) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchFop_mail_host_box_draft_edit_contentSignature_defaultDynamicwf_fop_mail_host_box_draft_edit_contentSignature_defaultDynamicAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.qi('fop_mail_host_box').'.'.qi('signature').') FROM '.qi('fop_mail_host_box').' WHERE ((CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('fop_mail_host_box').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END)) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function delete($id, $disregardPermissions = false ) { 
    
    
    // --- BLOCK: main ---
    
			$sql = 'SELECT ' . ($disregardPermissions ? 1 : ''.(\FOP\User::getIsGuest() ? 'false' : 'true').'') . ' FROM '.qi('fop_mail_host_box').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id);
			if (\FOP\Database::query($sql)->fetchColumn() != 1) {
				return false;
			}
			
	    \FOP\Database::query('DELETE FROM fop_mail_host_box_dir_email WHERE boxid = ' . intval($id));
	    \FOP\Database::query('DELETE FROM fop_imaplistener WHERE mailboxid = ' . intval($id));
	
			$sql = 'DELETE FROM  '.qi('fop_mail_host_box').'  WHERE '.qi('ID').' = ' . \FOP\Database::quote($id);
			$result = \FOP\Database::query($sql);
			
			return true;
	
    
  }

  public static function createListFop_mail_host_box_share_mailboxAction($row = null , $parent = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: before-prepare-parent ---
    
		if (!isset($parent)) $parent = [];
	
    // --- BLOCK: before-prepare-row ---
    
		if (!is_array($row)) {
			$parentrow = [];
			$row = \Tables\Fop_mail_host_box_share::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\Fop_mail_host_box_share::sanitizeDefaults($row, true, 'fop_mail_host_box', $parentrow);
		} else {
			
			$row['fopuser'] = \FOP\Sanitizers::null_converter($row['fopuser']);
			$row['type'] = \FOP\Util::IntStringNull($row['type']);			
			$row['canDelete'] = $row['canDelete'] ?? false;
		}
		
		
    // --- BLOCK: main ---
    
		?>
		<tr class='wfl-item'>
					<td class='mdl-data-table__cell--non-numeric'>
						<div>
							<?php if ($row['canDelete']) { ?>
							<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='$(this).closest("tr").fadeOut().find("input[name=&apos;fop_mail_host_box_share_mailbox[]&apos;]").val("0");'>
								<i class="material-icons">remove</i>
							</div>
							<?php } ?>
							<input type='hidden' name='fop_mail_host_box_share_mailbox[]' value='1'>
							<input type='hidden' name='fop_mail_host_box_share_mailbox_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
						</div>
					</td><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Benutzer": fopuser
			--><td class='mdl-data-table__cell--non-numeric'><span><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Mitglied::renderEditformarray_wf_fop_mail_host_box_create_fop_mail_host_box_share_mailbox_fopuserAction($row['fopuser'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Mitglied::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Mitglied::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitglied%26colinsert=fop_mail_host_box_share_mailbox_fopuser[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Mitglied::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitglied%26colinsert=fop_mail_host_box_share_mailbox_fopuser[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=mitglied", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Berechtigung": type
			--><td class='mdl-data-table__cell--non-numeric'><span><div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="selectdropdown mdlext-selectfield__select" name='fop_mail_host_box_share_mailbox_type[]' id='fop_mail_host_box_share_mailbox_type[]'><option value='1'<?php if ($row['type'] == 1) {echo " selected";}?>><?php echo(_('nur lesen')); ?></option><option value='2'<?php if ($row['type'] == 2) {echo " selected";}?>><?php echo(_('lesen und schreiben')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?></tr><?php
	
    
  }

  public static function editListFop_mail_host_box_share_mailboxAction($row = null , $parent = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: before-prepare-parent ---
    
		if (!isset($parent)) $parent = [];
	
    // --- BLOCK: before-prepare-row ---
    
		if (!is_array($row)) {
			$parentrow = [];
			$row = \Tables\Fop_mail_host_box_share::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\Fop_mail_host_box_share::sanitizeDefaults($row, true, 'fop_mail_host_box', $parentrow);
		} else {
			
			$row['fopuser'] = \FOP\Sanitizers::null_converter($row['fopuser']);
			$row['type'] = \FOP\Util::IntStringNull($row['type']);			
			$row['canDelete'] = $row['canDelete'] ?? false;
		}
		
		
    // --- BLOCK: main ---
    
		?>
		<tr class='wfl-item'>
					<td class='mdl-data-table__cell--non-numeric'>
						<div>
							<?php if ($row['canDelete']) { ?>
							<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='$(this).closest("tr").fadeOut().find("input[name=&apos;fop_mail_host_box_share_mailbox[]&apos;]").val("0");'>
								<i class="material-icons">remove</i>
							</div>
							<?php } ?>
							<input type='hidden' name='fop_mail_host_box_share_mailbox[]' value='1'>
							<input type='hidden' name='fop_mail_host_box_share_mailbox_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
						</div>
					</td><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Benutzer": fopuser
			--><td class='mdl-data-table__cell--non-numeric'><span><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Mitglied::renderEditformarray_wf_fop_mail_host_box_edit_fop_mail_host_box_share_mailbox_fopuserAction($row['fopuser'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Mitglied::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Mitglied::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitglied%26colinsert=fop_mail_host_box_share_mailbox_fopuser[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Mitglied::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitglied%26colinsert=fop_mail_host_box_share_mailbox_fopuser[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=mitglied", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Berechtigung": type
			--><td class='mdl-data-table__cell--non-numeric'><span><div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="selectdropdown mdlext-selectfield__select" name='fop_mail_host_box_share_mailbox_type[]' id='fop_mail_host_box_share_mailbox_type[]'><option value='1'<?php if ($row['type'] == 1) {echo " selected";}?>><?php echo(_('nur lesen')); ?></option><option value='2'<?php if ($row['type'] == 2) {echo " selected";}?>><?php echo(_('lesen und schreiben')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?></tr><?php
	
    
  }

  public static function create($data, $disregardPermissions = false , $updateOnDuplicate = false ) { 
    
    
    // --- BLOCK: main ---
    
				$sql = 'INSERT INTO '.qi('fop_mail_host_box').'(';
				
				$set = [];
				
					
					$set[qi('user')] = \FOP\Database::quote($data['user']);
					
				
					
					$set[qi('password')] = \FOP\Database::quote($data['password']);
					
				
					
					$set[qi('from_name')] = \FOP\Database::quote($data['from_name']);
					
				
					
					$set[qi('from_address')] = \FOP\Database::quote($data['from_address']);
					
				
					
					$set[qi('email_server')] = \FOP\Database::quote($data['email_server']);
					
				
					
					$set[qi('syncdate')] = \FOP\Database::quote($data['syncdate']);
					
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('trash_dir')] = \FOP\Database::quote($data['trash_dir']);
					} else {
						$set[qi('trash_dir')] = \FOP\Database::quote(\FOP\Sanitizers::null_filter(null));
					}
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('spam_dir')] = \FOP\Database::quote($data['spam_dir']);
					} else {
						$set[qi('spam_dir')] = \FOP\Database::quote(\FOP\Sanitizers::null_filter(null));
					}
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('sent_dir')] = \FOP\Database::quote($data['sent_dir']);
					} else {
						$set[qi('sent_dir')] = \FOP\Database::quote(\FOP\Sanitizers::null_filter(null));
					}
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('status')] = \FOP\Database::quote($data['status']);
					} else {
						$set[qi('status')] = \FOP\Database::quote((''));
					}
				
					
					$set[qi('signature')] = \FOP\Database::quote($data['signature']);
					
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('zustand')] = \FOP\Database::quote($data['zustand']);
					} else {
						$set[qi('zustand')] = \FOP\Database::quote(('0'));
					}
				
					$set[qi('fopuser')] = '' . (\FOP\User::getID() ?: 'NULL') . '';
				$id = 0;

				$sql = $sql . implode(', ', array_keys($set)) . ') VALUES (' . implode(', ', array_values($set)) . ')';
				if ($updateOnDuplicate){
					// TODO: Postgres ON CONFLICT(...) DO UPDATE SET ...
					$set2 = [];
					foreach ($set AS $k => $v) {
						array_push($set2, "$k = $v");
					}
					if (\FOP\Database::getDriver() == 'mysql') {
						$sql .= ' ON DUPLICATE KEY UPDATE ' . implode(', ', $set2);
					} else {
						
					}
				}

				try {
					\FOP\Database::query($sql);
					$id = \FOP\Database::getLastInsertId();
				} catch (\PDOException $e) {
					if ($e->errorInfo[1] == 1062) {
						throw new \FOP\AccessDeniedException('duplicateinsert');
					}
                    throw $e; // weiterwerfen
				}
				$data['fop-id'] = $id; // für Hooks
				
		\FOP\Database::query('UPDATE fop_mail_host_box SET status = ' . \FOP\Database::quote('Please wait for sync') . ', zustand = 3 WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['fop-id']));
	
				return $id;

    
  }

  public static function view($id, $snippet = false , $ignoreAccess = false ) { 
    
    
    // --- BLOCK: main ---
    
		$sql = 'SELECT /* ID */ '.qi('ID').' AS '.qi('ID').',
									/* ID */ '.qi('fop_mail_host_box').'.'.qi('ID').' AS '.qi('ID').',
									/* delimiter */ '.qi('fop_mail_host_box').'.'.qi('delimiter').' AS '.qi('delimiter').',
									/* email_server */ '.qi('fop_mail_host_box').'.'.qi('email_server').' AS '.qi('email_server').',
									/* email_server::canView */ '.qi('ref:email_server').'.'.qi('email_server:canView').' AS '.qi('email_server::canView').',
									/* email_server::description */ '.qi('ref:email_server').'.'.qi('email_server:description').' AS '.qi('email_server::description').',
									/* fopuser */ '.qi('fop_mail_host_box').'.'.qi('fopuser').' AS '.qi('fopuser').',
									/* fopuser_ */ '.qi('fop_mail_host_box').'.'.qi('fopuser').' AS '.qi('fopuser_').',
									/* fopuser_::canView */ '.qi('ref:fopuser_').'.'.qi('fopuser_:canView').' AS '.qi('fopuser_::canView').',
									/* fopuser_::description */ '.qi('ref:fopuser_').'.'.qi('fopuser_:description').' AS '.qi('fopuser_::description').',
									/* from_address */ '.qi('fop_mail_host_box').'.'.qi('from_address').' AS '.qi('from_address').',
									/* from_name */ '.qi('fop_mail_host_box').'.'.qi('from_name').' AS '.qi('from_name').',
									/* gssapi */ '.qi('fop_mail_host_box').'.'.qi('gssapi').' AS '.qi('gssapi').',
									/* hoststr */ '.qi('fop_mail_host_box').'.'.qi('hoststr').' AS '.qi('hoststr').',
									/* operation::create */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::create').',
									/* operation::delete */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::delete').',
									/* operation::edit */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::edit').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::menu */ ' . (((\FOP\Util::FalseToNull(\FOP\Database::query('SELECT EXISTS (SELECT (TRUE) FROM '.qi('fop_mail_host_box').' '.qi('k8RY5cHX').' WHERE TRUE AND ((SELECT ((CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('JRBjvdI2').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END)) FROM '.qi('fop_mail_host_box').' '.qi('JRBjvdI2').' WHERE '.qi('JRBjvdI2').'.'.qi('ID').' = '.qi('k8RY5cHX').'.'.qi('ID').' LIMIT 1)))')->fetchColumn()))) ? 1 : 0) . ' AS '.qi('operation::menu').',
									/* operation::send */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::send').',
									/* operation::view */ (CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('fop_mail_host_box').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AS '.qi('operation::view').',
									/* password */ '.qi('fop_mail_host_box').'.'.qi('password').' AS '.qi('password').',
									/* root_dir */ '.qi('fop_mail_host_box').'.'.qi('root_dir').' AS '.qi('root_dir').',
									/* sent_dir */ '.qi('fop_mail_host_box').'.'.qi('sent_dir').' AS '.qi('sent_dir').',
									/* sent_dir::canView */ '.qi('ref:sent_dir').'.'.qi('sent_dir:canView').' AS '.qi('sent_dir::canView').',
									/* sent_dir::description */ '.qi('ref:sent_dir').'.'.qi('sent_dir:description').' AS '.qi('sent_dir::description').',
									/* sent_dir::mbox */ '.qi('fop_mail_host_box').'.'.qi('ID').' AS '.qi('sent_dir::mbox').',
									/* signature */ '.qi('fop_mail_host_box').'.'.qi('signature').' AS '.qi('signature').',
									/* spam_dir */ '.qi('fop_mail_host_box').'.'.qi('spam_dir').' AS '.qi('spam_dir').',
									/* spam_dir::canView */ '.qi('ref:spam_dir').'.'.qi('spam_dir:canView').' AS '.qi('spam_dir::canView').',
									/* spam_dir::description */ '.qi('ref:spam_dir').'.'.qi('spam_dir:description').' AS '.qi('spam_dir::description').',
									/* spam_dir::mbox */ '.qi('fop_mail_host_box').'.'.qi('ID').' AS '.qi('spam_dir::mbox').',
									/* status */ '.qi('fop_mail_host_box').'.'.qi('status').' AS '.qi('status').',
									/* status::canEdit */ (FALSE) AS '.qi('status::canEdit').',
									/* syncdate */ '.qi('fop_mail_host_box').'.'.qi('syncdate').' AS '.qi('syncdate').',
									/* trash_dir */ '.qi('fop_mail_host_box').'.'.qi('trash_dir').' AS '.qi('trash_dir').',
									/* trash_dir::canView */ '.qi('ref:trash_dir').'.'.qi('trash_dir:canView').' AS '.qi('trash_dir::canView').',
									/* trash_dir::description */ '.qi('ref:trash_dir').'.'.qi('trash_dir:description').' AS '.qi('trash_dir::description').',
									/* trash_dir::mbox */ '.qi('fop_mail_host_box').'.'.qi('ID').' AS '.qi('trash_dir::mbox').',
									/* user */ '.qi('fop_mail_host_box').'.'.qi('user').' AS '.qi('user').',
									/* zustand */ '.qi('fop_mail_host_box').'.'.qi('zustand').' AS '.qi('zustand').',
									/* zustand::canEdit */ (FALSE) AS '.qi('zustand::canEdit').',
									1
								FROM '.qi('fop_mail_host_box').' '.qi('fop_mail_host_box').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('email_server:ID').', '.qi('fop_mail_host').'.'.qi('name').' AS '.qi('email_server:description').', ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('email_server:canView').' FROM '.qi('fop_mail_host').') '.qi('ref:email_server').' ON '.qi('ref:email_server').'.'.qi('email_server:ID').' = '.qi('fop_mail_host_box').'.'.qi('email_server').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('trash_dir:ID').', '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS '.qi('trash_dir:description').', ((COALESCE((SELECT (CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('1IDxgk3w').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('fop_mail_host_box').' '.qi('1IDxgk3w').' WHERE '.qi('1IDxgk3w').'.'.qi('ID').' = '.qi('fop_mail_host_box_dir').'.'.qi('mailbox').' LIMIT 1), FALSE))) AS '.qi('trash_dir:canView').' FROM '.qi('fop_mail_host_box_dir').') '.qi('ref:trash_dir').' ON '.qi('ref:trash_dir').'.'.qi('trash_dir:ID').' = '.qi('fop_mail_host_box').'.'.qi('trash_dir').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('spam_dir:ID').', '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS '.qi('spam_dir:description').', ((COALESCE((SELECT (CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('1IDxgk3w').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('fop_mail_host_box').' '.qi('1IDxgk3w').' WHERE '.qi('1IDxgk3w').'.'.qi('ID').' = '.qi('fop_mail_host_box_dir').'.'.qi('mailbox').' LIMIT 1), FALSE))) AS '.qi('spam_dir:canView').' FROM '.qi('fop_mail_host_box_dir').') '.qi('ref:spam_dir').' ON '.qi('ref:spam_dir').'.'.qi('spam_dir:ID').' = '.qi('fop_mail_host_box').'.'.qi('spam_dir').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('sent_dir:ID').', '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS '.qi('sent_dir:description').', ((COALESCE((SELECT (CASE WHEN FALSE THEN TRUE ELSE NOT (('.qi('1IDxgk3w').'.'.qi('fopuser').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('fop_mail_host_box').' '.qi('1IDxgk3w').' WHERE '.qi('1IDxgk3w').'.'.qi('ID').' = '.qi('fop_mail_host_box_dir').'.'.qi('mailbox').' LIMIT 1), FALSE))) AS '.qi('sent_dir:canView').' FROM '.qi('fop_mail_host_box_dir').') '.qi('ref:sent_dir').' ON '.qi('ref:sent_dir').'.'.qi('sent_dir:ID').' = '.qi('fop_mail_host_box').'.'.qi('sent_dir').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('fopuser_:ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS '.qi('fopuser_:description').', ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('fopuser_:canView').' FROM '.qi('mitglied').') '.qi('ref:fopuser_').' ON '.qi('ref:fopuser_').'.'.qi('fopuser_:ID').' = '.qi('fop_mail_host_box').'.'.qi('fopuser').'
								WHERE ('.qi('ID').' = ' . \FOP\Database::quote($id) . ')';
		$result = \FOP\Database::query($sql);
		if (!$row = $result->fetch(\PDO::FETCH_ASSOC)) {
			throw new \FOP\AccessDeniedException('notfoundread');
		} else if (!$ignoreAccess && !$row['operation::view']) {
			throw new \FOP\AccessDeniedException('accessdeniedread');
		}
		
		$row['fopuser_'] = \FOP\Sanitizers::null_converter($row['fopuser_']);
		$row['password'] = \Types\Password::decryptSymmetric($row['password']);
		$row['from_address'] = \FOP\Sanitizers::a_text($row['from_address']);
		$row['email_server'] = \FOP\Sanitizers::null_converter($row['email_server']);
		$row['syncdate'] = intval($row['syncdate']);
		$row['trash_dir'] = \FOP\Sanitizers::null_converter($row['trash_dir']);
		$row['spam_dir'] = \FOP\Sanitizers::null_converter($row['spam_dir']);
		$row['sent_dir'] = \FOP\Sanitizers::null_converter($row['sent_dir']);
		$row['zustand'] = \FOP\Util::IntStringNull($row['zustand']);
		

		if($snippet){
			$row['fopuser_'] = (
  \FOP\Database::query('SELECT CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['fopuser_']))->fetchColumn() ?: _('')
);
			$row['user'] = ($row['user']);
			$row['password'] = ('*****');
			$row['from_name'] = ($row['from_name']);
			$row['from_address'] = ($row['from_address']);
			$row['email_server'] = (
  \FOP\Database::query('SELECT '.qi('fop_mail_host').'.'.qi('name').' AS description FROM '.qi('fop_mail_host').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['email_server']))->fetchColumn() ?: _('')
);
			$row['syncdate'] = (($row['syncdate']) ? strftime(_('dateformat_php2'), intval($row['syncdate'])) : '');
			$row['trash_dir'] = (
  \FOP\Database::query('SELECT '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS description FROM '.qi('fop_mail_host_box_dir').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['trash_dir']))->fetchColumn() ?: _('-')
);
			$row['spam_dir'] = (
  \FOP\Database::query('SELECT '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS description FROM '.qi('fop_mail_host_box_dir').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['spam_dir']))->fetchColumn() ?: _('-')
);
			$row['sent_dir'] = (
  \FOP\Database::query('SELECT '.qi('fop_mail_host_box_dir').'.'.qi('name').' AS description FROM '.qi('fop_mail_host_box_dir').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['sent_dir']))->fetchColumn() ?: _('-')
);
			$row['status'] = ($row['status']);
			$row['signature'] = (mb_substr(preg_replace('/[ \t\r\n]+/', ' ', strip_tags(preg_replace('/<style.*?\/style>/s', '', html_entity_decode($row['signature'])))), 0, 20) . (strlen($row['signature']) >= 20 ? '...' : ''));
			$row['zustand'] = (\Types\Zustand_box::toString($row['zustand']));
			
		}


		return $row;

    
  }

  public static function searchOptionsfop_mail_host_box_dir_mailbox_deletecascadeAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsfop_mail_host_box_share_mailbox_deletecascadeAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_fop_mail_host_box_create_fop_mail_host_box_share_mailbox_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_fop_mail_host_box_edit_fop_mail_host_box_share_mailbox_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_fop_mail_host_box_dir_create_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_fop_mail_host_box_share_create_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_fop_mail_host_box_dir_edit_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_fop_mail_host_box_share_edit_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsfop_mail_host_box_draft_mailbox_deletecascadeAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_fop_mail_host_box_draft_answer_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_fop_mail_host_box_draft_forward_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_fop_mail_host_box_draft_create_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_fop_mail_host_box_draft_edit_mailboxAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function sanitizeDefaults(&$data, $sanitizeForForms, $refcol = null , $parentdata = null ) { 
    
    
    // --- BLOCK: main ---
    
		$virginData = self::getDefaults();
		// column: email_server
			if (!$data['email_server']) {
				// replace forbidden NULL values
				$items = \Types\Fop_mail_host::getItems([], null);
				$best = -INF;
				foreach ($items as $item) /* TODO: InputFieldLoadCondition: if (!$condition || $item[$condition]) */ {
					if ($item['priority'] > $best) {
						$data['email_server'] = $item['ID'];
						$best = $item['priority'];
					}
				}
			}
		
		// column: password
		
		// column: sent_dir
			if (!$data['sent_dir']) {
				$data['sent_dir'] = $sanitizeForForms ? '0' : null;
			}
		
		// column: signature
		
		// column: spam_dir
			if (!$data['spam_dir']) {
				$data['spam_dir'] = $sanitizeForForms ? '0' : null;
			}
		
		// column: status
		
		// column: syncdate
		
		// column: trash_dir
			if (!$data['trash_dir']) {
				$data['trash_dir'] = $sanitizeForForms ? '0' : null;
			}
		
		// column: user
		
		// column: from_address
			// set DefaultDynamic value
			if ($data['from_address'] == $virginData['from_address']) {
				$data['from_address'] = $data['user'];
			}
			
		
		// column: from_name
			// set DefaultDynamic value
			if ($data['from_name'] == $virginData['from_name']) {
				$data['from_name'] = $data['user'];
			}
			
		
		// column: zustand
		
		if ($sanitizeForForms) {
			
			$data['password'] = \Types\Password::decryptSymmetric($data['password']);
			$data['from_address'] = \FOP\Sanitizers::a_text($data['from_address']);
			$data['email_server'] = \FOP\Sanitizers::null_converter($data['email_server']);
			$data['syncdate'] = intval($data['syncdate']);
			$data['trash_dir'] = \FOP\Sanitizers::null_converter($data['trash_dir']);
			$data['spam_dir'] = \FOP\Sanitizers::null_converter($data['spam_dir']);
			$data['sent_dir'] = \FOP\Sanitizers::null_converter($data['sent_dir']);
			$data['zustand'] = \FOP\Util::IntStringNull($data['zustand']);
		}
	
    
  }

  public static function edit($id, $data, $ignoreUniqueConstraints = false , $disregardPermissions = false ) { 
    
    
    // --- BLOCK: main ---
    
				
				$set = [];
				
					
					if (array_key_exists('user', $data)) {
						array_push($set, qi('user').' = ' . \FOP\Database::quote($data['user']));
					}
				
					
					if (array_key_exists('password', $data)) {
						array_push($set, qi('password').' = ' . \FOP\Database::quote($data['password']));
					}
				
					
					if (array_key_exists('from_name', $data)) {
						array_push($set, qi('from_name').' = ' . \FOP\Database::quote($data['from_name']));
					}
				
					
					if (array_key_exists('from_address', $data)) {
						array_push($set, qi('from_address').' = ' . \FOP\Database::quote($data['from_address']));
					}
				
					
					if (array_key_exists('email_server', $data)) {
						array_push($set, qi('email_server').' = ' . \FOP\Database::quote($data['email_server']));
					}
				
					
					if (array_key_exists('syncdate', $data)) {
						array_push($set, qi('syncdate').' = ' . \FOP\Database::quote($data['syncdate']));
					}
				
					
					if (array_key_exists('trash_dir', $data)) {
						array_push($set, qi('trash_dir').' = ' . \FOP\Database::quote($data['trash_dir']));
					}
				
					
					if (array_key_exists('spam_dir', $data)) {
						array_push($set, qi('spam_dir').' = ' . \FOP\Database::quote($data['spam_dir']));
					}
				
					
					if (array_key_exists('sent_dir', $data)) {
						array_push($set, qi('sent_dir').' = ' . \FOP\Database::quote($data['sent_dir']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('status', $data)) {
						array_push($set, qi('status').' = ' . \FOP\Database::quote($data['status']));
					}
				
					
					if (array_key_exists('signature', $data)) {
						array_push($set, qi('signature').' = ' . \FOP\Database::quote($data['signature']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('zustand', $data)) {
						array_push($set, qi('zustand').' = ' . \FOP\Database::quote($data['zustand']));
					}
				;
				
				if (count($set)) {
					try {
						\FOP\Database::query('UPDATE '.qi('fop_mail_host_box').' SET ' . implode(', ', $set) . ' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id));
						if (isset($data['ID'])) {
							$id = $data['ID'];
						}
					} catch (\PDOException $e) {
						if ($e->errorInfo[1] == 1062) {
							if ($ignoreUniqueConstraints) {
								return false;
							}
							throw new \FOP\AccessDeniedException('duplicateupdate');
						}
						throw $e; // weiterwerfen
					}
				}
				$data['fop-id'] = $id; // für Hooks
				
				return true;

    
  }

  public static function renderEditfop_mail_host_box_dir_mailbox_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="value_fop_mail_host_box_dir_mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsfop_mail_host_box_dir_mailbox_deletecascade?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditfop_mail_host_box_share_mailbox_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="value_fop_mail_host_box_share_mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsfop_mail_host_box_share_mailbox_deletecascade?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_fop_mail_host_box_create_fop_mail_host_box_share_mailbox_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="fop_mail_host_box_share_mailbox_mailbox[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsformarray_wf_fop_mail_host_box_create_fop_mail_host_box_share_mailbox_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_fop_mail_host_box_edit_fop_mail_host_box_share_mailbox_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="fop_mail_host_box_share_mailbox_mailbox[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsformarray_wf_fop_mail_host_box_edit_fop_mail_host_box_share_mailbox_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_fop_mail_host_box_dir_create_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;mailbox&apos;]' class="selectdropdown mdlext-selectfield__select" name="mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;mailbox&apos;]' fop-type='Fop_mail_host_box' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsform_wf_fop_mail_host_box_dir_create_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_fop_mail_host_box_share_create_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsform_wf_fop_mail_host_box_share_create_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_fop_mail_host_box_dir_edit_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;mailbox&apos;]' class="selectdropdown mdlext-selectfield__select" name="mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;mailbox&apos;]' fop-type='Fop_mail_host_box' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsform_wf_fop_mail_host_box_dir_edit_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_fop_mail_host_box_share_edit_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsform_wf_fop_mail_host_box_share_edit_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditfop_mail_host_box_draft_mailbox_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="value_fop_mail_host_box_draft_mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsfop_mail_host_box_draft_mailbox_deletecascade?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_fop_mail_host_box_draft_answer_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;mailbox&apos;]' class="selectdropdown mdlext-selectfield__select" name="mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;mailbox&apos;]' fop-type='Fop_mail_host_box_send' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsform_wf_fop_mail_host_box_draft_answer_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_fop_mail_host_box_draft_forward_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;mailbox&apos;]' class="selectdropdown mdlext-selectfield__select" name="mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;mailbox&apos;]' fop-type='Fop_mail_host_box_send' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsform_wf_fop_mail_host_box_draft_forward_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_fop_mail_host_box_draft_create_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;mailbox&apos;]' class="selectdropdown mdlext-selectfield__select" name="mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;mailbox&apos;]' fop-type='Fop_mail_host_box_send' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsform_wf_fop_mail_host_box_draft_create_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_fop_mail_host_box_draft_edit_mailboxAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Fop_mail_host_box_send::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;mailbox&apos;]' class="selectdropdown mdlext-selectfield__select" name="mailbox" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;mailbox&apos;]' fop-type='Fop_mail_host_box_send' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Fop_mail_host_box/searchOptionsform_wf_fop_mail_host_box_draft_edit_mailbox?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function deleteAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-itemlist-fop_mail_host_box-delete ---
    
		// ID-Liste neu aufbauen und nur die übrig lassen, die auch erlaubt sind
		$id_ = new \FOP\IDList($id);
		$id = new \FOP\IDList();
		foreach (\FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('fop_mail_host_box').' WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND ' . $id_->toSQL(qi('ID')))->fetchAll(\PDO::FETCH_COLUMN) AS $id_sub) {
			$id->push($id_sub);
		}
	
    // --- BLOCK: main ---
    
		\FOP\Database::beginTransaction();
		$ids = new \FOP\IDList($id);
		foreach ($ids->all() AS $id) {
			try {
				$success = self::delete($id);
			} catch (\PDOException $e) {
				if (\FOP\Database::getDriver() == 'mysql' && $e->errorInfo[1] == 1451 /* mysql error code */ || \FOP\Database::getDriver() == 'pgsql' && $e->getCode() == 23503/* psql error code */) {
					// fail due to foreign key constraints (the GUI before should already handle this)
					\FOP\Database::rollbackTransaction();
					if (isset($_GET['ajax'])) {
						header('HTTP/1.0 403 Forbidden');
						die(\TablesRouter\Fop_mail_host_box::deleteConfirmURL($ids->toString(), ['from' => $_GET['from'] ?? null])); // open delete confirm window when something went wrong
					}
					// TODO: I18n
					header('Location: ' . \TablesRouter\Fop_mail_host_box::deleteConfirmURL($ids->toString(), ['from' => $_GET['from'] ?? null]) . '#snack:Eine Löschung ist noch nicht möglich'); // open delete confirm window when something went wrong
					die();
				}
				throw $e; // sonst: weiterwerfen
			}
			if (!$success) {
				// fail due to permission
				\FOP\Database::rollbackTransaction();
				if (isset($_GET['ajax'])) {
					header('HTTP/1.0 403 Forbidden');
					die(_('deletiondenied'));
				}
				throw new \FOP\AccessDeniedException('deletiondenied');
			}

			$addition = '#snack:' . _('delete successful');
		}
		\FOP\Database::commitTransaction();

		if (isset($_GET['ajax'])) die('');
		header("Location: " . (isset($_GET['from']) ? $_GET['from'] : \TablesRouter\Fop_mail_host_box::indexURL()) . $addition);
		die();
	
    
  }

  public static function indexAction() { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo(_('emailmailbox_plural')); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(_('emailmailbox_plural')); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(_('emailmailbox_plural')); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<div
								 
								id="cardform-fop_mail_host_box"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormFop_mail_host_box" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 ?>
								<div id='fop-upbar'></div>
								<?php \DataView\Fop_mail_host_box::renderScript(); ?>
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'main_table',
										'title' => _('table'),
										'order' => '500-100', // 500-100 (50)
										'mode' => 'area', // area (51) / tab (50)
										'position' => 'full', // 
										'collapsed' => 0, // 0 (51) / 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'fop_mail_host_box\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main_table']);
										?>
	<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
	<div id="fop_mail_host_box-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadfop_mail_host_box()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\Fop_mail_host_box::renderTabTableAction();
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['main_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										$(function(){
											// bei Änderungen: prüfen, ob Form geändert wurde
											var formData = $('#cardform-fop_mail_host_box').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-fop_mail_host_box').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-fop_mail_host_box').on('submit', function () {
												document.body.onbeforeunload = undefined;
											});
											<?php if ($upbar_collapsed) {
												?>$('#fop-bar-mainbutton').click();<?php
											} ?>
											$('#fop-bar-mainbutton').click(function () {
												setTimeout(function () {
													setCFF('upbar', 'collapsed', $('#fop-bar-container').is(':visible') ? 0 : 1);
												}, 440); /* perfect timing for fadeOut */
											});
										});
										
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=fop_mail_host_box&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=fop_mail_host_box&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-fop_mail_host_box')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-fop_mail_host_box input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</div>
							

							</div>
							<div class="content" id="focus-supersearch">
		<script type='text/javascript'>
			$(function () {
				var focusfield = $('#supersearch');
				
				if (focusfield.length) {
					focusfield[0].focus();
					focusfield[0].select();
				}
			});
		</script>
	
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    
  }


  
  

  
  
}



