Skip to content
Snippets Groups Projects
Commit dd4498a7 authored by Carsten  Rose's avatar Carsten Rose
Browse files

WIP: es wird nur noch ein 'class' attribute gerendert:ok. Next Task: alles mit...

WIP: es wird nur noch ein 'class' attribute gerendert:ok. Next Task: alles mit div wrappen, anstatt <span>
parent ce7b46fd
No related branches found
No related tags found
1 merge request!331B11265 dropdown menu wrap with p breaks dropdown
Pipeline #5089 passed
......@@ -1846,7 +1846,6 @@ const MONITOR_MODE_APPEND_0 = '0';
const MONITOR_MODE_APPEND_1 = '1';
const MONITOR_SESSION_FILE_SEEK = 'monitor-seek-file';
const RENDER_MODE_1 = '1';
const RENDER_MODE_2 = '2';
const RENDER_MODE_3 = '3';
......
......@@ -305,11 +305,12 @@ class Link {
*
* @param array $vars
* @param $keyName
* @param $bsCssDisabled by default 'disabled'. For Bootstrap dropdown Button empty: Fake to misuse this function for rendering.
*
* @return string
* @return mixed|string
* @throws \CodeException
*/
private function wrapLinkTextOnly(array $vars, $keyName) {
private function wrapLinkTextOnly(array $vars, $keyName, $bsCssDisabled) {
$text = $vars[$keyName];
if ($vars[NAME_BOOTSTRAP_BUTTON] == '' && $vars[FINAL_TOOL_TIP] == '' && $vars[NAME_ATTRIBUTE] == '') {
......@@ -322,7 +323,7 @@ class Link {
}
if ($vars[NAME_BOOTSTRAP_BUTTON] != '') {
$attributes .= Support::doAttribute('class', [$vars[NAME_BOOTSTRAP_BUTTON], 'disabled']);
$attributes .= Support::doAttribute('class', [$vars[NAME_BOOTSTRAP_BUTTON], $bsCssDisabled]);
}
return Support::wrapTag("<span $attributes>", $text);
......@@ -381,6 +382,8 @@ class Link {
// Remove first array element - that's the menu, not a menu entry. Render the menu.
$flagMenuEnabled = false;
// Final rendering of dropdown Menu
$dropdownSymbol = $this->renderDropdownSymbol(array_shift($menuEntryStrArr), $htmlId, $flagMenuEnabled);
if ($flagMenuEnabled) {
......@@ -483,7 +486,7 @@ class Link {
$flagMenuEnabled = ($paramArr[TOKEN_RENDER] ?? 0) < 3;
// Misuse the link class to render the menu symbol: this gives tooltip, glyph, button, text ... - set render mode to '3' = 'no link'
$paramArr[TOKEN_RENDER] = '1';
$paramArr[TOKEN_RENDER] = '3';
if (!isset($paramArr[TOKEN_GLYPH]) || $paramArr[TOKEN_GLYPH] == '1') {
$paramArr[TOKEN_GLYPH] = 'glyphicon-option-vertical';
......@@ -500,7 +503,7 @@ class Link {
if (!$flagMenuEnabled) {
$class .= ' disabled';
// In case there is no button: set the text an glyphicon to 'muted'
// In case there is no button: set the text and glyphicon to 'muted'
if (($vars[NAME_BOOTSTRAP_BUTTON] ?? '') === '') {
if (($paramArr[TOKEN_TEXT] ?? '') != '') {
......@@ -514,10 +517,11 @@ class Link {
}
$paramArr[TOKEN_CLASS] .= 'dropdown-toggle' . $class;
// $paramArr[TOKEN_ATTRIBUTE] .= ' class="dropdown-toggle' . $class . '"';
$paramArr[TOKEN_ATTRIBUTE] .= ' class="dropdown-toggle' . $class . '"';
$paramArr[TOKEN_ATTRIBUTE] .= ' id="' . $htmlId . '"';
return $this->renderLink(KeyValueStringParser::unparse($paramArr, PARAM_TOKEN_DELIMITER, PARAM_DELIMITER));
return $this->renderLink(KeyValueStringParser::unparse($paramArr, PARAM_TOKEN_DELIMITER, PARAM_DELIMITER),
'', '');
}
/**
......@@ -588,6 +592,7 @@ class Link {
*
* @param string $str Qualifier with params. 'report'-syntax. F.e.: u:www.example.com|P:home.gif|t:Home"
* @param string $strDefault Same as $str, but might give some defaults if corresponding values in $str are missing.
* @param string $bsCssDisabled CSS class name added to Bootstrap button class attribute. By default not given (it becomes 'disabled')
*
* @return string The complete HTML encoded Link like
* <a href='http://example.com' class='external'><img src='icon.gif' title='help text'>Description</a>
......@@ -596,7 +601,7 @@ class Link {
* @throws \UserFormException
* @throws \UserReportException
*/
public function renderLink($str, $strDefault = '') {
public function renderLink($str, $strDefault = '', $bsCssDisabled = 'disabled') {
$tokenGiven = array();
$link = "";
......@@ -643,13 +648,13 @@ class Link {
// 1: 'text'
case '1':
case '11':
$link = $this->wrapLinkTextOnly($vars, FINAL_CONTENT);
$link = $this->wrapLinkTextOnly($vars, FINAL_CONTENT, $bsCssDisabled);
break;
// 2: 'url'
case '2':
case '12':
$link = $this->wrapLinkTextOnly($vars, FINAL_HREF);
$link = $this->wrapLinkTextOnly($vars, FINAL_HREF, $bsCssDisabled);
break;
// 3: <a href=url ...>url</a>
......@@ -1612,12 +1617,13 @@ EOF;
*/
private function buildPage($vars, $value) {
$vars[NAME_LINK_CLASS_DEFAULT] = '';
if (substr($value, 0, 3) !== 'id=') {
$value = 'id=' . $value;
}
$vars[NAME_PAGE] = Support::concatUrlParam('', $value);
$vars[NAME_LINK_CLASS_DEFAULT] = '';
// $vars[NAME_LINK_CLASS_DEFAULT] = $this->cssLinkClassInternal;
return $vars;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment