' . "\n";
- } else {
- echo '
';
- }
- //test d'existance du fichier
- if (isset($fullFilename) and (!file_exists($fullFilename) or $fullFilename == '')) {
- $att->showFileNotExits();
- //return;
- }
-} else {
- echo '
' . _t('TEMPLATE_ACTION_SECTION') . ' : '
- . _t('TEMPLATE_ELEM_SECTION_NOT_CLOSED') . '.
' . "\n";
-
- return;
-}
diff --git a/tools/templates/actions/sectionAction.php b/tools/templates/actions/sectionAction.php
new file mode 100644
index 0000000000..5e80f3b677
--- /dev/null
+++ b/tools/templates/actions/sectionAction.php
@@ -0,0 +1,170 @@
+arguments['bgcolor'] ?? '';
+ $patternreverse = ($this->arguments['patternreverse'] ?? false) == 'true';
+ $patternId = $this->arguments['pattern'] ?? '';
+ $patternbg = $patternreverse ? 'var(--main-bg-color)' : $bgcolor;
+ $patterncolor = $patternreverse ? $bgcolor : 'var(--main-bg-color)';
+ $patternborder = false;
+
+ // image's background color
+ switch ($patternId) {
+ case 'border-solid':
+ case 'border-dashed':
+ case 'border-dotted':
+ $patternborder = true;
+ $pattern = <<
arguments['file'] ?? '';
+ $backgroundimg = true;
+ if (empty($file) && empty($bgcolor)) {
+ $bgcolor = false;
+ $backgroundimg = false;
+ }
+
+ if (!empty($file)) {
+ if (!class_exists('attach')) {
+ include 'tools/attach/libs/attach.lib.php';
+ }
+ $att = new attach($this->wiki);
+
+ // test of image extension
+ if (!$att->isPicture($file)) {
+ echo '' . _t('ATTACH_ACTION_BACKGROUNDIMAGE') . ' : '
+ . _t('ATTACH_PARAM_FILE_MUST_BE_IMAGE') . '.
' . "\n";
+
+ return;
+ }
+ // image size
+ $height = $this->arguments['height'] ?? '';
+ $width = $this->arguments['width'] ?? '';
+ if (empty($width)) {
+ $width = 1920;
+ }
+
+ //recuperation des parametres necessaires
+ $att->file = $file;
+ $att->desc = 'background image ' . $file;
+ $att->height = $height;
+ $att->width = $width;
+ $fullFilename = $att->GetFullFilename();
+ }
+
+ // container class
+ $class = $this->arguments['class'] ?? '';
+
+ // container id
+ $id = $this->arguments['id'] ?? '';
+
+ // container data attributes
+ $data = $this->wiki->services->get(\YesWiki\Templates\Service\Utils::class)->getDataParameter();
+
+ $pagetag = $this->wiki->GetPageTag();
+
+ if ($this->check_end_elem('section')) {
+ // specify the role to be checked ( *, +, %, @admins)
+ $role = $this->arguments['visibility'] ?? '';
+ $role = empty($role) ? $role : str_replace('\\n', "\n", $role);
+ $visible = !$role || ($GLOBALS['wiki']->CheckACL($role, null, false));
+ $class = ($backgroundimg ? 'background-image' : '')
+ . ($patternId && !$patternborder ? ' with-bg-pattern' : '')
+ . ($patternborder ? ' pattern-border' : '')
+ . ($visible ? '' : ' remove-this-div-on-page-load ')
+ . " pattern-$patternId"
+ . (!empty($class) ? ' ' . $class : '');
+
+ echo '
+ $value) {
+ echo ' data-' . $key . '="' . $value . '"';
+ }
+ }
+ echo '>' . "\n";
+
+ $nocontainer = $this->arguments['nocontainer'] ?? '';
+ if (empty($nocontainer)) {
+ echo '' . "\n";
+ } else {
+ echo '
';
+ }
+ //test d'existance du fichier
+ if (isset($fullFilename) and (!file_exists($fullFilename) or $fullFilename == '')) {
+ $att->showFileNotExits();
+ //return;
+ }
+ } else {
+ echo $this->generate_error_msg('section');
+ }
+ $section = ob_get_contents();
+ ob_end_clean();
+ return $section;
+ }
+
+ public function end(): string {
+ return '\n
';
+ }
+}