bugfixes HTML-Elements and cHTML

Dieser Commit ist enthalten in:
o.pinke 2023-02-12 12:59:50 +01:00
Ursprung 0589fd287e
Commit 6f0385f4ba
2 geänderte Dateien mit 28 neuen und 37 gelöschten Zeilen

Datei anzeigen

@ -415,7 +415,7 @@ class cHTML extends cHTML5Common {
$style = $this->getAttribute("style");
/* If the style doesn't end with a semicolon, append one */
if(is_string($style)) {
if(!empty($style) && is_string($style)) {
$style = trim($style);
if (substr($style, strlen($style) - 1) != ";") {
@ -423,12 +423,20 @@ class cHTML extends cHTML5Common {
}
}
foreach($this->_aStyleDefinitions as $sEntry) {
$style .= $sEntry;
foreach($this->_aStyleDefinitions as $sKey => $sEntry) {
$style .= $sKey.': '.$sEntry;
if (substr($style, strlen($style) - 1) != ";") {
$style .= ";";
}
}
/* Apply all stored styles */
foreach ($this->_styledefs as $key => $value) {
$style .= "$key: $value;";
}
if ($style != "") {
$this->setStyle($style);
}
foreach($this->_aEventDefinitions as $sEventName => $sEntry) {
@ -440,15 +448,6 @@ class cHTML extends cHTML5Common {
$this->setAttribute($sEventName, $this->getAttribute($sEventName).implode(" ", $aFullCode));
}
/* Apply all stored styles */
foreach ($this->_styledefs as $key => $value) {
$style .= "$key: $value;";
}
if ($style != "") {
$this->setStyle($style);
}
if ($this->_content != "" || $this->_contentlessTag == false) {
$attributes = $this->getAttributes(true);
return $this->fillSkeleton($attributes).$this->_content.$this->fillCloseSkeleton();

Datei anzeigen

@ -57,8 +57,7 @@ class cHTMLFormElement extends cHTML {
if (is_string($id) && !empty($id)) {
$this->updateAttributes(array("id" => $id));
}
$this->setClass("text_medium"); // TODO: Remove this...
$this->setDisabled($disabled);
$this->setTabindex($tabindex);
$this->setAccessKey($accesskey);
@ -931,7 +930,7 @@ class cHTMLRadiobutton extends cHTMLFormElement {
*/
function toHtml($renderLabel = true) {
$attributes = $this->getAttributes(true);
//print_r($attributes);
if ($renderLabel == false) {
return $this->fillSkeleton($attributes);
}
@ -1029,37 +1028,30 @@ class cHTMLCheckbox extends cHTMLFormElement {
* @return string Rendered HTML
*/
function toHtml($renderlabel = true) {
$attributes = $this->getAttributes(true);
if ($renderlabel == false) {
return $this->fillSkeleton($attributes);
}
$id = $this->getAttribute("id");
$renderedLabel = "";
if ($renderlabel == true) {
if ($id != "") {
$label = new cHTMLLabel($this->_value, $this->getAttribute("id"));
if ($id != "") {
$label = new cHTMLLabel($this->_value, $this->getAttribute("id"));
$label->setClass($this->getAttribute("class"));
if ($this->_labelText != "") {
$label->setLabelText($this->_labelText);
}
$renderedLabel = $label->toHtml();
} else {
$renderedLabel = $this->_value;
if ($this->_labelText != "") {
$label = new cHTMLLabel($this->_value, $this->getAttribute("id"));
$label->setLabelText($this->_labelText);
$renderedLabel = $label->toHtml();
}
if ($this->_labelText != "") {
$label->setLabelText($this->_labelText);
}
return '<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap="nowrap">' . parent::toHTML() . '</td><td nowrap="nowrap">' . $renderedLabel . '</td></tr></table>';
$renderedLabel = $label->toHtml();
} else {
return parent::toHTML();
$renderedLabel = $this->_value;
}
}
return $this->fillSkeleton($attributes) . $renderedLabel;
}
}
/**