Commit 34305b44 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Merge remote-tracking branch 'origin/crose_work' into raos_work

parents 6afc0a1e 97e88238
......@@ -80,21 +80,26 @@ Debug / Log / Errormessages
* Before firing a SQL or doing processing of an FormElement, set some debugging / error variables:
[src] $this->store->setVar(SYSTEM_SQL_RAW, STORE_SYSTEM)
[src] $this->store->setVar(SYSTEM_SQL_RAW, STORE_SYSTEM)
* Available fields:
<code>
SYSTEM_SQL_RAW
SYSTEM_SQL_FINAL
SYSTEM_SQL_COUNT
SYSTEM_SQL_PARAM_ARRAY
SYSTEM_FORM = CLIENT_FORM; // '<formName> / <formId>'
SYSTEM_FORM_ELEMENT = 'formElement'; // '<formElementName> / <formElementeId>'
SYSTEM_FORM_ELEMENT_COLUMN = 'formElementColumn'; // '<columnname of current processed formElement>'
</code>
<code>
SYSTEM_SQL_RAW
SYSTEM_SQL_FINAL
SYSTEM_SQL_COUNT
SYSTEM_SQL_PARAM_ARRAY
SYSTEM_FORM = CLIENT_FORM; // '<formName> / <formId>'
SYSTEM_FORM_ELEMENT = 'formElement'; // '<formElementName> / <formElementeId>'
SYSTEM_FORM_ELEMENT_COLUMN = 'formElementColumn'; // '<columnname of current processed formElement>'
</code>
* Form.debugShowInfo: yes|no will display a tooltip near beside every formelement and show parse/evaluate as tooltip.
* Check to display debug info:
$this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes'
Stores
======
......
......@@ -60,13 +60,15 @@ Setup a *report* to manage all *forms*: Create a Typo3 page and insert a content
::
form = {{form}}
10.sql = SELECT CONCAT('{{pageId}}&form=Form&r=', f.id) as Pagee, f.id, f.name, f.title, f.tableName FROM FormEditor As f ORDER BY f.name
10.head = <br><table class="table">
10.tail = </table>
10.rbeg = <tr class="table-hover">
10.rend = </tr>
10.fbeg = <td>
10.fend = </td>
10 {
sql = SELECT CONCAT('{{pageId}}&form=Form&r=', f.id) as Pagee, f.id, f.name, f.title, f.tableName FROM FormEditor As f ORDER BY f.name
head = <br><table class="table">
tail = </table>
rbeg = <tr class="table-hover">
rend = </tr>
fbeg = <td>
fend = </td>
}
<ext_dir>/config.ini
--------------------
......
......@@ -380,16 +380,18 @@ abstract class AbstractBuildForm {
public function deriveNewRecordUrlFromExistingSip(&$toolTipNew) {
$urlParam = $this->store->getStore(STORE_SIP);
$urlParam[SIP_RECORD_ID] = 0;
unset($urlParam[SIP_SIP]);
unset($urlParam[SIP_URLPARAM]);
$urlParam['id'] = $this->store->getVar(TYPO3_PAGE_ID, STORE_TYPO3);
$urlParam['type'] = $this->store->getVar(TYPO3_PAGE_TYPE, STORE_TYPO3);
Support::appendTypo3ParameterToArray($urlParam);
$sip = $this->store->getSipInstance();
$url = $sip->queryStringToSip(OnArray::toString($urlParam));
if ($this->showDebugInfo) {
//TODO: missing decoding of SIP
$toolTipNew .= PHP_EOL . PHP_EOL . OnArray::toString($urlParam, ' = ', PHP_EOL, "'");
}
......
......@@ -61,7 +61,8 @@ class BodytextParser {
$full = '';
foreach ($bodytextArray as $row) {
// Valid 'new line' starts indicators: form, <level>, <level.sublevel>, <level>.<keyword>, {, <level> {, }
if ((1 === preg_match('/^\s*(\d*(\.)?)*\s*(head|althead|tail|sql|rbeg|rend|renr|rsep|fbeg|fend|fsep|form|debugShowBodyText|r) *=/', $row))
if ((1 === preg_match('/^\s*(\d*(\.)?)*\s*(head|althead|tail|sql|rbeg|rend|renr|rsep|fbeg|fend|fsep|' .
TYPO3_FORM . '|' . TYPO3_DEBUG_SHOW_BODY_TEXT . '|' . TYPO3_RECORD_ID . ') *=/', $row))
|| (1 === preg_match('/^\s*(\d*(\.)?)*\s*({|})\s*/', $row))
|| (1 === preg_match('/^\s*(\d+(\.)?)+/', $row))
) {
......@@ -96,8 +97,7 @@ class BodytextParser {
// Replace '\{' | '\}' by internal token. All remaining '}' | '{' means: 'nested'
$bodytext = str_replace('\{', '#&[_#', $bodytext);
$bodytext = str_replace('\}', '#&]_#', $bodytext);
$bodytext = str_replace('{{', '#&[[_#', $bodytext);
$bodytext = str_replace('}}', '#&]]_#', $bodytext);
$bodytext = Support::encryptDoubleCurlyBraces($bodytext);
$result = $bodytext;
$posFirstClose = strpos($result, '}');
......@@ -143,9 +143,7 @@ class BodytextParser {
$result = str_replace('#&[_#', '{', $result);
$result = str_replace('#&]_#', '}', $result);
$result = str_replace('#&[[_#', '{{', $result);
$result = str_replace('#&]]_#', '}}', $result);
$result = Support::decryptDoubleCurlyBraces($result);
return $result;
}
......
......@@ -10,6 +10,7 @@ namespace qfq;
use qfq;
use qfq\UserFormException;
use TYPO3\CMS\Form\Domain\Model\Element\ButtonElement;
require_once(__DIR__ . '/../qfq/Constants.php');
require_once(__DIR__ . '/../qfq/helper/OnArray.php');
......@@ -112,71 +113,102 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
/**
* Simlute Submit Button: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
* Simulate Submit Button: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
*
* @return string
*/
private function buildButtons() {
$toolTipNew = 'New';
$toolTipDelete = 'Delete';
$buttonDelete = '';
$buttonNew = '';
$buttonDebug = '';
$buttonDelete = '';
$buttonClose = '';
$buttonSave = '';
$buttonEditForm = '';
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
// Button: FormEdit
if ($this->showDebugInfo) {
$tooltipFormEdit = "Edit form" . PHP_EOL . PHP_EOL . OnArray::toString($this->store->getStore(STORE_SIP), ' = ', PHP_EOL, "'");
$urlFormEdit = $this->createFormEditUrl();
// Edit Form
$buttonDebug = <<<BUTTON
<div class="btn-group" role="group">
<a href="$urlFormEdit" id="form-edit-button" class="btn btn-default navbar-btn" title="$tooltipFormEdit"><span class="glyphicon glyphicon-wrench"></span></a>
</div>
BUTTON;
$toolTip = "Edit form" . PHP_EOL . PHP_EOL . OnArray::toString($this->store->getStore(STORE_SIP), ' = ', PHP_EOL, "'");
$url = $this->createFormEditUrl();
$buttonEditForm = $this->buildButtonAnchor('form-edit-button', $url, $toolTip, 'glyphicon-wrench');
}
// Button: Save
if (Support::findInSet(FORM_BUTTON_SAVE, $this->formSpec['showButton'])) {
$toolTip = 'Save';
if ($this->showDebugInfo) {
$toolTip .= PHP_EOL . "table = '" . $this->formSpec['tableName'] . "'" . PHP_EOL . "r = '" . $recordId . "'";
}
$buttonSave = $this->buildButtonCode('save-button', $toolTip, 'glyphicon-ok');
}
// Button: Close
if (Support::findInSet(FORM_BUTTON_CLOSE, $this->formSpec['showButton'])) {
$toolTip = 'Close';
if ($this->showDebugInfo) {
$toolTip .= PHP_EOL . "table = '" . $this->formSpec['tableName'] . "'" . PHP_EOL . "r = '" . $recordId . "'";
}
$buttonClose = $this->buildButtonCode('close-button', 'Close', 'glyphicon-remove');
}
// Button: Delete
if (Support::findInSet(FORM_BUTTON_DELETE, $this->formSpec['showButton'])) {
$toolTip = 'Delete';
if ($this->showDebugInfo && $recordId > 0) {
$toolTipDelete .= PHP_EOL . "table = '" . $this->formSpec['tableName'] . "'" . PHP_EOL . "r = '" . $recordId . "'";
$toolTip .= PHP_EOL . "table = '" . $this->formSpec['tableName'] . "'" . PHP_EOL . "r = '" . $recordId . "'";
}
$buttonDeleteDisabled = ($recordId > 0) ? '' : 'disabled';
$disabled = ($recordId > 0) ? '' : 'disabled';
$buttonDelete = <<<BUTTON
<div class="btn-group" role="group">
<button id="delete-button" type="button" class="btn btn-default navbar-btn $buttonDeleteDisabled" title="$toolTipDelete"><span class="glyphicon glyphicon-trash"></span></button>
</div>
BUTTON;
$buttonDelete = $this->buildButtonCode('delete-button', $toolTip, 'glyphicon-trash', $disabled);
}
// Button: New
if (Support::findInSet(FORM_BUTTON_NEW, $this->formSpec['showButton'])) {
$formNewUrl = $this->deriveNewRecordUrlFromExistingSip($toolTipNew);
$toolTip = 'New';
$url = $this->deriveNewRecordUrlFromExistingSip($toolTip);
$buttonNew = <<<BUTTON
<div class="btn-group" role="group">
<a href="$formNewUrl" id="form-new-button" class="btn btn-default navbar-btn" title="$toolTipNew"><span class="glyphicon glyphicon-plus"></span></a>
</div>
BUTTON;
$buttonNew = $this->buildButtonAnchor('form-new-button', $url, $toolTip, 'glyphicon-plus');
}
// <div class="btn-toolbar pull-right" role="toolbar">
$html = <<<BUTTON
<div class="btn-toolbar" role="toolbar">
$buttonDebug
<div class="btn-group" role="group">
<button id="save-button" type="button" class="btn btn-default navbar-btn" title="Save"><span class="glyphicon glyphicon-ok"></span></button>
<button id="close-button" type="button" class="btn btn-default navbar-btn" title="Close"><span class="glyphicon glyphicon-remove"></span></button>
</div>
$buttonDelete
$buttonNew
</div>
BUTTON;
$html = Support::wrapTag('<div class="btn-group" role="group">', $buttonEditForm);
$html .= Support::wrapTag('<div class="btn-group" role="group">', $buttonSave . $buttonClose);
$html .= Support::wrapTag('<div class="btn-group" role="group">', $buttonDelete);
$html .= Support::wrapTag('<div class="btn-group" role="group">', $buttonNew);
$html = Support::wrapTag('<div class="btn-toolbar" role="toolbar">', $html);
return $html;
}
/**
* @param $id
* @param $url
* @param $title
* @param $icon
* @param string $disabled
* @return string
*/
private function buildButtonAnchor($id, $url, $title, $icon, $disabled = '') {
return "<a href='$url' id='$id' class='btn btn-default navbar-btn $disabled' " . Support::doAttribute('title', $title) . "><span class='glyphicon $icon'></span></a>";
}
/**
* @param $id
* @param $title
* @param $icon
* @param string $disabled
* @return string
*/
private function buildButtonCode($id, $title, $icon, $disabled = '') {
return "<button id='$id' type='button' class='btn btn-default navbar-btn $disabled' " . Support::doAttribute('title', $title) . "><span class='glyphicon $icon'></span></button>";
}
/**
* @param $pillArray
* @return string
......
......@@ -26,6 +26,8 @@ const FORM_PERMISSION_ALWAYS = 'always';
const FORM_PERMISSION_NEVER = 'never';
const FORM_BUTTON_NEW = 'new';
const FORM_BUTTON_DELETE = 'delete';
const FORM_BUTTON_CLOSE = 'close';
const FORM_BUTTON_SAVE = 'save';
const FORM_FORWARD_MODE_NO = 'no';
const FORM_FORWARD_MODE_AUTO = 'auto';
......@@ -35,6 +37,7 @@ const SESSION_FE_USER_UID = 'fe_user_uid';
const RETURN_URL = 'return_url';
const RETURN_SIP = 'return_sip';
const RETURN_ARRAY = 'return_array';
const SQL_FORM_ELEMENT_SPECIFIC_CONTAINER = "SELECT *, ? AS 'nestedInFieldSet' FROM FormElement AS fe WHERE fe.formId = ? AND fe.deleted = 'no' AND FIND_IN_SET(fe.class, ? ) AND fe.feIdContainer = ? AND fe.enabled='yes' ORDER BY fe.ord, fe.id";
const SQL_FORM_ELEMENT_ALL_CONTAINER = "SELECT *, ? AS 'nestedInFieldSet' FROM FormElement AS fe WHERE fe.formId = ? AND fe.deleted = 'no' AND FIND_IN_SET(fe.class, ? ) AND fe.enabled='yes' ORDER BY fe.ord, fe.id";
......@@ -171,7 +174,9 @@ const STORE_TABLE_DEFAULT = "D"; // definition of primary table.
const STORE_TABLE_COLUMN_TYPES = "M"; // column types of primary table.
const STORE_CLIENT = "C"; // Client: POST variable, if not found: GET variable
const STORE_TYPO3 = "T"; // Typo3 > Page content record > bodytext
const STORE_VAR = "V"; // Generic Vars
const STORE_ZERO = "0"; // value: 0, might helpfull if variable is empty but used in an SQL statement, which might produce a SQL error otherwise if substituted with an empty string
const STORE_EMPTY = "E"; // value: '', might helpfull if variable is not defined and should result in an empty string instead of {{...}} (cause not replaced)
const STORE_SYSTEM = "Y"; // various system values like db connection credentials
const STORE_USE_DEFAULT = "FSRD";
......@@ -209,12 +214,15 @@ const CLIENT_PHP_SELF = 'PHP_SELF';
// T3 Bodytext Keywords
const TYPO3_FORM = CLIENT_FORM;
const TYPO3_RECORD_ID = CLIENT_RECORD_ID;
const TYPO3_FE_USER = 'feUser';
const TYPO3_FE_USER_UID = 'feUserUid';
const TYPO3_FE_USER_GROUP = 'feUserGroup';
const TYPO3_TT_CONTENT_UID = 'ttcontentUid';
const TYPO3_PAGE_ID = 'typo3PageId';
const TYPO3_PAGE_TYPE = 'typo33PageType';
const TYPO3_PAGE_ID = 'pageId';
const TYPO3_PAGE_TYPE = 'pageType';
const TYPO3_PAGE_LANGUAGE = 'pageLanguage';
const TYPO3_DEBUG_SHOW_BODY_TEXT = 'debugShowBodyText';
// System
const SYSTEM_DB_USER = 'DB_USER';
......@@ -260,6 +268,12 @@ const SIP_TABLE = 'table'; // delete a record from 'table'
const SIP_URLPARAM = 'urlparam';
// FURTHER: all extracted params from 'urlparam
const VAR_RANDOM = 'random';
const RANDOM_LENGTH = 32;
// FORM - copy from table 'form' of processed form
//const DEF_FORM_NAME = CLIENT_FORM;
......@@ -317,3 +331,6 @@ const GLYPH_ICON_SHOW = 'glyphicon glyphicon-search';
const GLYPH_ICON_TOOL = 'glyphicon-wrench';
const GLYPH_ICON_CHECK = 'glyphicon glyphicon-ok';
// SUPPORT
const PARAM_T3_ALL = 't3 all';
const PARAM_T3_NO_ID = "t3 no id";
\ No newline at end of file
......@@ -84,7 +84,6 @@ class Evaluate {
$posFirstClose = strpos($result, $this->endDelimiter);
while ($posFirstClose !== false) {
$flagTokenReplaced = true;
$posMatchOpen = strrpos(substr($result, 0, $posFirstClose), $this->startDelimiter);
if ($posMatchOpen === false) {
......@@ -96,32 +95,42 @@ class Evaluate {
$match = substr($result, $posMatchOpen + $this->startDelimiterLength, $posFirstClose - $posMatchOpen - $this->startDelimiterLength);
$evaluated = $this->substitute($match, $foundInStore);
$debugLocal[] = $debugIndent . "#Replace: '$match'";
// If an array is returned, break everything and return this assoc array.
if (is_array($evaluated)) {
$result = $evaluated;
$debugLocal[] = $debugIndent . "#By: 'array(" . count($result) . ")'";
break;
}
if ($foundInStore === '') {
// Encode the non replaceable part as preparation not to process again and to recode at the end.
$evaluated = Support::encryptDoubleCurlyBraces($this->startDelimiter . $match . $this->endDelimiter);
$debugLocal[] = $debugIndent . "#By: <nothing found - not replaced>";
} else {
$flagTokenReplaced = true;
$debugLocal[] = $debugIndent . "#By: '$evaluated'";
// If an array is returned, break everything and return this assoc array.
if (is_array($evaluated)) {
$result = $evaluated;
$debugLocal[] = $debugIndent . "#By: 'array(" . count($result) . ")'";
break;
}
// More to substitute in the new evaluated result? Start recursion just with the new result..
if (strpos($evaluated, $this->endDelimiter) !== false) {
$evaluated = $this->parse($evaluated, $recursion + 1, $debugLocal, $foundInStore);
}
$debugLocal[] = $debugIndent . "#By: '$evaluated'";
// More to substitute in the new evaluated result? Start recursion just with the new result..
if (strpos($evaluated, $this->endDelimiter) !== false) {
$evaluated = $this->parse($evaluated, $recursion + 1, $debugLocal, $foundInStore);
}
}
$result = $pre . $evaluated . $post;
$posFirstClose = strpos($result, $this->endDelimiter);
}
if ($flagTokenReplaced === true) {
$debugLocal[] = $debugIndent . "#Final: " . is_array($result) ? "array(" . count($result) .")" : "'$result'" ;
$debugLocal[] = $debugIndent . "#Final: " . is_array($result) ? "array(" . count($result) . ")" : "'$result'";
$debugStack = $debugLocal;
}
return $result;
return Support::decryptDoubleCurlyBraces($result);
}
/**
......@@ -133,7 +142,7 @@ class Evaluate {
* If neither a) or b) match, return the token itself, surrounded by single ticks, to emphase that substition failed.
*
* @param $token
* @param string $foundInStore
* @param string $foundInStore Returns the name of the store where $key has been found. If $key is not found, return ''.
* @return array|mixed|null|string
* @throws CodeException
* @throws DbException
......@@ -154,6 +163,7 @@ class Evaluate {
// SQL Statement?
if (in_array(strtoupper($arr[0] . ' '), $this->sqlKeywords)) {
$foundInStore = 'query';
return $this->db->sql($token, $sqlMode);
}
......@@ -168,8 +178,11 @@ class Evaluate {
// search for value in stores
$value = $this->store->getVar($arr[0], $arr[1], $arr[2], $foundInStore);
// nothing replaced: put ticks around, to sanitize strings for SQL statements. Nothing to substitute is not a wished situation.
return ($value === false) ? "'" . $token . "'" : $value;
// OLD: nothing replaced: put ticks around, to sanitize strings for SQL statements. Nothing to substitute is not a wished situation.
// return ($value === false) ? "'" . $token . "'" : $value;
// NEW: nothing replaced: higher level should decide what to do
return $value;
}
public function getDebug() {
......
......@@ -158,7 +158,7 @@ class QuickFormQuery {
public function process() {
$html = '';
if ($this->store->getVar('debugShowBodyText', STORE_TYPO3) === '1') {
if ($this->store->getVar(TYPO3_DEBUG_SHOW_BODY_TEXT, STORE_TYPO3) === '1') {
$html .= Support::appendTooltip('', $this->t3data['bodytext']);
}
......@@ -418,7 +418,7 @@ class QuickFormQuery {
* @return string
*/
private function doReport() {
$report = new Report($this->t3data, $this->store->getVar(SYSTEM_SESSION_NAME, STORE_SYSTEM), $this->phpUnit);
$report = new Report($this->t3data, $this->store->getVar(SYSTEM_SESSION_NAME, STORE_SYSTEM), $this->eval, $this->phpUnit);
$html = $report->process();
......
......@@ -14,19 +14,29 @@ class Support {
/**
* @param array $queryArray Empty or prefilled assoc array with url parameter
* @param string $mode PARAM_T3_NO_ID, PARAM_T3_ALL
*/
public static function appendTypo3ParameterToArray(array &$queryArray) {
public static function appendTypo3ParameterToArray(array &$queryArray, $mode = PARAM_T3_ALL) {
// if (isset($_GET['id']))
// $queryArray['id'] = self::getCurrentPage();
if (isset($GLOBALS["TSFE"]->id))
$queryArray['id'] = $GLOBALS["TSFE"]->id;
if (isset($_GET['L']))
$queryArray['L'] = $_GET['L'];
$store = Store::getInstance();
if (isset($_GET['type']))
$queryArray['type'] = $_GET['type'];
if ($mode === PARAM_T3_ALL) {
$queryArray['id'] = $store->getVar(TYPO3_PAGE_ID, STORE_TYPO3);
}
// TYPE
$tmp = $store->getVar(TYPO3_PAGE_TYPE, STORE_TYPO3);
if ($tmp !== false && $tmp != 0) {
$queryArray['type'] = $tmp;
}
// Language
$tmp = $store->getVar(TYPO3_PAGE_LANGUAGE, STORE_TYPO3);
if ($tmp !== false && $tmp != 0) {
$queryArray['L'] = $tmp;
}
}
/**
......@@ -186,4 +196,57 @@ class Support {
return $date . ' ' . $time;
}
/**
* Encrypt curly braces by an uncommon string. Helps preventing unwished action on curly braces.
*
* @param $text
* @return mixed
*/
public static function encryptDoubleCurlyBraces($text) {
$text = str_replace('{{', '#&@[[@_#', $text);
$text = str_replace('}}', '#&@]]@_#', $text);
return $text;
}
/**
* Decrypt curly braces by an uncommon string. Helps preventing unwished action on curly braces
*
* @param $text
* @return mixed
*/
public static function decryptDoubleCurlyBraces($text) {
$text = str_replace('#&@[[@_#', '{{', $text);
$text = str_replace('#&@]]@_#', '}}', $text);
return $text;
}
/**
* @param int $length Length of the required hash string
* @return string A random alphanumeric hash
*/
public static function randomAlphaNum($length) {
$possible_characters = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$string = "";
while (strlen($string) < $length) {
$string .= substr($possible_characters, rand() % (strlen($possible_characters)), 1);
}
return ($string);
}
/**
* @param $url
* @param $param
* @return string
*/
public static function concatUrlParam($url, $param) {
if ($param == '')
return $url;
$token = (strpos($url, '?') === false) ? '?' : '&';
return $url . $token . $param;
}
}
\ No newline at end of file
......@@ -70,6 +70,7 @@ const NAME_PAGE = 'page';
const NAME_TEXT = 'text';
const NAME_ALT_TEXT = 'altText';
const NAME_TOOL_TIP = 'toolTip';
const NAME_TOOL_TIP_JS = 'toolTipJs';
const NAME_IMAGE = 'image';
const NAME_IMAGE_TITLE = 'imageTitle';
const NAME_GLYPH = 'glyph';
......@@ -85,6 +86,8 @@ const NAME_HASH = 'hash';
const NAME_URL_PARAM = 'param';
const NAME_RIGHT_PICTURE_POSITION = 'picturePosition';
const NO_CLASS = 'no_class';
/**
* Class Link
* @package qfq
......@@ -123,6 +126,7 @@ class Link {
'u' => 'buildUrl',
'm' => 'buildMail',
'p' => 'buildPage',
'o' => 'buildToolTip',
'P' => 'buildPicture',
'B' => 'buildBullet',
'C' => 'buildCheck',
......@@ -178,7 +182,7 @@ class Link {
$this->utils = new Utils();
$this->varsDefault[NAME_QUESTION] = 'Please confirm';
$this->varsDefault[NAME_PAGE] = $this->store->getVar(TYPO3_PAGE_ID, STORE_TYPO3);
// $this->varsDefault[NAME_PAGE] = $this->store->getVar(TYPO3_PAGE_ID, STORE_TYPO3);
$this->varsDefault[NAME_ENCRYPTION] = '0';
$this->varsDefault[NAME_RIGHT_PICTURE_POSITION] = 'l';
$this->varsDefault[NAME_RENDER] = 0;
......@@ -270,7 +274,12 @@ class Link {
$this->doCssClass($vars);
$htmlUrl = $this->doHtmlUrl($vars);
// Set default tooltip
if ($vars[NAME_TOOL_TIP] == '' && $vars[NAME_GLYPH_TITLE] !== '') {
$vars[NAME_TOOL_TIP] = $vars[NAME_GLYPH_TITLE];
}
$htmlUrl = $this->doAnchor($vars);
$htmlImage = $this->doHtmlImageGlyph($vars);
// Compose Image & Text
......@@ -281,8 +290,8 @@ class Link {
// ToolTip
$extraSpan = ['', ''];
if ($vars[NAME_TOOL_TIP]) {
$extraSpan[0] = "<span " . $vars[NAME_TOOL_TIP][0] . ">" . $vars[NAME_TOOL_TIP][1];
if ($vars[NAME_TOOL_TIP] !== '') {
$extraSpan[0] = "<span " . $vars[NAME_TOOL_TIP_JS][0] . ">" . $vars[NAME_TOOL_TIP_JS][1];
$extraSpan[1] = "</span>";
}
......@@ -337,7 +346,7 @@ class Link {
// 3: <a href=url>url</a>
case '3':
$link = $htmlUrl . $vars[NAME_URL] . '</a>' . $vars[NAME_TOOL_TIP][1];
$link = $htmlUrl . $vars[NAME_URL] . '</a>' . $vars[NAME_TOOL_TIP_JS][1];
break;
case '13':
$vars[NAME_TEXT] = $vars[NAME_MAIL];
......@@ -346,7 +355,7 @@ class Link {
// 4: <a href=url>Text</a>
case '4':
$link = $htmlUrl . $vars[NAME_TEXT] . '</a>' . $vars[NAME_TOOL_TIP][1];
$link = $htmlUrl . $vars[NAME_TEXT] . '</a>' . $vars[NAME_TOOL_TIP_JS][1];
break;