Project

General

Profile

Task #26829 ยป search-trunk.diff

Dmitry Dulepov, 2011-05-16 11:03

View differences:

t3lib/stddb/tables.php
'255' => 'recycler.gif',
),
'dynamicConfigFile' => 'T3LIB:tbl_pages.php',
'searchFields' => 'title,alias,nav_title,subtitle,url,keywords,description,abstract,author,author_email',
)
);
......
'useColumnsForDefaultValues' => 'usergroup,lockToDomain,options,db_mountpoints,file_mountpoints,fileoper_perms,userMods',
'dividers2tabs' => TRUE,
'dynamicConfigFile' => 'T3LIB:tbl_be.php',
'versioningWS_alwaysAllowLiveEdit' => TRUE
'versioningWS_alwaysAllowLiveEdit' => TRUE,
'searchFields' => 'username,email,realName',
)
);
......
'useColumnsForDefaultValues' => 'lockToDomain, fileoper_perms',
'dividers2tabs' => TRUE,
'dynamicConfigFile' => 'T3LIB:tbl_be.php',
'versioningWS_alwaysAllowLiveEdit' => TRUE
'versioningWS_alwaysAllowLiveEdit' => TRUE,
'searchFields' => 'title',
)
);
......
'iconfile' => '_icon_ftp.gif',
'useColumnsForDefaultValues' => 'path,base',
'dynamicConfigFile' => 'T3LIB:tbl_be.php',
'versioningWS_alwaysAllowLiveEdit' => TRUE
'versioningWS_alwaysAllowLiveEdit' => TRUE,
'searchFields' => 'title,path',
)
);
t3lib/stddb/tbl_be.php
'type' => 'input',
'size' => '20',
'max' => '50',
'eval' => 'nospace,lower,unique,required'
'eval' => 'nospace,lower,unique,required',
'search' => array(
'nocase'
),
)
),
'password' => array(
......
'type' => 'input',
'size' => '20',
'eval' => 'trim',
'max' => '80'
'max' => '80',
'search' => array(
'nocase'
),
)
),
'disable' => array(
......
'type' => 'input',
'size' => '25',
'max' => '50',
'eval' => 'trim,required'
'eval' => 'trim,required',
'search' => array(
'nocase'
),
)
),
'db_mountpoints' => array(
......
'type' => 'input',
'size' => '20',
'max' => '30',
'eval' => 'required,trim'
'eval' => 'required,trim',
'search' => array(
'nocase'
),
)
),
'path' => array(
t3lib/stddb/tbl_pages.php
'size' => '50',
'max' => '255',
'eval' => 'trim,required',
'search' => array(
'nocase'
),
),
),
'TSconfig' => array(
......
'size' => '50',
'max' => '255',
'eval' => 'trim',
'search' => array(
'nocase'
),
),
),
'nav_hide' => array(
......
'size' => '50',
'max' => '255',
'eval' => '',
'search' => array(
'nocase'
),
),
),
'target' => array(
......
'max' => '32',
'eval' => 'nospace,alphanum_x,lower,unique',
'softref' => 'notify',
'search' => array(
'nocase'
),
),
),
'url' => array(
......
'max' => '255',
'eval' => 'trim,required',
'softref' => 'url',
'search' => array(
'nocase'
),
),
),
'urltype' => array(
......
'type' => 'text',
'cols' => '40',
'rows' => '3',
'search' => array(
'nocase'
),
),
),
'description' => array(
......
'type' => 'text',
'cols' => '40',
'rows' => '3',
'search' => array(
'nocase'
),
),
),
'abstract' => array(
......
'type' => 'text',
'cols' => '40',
'rows' => '3',
'search' => array(
'nocase'
),
),
),
'author' => array(
......
'size' => '23',
'eval' => 'trim',
'max' => '80',
'search' => array(
'nocase'
),
),
),
'author_email' => array(
......
'eval' => 'trim',
'max' => '80',
'softref' => 'email[subst]',
'search' => array(
'nocase'
),
),
),
'media' => array(
typo3/class.db_list.inc
}
// Set select levels:
$sL=intval($this->searchLevels);
$searchLevels = intval($this->searchLevels);
$this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
// this will hide records from display - it has nothing todo with user rights!!
......
}
}
if ($sL>0) {
$tree = $this->getTreeObject($this->id, $sL, $this->perms_clause);
if ($searchLevels > 0) {
$tree = $this->getTreeObject($this->id, $searchLevels, $this->perms_clause);
$pidList = implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($tree->ids));
$this->pidSelect = 'pid IN (' . $pidList . ')';
} else {
}
elseif ($searchLevels < 0) {
// Search everywhere
$this->pidSelect = '1=1';
}
else {
$this->pidSelect = 'pid='.intval($id);
}
......
$this->pidSelect = 'pid='.intval($this->id);
}
}
#debug($this->pidSelect,$tableName);
// Finally, render the list:
$this->HTMLcode.=$this->getTable($tableName, $this->id, implode(',',$fields));
}
......
$pC = ($table=='pages' && $this->perms_clause)?' AND '.$this->perms_clause:'';
// Adding search constraints:
$search = $this->makeSearchString($table);
$search = $this->makeSearchString($table, $id);
// Compiling query array:
$queryParts = array(
......
}
/**
* Creates part of query for searching after a word ($this->searchString) fields in input table
* Creates part of query for searching after a word ($this->searchString)
* fields in input table.
*
* @param string Table, in which the fields are being searched.
* @return string Returns part of WHERE-clause for searching, if applicable.
* @param string $table Table, in which the fields are being searched.
* @param int $currentPid Page id for the possible search limit. -1 only if called from an old XCLASS.
* @return string Returns part of WHERE-clause for searching, if applicable.
*/
function makeSearchString($table) {
function makeSearchString($table, $currentPid = -1) {
global $TCA;
// Make query, only if table is valid and a search string is actually defined:
if ($GLOBALS['TCA'][$table] && $this->searchString) {
// Loading full table description - we need to traverse fields:
t3lib_div::loadTCA($table);
$result = '';
// Initialize field array:
$sfields=array();
$sfields[]='uid'; // Adding "uid" by default.
$currentPid = intval($currentPid);
$tablePidField = ($table == 'pages' ? 'uid' : 'pid');
// Traverse the configured columns and add all columns that can be searched:
foreach($GLOBALS['TCA'][$table]['columns'] as $fieldName => $info) {
if ($info['config']['type']=='text' || ($info['config']['type']=='input' && !preg_match('/date|time|int/',$info['config']['eval']))) {
$sfields[]=$fieldName;
// Make query, only if table is valid and a search string is actually defined:
if ($this->searchString) {
$result = ' AND 0=1';
if ($TCA[$table] && $TCA[$table]['ctrl']['searchFields']) {
$searchableFields = t3lib_div::trimExplode(',', $TCA[$table]['ctrl']['searchFields'], true);
// Loading full table description - we need to traverse fields:
t3lib_div::loadTCA($table);
if (t3lib_div::testInt($this->searchString)) {
$whereParts = array(
'uid=' . $this->searchString
);
foreach($searchableFields as $fieldName) {
if (isset($TCA[$table]['columns'][$fieldName])) {
$fieldConfig = &$TCA[$table]['columns'][$fieldName]['config'];
if ($fieldConfig['type'] == 'input' && $fieldConfig['eval'] && t3lib_div::inList($fieldConfig['eval'], 'int')) {
$condition = $fieldName . '=' . $this->searchString;
if (is_array($fieldConfig['search']) && in_array('pidonly', $fieldConfig['search']) && $currentPid > 0) {
$condition = '(' . $condition . ' AND ' . $tablePidField . '=' . $currentPid . ')';
}
$whereParts[] = $condition;
}
}
}
}
else {
$whereParts = array();
$like = '\'%' .
$GLOBALS['TYPO3_DB']->quoteStr($GLOBALS['TYPO3_DB']->escapeStrForLike($this->searchString, $table), $table) .
'%\'';
foreach($searchableFields as $fieldName) {
if (isset($TCA[$table]['columns'][$fieldName])) {
$fieldConfig = &$TCA[$table]['columns'][$fieldName]['config'];
$format = '%s LIKE %s';
if (is_array($fieldConfig['search'])) {
if (in_array('nocase', $fieldConfig['search'])) {
$format = 'LCASE(%s) LIKE LCASE(%s)';
}
if (in_array('pidonly', $fieldConfig['search']) && $currentPid > 0) {
$format = '(' . $format . ' AND ' . $tablePidField . '=' . $currentPid . ')';
}
if ($fieldConfig['search']['andWhere']) {
$format = '((' . $fieldConfig['search']['andWhere'] . ') AND (' . $format . '))';
}
}
if ($fieldConfig['type'] == 'text' ||
$fieldConfig['type'] == 'flex' ||
($fieldConfig['type'] == 'input' && (!$fieldConfig['eval'] || !preg_match('/date|time|int/',$fieldConfig['eval'])))) {
$whereParts[] = sprintf($format, $fieldName, $like);
}
}
}
}
}
// If search-fields were defined (and there always are) we create the query:
if (count($sfields)) {
$like = ' LIKE \'%'.$GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table).'%\''; // Free-text searching...
$queryPart = ' AND ('.implode($like.' OR ',$sfields).$like.')';
// Return query:
return $queryPart;
// If search-fields were defined (and there always are) we create the query:
if (count($whereParts)) {
$result = ' AND (' . implode(' OR ', $whereParts) . ')';
}
}
}
return $result;
}
/**
typo3/js/backendsearch.js
break;
case 'search':
this.jump(
unescape(TYPO3.configuration.listModulePath + 'db_list.php?id=' + jsonResponse.firstMountPoint + '&search_field=' + jsonResponse.searchFor + '&search_levels=4'),
unescape(TYPO3.configuration.listModulePath + 'db_list.php?id=' + jsonResponse.firstMountPoint + '&search_field=' + jsonResponse.searchFor + '&search_levels=' + (jsonResponse.firstMountPoint > 0 ? '4' : '-1')),
'web_list',
'web'
);
typo3/sysext/cms/ext_tables.php
'thumbnail' => 'image',
'requestUpdate' => 'list_type,rte_enabled',
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_tt_content.php',
'dividers2tabs' => 1
'dividers2tabs' => 1,
'searchFields' => 'header,header_link,subheader,bodytext,pi_flexform',
)
);
......
),
'useColumnsForDefaultValues' => 'usergroup,lockToDomain,disable,starttime,endtime',
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php',
'dividers2tabs' => 1
'dividers2tabs' => 1,
'searchFields' => 'username,name,first_name,last_name,middle_name,address,telephone,fax,email,title,zip,city,country,company',
),
'feInterface' => array (
'fe_admin_fieldList' => 'username,password,usergroup,name,address,telephone,fax,email,title,zip,city,country,www,company',
......
),
'useColumnsForDefaultValues' => 'lockToDomain',
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php',
'dividers2tabs' => 1
'dividers2tabs' => 1,
'searchFields' => 'title,description',
)
);
......
'typeicon_classes' => array(
'default' => 'mimetypes-x-content-domain',
),
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php'
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php',
'searchFields' => 'domainName,redirectTo',
)
);
......
'typeicon_classes' => array(
'default' => 'mimetypes-x-content-page-language-overlay',
),
'dividers2tabs' => TRUE
'dividers2tabs' => TRUE,
'searchFields' => 'title,subtitle,nav_title,keywords,description,abstract,author,author_email,url',
)
);
......
'0' => 'template_add.gif'
),
'dividers2tabs' => 1,
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php'
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php',
'searchFields' => 'title,constants,config',
)
);
typo3/sysext/cms/tbl_cms.php
'type' => 'input',
'size' => '20',
'max' => '50',
'eval' => 'nospace,lower,uniqueInPid,required'
'eval' => 'nospace,lower,uniqueInPid,required',
'search' => array(
'nocase'
),
)
),
'password' => array(
......
'type' => 'input',
'size' => '40',
'eval' => 'trim',
'max' => '80'
'max' => '80',
'search' => array(
'nocase'
),
)
),
'first_name' => array(
......
'type' => 'input',
'size' => '25',
'eval' => 'trim',
'max' => '50'
'max' => '50',
'search' => array(
'nocase'
),
)
),
'middle_name' => array(
......
'type' => 'input',
'size' => '25',
'eval' => 'trim',
'max' => '50'
'max' => '50',
'search' => array(
'nocase'
),
)
),
'last_name' => array(
......
'type' => 'input',
'size' => '25',
'eval' => 'trim',
'max' => '50'
'max' => '50',
'search' => array(
'nocase'
),
)
),
'address' => array(
......
'config' => array(
'type' => 'text',
'cols' => '20',
'rows' => '3'
'rows' => '3',
'search' => array(
'nocase'
),
)
),
'telephone' => array(
......
'type' => 'input',
'eval' => 'trim',
'size' => '20',
'max' => '20'
'max' => '20',
'search' => array(
'nocase'
),
)
),
'fax' => array(
......
'type' => 'input',
'size' => '20',
'eval' => 'trim',
'max' => '20'
'max' => '20',
'search' => array(
'nocase'
),
)
),
'email' => array(
......
'type' => 'input',
'size' => '20',
'eval' => 'trim',
'max' => '80'
'max' => '80',
'search' => array(
'nocase'
),
)
),
'title' => array(
......
'type' => 'input',
'size' => '20',
'eval' => 'trim',
'max' => '40'
'max' => '40',
'search' => array(
'nocase'
),
)
),
'zip' => array(
......
'type' => 'input',
'eval' => 'trim',
'size' => '10',
'max' => '10'
'max' => '10',
'search' => array(
'nocase'
),
)
),
'city' => array(
......
'type' => 'input',
'size' => '20',
'eval' => 'trim',
'max' => '50'
'max' => '50',
'search' => array(
'nocase'
),
)
),
'country' => array(
......
'type' => 'input',
'size' => '20',
'eval' => 'trim',
'max' => '40'
'max' => '40',
'search' => array(
'nocase'
),
)
),
'www' => array(
......
'type' => 'input',
'eval' => 'trim',
'size' => '20',
'max' => '80'
'max' => '80',
'search' => array(
'nocase'
),
)
),
'image' => array(
......
'type' => 'input',
'size' => '20',
'max' => '50',
'eval' => 'trim,required'
'eval' => 'trim,required',
'search' => array(
'nocase'
),
)
),
'subgroup' => array(
......
'config' => array(
'type' => 'text',
'rows' => 5,
'cols' => 48
'cols' => 48,
'search' => array(
'nocase'
),
)
),
'TSconfig' => array(
......
'size' => '35',
'max' => '80',
'eval' => 'required,unique,lower,trim',
'softref' => 'substitute'
'softref' => 'substitute',
'search' => array(
'nocase'
),
),
),
'redirectTo' => array(
......
'max' => '255',
'default' => '',
'eval' => 'trim',
'softref' => 'substitute'
'softref' => 'substitute',
'search' => array(
'nocase'
),
),
),
'redirectHttpStatusCode' => array(
......
'size' => '50',
'max' => '255',
'eval' => 'trim,required',
'search' => array(
'nocase'
),
)
),
'subtitle' => array(
......
'size' => '50',
'max' => '255',
'eval' => 'trim',
'search' => array(
'nocase'
),
)
),
'nav_title' => array(
......
'size' => '50',
'max' => '255',
'eval' => 'trim',
'search' => array(
'nocase'
),
)
),
'keywords' => array(
......
'config' => array(
'type' => 'text',
'cols' => '40',
'rows' => '3'
'rows' => '3',
'search' => array(
'nocase'
),
)
),
'abstract' => array(
......
'config' => array(
'type' => 'text',
'cols' => '40',
'rows' => '3'
'rows' => '3',
'search' => array(
'nocase'
),
)
),
'author' => array(
......
'size' => '23',
'eval' => 'trim',
'max' => '80',
'search' => array(
'nocase'
),
)
),
'author_email' => array(
......
'type' => 'input',
'size' => '25',
'max' => '256',
'eval' => 'required'
'eval' => 'required',
'search' => array(
'nocase'
),
)
),
'hidden' => array(
......
'cols' => '48',
'rows' => '10',
'wrap' => 'OFF',
'softref' => 'TStemplate,email[subst],url[subst]'
'softref' => 'TStemplate,email[subst],url[subst]',
'search' => array(
'nocase'
),
),
'defaultExtras' => 'fixed-font : enable-tab',
),
......
)
),
'wrap' => 'OFF',
'softref' => 'TStemplate,email[subst],url[subst]'
'softref' => 'TStemplate,email[subst],url[subst]',
'search' => array(
'nocase'
),
),
'defaultExtras' => 'fixed-font : enable-tab',
),
......
'type' => 'input',
'size' => '25',
'max' => '256',
'eval' => 'required'
'eval' => 'required',
)
),
'description' => array(
typo3/sysext/cms/tbl_tt_content.php
'type' => 'input',
'size' => '50',
'max' => '256',
'search' => array(
'nocase'
)
),
),
'header_position' => array(
......
'size' => '50',
'max' => '256',
'softref' => 'email[subst]',
'search' => array(
'nocase'
)
),
),
'bodytext' => array(
......
),
),
'softref' => 'typolink_tag,images,email[subst],url',
'search' => array(
'nocase',
'andWhere' => 'CType=\'text\' OR CType=\'textpic\'',
)
),
),
'text_align' => array(
......
',
',media' => file_get_contents(t3lib_extMgm::extPath('cms') . 'flexform_media.xml'),
),
'search' => array(
'nocase',
'andWhere' => 'CType=\'list\''
)
),
),
'tx_impexp_origuid' => array(
    (1-1/1)