Project

General

Profile

Bug #17753 » 0006651.patch

Administrator Admin, 2007-12-15 15:21

View differences:

t3lib/jsfunc.inline.js (Arbeitskopie)
if (!records[i].length) continue;
headerObj = $(objectPrefix+'['+records[i]+']_header');
sortingObj[0] = headerObj.getElementsByClassName('sortingUp');
sortingObj[1] = headerObj.getElementsByClassName('sortingDown');
sortingObj[0] = Element.getElementsByClassName(headerObj, 'sortingUp');
sortingObj[1] = Element.getElementsByClassName(headerObj, 'sortingDown');
if (sortingObj[0].length)
sortingObj[0][0].style.visibility = i == 0 ? 'hidden' : 'visible';
if (sortingObj[1].length)
sortingObj[1][0].style.visibility = i == records.length-1 ? 'hidden' : 'visible';
if (sortingObj[0].length) {
sortingObj[0][0].style.visibility = (i == 0 ? 'hidden' : 'visible');
}
if (sortingObj[1].length) {
sortingObj[1][0].style.visibility = (i == records.length-1 ? 'hidden' : 'visible');
}
}
},
......
// if we reached the maximum off possible records after this action, hide the new buttons
if (!this.isBelowMax(objectPrefix)) {
this.hideElementsWithClassName('inlineNewButton', this.parseFormElementName('full', objectPrefix, 0 , 1));
var objectParent = this.parseFormElementName('full', objectPrefix, 0 , 1);
var md5 = this.getObjectMD5(objectParent);
this.hideElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
}
if (TBE_EDITOR) TBE_EDITOR.fieldChanged_fName(objectName, formObj);
......
// revert the unique settings if available
this.revertUnique(objectPrefix, elName, recordUid);
// if the record is new and was never saved before, just remove it from DOM
if (this.isNewRecord(objectId)) {
new Effect.Fade(objectId+'_div', { afterFinish: function() { Element.remove(objectId+'_div'); } });
// if the record already exists in storage, mark it to be deleted on clicking the save button
} else {
document.getElementsByName('cmd'+shortName+'[delete]')[0].disabled = false;
new Effect.Fade(objectId+'_div');
}
// Remove from TBE_EDITOR (required fields, required range, etc.):
if (TBE_EDITOR && TBE_EDITOR.removeElement) {
inlineRecords = document.getElementsByClassName('inlineRecord', objectId+'_div');
inlineRecords = Element.getElementsByClassName(objectId+'_div', 'inlineRecord');
// Remove nested child records from TBE_EDITOR required/range checks:
for (i=inlineRecords.length-1; i>=0; i--) {
if (inlineRecords[i].value.length) {
......
TBE_EDITOR.removeElement(this.prependFormFieldNames+shortName);
}
// If the record is new and was never saved before, just remove it from DOM:
if (this.isNewRecord(objectId)) {
new Effect.Fade(objectId+'_div', { afterFinish: function() { Element.remove(objectId+'_div'); } });
// If the record already exists in storage, mark it to be deleted on clicking the save button:
} else {
document.getElementsByName('cmd'+shortName+'[delete]')[0].disabled = false;
new Effect.Fade(objectId+'_div');
}
var recordCount = this.memorizeRemoveRecord(
this.prependFormFieldNames+this.parseFormElementName('parts', objectId, 3, 2),
recordUid
......
this.redrawSortingButtons(objectPrefix);
// if the NEW-button was hidden and now we can add again new children, show the button
if (!beforeDeleteIsBelowMax && this.isBelowMax(objectPrefix))
this.showElementsWithClassName('inlineNewButton', this.parseFormElementName('full', objectPrefix, 0 , 1));
if (!beforeDeleteIsBelowMax && this.isBelowMax(objectPrefix)) {
var objectParent = this.parseFormElementName('full', objectPrefix, 0 , 1);
var md5 = this.getObjectMD5(objectParent);
this.showElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
}
return false;
},
......
selectObj.add(readdOption, document.all ? index : selectObj.options[index]);
},
hideElementsWithClassName: function(className, parentElement) {
this.setVisibilityOfElementsWithClassName('hide', className, parentElement);
hideElementsWithClassName: function(selector, parentElement) {
this.setVisibilityOfElementsWithClassName('hide', selector, parentElement);
},
showElementsWithClassName: function(className, parentElement) {
this.setVisibilityOfElementsWithClassName('show', className, parentElement);
showElementsWithClassName: function(selector, parentElement) {
this.setVisibilityOfElementsWithClassName('show', selector, parentElement);
},
setVisibilityOfElementsWithClassName: function(action, className, parentElement) {
var domObjects = document.getElementsByClassName(className, parentElement);
for (var i=0; i<domObjects.length; i++) {
if (action == 'hide')
new Effect.Fade(domObjects[i]);
else if (action = 'show')
new Effect.Appear(domObjects[i]);
setVisibilityOfElementsWithClassName: function(action, selector, parentElement) {
var domObjects = Selector.findChildElements($(parentElement), [selector]);
if (action == 'hide') {
$A(domObjects).each(function(domObject) { new Effect.Fade(domObject); });
} else if (action == 'show') {
$A(domObjects).each(function(domObject) { new Effect.Appear(domObject); });
}
},
......
number = RTEarea.length-1;
}
return number;
},
getObjectMD5: function(objectPrefix) {
var md5 = false;
if (this.data.config && this.data.config[objectPrefix] && this.data.config[objectPrefix].md5) {
md5 = this.data.config[objectPrefix].md5;
}
return md5
}
}
t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie)
// Tell the browser what we have (using JSON later):
$top = $this->getStructureLevel(0);
$this->inlineData['config'][$nameObject] = array('table' => $foreign_table);
$this->inlineData['config'][$nameObject] = array(
'table' => $foreign_table,
'md5' => md5($nameObject),
);
$this->inlineData['config'][$nameObject.'['.$foreign_table.']'] = array(
'min' => $minitems,
'max' => $maxitems,
......
$isOnSymmetricSide = t3lib_loadDBGroup::isOnSymmetricSide($parentUid, $config, $rec);
$enableManualSorting = $tcaTableCtrl['sortby'] || $config['MM'] || (!$isOnSymmetricSide && $config['foreign_sortby']) || ($isOnSymmetricSide && $config['symmetric_sortby']) ? true : false;
$nameObjectFt = $this->inlineNames['object'].'['.$foreign_table.']';
$nameObject = $this->inlineNames['object'];
$nameObjectFt = $nameObject.'['.$foreign_table.']';
$nameObjectFtId = $nameObjectFt.'['.$rec['uid'].']';
$calcPerms = $GLOBALS['BE_USER']->calcPerms(
......
($isPagesTable && ($calcPerms&8)) // For pages, must have permission to create new pages here.
) {
$onClick = "return inline.createNewRecord('".$nameObjectFt."','".$rec['uid']."')";
$class = ' class="inlineNewButton '.$this->inlineData['config'][$nameObject]['md5'].'"';
if ($config['inline']['inlineNewButtonStyle']) {
$style = ' style="'.$config['inline']['inlineNewButtonStyle'].'"';
}
$cells[]='<a href="#" onclick="'.htmlspecialchars($onClick).'" class="inlineNewButton"'.$style.'>'.
$cells[]='<a href="#" onclick="'.htmlspecialchars($onClick).'"'.$class.$style.'>'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($isPagesTable?'page':'el').'.gif','width="'.($isPagesTable?13:11).'" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:new'.($isPagesTable?'Page':'Record'),1).'" alt="" />'.
'</a>';
}
......
* @return string The HTML code for the new record link
*/
function getNewRecordLink($objectPrefix, $conf = array()) {
if ($conf['inline']['inlineNewButtonStyle']) $style = ' style="'.$conf['inline']['inlineNewButtonStyle'].'"';
$nameObject = $this->inlineNames['object'];
$class = ' class="inlineNewButton '.$this->inlineData['config'][$nameObject]['md5'].'"';
if ($conf['inline']['inlineNewButtonStyle']) {
$style = ' style="'.$conf['inline']['inlineNewButtonStyle'].'"';
}
$onClick = "return inline.createNewRecord('$objectPrefix')";
$title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.createnew',1);
if ($conf['appearance']['newRecordLinkAddTitle'])
if ($conf['appearance']['newRecordLinkAddTitle']) {
$tableTitle .= ' '.$GLOBALS['LANG']->sL($GLOBALS['TCA'][$conf['foreign_table']]['ctrl']['title'],1);
}
$out = '
<div class="typo3-newRecordLink">
<a href="#" onClick="'.$onClick.'" class="inlineNewButton"'.$style.' title="'.$title.$tableTitle.'">'.
<a href="#" onClick="'.$onClick.'"'.$class.$style.' title="'.$title.$tableTitle.'">'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_el.gif','width="11" height="12"').' alt="'.$title.$tableTitle.'" />'.
$title.t3lib_div::fixed_lgd_cs($tableTitle, $this->fObj->titleLen).
'</a>
(3-3/3)