Bug #20903 » 11747_v2.diff
t3lib/class.t3lib_befunc.php (Arbeitskopie) | ||
---|---|---|
* @param string Table name (or "_FILE" if its a file)
|
||
* @param string Reference: If table, then integer-uid, if _FILE, then file reference (relative to PATH_site)
|
||
* @param string Message with %s, eg. "There were %s records pointing to this file!"
|
||
* @param string reference count
|
||
* @return string Output string (or integer count value if no msg string specified)
|
||
*/
|
||
public static function referenceCount($table, $ref, $msg = '') {
|
||
// Look up the path:
|
||
if ($table=='_FILE') {
|
||
if (t3lib_div::isFirstPartOfStr($ref, PATH_site)) {
|
||
$ref = substr($ref, strlen(PATH_site));
|
||
$condition = 'ref_string='.$GLOBALS['TYPO3_DB']->fullQuoteStr($ref, 'sys_refindex');
|
||
public static function referenceCount($table, $ref, $msg = '', $count = NULL) {
|
||
if ($count === NULL) {
|
||
// Look up the path:
|
||
if ($table=='_FILE') {
|
||
if (t3lib_div::isFirstPartOfStr($ref, PATH_site)) {
|
||
$ref = substr($ref, strlen(PATH_site));
|
||
$condition = 'ref_string='.$GLOBALS['TYPO3_DB']->fullQuoteStr($ref, 'sys_refindex');
|
||
} else {
|
||
return '';
|
||
}
|
||
} else {
|
||
return '';
|
||
$condition = 'ref_uid=' . intval($ref);
|
||
}
|
||
} else {
|
||
$condition = 'ref_uid=' . intval($ref);
|
||
$count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
|
||
'*',
|
||
'sys_refindex',
|
||
'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') .
|
||
' AND ' . $condition .
|
||
' AND deleted=0'
|
||
);
|
||
}
|
||
$count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
|
||
'*',
|
||
'sys_refindex',
|
||
'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') .
|
||
' AND ' . $condition .
|
||
' AND deleted=0'
|
||
);
|
||
return ($count ? ($msg ? sprintf($msg, $count) : $count) : '');
|
||
}
|
||
typo3/class.db_list_extra.inc (Arbeitskopie) | ||
---|---|---|
var $CBnames=array(); // Tracking names of elements (for clipboard use)
|
||
var $duplicateStack=array(); // Used to track which elements has duplicates and how many
|
||
var $references; // References of the current record
|
||
public function __construct() {
|
||
parent::__construct();
|
||
}
|
||
... | ... | |
} else {
|
||
//default exclusion: doktype 254, 255
|
||
$noViewDokTypes = array('254', '255');
|
||
}
|
||
|
||
}
|
||
if (!in_array($this->pageRow['doktype'], $noViewDokTypes)) {
|
||
$buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id, $this->backPath, t3lib_BEfunc::BEgetRootLine($this->id))) . '">' .
|
||
'<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/zoom.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" alt="" />' .
|
||
'</a>';
|
||
}
|
||
|
||
// New record
|
||
if (!$GLOBALS['SOBE']->modTSconfig['properties']['noCreateRecordsLink']) {
|
||
$buttons['new_record'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'db_new.php?id=' . $this->id . '\');') . '">' .
|
||
... | ... | |
if (is_array($row)) {
|
||
$this->setReferences($table, $row['uid']);
|
||
// add special classes for first and last row
|
||
$rowSpecial = '';
|
||
if ($cc == 1 && $indent == 0) {
|
||
... | ... | |
}
|
||
/**
|
||
* Write sys_refindex entries for current record to $this->references
|
||
*
|
||
* @param string Table name
|
||
* @param integer Uid of current record
|
||
* @return void
|
||
*/
|
||
function setReferences($table, $uid) {
|
||
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
'*',
|
||
'sys_refindex',
|
||
'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex').
|
||
' AND ref_uid='.intval($uid).
|
||
' AND deleted=0'
|
||
);
|
||
$this->references = $rows;
|
||
}
|
||
/**
|
||
* Rendering the header row for a table
|
||
*
|
||
* @param string Table name
|
||
... | ... | |
. '</span>';
|
||
$content .= '<div id="typo3-dblist-pagination">'
|
||
. $first . $previous
|
||
. $first . $previous
|
||
. '<span class="bar"> </span>'
|
||
. $rangeIndicator . '<span class="bar"> </span>'
|
||
. $pageIndicator . '<span class="bar"> </span>'
|
||
... | ... | |
$titleOrig = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
|
||
$title = t3lib_div::slashJS(t3lib_div::fixed_lgd_cs($titleOrig, $this->fixedL), 1);
|
||
$params = '&cmd['.$table.']['.$row['uid'].'][delete]=1';
|
||
$cells['delete']='<a href="#" onclick="'.htmlspecialchars('if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning').' "'. $title.'" '.t3lib_BEfunc::referenceCount($table,$row['uid'],' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.referencesToRecord'))).')) {jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');} return false;').'">'.
|
||
$refCountMsg = t3lib_BEfunc::referenceCount($table, $row['uid'], ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.referencesToRecord'), count($this->references));
|
||
$cells['delete']='<a href="#" onclick="'.htmlspecialchars('if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning').' "'. $title.'" '.$refCountMsg).')) {jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');} return false;').'">'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('delete',1).'" alt="" />'.
|
||
'</a>';
|
||
} elseif(!$this->table) {
|
||
... | ... | |
*/
|
||
function makeRef($table,$uid) {
|
||
// Look up the path:
|
||
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
'*',
|
||
'sys_refindex',
|
||
'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex').
|
||
' AND ref_uid='.intval($uid).
|
||
' AND deleted=0'
|
||
);
|
||
// Compile information for title tag:
|
||
$infoData=array();
|
||
if (is_array($rows)) {
|
||
foreach($rows as $row) {
|
||
if (is_array($this->references)) {
|
||
foreach ($this->references as $row) {
|
||
$infoData[]=$row['tablename'].':'.$row['recuid'].':'.$row['field'];
|
||
}
|
||
}
|
- « Previous
- 1
- 2
- Next »