Feature #16323 » 6039_v4_new_internal_type.patch
class.t3lib_refindex.php (working copy) | ||
---|---|---|
case 'db':
|
||
$this->createEntryData_dbRels($table,$uid,$fieldname,'',$deleted,$dat['itemArray']);
|
||
break;
|
||
case 'file_reference':
|
||
case 'file':
|
||
$this->createEntryData_fileRels($table,$uid,$fieldname,'',$deleted,$dat['newValueFiles']);
|
||
break;
|
||
... | ... | |
list($tableName,$recordId) = explode(':',$el['subst']['recordRef']);
|
||
$this->relations[] = $this->createEntryData($table,$uid,$fieldname,$flexpointer,$deleted,$tableName,$recordId,'',-1,$spKey,$subKey);
|
||
break;
|
||
case 'file_reference':
|
||
case 'file':
|
||
$this->relations[] = $this->createEntryData($table,$uid,$fieldname,$flexpointer,$deleted,'_FILE',0,$el['subst']['relFileName'],-1,$spKey,$subKey);
|
||
break;
|
||
... | ... | |
*/
|
||
function getRelations_procFiles($value, $conf, $uid) {
|
||
// Take care of files...
|
||
if ($conf['type']=='group' && $conf['internal_type']=='file') {
|
||
if ($conf['type']=='group' && ($conf['internal_type']=='file' || $conf['internal_type']=='file_reference')) {
|
||
// Collect file values in array:
|
||
if ($conf['MM']) {
|
||
... | ... | |
}
|
||
// Traverse the files and add them:
|
||
$uploadFolder = $conf['uploadfolder'];
|
||
$uploadFolder = $conf['internal_type']=='file' ? $conf['uploadfolder'] : '';
|
||
$dest = $this->destPathFromUploadFolder($uploadFolder);
|
||
$newValue = array();
|
||
$newValueFiles = array();
|
||
... | ... | |
$realFile = $dest.'/'.trim($file);
|
||
# if (@is_file($realFile)) { // Now, the refernece index should NOT look if files exist - just faithfully include them if they are in the records!
|
||
$newValueFiles[] = array(
|
||
'filename' => $file,
|
||
'filename' => basename($file),
|
||
'ID' => md5($realFile),
|
||
'ID_absFile' => $realFile
|
||
); // the order should be preserved here because.. (?)
|
||
... | ... | |
$error = $this->setReferenceValue_dbRels($refRec,$dat['itemArray'],$newValue,$dataArray);
|
||
if ($error) return $error;
|
||
break;
|
||
case 'file_reference':
|
||
case 'file':
|
||
$this->setReferenceValue_fileRels($refRec,$dat['newValueFiles'],$newValue,$dataArray);
|
||
if ($error) return $error;
|
||
... | ... | |
* @return string Input folder prefixed with PATH_site. No checking for existence is done. Output must be a folder without trailing slash.
|
||
*/
|
||
function destPathFromUploadFolder($folder) {
|
||
if (!$folder) {
|
||
return substr(PATH_site, 0, -1);
|
||
}
|
||
return PATH_site.$folder;
|
||
}
|
||
class.t3lib_tceforms.php (working copy) | ||
---|---|---|
// Acting according to either "file" or "db" type:
|
||
switch((string)$config['internal_type']) {
|
||
case 'file_reference':
|
||
$config['uploadfolder'] = '';
|
||
case 'file': // If the element is of the internal type "file":
|
||
// Creating string showing allowed types:
|
||
... | ... | |
if(!$disabled && !(isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'upload'))) {
|
||
// Adding the upload field:
|
||
if ($this->edit_docModuleUpload) $item.='<input type="file" name="'.$PA['itemFormElName_file'].'"'.$this->formWidth().' size="60" />';
|
||
if ($this->edit_docModuleUpload && $config['uploadfolder']) {
|
||
$item.='<input type="file" name="'.$PA['itemFormElName_file'].'"'.$this->formWidth().' size="60" />';
|
||
}
|
||
}
|
||
break;
|
||
case 'folder': // If the element is of the internal type "folder":
|
||
... | ... | |
}
|
||
}
|
||
break;
|
||
case 'file_reference':
|
||
case 'file':
|
||
case 'folder':
|
||
while(list(,$pp)=each($itemArray)) {
|
||
$pParts = explode('|',$pp);
|
||
$uidList[]=$pUid=$pTitle = $pParts[0];
|
||
$opt[]='<option value="'.htmlspecialchars(rawurldecode($pParts[0])).'">'.htmlspecialchars(rawurldecode($pParts[0])).'</option>';
|
||
$opt[]='<option value="'.htmlspecialchars(rawurldecode($pParts[0])).'">'.htmlspecialchars(basename(rawurldecode($pParts[0]))).'</option>';
|
||
}
|
||
break;
|
||
default:
|
||
... | ... | |
}
|
||
$aOnClick='setFormValueOpenBrowser(\''.$mode.'\',\''.($fName.'|||'.$allowed.'|'.$aOnClickInline).'\'); return false;';
|
||
$icons['R'][]='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/insert3.gif','width="14" height="14"').' border="0" '.t3lib_BEfunc::titleAltAttrib($this->getLL('l_browse_'.($mode=='file'?'file':'db'))).' />'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/insert3.gif','width="14" height="14"').' border="0" '.t3lib_BEfunc::titleAltAttrib($this->getLL('l_browse_'.($mode=='db'?'db':'file'))).' />'.
|
||
'</a>';
|
||
}
|
||
if (!$params['dontShowMoveIcons']) {
|
||
... | ... | |
$aOnClick = '';
|
||
# $counter = 0;
|
||
foreach($clipElements as $elValue) {
|
||
if ($mode=='file') {
|
||
$itemTitle = 'unescape(\''.rawurlencode(basename($elValue)).'\')';
|
||
} else { // 'db' mode assumed
|
||
if ($mode=='db') {
|
||
list($itemTable,$itemUid) = explode('|', $elValue);
|
||
$itemTitle = $GLOBALS['LANG']->JScharCode(t3lib_BEfunc::getRecordTitle($itemTable, t3lib_BEfunc::getRecordWSOL($itemTable,$itemUid)));
|
||
$elValue = $itemTable.'_'.$itemUid;
|
||
} else { // 'file' mode assumed
|
||
$itemTitle = 'unescape(\''.rawurlencode(basename($elValue)).'\')';
|
||
}
|
||
$aOnClick.= 'setFormValueFromBrowseWin(\''.$fName.'\',unescape(\''.rawurlencode(str_replace('%20',' ',$elValue)).'\'),'.$itemTitle.');';
|
||
... | ... | |
}
|
||
$aOnClick.= 'return false;';
|
||
$icons['R'][]='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/insert5.png','width="14" height="14"').' border="0" '.t3lib_BEfunc::titleAltAttrib(sprintf($this->getLL('l_clipInsert_'.($mode=='file'?'file':'db')),count($clipElements))).' />'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/insert5.png','width="14" height="14"').' border="0" '.t3lib_BEfunc::titleAltAttrib(sprintf($this->getLL('l_clipInsert_'.($mode=='db'?'db':'file')),count($clipElements))).' />'.
|
||
'</a>';
|
||
}
|
||
$rOnClick = $rOnClickInline.'setFormValueManipulate(\''.$fName.'\',\'Remove\'); return false';
|
||
... | ... | |
if (is_object($this->clipObj)) {
|
||
switch($mode) {
|
||
case 'file_reference':
|
||
case 'file':
|
||
$elFromTable = $this->clipObj->elFromTable('_FILE');
|
||
$allowedExts = t3lib_div::trimExplode(',', $allowed, 1);
|
||
... | ... | |
* @return string HTML formatted output
|
||
*/
|
||
function previewFieldValue($value, $config) {
|
||
if ($config['config']['type']==='group' && $config['config']['internal_type'] === 'file') {
|
||
if ($config['config']['type']==='group' && ($config['config']['internal_type'] === 'file' || $config['config']['internal_type'] === 'file_reference')) {
|
||
// Ignore uploadfolder if internal_type is file_reference
|
||
if ($config['config']['internal_type'] === 'file_reference') {
|
||
$config['config']['uploadfolder'] = '';
|
||
}
|
||
|
||
$show_thumbs = TRUE;
|
||
$table = 'tt_content';
|
||
class.t3lib_tcemain.php (working copy) | ||
---|---|---|
// For group types:
|
||
if ($tcaFieldConf['type']=='group') {
|
||
switch($tcaFieldConf['internal_type']) {
|
||
case 'file_reference':
|
||
case 'file':
|
||
$valueArray = $this->checkValue_group_select_file(
|
||
$valueArray,
|
||
... | ... | |
}
|
||
// If there is an upload folder defined:
|
||
if ($tcaFieldConf['uploadfolder']) {
|
||
if ($tcaFieldConf['uploadfolder'] && $tcaFieldConf['internal_type'] == 'file') {
|
||
if (!$this->bypassFileHandling) { // If filehandling should NOT be bypassed, do processing:
|
||
// For logging..
|
||
$propArr = $this->getRecordProperties($table,$id);
|
||
... | ... | |
}
|
||
$valueArray = $dbAnalysis->countItems();
|
||
}
|
||
//store path relative to site root (if uploadfolder is not set or internal_type is file_reference)
|
||
} else {
|
||
if (count($valueArray)){
|
||
foreach($valueArray as &$theFile){
|
||
if (t3lib_div::isFirstPartOfStr($theFile,PATH_site)) {
|
||
$theFile = substr($theFile,strlen(PATH_site));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return $valueArray;
|
||
... | ... | |
function copyRecord_procFilesRefs($conf, $uid, $value) {
|
||
// Prepend absolute paths to files:
|
||
if ($conf['type']=='group' && $conf['internal_type']=='file') {
|
||
if ($conf['type']=='group' && ($conf['internal_type']=='file' || $conf['internal_type']=='file_reference')) {
|
||
// Get an array with files as values:
|
||
if ($conf['MM']) {
|
||
... | ... | |
}
|
||
// Traverse this array of files:
|
||
$uploadFolder = $conf['uploadfolder'];
|
||
$uploadFolder = $conf['internal_type']=='file' ? $conf['uploadfolder'] : '';
|
||
$dest = $this->destPathFromUploadFolder($uploadFolder);
|
||
$newValue = array();
|
||
... | ... | |
if ($TCA[$table]['columns']) {
|
||
reset($TCA[$table]['columns']);
|
||
while (list($field,$configArr)=each($TCA[$table]['columns'])) {
|
||
if ($configArr['config']['type']=='group' && $configArr['config']['internal_type']=='file') {
|
||
if ($configArr['config']['type']=='group' && ($configArr['config']['internal_type']=='file' || $configArr['config']['internal_type']=='file_reference')) {
|
||
$listArr[]=$field;
|
||
}
|
||
}
|
||
... | ... | |
global $TCA;
|
||
t3lib_div::loadTCA($table);
|
||
$uploadFolder = $TCA[$table]['columns'][$field]['config']['uploadfolder'];
|
||
if ($uploadFolder && trim($filelist)) {
|
||
if ($uploadFolder && trim($filelist) && $TCA[$table]['columns'][$field]['config']['internal_type'] == 'file') {
|
||
$uploadPath = $this->destPathFromUploadFolder($uploadFolder);
|
||
$fileArray = explode(',',$filelist);
|
||
while (list(,$theFile)=each($fileArray)) {
|