commit f41621b47c75fa24ea3fa1b052e3aa5577bc87f1
parent d6a4d87eb3f24c88fc836ed1909fe0f523fb1152
Author: Jan Dankert <develop@jandankert.de>
Date: Fri, 24 May 2019 01:42:27 +0200
New: Labels von Formularelementen können auch Variablen enthalten.
Diffstat:
7 files changed, 39 insertions(+), 34 deletions(-)
diff --git a/dev-helper/create-output-files.sh b/dev-helper/create-output-files.sh
@@ -89,5 +89,15 @@ function createfile
fi
}
+function xsdfile
+{
+
+ xsd="../modules/template-engine/components/template.xsd"
+ if [ -f $xsd ]; then
+ chmod 666 -v $xsd
+ fi
+}
+
language
check
+xsdfile
diff --git a/modules/cms-ui/themes/default/html/views/project/info.php b/modules/cms-ui/themes/default/html/views/project/info.php
@@ -1,17 +1,9 @@
- <?php foreach($info as $list_key=>$list_value){ ?>
- <div class="line">
- <div class="label">
- <label class="label">
- <span><?php echo nl2br(encodeHtml(htmlentities(lang('project_info_'.$list_key.'')))); ?></span>
-
- </label>
- </div>
- <div class="input">
- <strong><?php echo nl2br(encodeHtml(htmlentities($list_value))); ?></strong>
-
- </div>
- </div>
- <?php } ?>
+ <form name="" target="_self" data-target="view" action="./" data-method="info" data-action="project" data-id="<?php echo OR_ID ?>" method="POST" enctype="application/x-www-form-urlencoded" class="or-form project" data-async="" data-autosave=""><input type="hidden" name="<?php echo REQ_PARAM_EMBED ?>" value="1" /><input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" /><input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="project" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="info" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" />
+ <?php foreach($info as $list_key=>$list_value){ ?>
+ <label class="or-form-row"><span class="or-form-label"><?php echo lang($list_key) ?></span><span class="or-form-input"><span><?php echo nl2br(encodeHtml(htmlentities($list_value))); ?></span></span></label>
+
+ <?php } ?>
+ <div class="or-form-actionbar"><input type="button" class="or-form-btn or-form-btn--secondary or-form-btn--cancel" value="<?php echo lang("CANCEL") ?>" /></div></form>
\ No newline at end of file
diff --git a/modules/cms-ui/themes/default/html/views/project/info.tpl.src.xml b/modules/cms-ui/themes/default/html/views/project/info.tpl.src.xml
@@ -1,15 +1,9 @@
<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd">
- <list list="info">
- <part class="line">
- <part class="label">
- <label for="">
- <text key="var:list_key" prefix="project_info_"></text>
- </label>
- </part>
- <part class="input">
- <text type="strong" var="list_value"></text>
- </part>
- </part>
- </list>
+ xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd">
+ <form readonly="true">
+
+ <list list="info">
+ <text label="var:list_key" var="list_value"/>
+ </list>
+ </form>
</output>
\ No newline at end of file
diff --git a/modules/template-engine/components/XSDGenerator.php b/modules/template-engine/components/XSDGenerator.php
@@ -9,6 +9,8 @@ require('../../util/FileUtils.class.php');
// Baseclass of all components.
require('html/Component.class.php');
+require('html/HtmlComponent.class.php');
+require('html/FieldComponent.class.php');
header('Content-Type: text/plain');
$folder = FileUtils::readDir(__DIR__ . '/html');
diff --git a/modules/template-engine/components/html/input/Input.class.php b/modules/template-engine/components/html/input/Input.class.php
@@ -36,7 +36,7 @@ class InputComponent extends FieldComponent
{
if ( $this->label )
{
- echo '<label class="or-form-row"><span class="or-form-label">'.lang($this->label).'</span><span class="or-form-input">';
+ echo '<label class="or-form-row"><span class="or-form-label">'.'<?php echo lang('.$this->value($this->label).') ?>'.'</span><span class="or-form-input">';
}
if(!$this->type == 'hidden')
diff --git a/modules/template-engine/components/html/text/Text.class.php b/modules/template-engine/components/html/text/Text.class.php
@@ -22,7 +22,7 @@ class TextComponent extends HtmlComponent
public function begin()
{
if ( $this->label )
- echo '<label class="or-form-row"><span class="or-form-label">'.lang($this->label).'</span><span class="or-form-input">';
+ echo '<label class="or-form-row"><span class="or-form-label">'.'<?php echo lang('.$this->value($this->label).') ?>'.'</span><span class="or-form-input">';
if ( $this->raw )
$this->escape = false;
diff --git a/modules/template-engine/components/template.xsd b/modules/template-engine/components/template.xsd
@@ -99,7 +99,6 @@
<xsd:attribute name="suffix" type="xsd:string"/>
<xsd:attribute name="title" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
- <xsd:attribute name="class" type="xsd:string"/>
<xsd:attribute name="escape" type="xsd:boolean"/>
<xsd:attribute name="var" type="xsd:string"/>
<xsd:attribute name="text" type="xsd:string"/>
@@ -109,6 +108,8 @@
<xsd:attribute name="maxlength" type="xsd:string"/>
<xsd:attribute name="accesskey" type="xsd:string"/>
<xsd:attribute name="cut" type="xsd:string"/>
+ <xsd:attribute name="label" type="xsd:string"/>
+ <xsd:attribute name="class" type="xsd:string"/>
<xsd:attribute name="request" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="dummy" type="dummyType"/>
@@ -390,6 +391,9 @@
<xsd:attribute name="mode" type="xsd:string"/>
<xsd:attribute name="extension" type="xsd:string"/>
<xsd:attribute name="mimetype" type="xsd:string"/>
+ <xsd:attribute name="prefix" type="xsd:string"/>
+ <xsd:attribute name="readonly" type="xsd:boolean"/>
+ <xsd:attribute name="class" type="xsd:string"/>
<xsd:attribute name="request" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="newline" type="newlineType"/>
@@ -655,6 +659,7 @@
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="readonly" type="xsd:boolean"/>
<xsd:attribute name="required" type="xsd:boolean"/>
+ <xsd:attribute name="label" type="xsd:string"/>
<xsd:attribute name="request" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="input" type="inputType"/>
@@ -700,7 +705,6 @@
<xsd:element ref="output" maxOccurs="unbounded" minOccurs="0"/>
<xsd:element ref="tree" maxOccurs="unbounded" minOccurs="0"/>
</xsd:choice>
- <xsd:attribute name="class" type="xsd:string"/>
<xsd:attribute name="default" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="index" type="xsd:string"/>
@@ -710,12 +714,13 @@
<xsd:attribute name="size" type="xsd:string"/>
<xsd:attribute name="maxlength" type="xsd:int"/>
<xsd:attribute name="onchange" type="xsd:string"/>
- <xsd:attribute name="readonly" type="xsd:boolean"/>
<xsd:attribute name="hint" type="xsd:string"/>
<xsd:attribute name="icon" type="xsd:string"/>
<xsd:attribute name="required" type="xsd:boolean"/>
<xsd:attribute name="focus" type="xsd:boolean"/>
<xsd:attribute name="label" type="xsd:string"/>
+ <xsd:attribute name="readonly" type="xsd:boolean"/>
+ <xsd:attribute name="class" type="xsd:string"/>
<xsd:attribute name="request" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="insert" type="insertType"/>
@@ -1051,8 +1056,9 @@
<xsd:element ref="output" maxOccurs="unbounded" minOccurs="0"/>
<xsd:element ref="tree" maxOccurs="unbounded" minOccurs="0"/>
</xsd:choice>
- <xsd:attribute name="class" type="xsd:string"/>
+ <xsd:attribute name="filter" type="xsd:boolean"/>
<xsd:attribute name="width" type="xsd:string"/>
+ <xsd:attribute name="class" type="xsd:string"/>
<xsd:attribute name="request" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="inputarea" type="inputareaType"/>
@@ -1098,7 +1104,6 @@
<xsd:element ref="output" maxOccurs="unbounded" minOccurs="0"/>
<xsd:element ref="tree" maxOccurs="unbounded" minOccurs="0"/>
</xsd:choice>
- <xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="rows" type="xsd:int"/>
<xsd:attribute name="cols" type="xsd:int"/>
<xsd:attribute name="value" type="xsd:string"/>
@@ -1109,6 +1114,8 @@
<xsd:attribute name="default" type="xsd:string"/>
<xsd:attribute name="maxlength" type="xsd:int"/>
<xsd:attribute name="label" type="xsd:string"/>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="readonly" type="xsd:boolean"/>
<xsd:attribute name="request" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="window" type="windowType"/>