Feature #16323 » 6039_v5.diff
t3lib/class.t3lib_refindex.php (working copy) | ||
---|---|---|
switch((string)$dat['type']) {
|
||
case 'db':
|
||
$this->createEntryData_dbRels($table,$uid,$fieldname,'',$deleted,$dat['itemArray']);
|
||
break;
|
||
break;
|
||
case 'file_reference':
|
||
case 'file':
|
||
$this->createEntryData_fileRels($table,$uid,$fieldname,'',$deleted,$dat['newValueFiles']);
|
||
break;
|
||
break;
|
||
case 'flex':
|
||
// DB references:
|
||
if (is_array($dat['flexFormRels']['db'])) {
|
||
... | ... | |
$this->createEntryData_softreferences($table,$uid,$fieldname,$flexpointer,$deleted,$subList['keys']);
|
||
}
|
||
}
|
||
break;
|
||
break;
|
||
}
|
||
// Softreferences in the field:
|
||
... | ... | |
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']) {
|
||
if ($conf['MM']) {
|
||
$theFileValues = array();
|
||
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
|
||
$dbAnalysis->start('', 'files', $conf['MM'], $uid);
|
||
... | ... | |
}
|
||
// 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;
|
||
... | ... | |
* @param string Folder relative to PATH_site
|
||
* @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) {
|
||
return PATH_site.$folder;
|
||
function destPathFromUploadFolder($folder) {
|
||
return $folder ? PATH_site . $folder : substr(PATH_site, 0, -1);
|
||
}
|
||
/**
|
t3lib/class.t3lib_tceforms.php (working copy) | ||
---|---|---|
$hookObject->getSingleField_beforeRender($table, $field, $row, $PA);
|
||
}
|
||
}
|
||
|
||
switch($PA['fieldConf']['config']['form_type']) {
|
||
case 'input':
|
||
$item = $this->getSingleField_typeInput($table,$field,$row,$PA);
|
||
... | ... | |
// Get values in an array (and make unique, which is fine because there can be no duplicates anyway):
|
||
$itemArray = array_flip($this->extractValuesOnlyFromValueLabelList($PA['itemFormElValue']));
|
||
|
||
$disabled = '';
|
||
if($this->renderReadonly || $config['readOnly']) {
|
||
$disabled = ' disabled="disabled"';
|
||
... | ... | |
// Acting according to either "file" or "db" type:
|
||
switch((string)$config['internal_type']) {
|
||
case 'file': // If the element is of the internal type "file":
|
||
// Creating string showing allowed types:
|
||
case 'file_reference':
|
||
$config['uploadfolder'] = '';
|
||
// Fall through
|
||
case 'file':
|
||
// Creating string showing allowed types:
|
||
$tempFT = t3lib_div::trimExplode(',',$allowed,1);
|
||
if (!count($tempFT)) {$info.='*';}
|
||
foreach($tempFT as $ext) {
|
||
... | ... | |
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']) {
|
||
... | ... | |
$clipElements = $this->getClipboardElements($allowed,$mode);
|
||
if (count($clipElements)) {
|
||
$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', 'file_reference' and 'folder' mode
|
||
$itemTitle = 'unescape(\''.rawurlencode(basename($elValue)).'\')';
|
||
}
|
||
$aOnClick.= 'setFormValueFromBrowseWin(\''.$fName.'\',unescape(\''.rawurlencode(str_replace('%20',' ',$elValue)).'\'),'.$itemTitle.');';
|
||
# $counter++;
|
||
# if ($params['maxitems'] && $counter >= $params['maxitems']) { break; } // Makes sure that no more than the max items are inserted... for convenience.
|
||
}
|
||
$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';
|
||
t3lib/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();
|
||
}
|
||
} else {
|
||
if (count($valueArray)){
|
||
// store path relative to site root (if uploadfolder is not set or internal_type is file_reference)
|
||
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') {
|
||
// Prepend absolute paths to files:
|
||
if ($conf['type'] == 'group' && ($conf['internal_type'] == 'file' || $conf['internal_type'] == 'file_reference')) {
|
||
// Get an array with files as values:
|
||
if ($conf['MM']) {
|
||
if ($conf['MM']) {
|
||
$theFileValues = array();
|
||
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
|
||
... | ... | |
}
|
||
// 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') {
|
||
$listArr[]=$field;
|
||
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)) {
|