Project

General

Profile

Feature #14902 » 14902_6.0_v2.patch

Ralf Hettinger, 2013-04-25 21:19

View differences:

indexed_search/Classes/Controller/SearchFormController.php 2013-04-25 20:41:37.406059337 +0200
*/
public $iconFileNameCache = array();
// a small cache used for building the browse links
protected $pointerSelectorCache;
// Storage of icons....
/**
* @todo Define visibility
......
* @todo Define visibility
*/
public function makePointerSelector_link($str, $p, $freeIndexUid) {
$pointerSelector = '';
if ($this->conf['pageBrowser.']['makePointerLinksWithHref']) {
// pointerSelector is a normal hyperlink (no JavaScript required)
if (!$this->pointerSelectorCache) {
$this->pointerSelectorCache = array();
// create pointerSelectorCache only once, which need to be transferred as GET parameters of the URL
$this->pointerSelectorCache = $this->piVars;
unset($this->pointerSelectorCache['submit_button']);
unset($this->pointerSelectorCache['pointer']);
unset($this->pointerSelectorCache['_freeIndexUid']);
// only use non-default values
foreach ($this->pointerSelectorCache as $var => $val) {
if (
(is_array($this->optValues[$var]) && $this->piVars[$var] == (string) array_shift(array_keys($this->optValues[$var]))) ||
(isset($this->conf['_DEFAULT_PI_VARS.'][$var]) && $this->conf['_DEFAULT_PI_VARS'][$var] == $val)
) {
unset($this->pointerSelectorCache[$var]);
}
}
}
$this->pointerSelectorCache['pointer'] = $p;
$this->pointerSelectorCache['_freeIndexUid'] = $freeIndexUid;
$linkArray = array (
'parameter' => $GLOBALS['TSFE']->id,
'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $this->pointerSelectorCache)
);
$linkArray = array_merge((array) $this->conf['pageBrowser.']['makePointerLinksWithHref.'], $linkArray);
$pointerSelector = $this->cObj->typolink($str, $linkArray);
} elseif ($this->conf['pageBrowser.']['makePointerLinksWithForm']) {
// pointerSelector is a submit button of a pointer form (no JavaScript required; URL will stay "clean" after submission)
if (!$this->pointerSelectorCache) {
$this->pointerSelectorCache = array(
'hiddenInputs' => '',
'currentUrl' => ''
);
foreach ($this->piVars as $key => $value) {
if ($key != 'pointer' && $key != '_freeIndexUid') {
$this->pointerSelectorCache['hiddenInputs'] .= '<input type="hidden" name="' . $this->prefixId . '[' . $key . ']" value="' . $value . '" />';
}
}
$this->pointerSelectorCache['currentUrl'] = $this->cObj->getTypoLink_URL($GLOBALS['TSFE']->id, array(), '_self');
}
$hiddenPointerForm = $this->pointerSelectorCache['hiddenInputs'] .
'<input type="hidden" name="' . $this->prefixId . '[pointer]" value=' . $p . '" />' .
'<input type="hidden" name="' . $this->prefixId . '[_freeIndexUid]" value=' . $freeIndexUid . '" />';
$pointerSelector =
'<form method="post" class="tx-indexedsearch-browseresults-form" action="' . $this->pointerSelectorCache['currentUrl'] . '">' .
'<div class="hiddenPointerForm">' . $hiddenPointerForm . '</div>' .
'<input type="submit" value="' . $str . '" title="' . $str . '"' .
($this->conf['pageBrowser.']['makePointerLinksWithForm.']['submit_params'] ? ' ' . $this->conf['pageBrowser.']['makePointerLinksWithForm.']['submit_params'] : '') .
' />' .
'</form>';
} else {
// pointerSelector is a JavaScript onclick event (the default way)
$onclick = 'document.getElementById(\'' . $this->prefixId . '_pointer\').value=\'' . $p . '\';' . 'document.getElementById(\'' . $this->prefixId . '_freeIndexUid\').value=\'' . rawurlencode($freeIndexUid) . '\';' . 'document.getElementById(\'' . $this->prefixId . '\').submit();return false;';
return '<a href="#" onclick="' . htmlspecialchars($onclick) . '">' . $str . '</a>';
$pointerSelector = '<a href="#" onclick="' . htmlspecialchars($onclick) . '">' . $str . '</a>';
}
return $pointerSelector;
}
/**
indexed_search/ext_typoscript_setup.txt 2013-04-25 20:45:11.126059763 +0200
targetPid.data = TSFE:id
}
pageBrowser {
makePointerLinksWithHref = 0
makePointerLinksWithHref {
ATagParams = class="tx-indexedsearch-pointerLink"
}
makePointerLinksWithForm = 0
makePointerLinksWithForm {
submit_params = class="tx-indexedsearch-pointerButton"
}
}
result_link_target =
/*
flagRendering = CASE
(5-5/5)