Project

General

Profile

Bug #22312 ยป rtehtmlarea_bugfix_13887.patch

Administrator Admin, 2010-03-22 15:50

View differences:

typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js (copie de travail)
if (!element) {
var element = this.getClosest('th');
}
this.properties = this.buttonsConfiguration.cellproperties.properties;
this.properties = (this.buttonsConfiguration.cellproperties && this.buttonsConfiguration.cellproperties.properties) ? this.buttonsConfiguration.cellproperties.properties : {};
var title = (type == 'column') ? 'Column Properties' : 'Cell Properties';
break;
case 'row':
var element = this.getClosest('tr');
this.properties = this.buttonsConfiguration.rowproperties.properties;
this.properties = (this.buttonsConfiguration.rowproperties && this.buttonsConfiguration.rowproperties.properties) ? this.buttonsConfiguration.rowproperties.properties : {};
var title = 'Row Properties';
break;
case 'table':
var insert = (buttonId === 'InsertTable');
var element = insert ? null : this.getClosest('table');
this.properties = this.buttonsConfiguration.table.properties;
this.properties = (this.buttonsConfiguration.table && this.buttonsConfiguration.table.properties) ? this.buttonsConfiguration.table.properties : {};
var title = insert ? 'Insert Table' : 'Table Properties';
break;
}
var propertySet = element ? type + 'properties' : 'table';
this.removedFieldsets = (this.buttonsConfiguration[propertySet] && this.buttonsConfiguration[propertySet].removeFieldsets) ? this.buttonsConfiguration[propertySet].removeFieldsets : '';
this.removedProperties = (this.properties && this.properties.removed) ? this.properties.removed : '';
this.removedProperties = this.properties.removed ? this.properties.removed : '';
// Open the dialogue window
this.openDialogue(
title,
......
return false;
});
var errorFlag = false;
if (this.buttonsConfiguration.table.properties && this.buttonsConfiguration.table.properties.required) {
if (this.buttonsConfiguration.table.properties.required.indexOf('captionOrSummary') != -1) {
if (this.properties.required) {
if (this.properties.required.indexOf('captionOrSummary') != -1) {
if (!/\S/.test(params.f_caption) && !/\S/.test(params.f_summary)) {
Ext.MessageBox.alert(this.localize('Error'), this.localize('captionOrSummary' + '-required'));
var field = this.dialog.find('itemId', 'f_caption')[0];
......
f_summary: 'summary'
};
Ext.iterate(required, function (item) {
if (!params[item] && this.buttonsConfiguration.table.properties.required.indexOf(required[item]) != -1) {
if (!params[item] && this.properties.required.indexOf(required[item]) != -1) {
Ext.MessageBox.alert(this.localize('Error'), this.localize(required[item] + '-required'));
var field = this.dialog.find('itemId', item)[0];
var tab = field.findParentByType('container');
......
fieldLabel: this.localize('Rows:'),
labelSeparator: '',
itemId: 'f_rows',
value: (this.properties && this.properties.numberOfRows && this.properties.numberOfRows.defaultValue) ? this.properties.numberOfRows.defaultValue : '2',
value: (this.properties.numberOfRows && this.properties.numberOfRows.defaultValue) ? this.properties.numberOfRows.defaultValue : '2',
width: 30,
minValue: 1,
helpTitle: this.localize('Number of rows')
......
fieldLabel: this.localize('Cols:'),
labelSeparator: '',
itemId: 'f_cols',
value: (this.properties && this.properties.numberOfColumns && this.properties.numberOfColumns.defaultValue) ? this.properties.numberOfColumns.defaultValue : '4',
value: (this.properties.numberOfColumns && this.properties.numberOfColumns.defaultValue) ? this.properties.numberOfColumns.defaultValue : '4',
width: 30,
minValue: 1,
helpTitle: this.localize('Number of columns')
......
});
this.removeOptions(store, 'headers');
if (Ext.isEmpty(table)) {
var selected = (this.properties && this.properties.headers && this.properties.headers.defaultValue) ? this.properties.headers.defaultValue : 'top';
var selected = (this.properties.headers && this.properties.headers.defaultValue) ? this.properties.headers.defaultValue : 'top';
} else {
var selected = 'none';
var thead = table.getElementsByTagName('thead');
......
itemId: 'f_headers',
helpTitle: this.localize('Table headers'),
store: store,
width: (this.properties && this.properties['headers'] && this.properties['headers'].width) ? this.properties['headers'].width : 200,
width: (this.properties['headers'] && this.properties['headers'].width) ? this.properties['headers'].width : 200,
value: selected
}, this.configDefaults['combo']));
}
......
itemId: fieldName,
fieldLabel: this.localize(fieldLabel),
helpTitle: this.localize(fieldTitle),
width: (this.properties && this.properties['style'] && this.properties['style'].width) ? this.properties['style'].width : 300,
width: (this.properties['style'] && this.properties['style'].width) ? this.properties['style'].width : 300,
store: new Ext.data.ArrayStore({
autoDestroy: true,
fields: [ { name: 'text'}, { name: 'value'}, { name: 'style'} ],
......
itemId: 'f_lang',
helpTitle: this.localize('Language'),
store: languageStore,
width: (this.properties && this.properties['language'] && this.properties['language'].width) ? this.properties['language'].width : 200,
width: (this.properties['language'] && this.properties['language'].width) ? this.properties['language'].width : 200,
value: selectedLanguage
}, this.configDefaults['combo']));
}
......
[this.localize('LeftToRight'), 'ltr']
]
}),
width: (this.properties && this.properties['direction'] && this.properties['dirrection'].width) ? this.properties['direction'].width : 200,
width: (this.properties['direction'] && this.properties['dirrection'].width) ? this.properties['direction'].width : 200,
value: !Ext.isEmpty(element) && element.dir ? element.dir : 'not set'
}, this.configDefaults['combo']));
}
......
fieldLabel: this.localize('Width:'),
labelSeparator: '',
itemId: 'f_st_width',
value: element ? this.getLength(element.style.width) : ((this.properties && this.properties.width && this.properties.width.defaultValue) ? this.properties.width.defaultValue : ''),
value: element ? this.getLength(element.style.width) : ((this.properties.width && this.properties.width.defaultValue) ? this.properties.width.defaultValue : ''),
width: 30,
helpTitle: this.localize(widthTitle)
});
......
itemId: 'f_st_widthUnit',
helpTitle: this.localize('Width unit'),
store: widthUnitStore,
width: (this.properties && this.properties['widthUnit'] && this.properties['widthUnit'].width) ? this.properties['widthUnit'].width : 60,
value: element ? (/%/.test(element.style.width) ? '%' : (/px/.test(element.style.width) ? 'px' : 'em')) : ((this.properties && this.properties.widthUnit &&this.properties.widthUnit.defaultValue) ? this.properties.widthUnit.defaultValue : '%')
width: (this.properties['widthUnit'] && this.properties['widthUnit'].width) ? this.properties['widthUnit'].width : 60,
value: element ? (/%/.test(element.style.width) ? '%' : (/px/.test(element.style.width) ? 'px' : 'em')) : ((this.properties.widthUnit && this.properties.widthUnit.defaultValue) ? this.properties.widthUnit.defaultValue : '%')
}, this.configDefaults['combo']));
}
if (this.removedProperties.indexOf('height') === -1) {
......
fieldLabel: this.localize('Height:'),
labelSeparator: '',
itemId: 'f_st_height',
value: element ? this.getLength(element.style.height) : ((this.properties && this.properties.height && this.properties.height.defaultValue) ? this.properties.height.defaultValue : ''),
value: element ? this.getLength(element.style.height) : ((this.properties.height && this.properties.height.defaultValue) ? this.properties.height.defaultValue : ''),
width: 30,
helpTitle: this.localize(heightTitle)
});
......
itemId: 'f_st_heightUnit',
helpTitle: this.localize('Height unit'),
store: heightUnitStore,
width: (this.properties && this.properties['heightUnit'] && this.properties['heightUnit'].width) ? this.properties['heightUnit'].width : 60,
value: element ? (/%/.test(element.style.height) ? '%' : (/px/.test(element.style.height) ? 'px' : 'em')) : ((this.properties && this.properties.heightUnit &&this.properties.heightUnit.defaultValue) ? this.properties.heightUnit.defaultValue : '%')
width: (this.properties['heightUnit'] && this.properties['heightUnit'].width) ? this.properties['heightUnit'].width : 60,
value: element ? (/%/.test(element.style.height) ? '%' : (/px/.test(element.style.height) ? 'px' : 'em')) : ((this.properties.heightUnit && this.properties.heightUnit.defaultValue) ? this.properties.heightUnit.defaultValue : '%')
}, this.configDefaults['combo']));
}
if (nodeName == 'table' && this.removedProperties.indexOf('float') === -1) {
......
itemId: 'f_st_float',
helpTitle: this.localize('Specifies where the table should float'),
store: floatStore,
width: (this.properties && this.properties['float'] && this.properties['float'].width) ? this.properties['float'].width : 120,
width: (this.properties['float'] && this.properties['float'].width) ? this.properties['float'].width : 120,
value: element ? (Ext.get(element).hasClass(this.floatLeft) ? 'left' : (Ext.get(element).hasClass(this.floatRight) ? 'right' : 'not set')) : this.floatDefault
}, this.configDefaults['combo']));
}
......
[this.localize('Justify'), 'justify']
]
}),
width: (this.properties && this.properties['textAlign'] && this.properties['textAlign'].width) ? this.properties['textAlign'].width : 100,
width: (this.properties['textAlign'] && this.properties['textAlign'].width) ? this.properties['textAlign'].width : 100,
value: selectedTextAlign
}, this.configDefaults['combo']));
// Vertical alignment
......
[this.localize('Baseline'), 'baseline']
]
}),
width: (this.properties && this.properties['verticalAlign'] && this.properties['verticalAlign'].width) ? this.properties['verticalAlign'].width : 100,
width: (this.properties['verticalAlign'] && this.properties['verticalAlign'].width) ? this.properties['verticalAlign'].width : 100,
value: (element && element.style.verticalAlign) ? element.style.verticalAlign : 'not set'
}, this.configDefaults['combo']));
return {
......
this.removeOptions(borderStyleStore, 'borderStyle');
// Gecko reports "solid solid solid solid" for "border-style: solid".
// That is, "top right bottom left" -- we only consider the first value.
var selectedBorderStyle = element && element.style.borderStyle ? element.style.borderStyle : ((this.properties && this.properties.borderWidth) ? ((this.properties.borderStyle && this.properties.borderStyle.defaultValue) ? this.properties.borderStyle.defaultValue : 'solid') : 'not set');
var selectedBorderStyle = element && element.style.borderStyle ? element.style.borderStyle : ((this.properties.borderWidth) ? ((this.properties.borderStyle && this.properties.borderStyle.defaultValue) ? this.properties.borderStyle.defaultValue : 'solid') : 'not set');
itemsConfig.push(Ext.apply({
xtype: 'combo',
fieldLabel: this.localize('Border style:'),
itemId: 'f_st_borderStyle',
helpTitle: this.localize('Border style'),
store: borderStyleStore,
width: (this.properties && this.properties.borderStyle && this.properties.borderStyle.width) ? this.properties.borderStyle.width : 150,
width: (this.properties.borderStyle && this.properties.borderStyle.width) ? this.properties.borderStyle.width : 150,
value: selectedBorderStyle,
listeners: {
change: {
......
itemsConfig.push({
fieldLabel: this.localize('Border width:'),
itemId: 'f_st_borderWidth',
value: element ? this.getLength(element.style.borderWidth) : ((this.properties && this.properties.borderWidth && this.properties.borderWidth.defaultValue) ? this.properties.borderWidth.defaultValue : ''),
value: element ? this.getLength(element.style.borderWidth) : ((this.properties.borderWidth && this.properties.borderWidth.defaultValue) ? this.properties.borderWidth.defaultValue : ''),
width: 30,
minValue: 0,
helpTitle: this.localize('Border width'),
......
fieldLabel: this.localize('Color:'),
itemId: 'f_st_borderColor',
colorsConfiguration: this.editorConfiguration.colors,
value: HTMLArea.util.Color.colorToHex(element && element.style.borderColor ? element.style.borderColor : ((this.properties && this.properties.borderColor && this.properties.borderColor.defaultValue) ? this.properties.borderColor.defaultValue : '')).substr(1, 6),
value: HTMLArea.util.Color.colorToHex(element && element.style.borderColor ? element.style.borderColor : ((this.properties.borderColor && this.properties.borderColor.defaultValue) ? this.properties.borderColor.defaultValue : '')).substr(1, 6),
helpTitle: this.localize('Border color'),
disabled: (selectedBorderStyle === 'none')
});
......
[this.localize('Detached borders'), 'separate']
]
}),
width: (this.properties && this.properties.borderCollapse && this.properties.borderCollapse.width) ? this.properties.borderCollapse.width : 150,
width: (this.properties.borderCollapse && this.properties.borderCollapse.width) ? this.properties.borderCollapse.width : 150,
value: element && element.style.borderCollapse ? element.style.borderCollapse : 'not set',
disabled: (selectedBorderStyle === 'none')
}, this.configDefaults['combo']));
......
[this.localize('All four sides'), 'box']
]
}),
width: (this.properties && this.properties.frame && this.properties.frame.width) ? this.properties.frame.width : 250,
width: (this.properties.frame && this.properties.frame.width) ? this.properties.frame.width : 250,
value: (element && element.frame) ? element.frame : 'not set',
disabled: (selectedBorderStyle === 'none')
}, this.configDefaults['combo']));
......
[this.localize('Rules will appear between all rows and columns'), 'all']
]
}),
width: (this.properties && this.properties.rules && this.properties.rules.width) ? this.properties.rules.width : 360,
width: (this.properties.rules && this.properties.rules.width) ? this.properties.rules.width : 360,
value: (element && element.rules) ? element.rules : 'not set'
}, this.configDefaults['combo']));
}
......
fieldLabel: this.localize('FG Color:'),
itemId: 'f_st_color',
colorsConfiguration: this.editorConfiguration.colors,
value: HTMLArea.util.Color.colorToHex(element && element.style.color ? element.style.color : ((this.properties && this.properties.color && this.properties.color.defaultValue) ? this.properties.color.defaultValue : '')).substr(1, 6)
value: HTMLArea.util.Color.colorToHex(element && element.style.color ? element.style.color : ((this.properties.color && this.properties.color.defaultValue) ? this.properties.color.defaultValue : '')).substr(1, 6)
});
// Background color
itemsConfig.push({
......
fieldLabel: this.localize('Background:'),
itemId: 'f_st_backgroundColor',
colorsConfiguration: this.editorConfiguration.colors,
value: HTMLArea.util.Color.colorToHex(element && element.style.backgroundColor ? element.style.backgroundColor : ((this.properties && this.properties.backgroundColor && this.properties.backgroundColor.defaultValue) ? this.properties.backgroundColor.defaultValue : '')).substr(1, 6)
value: HTMLArea.util.Color.colorToHex(element && element.style.backgroundColor ? element.style.backgroundColor : ((this.properties.backgroundColor && this.properties.backgroundColor.defaultValue) ? this.properties.backgroundColor.defaultValue : '')).substr(1, 6)
});
// Background image
itemsConfig.push({
fieldLabel: this.localize('Image URL:'),
itemId: 'f_st_backgroundImage',
value: element && element.style.backgroundImage.match(/url\(\s*(.*?)\s*\)/) ? RegExp.$1 : '',
width: (this.properties && this.properties.backgroundImage && this.properties.backgroundImage.width) ? this.properties.backgroundImage.width : 300,
width: (this.properties.backgroundImage && this.properties.backgroundImage.width) ? this.properties.backgroundImage.width : 300,
helpTitle: this.localize('URL of the background image'),
helpIcon: true
});
......
// @return void
var self = this;
function cellTypeChange(cellTypeField, record) {
value = record.get('value');
var value = record.get('value');
var styleCombo = self.dialog.find('itemId', 'f_class')[0];
if (styleCombo) {
self.setStyleOptions(styleCombo, element, value.substring(0,2));
......
fields: [ { name: 'text'}, { name: 'value'}],
data: data
}),
width: (this.properties && this.properties.cellType && this.properties.cellType.width) ? this.properties.cellType.width : 250,
width: (this.properties.cellType && this.properties.cellType.width) ? this.properties.cellType.width : 250,
value: (column && selected == 'thcol') ? 'td' : selected,
listeners: {
select: {
......
[this.localize('Table footer'), 'tfoot']
]
}),
width: (this.properties && this.properties.rowGroup && this.properties.rowGroup.width) ? this.properties.rowGroup.width : 150,
width: (this.properties.rowGroup && this.properties.rowGroup.width) ? this.properties.rowGroup.width : 150,
value: current,
labelSeparator: '',
listeners: {
......
*
*/
removeOptions: function (store, property) {
if (this.properties && this.properties[property] && this.properties[property].removeItems) {
if (this.properties[property] && this.properties[property].removeItems) {
var items = this.properties[property].removeItems.split(',');
var index = -1;
Ext.each(items, function (item) {
    (1-1/1)