Commit b4c5b270 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Link.php: Replaced old edit,new,delete gifs by BS Glyph symbols.

parent f8d340e7
......@@ -308,4 +308,14 @@ const SUBRECORD_EDIT = SYMBOL_EDIT;
const SUBRECORD_DELETE = SYMBOL_DELETE;
const SUBRECORD_PARAMETER_FORM = CLIENT_FORM;
const SUBRECORD_PARAMETER_PAGE = 'page';
const SUBRECORD_PARAMETER_DETAIL = 'detail';
\ No newline at end of file
const SUBRECORD_PARAMETER_DETAIL = 'detail';
const GLYPH_ICON_EDIT = 'glyphicon-pencil';
const GLYPH_ICON_NEW = 'glyphicon-plus';
const GLYPH_ICON_DELETE = 'glyphicon-trash';
const GLYPH_ICON_HELP = 'glyphicon glyphicon-question-sign';
const GLYPH_ICON_INFO = 'glyphicon glyphicon-info-sign';
const GLYPH_ICON_SHOW = 'glyphicon glyphicon-search';
const GLYPH_ICON_TOOL = 'glyphicon-wrench';
const GLYPH_ICON_CHECK = 'glyphicon glyphicon-ok';
......@@ -72,6 +72,8 @@ const NAME_ALT_TEXT = 'altText';
const NAME_TOOL_TIP = 'toolTip';
const NAME_IMAGE = 'image';
const NAME_IMAGE_TITLE = 'imageTitle';
const NAME_GLYPH = 'glyph';
const NAME_GLYPH_TITLE = 'glyphTitle';
const NAME_DELETE = 'delete';
const NAME_RENDER = 'render';
const NAME_TARGET = 'target';
......@@ -269,7 +271,7 @@ class Link {
$this->doCssClass($vars);
$htmlUrl = $this->doHtmlUrl($vars);
$htmlImage = $this->doHtmlImage($vars);
$htmlImage = $this->doHtmlImageGlyph($vars);
// Compose Image & Text
if ($htmlImage != '') {
......@@ -375,10 +377,12 @@ class Link {
$vars[NAME_URL] = '';
$vars[NAME_PAGE] = '';
$vars[NAME_IMAGE] = '';
$vars[NAME_TEXT] = '';
$vars[NAME_ALT_TEXT] = '';
$vars[NAME_IMAGE] = '';
$vars[NAME_IMAGE_TITLE] = '';
$vars[NAME_GLYPH] = '';
$vars[NAME_GLYPH_TITLE] = '';
$vars[NAME_QUESTION] = '';
$vars[NAME_TARGET] = '';
$vars[NAME_TOOL_TIP] = ['', ''];
......@@ -434,14 +438,6 @@ class Link {
case 'p':
$value = $this->store->getVar(TYPO3_PAGE_ID, STORE_TYPO3); // If no pageid|pagealias is defined, take current page
break;
case 'E':
case 'N':
case 'D':
case 'H':
case 'I':
case 'S':
$value = '1';
break;
default:
break;
}
......@@ -452,8 +448,8 @@ class Link {
$value = $this->varsDefault[$keyName];
}
// Check for empty values
if ($key !== 'u' && $value === '') {
// Check for empty values. Some keys are allowed to be empty.
if ($value === '' && strpos('uENDHIS', $key) === false) {
throw new UserReportException ("Missing value for '$key'", ERROR_MISSING_VALUE);
}
......@@ -513,6 +509,7 @@ class Link {
$tags = '';
// build URL
$htmlUrl = "";
$anchorTitle = '';
if ($vars[NAME_URL] !== '') {
......@@ -542,9 +539,18 @@ class Link {
}
}
if ($vars[NAME_GLYPH] !== '') {
$vars[NAME_LINK_CLASS] .= ' btn btn-default ';
if ($vars[NAME_GLYPH_TITLE] !== '') {
$anchorTitle = $vars[NAME_GLYPH_TITLE];
}
}
$tags .= Support::doAttribute('href', $vars[NAME_URL]);
$tags .= Support::doAttribute('class', $vars[NAME_LINK_CLASS]);
$tags .= Support::doAttribute('target', $vars[NAME_TARGET]);
$tags .= Support::doAttribute('title', $anchorTitle);
if ($vars[NAME_QUESTION]) {
$tags .= Support::doAttribute('onclick', 'confirm(\'' . $vars[NAME_QUESTION] . '\')');
}
......@@ -554,23 +560,40 @@ class Link {
return ($htmlUrl);
}
//
//<a class="btn btn-default" href="index.php?id=2&s=56fbdd30a0cd2" title='comment'>
// <span class='glyphicon glyphicon-plus'></span>
//</a>
//
//<a href="index.php?id=2&s=56fb7f7703692" class="internal" >
// <img src="typo3conf/ext/qfq/Resources/Public/icons/edit.gif" title="Edit" >
//</a>
/**
* Create Image HTML Tag
* @return string $htmlImage
* @internal param $void
*
* @param array $vars
* @return string
*/
private function doHtmlImage(array $vars) {
private function doHtmlImageGlyph(array $vars) {
$tags = '';
$html = '';
// Build Image
if ($vars[NAME_IMAGE] != '') {
if ($vars[NAME_IMAGE] !== '') {
$tags .= Support::doAttribute('alt', $vars[NAME_ALT_TEXT]);
$tags .= Support::doAttribute('src', $vars[NAME_IMAGE]);
$tags .= Support::doAttribute('title', $vars[NAME_IMAGE_TITLE]);
$html .= '<img ' . $tags . '>';
}
return $tags == '' ? '' : '<img ' . $tags . '>';
if ($vars[NAME_GLYPH] !== '') {
$tags = Support::doAttribute('class', 'glyphicon ' . $vars[NAME_GLYPH]);
$html .= Support::wrapTag('<span ' . $tags . '>', '', false);
}
return $html;
}
/**
......@@ -744,9 +767,13 @@ class Link {
* @param $value
*/
private function buildDelete(&$vars, $key, $value) {
$vars[NAME_IMAGE] = PATH_ICONS . 'delete.gif';
$vars[NAME_IMAGE_TITLE] = "Delete";
// $vars[NAME_IMAGE] = PATH_ICONS . 'delete.gif';
// $vars[NAME_IMAGE_TITLE] = "Delete";
$vars[NAME_DELETE] = true;
$vars[NAME_GLYPH] = GLYPH_ICON_DELETE;
$vars[NAME_GLYPH_TITLE] = "Delete";
// Include Extjs library
$this->utils->loadJSlib($this->fr_error);
}
......@@ -759,10 +786,13 @@ class Link {
* @param $value
*/
private function buildEdit(&$vars, $key, $value) {
$vars[NAME_IMAGE] = PATH_ICONS . 'edit.gif';
$vars[NAME_IMAGE_TITLE] = "Edit";
// $vars[NAME_IMAGE] = PATH_ICONS . 'edit.gif';
// $vars[NAME_IMAGE_TITLE] = "Edit";
$vars[NAME_GLYPH] = GLYPH_ICON_EDIT;
$vars[NAME_GLYPH_TITLE] = "Edit";
}
/**
* Called by $this->callTable
*
......@@ -771,8 +801,10 @@ class Link {
* @param $value
*/
private function buildHelp(&$vars, $key, $value) {
$vars[NAME_IMAGE] = PATH_ICONS . 'help.gif';
$vars[NAME_IMAGE_TITLE] = "Help";
// $vars[NAME_IMAGE] = PATH_ICONS . 'help.gif';
// $vars[NAME_IMAGE_TITLE] = "Help";
$vars[NAME_GLYPH] = GLYPH_ICON_HELP;
$vars[NAME_GLYPH_TITLE] = "Help";
}
/**
......@@ -783,8 +815,12 @@ class Link {
* @param $value
*/
private function buildInfo(&$vars, $key, $value) {
$vars[NAME_IMAGE] = PATH_ICONS . 'info.gif';
$vars[NAME_IMAGE_TITLE] = "Information";
// $vars[NAME_IMAGE] = PATH_ICONS . 'info.gif';
// $vars[NAME_IMAGE_TITLE] = "Information";
$vars[NAME_GLYPH] = GLYPH_ICON_INFO;
$vars[NAME_GLYPH_TITLE] = "Information";
}
/**
......@@ -795,8 +831,12 @@ class Link {
* @param $value
*/
private function buildNew(&$vars, $key, $value) {
$vars[NAME_IMAGE] = PATH_ICONS . 'new.gif';
$vars[NAME_IMAGE_TITLE] = "New";
// $vars[NAME_IMAGE] = PATH_ICONS . 'new.gif';
// $vars[NAME_IMAGE_TITLE] = "New";
$vars[NAME_GLYPH] = GLYPH_ICON_NEW;
$vars[NAME_GLYPH_TITLE] = "New";
}
/**
......@@ -807,7 +847,11 @@ class Link {
* @param $value
*/
private function buildShow(&$vars, $key, $value) {
$vars[NAME_IMAGE] = PATH_ICONS . 'show.gif';
$vars[NAME_IMAGE_TITLE] = "Details";
// $vars[NAME_IMAGE] = PATH_ICONS . 'show.gif';
// $vars[NAME_IMAGE_TITLE] = "Details";
$vars[NAME_GLYPH] = GLYPH_ICON_SHOW;
$vars[NAME_GLYPH_TITLE] = "Details";
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment