-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdcbe_general_edit.html5
More file actions
130 lines (120 loc) · 6.56 KB
/
Copy pathdcbe_general_edit.html5
File metadata and controls
130 lines (120 loc) · 6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
use ContaoCommunityAlliance\DcGeneral\Data\VersionModelInterface;
use Contao\Message;
use Contao\StringUtil;
use Contao\System;
use Symfony\Contracts\Translation\TranslatorInterface;
$requestToken = System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$translator = System::getContainer()->get('translator');
assert($translator instanceof TranslatorInterface);
$request = System::getContainer()->get('request_stack')->getCurrentRequest()->getUri();
$fieldsetStates = System::getContainer()->get('request_stack')->getSession()->getBag('contao_backend')->get('fieldset_states');
// Add CSS
$GLOBALS['TL_CSS']['cca.dc-general.generalDriver'] = '/bundles/ccadcgeneral/css/generalDriver.css';
?>
<div data-controller="contao--jump-targets">
<div class="jump-targets">
<div class="inner" data-contao--jump-targets-target="navigation"></div>
</div>
<?php if($this->versions): ?>
<div class="tl_version_panel">
<form action="<?= StringUtil::ampersand($request, true) ?>" id="tl_version" class="tl_form" method="post">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_version" />
<input type="hidden" name="REQUEST_TOKEN" value="<?= $requestToken ?>" />
<select name="version" class="tl_select">
<?php foreach($this->versions as $objVersion): /** @var VersionModelInterface $objVersion */ ?>
<option value="<?= $objVersion->getId() ?>"<?php if($objVersion->isCurrent()): ?> selected="selected"<?php endif; ?>>
<?= $translator->trans(id: 'version', domain: 'dc-general') ?> <?= $objVersion->getVersion() ?> (<?= $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $objVersion->getDateTime()->getTimestamp()) ?>)
<?php if ($objVersion->getAuthorName()): ?> – <?= $objVersion->getAuthorName() ?> (<?= $objVersion->getAuthorUsername() ?>)
<?php elseif ($objVersion->getAuthorUsername()): ?> – (<?= $objVersion->getAuthorUsername() ?>)
<?php endif; ?>
</option>
<?php endforeach; ?>
</select> <input type="submit" name="showVersion" id="showVersion" class="tl_submit" value="<?= StringUtil::specialchars($translator->trans(id: 'restore', domain: 'dc-general')) ?>" />
</div>
</form>
</div>
<?php endif; ?>
<?php
$this->insert(
'dcbe_general_language_selector',
[
'language' => $this->language,
'languages' => $this->languages,
'request' => $request,
'submit' => $this->languageSubmit,
'REQUEST_TOKEN' => $requestToken,
]
) ?>
<?= $this->getBackButton() ?>
<?php if(\strlen($this->breadcrumb)): ?>
<div class="tl_listing_container">
<?= $this->breadcrumb ?>
</div>
<?php endif; ?>
<h2 class="sub_headline"><?= $this->subHeadline ?><?= ($this->languageHeadline !== '') ? ' - ' . $this->languageHeadline : '' ?></h2>
<?= Message::generate() ?>
<form class="tl_form tableextended" method="post"
action="<?= StringUtil::ampersand($request, true) ?><?php if($this->mode): ?>&mode=<?= $this->mode ?><?php endif; ?>"
id="<?= $this->table ?>"
enctype="<?= $this->enctype ?>"
<?php if($this->onsubmit): ?> onsubmit="<?= $this->onsubmit ?>"<?php endif; ?>>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="<?= StringUtil::specialchars($this->table) ?>" />
<input type="hidden" name="REQUEST_TOKEN" value="<?= $requestToken ?>" />
<?php if($this->error): ?>
<div class="error_wrapper<?php if(5 < \count($this->error)): ?> limit_height h128<?php endif; ?>">
<p class="tl_error"><?= \implode('<br />', $this->error) ?></p>
<script>
window.addEvent('domready', function() {
var firstErrorElement = $('<?= $this->table ?>').getElement('label.error');
if (firstErrorElement) {
Backend.vScrollTo((firstErrorElement.getPosition().y - 20));
} else {
Backend.vScrollTo(($('<?= $this->table ?>').getElement('.error_wrapper p.tl_error').getPosition().y - 20));
}
});
</script>
</div>
<?php endif; ?>
<?php foreach($this->fieldsets as $arrFieldset):
$class = $arrFieldset['class'];
if ($arrFieldset['legend'] ?? null):
$paletteId = 'pal_' . StringUtil::specialchars($arrFieldset['legend']);
if (null !== ($fieldsetState = ($fieldsetStates[$this->table][$paletteId] ?? null))) {
$class = \str_replace(' collapsed', '', $class);
if (0 === $fieldsetState) {
$class .= ' collapsed';
}
}
?>
<fieldset id="<?= $paletteId ?>" class="<?= $class ?>" data-controller="contao--toggle-fieldset" data-contao--toggle-fieldset-id-value="pal_<?= StringUtil::specialchars($arrFieldset['legend']) ?>" data-contao--toggle-fieldset-table-value="<?= StringUtil::specialchars($this->table) ?>" data-contao--toggle-fieldset-collapsed-class="collapsed" data-contao--jump-targets-target="section" data-contao--jump-targets-label-value="<?= $arrFieldset['label'] ?>" data-action="contao--jump-targets:scrollto->contao--toggle-fieldset#open">
<legend><button type="button" data-action="contao--toggle-fieldset#toggle" aria-expanded="true"><?= $arrFieldset['label'] ?></button></legend>
<?= $arrFieldset['palette'] ?>
</fieldset>
<?php else: ?>
<fieldset class="<?= $class ?> block nolegend">
<?= $arrFieldset['palette'] ?>
</fieldset>
<?php endif; endforeach; ?>
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
<?= $this->editButtons ?>
</div>
</div>
</form>
</div>
<script>
window.addEvent('domready', function() {
var e = $$("#" + <?= \json_encode($this->table) ?> + ' input[type="text"]')[0];
e && e.focus();
<?php if($this->noReload): ?>
var firstErrorElement = $('<?= $this->table ?>').getElement('label.error');
if (firstErrorElement) {
Backend.vScrollTo((firstErrorElement.getPosition().y - 20));
}
<?php endif; ?>
});
</script>