Project

General

Profile

Bug #21622 » 12679_v10.diff

Administrator Admin, 2010-07-15 15:27

View differences:

typo3/sysext/t3skin/stylesheets/structure/module_web_page.css (working copy)
padding-left: 20px;
padding-right: 20px;
position: relative;
min-width: 150px;
}
.t3-page-colHeader a {
typo3/sysext/cms/layout/class.tx_cms_layout.php (working copy)
);
var $CType_labels=array(); // Used to store labels for CTypes for tt_content elements
var $itemLabels=array(); // Used to store labels for the various fields in tt_content elements
/**
* Loaded with the parent object
*
* @var SC_db_layout
*/
protected $parentObject;
/**
* Initializes the clipboard object
*
*/
function __construct() {
// Start clipboard
$this->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
// Initialize - reads the clipboard content from the user session
$this->clipObj->initializeClipboard();
// Clipboard actions are handled:
$CB = t3lib_div::_GET('CB');
if ($this->cmd == 'setCB') {
// CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. By merging we get a full array of checked/unchecked elements
// This is set to the 'el' array of the CB after being parsed so only the table in question is registered.
$CB['el'] = $this->clipObj->cleanUpCBC(array_merge((array)t3lib_div::_POST('CBH'), (array)t3lib_div::_POST('CBC')), $this->cmd_table);
}
// If the clipboard is NOT shown, set the pad to 'normal'.
$CB['setP'] = 'normal';
// Execute commands.
$this->clipObj->setCmd($CB);
$this->clipObj->cleanCurrent();
$this->clipObj->endClipboard();
}
/*****************************************
......
// Add new-icon link, header:
$newP = $this->newContentElementOnClick($id,$key,$lP);
$head[$key].= $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content','colPos',$key), ($this->doEdit&&count($rowArr)?'&edit[tt_content]['.$editUidList.']=edit'.$pageTitleParamForAltDoc:''), $newP);
$head[$key] .= $this->tt_content_drawColHeader(
t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key),
($this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : ''),
$newP,
$key,
$lP
);
$editUidList = '';
}
......
<tr>
<td></td>
<td valign="top" colspan="3">'.
$this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content','colPos',$key), ($this->doEdit&&count($rowArr)?'&edit[tt_content]['.$editUidList.']=edit'.$pageTitleParamForAltDoc:''), $newP).
$this->tt_content_drawColHeader(
t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key),
($this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : ''),
$newP,
$key,
$this->tt_contentConfig['sys_language_uid']
) .
$theNewButton.
'<br /></td>
</tr>';
......
* @param string Column name
* @param string Edit params (Syntax: &edit[...] for alt_doc.php)
* @param string New element params (Syntax: &edit[...] for alt_doc.php)
* @param int ID of the current column
* @param int ID of the current language
* @return string HTML table
*/
function tt_content_drawColHeader($colName,$editParams,$newParams) {
function tt_content_drawColHeader($colName, $editParams, $newParams, $colKey, $languageID) {
$icons = '';
// Create command links:
......
t3lib_iconWorks::getSpriteIcon('actions-document-open') .
'</a>';
}
$redirectUrl = 'sysext/cms/layout/db_layout.php?id=' . $this->id . '&SET[function]=' . $this->parentObject->MOD_SETTINGS['function'];
$overrideValues = array(
'colPos' => $colKey,
'sys_language_uid' => $languageID
);
if($this->parentObject->current_sys_language) {
$overrideValues['sys_language_uid'] = $this->parentObject->current_sys_language;
}
$icons .= $this->clipObj->getPasteLink($this->id, array(), 'tt_content', $overrideValues, $redirectUrl);
}
if (strlen($icons)) {
$icons = '<div class="t3-page-colHeader-icons">' . $icons . '</div>';
......
$out .= '</span>';
}
}
// Add copy/cut icons
$out .= $this->clipObj->getCopyLink($row);
$out .= $this->clipObj->getCutLink($row);
// Add paste link
$redirectUrl = 'sysext/cms/layout/db_layout.php?id=' . $this->id . '&SET[function]=' . $this->parentObject->MOD_SETTINGS['function'];
$overrideValues = array(
'colPos' => $row['colPos']
);
$out .= $this->clipObj->getPasteLink(-$row['uid'], $row, 'tt_content', $overrideValues, $redirectUrl);
// Display info from records fields:
$infoOutput = '';
if (count($info)) {
......
return strip_tags($content);
}
/**
* Sets the parent object of this tx_cms_layout instance
*
* @param SC_db_layout The parent object
* @return void
*/
public function setParentObject(SC_db_layout $parentObject) {
$this->parentObject = $parentObject;
}
}
typo3/sysext/cms/layout/db_layout.php (working copy)
// Initialize list object (see "class.db_layout.inc"):
$dblist = t3lib_div::makeInstance('tx_cms_layout');
$dblist->backPath = $BACK_PATH;
$dblist->setParentObject($this);
$dblist->thumbs = $this->imagemode;
$dblist->no_noWrap = 1;
$dblist->descrTable = $this->descrTable;
typo3/class.db_list_extra.inc (working copy)
$isL10nOverlay = $this->localizationView && $table != 'pages_language_overlay' && $row[$TCA[$table]['ctrl']['transOrigPointerField']] != 0;
// Return blank, if disabled:
// Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
if ($this->clipObj->current=='normal') { // For the "Normal" pad:
if ($this->clipObj->current == 'normal') { // For the "Normal" pad:
// Show copy/cut icons:
$isSel = (string)$this->clipObj->isSelected($table,$row['uid']);
$cells['copy'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],1,($isSel=='copy'),array('returnUrl'=>'')).'\');').'" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.copy', TRUE).'">'.
((!$isSel=='copy') ? t3lib_iconWorks::getSpriteIcon('actions-edit-copy') : t3lib_iconWorks::getSpriteIcon('actions-edit-copy-release')) .
'</a>';
$cells['cut'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],0,($isSel=='cut'),array('returnUrl'=>'')).'\');').'" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.cut', TRUE).'">'.
((!$isSel=='cut') ? t3lib_iconWorks::getSpriteIcon('actions-edit-cut') : t3lib_iconWorks::getSpriteIcon('actions-edit-cut-release')) .
'</a>';
$cells['copy'] = $isL10nOverlay ? $this->spaceIcon : $this->clipObj->getCopyLink($row, $table);
$cells['cut'] = $isL10nOverlay ? $this->spaceIcon : $this->clipObj->getCutLink($row, $table);
} else { // For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
......
// Now, looking for selected elements from the current table:
$elFromTable = $this->clipObj->elFromTable($table);
$redirectUrl = 'db_list.php?id=' . $this->id;
if(t3lib_div::_GP('table')) {
$redirectUrl .= '&table=' . t3lib_div::_GP('table');
}
if (count($elFromTable) && $TCA[$table]['ctrl']['sortby']) { // IF elements are found and they can be individually ordered, then add a "paste after" icon:
$cells['pasteAfter'] = $isL10nOverlay ? $this->spaceIcon : '<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,-$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'after',$elFromTable)).'" title="'.$LANG->getLL('clip_pasteAfter', TRUE).'">'.
t3lib_iconWorks::getSpriteIcon('actions-document-paste-after') .
'</a>';
$overrideValues = array(
'colPos' => $row['colPos']
);
$cells['pasteAfter'] = $isL10nOverlay ? $this->spaceIcon : $this->clipObj->getPasteLink(-$row['uid'], $row, $table, $overrideValues, $redirectUrl);
}
// Now, looking for elements in general:
t3lib/class.t3lib_clipboard.php (working copy)
}
/**
* Returns a link to paste elements from clipboard into a page or
* after a content element if the second parameter is set
*
* @param int The ID of the column the elements in clipboard should get pasted into
* @param array Optional: The record array
* @param string Optional: The table to paste into
* @param array Optional: An array of field value pairs which should be set before inserting the new record
* @param array Optional: A redirect URL
* @return string The generated link
*/
public function getPasteLink($insertUid, $row = array(), $table = 'tt_content', $overrideValues = array(), $redirectUrl = '') {
global $LANG, $BACK_PATH;
$elFromTable = $this->elFromTable($table);
if (count($elFromTable)) {
$pasteUrl = $BACK_PATH . 'tce_db.php?&vC=' . $GLOBALS['BE_USER']->veriCode() . '&prErr=1&uPT=1&';
foreach ($elFromTable as $info=>$val) {
list($recordTable, $uid) = explode('|', $info);
$pasteUrl .= '&CB[paste]=' . $recordTable . '|' . $insertUid . '&CB[pad]=normal';
}
if(is_array($overrideValues)) {
$pasteUrl .= t3lib_div::implodeArrayForUrl('overrideValues', $overrideValues);
}
if(strlen($redirectUrl) > 0) {
$pasteUrl .= '&redirect=' . urlencode($redirectUrl);
}
$pasteCommand = '';
if(intval($insertUid) < 0) {
$title = $LANG->sL('LLL:EXT:lang/locallang_core.php:cm.pasteafter', TRUE);
$pasteCommand = 'after';
} else {
$title = $LANG->sL('LLL:EXT:lang/locallang_core.php:cm.pasteinto', TRUE);
$pasteCommand = 'into';
$sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
$row = $sys_page->getPage($insertUid);
$table = 'pages';
}
return '<a
href="' . htmlspecialchars($pasteUrl) . '"
onclick="' . htmlspecialchars('return ' . $this->confirmMsg($table, $row, $pasteCommand, $elFromTable)) . '"
title="' . $title . '"
>'. t3lib_iconWorks::getSpriteIcon('actions-document-paste-after') . '</a>';
}
}
/**
* Returns link to copy a record
*
* @param array The current record data
* @param string Optional: The table of the record in $row
* @return string The generated link
*/
public function getCopyLink($row, $table = 'tt_content') {
global $LANG;
$link = '';
if ($this->current === 'normal') {
$isSel = (string)$this->isSelected($table, $row['uid']);
$url = htmlspecialchars(
$this->selUrlDB(
$table,
$row['uid'],
1,
($isSel == 'copy'),
array('returnUrl' => '')
)
);
$link .= '<a href="' . $url . '"
title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:cm.copy', TRUE) . '">' .
((!($isSel == 'copy')) ? t3lib_iconWorks::getSpriteIcon('actions-edit-copy') : t3lib_iconWorks::getSpriteIcon('actions-edit-copy-release')) .
'</a>';
}
return $link;
}
/**
* Returns link to cut a record
*
* @param array The current record data
* @param string Optional: The table of the record in $row
* @return string The generated link
*/
public function getCutLink($row, $table = 'tt_content') {
global $LANG;
$link = '';
if ($this->current === 'normal') {
$isSel = (string)$this->isSelected($table, $row['uid']);
$url = htmlspecialchars(
$this->selUrlDB(
$table,
$row['uid'],
0,
($isSel == 'cut'),
array('returnUrl' => '')
)
);
$link .= '<a href="' . $url . '"
title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:cm.cut', TRUE) . '">'.
((!($isSel == 'cut')) ? t3lib_iconWorks::getSpriteIcon('actions-edit-cut') : t3lib_iconWorks::getSpriteIcon('actions-edit-cut-release')) .
'</a>';
}
return $link;
}
t3lib/class.t3lib_tcemain.php (working copy)
}
}
$overrideValues = t3lib_div::_GP('overrideValues');
// Init copyMapping array:
$this->copyMappingArray = Array(); // Must clear this array before call from here to those functions: Contains mapping information between new and old id numbers.
// Branch, based on command
switch ($command) {
case 'move':
$this->moveRecord($table,$id,$value);
$this->moveRecord($table, $id, $value, $overrideValues);
break;
case 'copy':
if ($table === 'pages') {
$this->copyPages($id,$value);
} else {
$this->copyRecord($table,$id,$value,1);
$this->copyRecord($table, $id, $value, 1, $overrideValues);
}
break;
case 'localize':
......
$this->errorLog = array_merge($this->errorLog, $copyTCE->errorLog);
unset($copyTCE);
if($language == 0) {
if($language == 0 && $overrideValues['sys_language_uid'] == 0) {
//repointing the new translation records to the parent record we just created
$overrideValues[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] = $theNewSQLID;
$this->copyL10nOverlayRecords($table, $uid, $destPid<0 ? $tscPID : $destPid , $first, $overrideValues, $excludeFields);
......
* @param string Table name to move
* @param integer Record uid to move
* @param integer Position to move to: $destPid: >=0 then it points to a page-id on which to insert the record (as the first element). <0 then it points to a uid from its own table after which to insert it (works if
* @param array Optional: Array of values to override before inserting the record
* @return void
*/
function moveRecord($table,$uid,$destPid) {
function moveRecord($table, $uid, $destPid, $overrideValues = array()) {
global $TCA;
if ($TCA[$table]) {
......
if (!count($workspaceAccessBlocked)) {
if ($WSversion['uid'] && !$recIsNewVersion && (int)$TCA[$table]['ctrl']['versioningWS']>=2) { // If the move operation is done on a versioned record, which is NOT new/deletd placeholder and versioningWS is in version 2, then...
$this->moveRecord_wsPlaceholders($table,$uid,$destPid,$WSversion['uid']);
$this->moveRecord_wsPlaceholders($table, $uid, $destPid, $WSversion['uid'], $overrideValues);
} else {
$this->moveRecord_raw($table,$uid,$destPid);
$this->moveRecord_raw($table, $uid, $destPid, $overrideValues);
}
} else {
$this->newlog("Move attempt failed due to workspace restrictions: ".implode(' // ',$workspaceAccessBlocked),1);
}
} else { // Live workspace - move it!
$this->moveRecord_raw($table,$uid,$destPid);
$this->moveRecord_raw($table, $uid, $destPid, $overrideValues);
}
} else {
$this->log($table,$uid,4,0,1,"Attempt to move record '%s' (%s) without having permissions to insert.",14,array($propArr['header'],$table.':'.$uid),$propArr['event_pid']);
......
* @return void
* @see moveRecord()
*/
function moveRecord_wsPlaceholders($table,$uid,$destPid,$wsUid) {
function moveRecord_wsPlaceholders($table, $uid, $destPid, $wsUid, $overrideValues) {
global $TCA;
if ($plh = t3lib_BEfunc::getMovePlaceholder($table,$uid,'uid')) {
// If already a placeholder exists, move it:
$this->moveRecord_raw($table,$plh['uid'],$destPid);
$this->moveRecord_raw($table, $plh['uid'], $destPid, $overrideValues);
} else {
// First, we create a placeholder record in the Live workspace that represents the position to where the record is eventually moved to.
$newVersion_placeholderFieldArray = array();
......
$this->insertDB($table,$id,$newVersion_placeholderFieldArray,FALSE); // Saving placeholder as 'original'
// Move the new placeholder from temporary root-level to location:
$this->moveRecord_raw($table,$this->substNEWwithIDs[$id],$destPid);
$this->moveRecord_raw($table, $this->substNEWwithIDs[$id], $destPid, $overrideValues);
// Move the workspace-version of the original to be the version of the move-to-placeholder:
$updateFields = array();
......
* @param string Table name to move
* @param integer Record uid to move
* @param integer Position to move to: $destPid: >=0 then it points to a page-id on which to insert the record (as the first element). <0 then it points to a uid from its own table after which to insert it (works if
* @param array Optional: Array of values to override before inserting the record
* @return void
* @see moveRecord()
*/
function moveRecord_raw($table,$uid,$destPid) {
function moveRecord_raw($table, $uid, $destPid, $overrideValues = array()) {
global $TCA, $TYPO3_CONF_VARS;
$sortRow = $TCA[$table]['ctrl']['sortby'];
......
if ($TCA[$table]['ctrl']['tstamp']) {
$updateFields[$TCA[$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
}
if(is_array($overrideValues)) {
$updateFields = array_merge($updateFields, $overrideValues);
}
if ($destPid>=0) { // insert as first element on page (where uid = $destPid)
if ($table!='pages' || $this->destNotInsideSelf($destPid,$uid)) {
......
$this->moveRecord_procFields($table,$uid,$destPid);
// Create query for update:
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields);
// check for the localizations of that element
$this->moveL10nOverlayRecords($table, $uid, $destPid);
if($overrideValues['sys_language_uid'] == 0) {
// check for the localizations of that element
$this->moveL10nOverlayRecords($table, $uid, $destPid);
} else {
// Delete localizations because the moved record is not in default language anymore
$GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . intval($uid));
}
// Call post processing hooks:
foreach($hookObjectsArr as $hookObj) {
......
$this->moveRecord_procFields($table,$uid,$destPid);
// Create query for update:
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields);
// check for the localizations of that element
$this->moveL10nOverlayRecords($table, $uid, $destPid);
if($overrideValues['sys_language_uid'] == 0) {
// check for the localizations of that element
$this->moveL10nOverlayRecords($table, $uid, $destPid);
} else {
// Delete localizations because the moved record is not in default language anymore
$GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . intval($uid));
}
// Call post processing hooks:
foreach($hookObjectsArr as $hookObj) {
(4-4/4)