openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit c4e40dc3e623468ded30d846e800534eec310a25
parent 2cd57ec7508cf6a4547010c97394f638ce56c8a8
Author: Jan Dankert <develop@jandankert.de>
Date:   Mon, 27 Jun 2022 02:22:50 +0200

Fix: Saving links in PageallAction and PageelementAllAction.

Diffstat:
Mmodules/cms/action/PageelementAction.class.php | 2+-
Mmodules/cms/action/page/PageAllAction.class.php | 2+-
Mmodules/cms/action/pageelement/PageelementAllAction.class.php | 2+-
Mmodules/cms/ui/themes/default/html/views/page/all.php | 4++--
Mmodules/cms/ui/themes/default/html/views/page/all.tpl.src.xml | 2+-
Mmodules/cms/ui/themes/default/html/views/pageelement/all.php | 4++--
Mmodules/cms/ui/themes/default/html/views/pageelement/all.tpl.src.xml | 2+-
Mmodules/template_engine/components/html/component_selector/SelectorComponent.class.php | 4+++-
Mmodules/template_engine/components/template.xsd | 1+
9 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/modules/cms/action/PageelementAction.class.php b/modules/cms/action/PageelementAction.class.php @@ -505,7 +505,7 @@ class PageelementAction extends BaseAction if ( $linkUrl = $this->request->getText('linkurl') ) $value->linkToObjectId = $this->parseSimpleOID($linkUrl); else - $value->linkToObjectId = intval($this->request->getText('linkobjectid')); + $value->linkToObjectId = $this->request->getNumber('linkobjectid'); $this->afterSave($value); } diff --git a/modules/cms/action/page/PageAllAction.class.php b/modules/cms/action/page/PageAllAction.class.php @@ -243,7 +243,7 @@ class PageAllAction extends PageAction implements Method { break; case Element::ELEMENT_TYPE_LINK: case Element::ELEMENT_TYPE_INSERT: - $value->linkToObjectId = intval($this->request->getNumber($element->name)); + $value->linkToObjectId = $this->request->getNumber($element->name); break; case Element::ELEMENT_TYPE_NUMBER: diff --git a/modules/cms/action/pageelement/PageelementAllAction.class.php b/modules/cms/action/pageelement/PageelementAllAction.class.php @@ -242,7 +242,7 @@ class PageelementAllAction extends PageelementAction implements Method { break; case Element::ELEMENT_TYPE_LINK: case Element::ELEMENT_TYPE_INSERT: - $value->linkToObjectId = intval($this->request->getNumber($language->isoCode)); + $value->linkToObjectId = $this->request->getNumber($language->isoCode); break; case Element::ELEMENT_TYPE_NUMBER: diff --git a/modules/cms/ui/themes/default/html/views/page/all.php b/modules/cms/ui/themes/default/html/views/page/all.php @@ -99,8 +99,8 @@ <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('link_target').'') ?></h3> <div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?> <div class="<?php echo O::escapeHtml('or-selector or-droppable-selector') ?>"><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('linkobjectid') ?>" value="<?php echo O::escapeHtml(''.@$linkobjectid.'') ?>" class="<?php echo O::escapeHtml('or-selector-link-value') ?>" /><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('text') ?>" name="<?php echo O::escapeHtml('linkobjectid_text') ?>" placeholder="<?php echo O::escapeHtml(''.@$name.'') ?>" value="<?php echo O::escapeHtml(''.@$name.'') ?>" class="<?php echo O::escapeHtml('or-input or-selector-link-name or-act-selector-search') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml(''.@$name.'') ?>" value="<?php echo O::escapeHtml(''.@$value.'') ?>" class="<?php echo O::escapeHtml('or-selector-link-value') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('text') ?>" name="<?php echo O::escapeHtml(''.@$name.'_text') ?>" placeholder="<?php echo O::escapeHtml(''.@$linkname.'') ?>" value="<?php echo O::escapeHtml(''.@$linkname.'') ?>" class="<?php echo O::escapeHtml('or-input or-selector-link-name or-act-selector-search') ?>" /><?php echo O::escapeHtml('') ?> <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--menu-tree or-act-selector-tree-button') ?>"><?php echo O::escapeHtml('') ?></i> <div class="<?php echo O::escapeHtml('or-dropdown or-act-selector-search-results') ?>"><?php echo O::escapeHtml('') ?></div> <div type="<?php echo O::escapeHtml('hidden') ?>" data-types="<?php echo O::escapeHtml(''.@$types.'') ?>" data-init-id="<?php echo O::escapeHtml(''.@$linkobjectid.'') ?>" data-init-folderid="<?php echo O::escapeHtml(''.@$rootfolderid.'') ?>" class="<?php echo O::escapeHtml('or-navtree or-selector-tree or-act-load-selector-tree') ?>"><?php echo O::escapeHtml('') ?></div> diff --git a/modules/cms/ui/themes/default/html/views/page/all.tpl.src.xml b/modules/cms/ui/themes/default/html/views/page/all.tpl.src.xml @@ -101,7 +101,7 @@ </if> <if value="${type}" equals="link"> <fieldset label="${message:link_target}"> - <selector param="linkobjectid" types="${types}" name="${name}" id="${linkobjectid}" + <selector param="${name}" default="${value}" types="${types}" name="${linkname}" id="${linkobjectid}" folderid="${rootfolderid}"/> </fieldset> <fieldset label="${message:link_url}"> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/all.php b/modules/cms/ui/themes/default/html/views/pageelement/all.php @@ -100,8 +100,8 @@ <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('link_target').'') ?></h3> <div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?> <div class="<?php echo O::escapeHtml('or-selector or-droppable-selector') ?>"><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('linkobjectid') ?>" value="<?php echo O::escapeHtml(''.@$linkobjectid.'') ?>" class="<?php echo O::escapeHtml('or-selector-link-value') ?>" /><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('text') ?>" name="<?php echo O::escapeHtml('linkobjectid_text') ?>" placeholder="<?php echo O::escapeHtml(''.@$name.'') ?>" value="<?php echo O::escapeHtml(''.@$name.'') ?>" class="<?php echo O::escapeHtml('or-input or-selector-link-name or-act-selector-search') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml(''.@$name.'') ?>" value="<?php echo O::escapeHtml(''.@$value.'') ?>" class="<?php echo O::escapeHtml('or-selector-link-value') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('text') ?>" name="<?php echo O::escapeHtml(''.@$name.'_text') ?>" placeholder="<?php echo O::escapeHtml(''.@$linkname.'') ?>" value="<?php echo O::escapeHtml(''.@$linkname.'') ?>" class="<?php echo O::escapeHtml('or-input or-selector-link-name or-act-selector-search') ?>" /><?php echo O::escapeHtml('') ?> <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--menu-tree or-act-selector-tree-button') ?>"><?php echo O::escapeHtml('') ?></i> <div class="<?php echo O::escapeHtml('or-dropdown or-act-selector-search-results') ?>"><?php echo O::escapeHtml('') ?></div> <div type="<?php echo O::escapeHtml('hidden') ?>" data-types="<?php echo O::escapeHtml(''.@$types.'') ?>" data-init-id="<?php echo O::escapeHtml(''.@$linkobjectid.'') ?>" data-init-folderid="<?php echo O::escapeHtml(''.@$rootfolderid.'') ?>" class="<?php echo O::escapeHtml('or-navtree or-selector-tree or-act-load-selector-tree') ?>"><?php echo O::escapeHtml('') ?></div> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/all.tpl.src.xml b/modules/cms/ui/themes/default/html/views/pageelement/all.tpl.src.xml @@ -97,7 +97,7 @@ </if> <if value="${type}" equals="link"> <fieldset label="${message:link_target}"> - <selector param="linkobjectid" types="${types}" name="${name}" id="${linkobjectid}" + <selector param="${name}" default="${value}" types="${types}" name="${linkname}" id="${linkobjectid}" folderid="${rootfolderid}"/> </fieldset> <fieldset label="${message:link_url}"> diff --git a/modules/template_engine/components/html/component_selector/SelectorComponent.class.php b/modules/template_engine/components/html/component_selector/SelectorComponent.class.php @@ -24,11 +24,13 @@ class SelectorComponent extends Component public $folderid; + public $default; + public $param; public function createElement() { return (new HtmlElement('div'))->addStyleClass(['selector','droppable-selector'])->addChild( - (new HtmlElement('input'))->addAttribute('type','hidden')->addStyleClass('selector-link-value')->addAttribute('name',$this->param)->addAttribute('value',Value::createExpression(ValueExpression::TYPE_DATA_VAR,$this->param)) + (new HtmlElement('input'))->addAttribute('type','hidden')->addStyleClass('selector-link-value')->addAttribute('name',$this->param)->addAttribute('value',$this->default?:Value::createExpression(ValueExpression::TYPE_DATA_VAR,$this->param)) )->addChild( (new HtmlElement('input'))->addAttribute('type','text')->addStyleClass(['input','selector-link-name','act-selector-search'])->addAttribute('name',$this->param.'_text')->addAttribute('placeholder',$this->name)->addAttribute('value',$this->name) )->addChild( diff --git a/modules/template_engine/components/template.xsd b/modules/template_engine/components/template.xsd @@ -1394,6 +1394,7 @@ <xsd:attribute name="name" type="xsd:string"/> <xsd:attribute name="id" type="xsd:string"/> <xsd:attribute name="folderid" type="xsd:string"/> + <xsd:attribute name="default" type="xsd:string"/> <xsd:attribute name="param" type="xsd:string"/> <xsd:attribute name="context" type="xsd:string"/> </xsd:complexType>