Bug #21428 » 12437_v2.diff
typo3/sysext/recycler/mod1/index.php (working copy) | ||
---|---|---|
public function render() {
|
||
global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
|
||
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('title'), $GLOBALS['LANG']->getLL('description'));
|
||
if ($this->isAccessibleForCurrentUser) {
|
||
$this->loadHeaderData();
|
||
// div container for renderTo
|
||
$this->content.= '<div id="recyclerContent"></div>';
|
||
$this->content .= '<div id="recyclerContent"></div>';
|
||
} else {
|
||
// If no access or if ID == zero
|
||
$this->content.= $this->doc->spacer(10);
|
||
$this->content .= $this->doc->spacer(10);
|
||
}
|
||
}
|
||
... | ... | |
$this->getTemplateMarkers()
|
||
);
|
||
$content.= $this->doc->endPage();
|
||
$content.= $this->doc->insertStylesAndJS($this->content);
|
||
$this->content = null;
|
||
$this->doc = null;
|
typo3/sysext/recycler/mod1/locallang.xml (working copy) | ||
---|---|---|
<data type="array">
|
||
<languageKey index="default" type="array">
|
||
<label index="title">Recycler</label>
|
||
<label index="description">The recycler allows you to select any deleted data and undelete it. You can undelete recursive if the parent of element is deleted too.</label>
|
||
<label index="label_alltables">All tables</label>
|
||
<label index="js.label_lostandfound">Lost and found</label>
|
||
<label index="js.label_deletedTab">Deleted data</label>
|
||
... | ... | |
<label index="js.label_title_delete">Delete?</label>
|
||
<label index="js.label_text_delete">Delete records from tables: </label>
|
||
<label index="js.label_boxLabel_undelete_recursive">Undelete recursively</label>
|
||
<label index="js.label_tableMenu_label">Table:</label>
|
||
<label index="js.label_tableMenu_emptyText">Choose a table...</label>
|
||
<label index="js.label_filter_emptyText">Keyword</label>
|
||
<label index="js.label_search">Search:</label>
|
typo3/sysext/recycler/mod1/mod_template.html (working copy) | ||
---|---|---|
<!-- Content of module, for instance listing, info or editing -->
|
||
<div id="typo3-docbody">
|
||
<div id="typo3-inner-docbody">
|
||
<h1>###TITLE###</h1>
|
||
###CONTENT###
|
||
</div>
|
||
</div>
|
typo3/sysext/recycler/res/css/customExtJs.css (working copy) | ||
---|---|---|
body#ext-recycler-mod1-index-php {
|
||
margin-left: 0;
|
||
}
|
||
#recyclerContent {
|
||
margin: 10px 0 0 4px;
|
||
}
|
||
body .x-panel { margin-bottom:20px; }
|
||
.icon-grid { background-image:url('../icons/recycler2.gif') !important; }
|
typo3/sysext/recycler/res/js/t3_recycler.js (working copy) | ||
---|---|---|
var rowAction = function(ob, confirmQuestion, cmd, confirmTitle, confirmText) {
|
||
// get the 'undeleted records' grid object
|
||
var grid = tabs.getComponent(0).getComponent(0);
|
||
recArray = grid.getSelectionModel().getSelections();
|
||
//var grid = gridContainer.view;
|
||
var recArray = gridContainer.getSelectionModel().getSelections();
|
||
if (recArray.length > 0) {
|
||
... | ... | |
callback: function(options, success, response) {
|
||
if (response.responseText === "1") {
|
||
// reload the records and the table selector
|
||
grid.getStore().reload();
|
||
gridDs.reload();
|
||
Ext.getCmp('tableSelector').store.reload();
|
||
if (arePagesAffected) {
|
||
Recycler.utility.updatePageTree();
|
||
... | ... | |
* tab container
|
||
****************************************************/
|
||
var tabs = new Ext.TabPanel({
|
||
var gridContainer = new Ext.grid.GridPanel ({
|
||
renderTo: Recycler.statics.renderTo,
|
||
layoutOnTabChange: true,
|
||
activeTab: 0,
|
||
width: '99%',
|
||
width: '98%',
|
||
height: 600,
|
||
frame: true,
|
||
border: false,
|
||
defaults: {autoScroll: true},
|
||
border: true,
|
||
defaults: {autoScroll: false},
|
||
plain: true,
|
||
buttons: [{
|
||
id: 'delRecordId',
|
||
loadMask: true,
|
||
store: gridDs,
|
||
cm: new Ext.grid.ColumnModel([
|
||
sm,
|
||
expander,
|
||
{header: "UID", width: 10, sortable: true, dataIndex: 'uid'},
|
||
{header: "PID", width: 10, sortable: true, dataIndex: 'pid'},
|
||
{id:'record',header: "Records", width: 60, sortable: true, dataIndex: 'record', renderer: renderTopic},
|
||
{header: "Table", width: 20, sortable: true, dataIndex: 'tableTitle'}
|
||
]),
|
||
view: new Ext.grid.GridView({
|
||
forceFit:true
|
||
}),
|
||
bbar: [
|
||
{
|
||
/****************************************************
|
||
* Delete button
|
||
* Paging toolbar
|
||
****************************************************/
|
||
id: 'recordPaging',
|
||
xtype: 'paging',
|
||
store: gridDs,
|
||
pageSize: Recycler.statics.pagingSize,
|
||
displayInfo: true,
|
||
displayMsg: Recycler.lang.pagingMessage,
|
||
emptyMsg: Recycler.lang.pagingEmpty
|
||
}
|
||
],
|
||
tbar: [
|
||
Recycler.lang.search, ' ',
|
||
new Ext.app.SearchField({
|
||
store: gridDs,
|
||
width: 200
|
||
}),
|
||
'-', {
|
||
xtype: 'tbtext',
|
||
text: Recycler.lang.depth + ':'
|
||
},{
|
||
/****************************************************
|
||
* Depth menu
|
||
****************************************************/
|
||
|
||
xtype: 'combo',
|
||
width: 100,
|
||
lazyRender: true,
|
||
valueField: 'depth',
|
||
displayField: 'label',
|
||
id: 'depthSelector',
|
||
mode: 'local',
|
||
emptyText: Recycler.lang.depth,
|
||
selectOnFocus: true,
|
||
readOnly: true,
|
||
triggerAction: 'all',
|
||
editable: false,
|
||
forceSelection: true,
|
||
hidden: Recycler.lang.showDepthMenu,
|
||
store: new Ext.data.SimpleStore({
|
||
autoLoad: true,
|
||
fields: ['depth','label'],
|
||
data : [
|
||
['0', Recycler.lang.depth_0],
|
||
['1', Recycler.lang.depth_1],
|
||
['2', Recycler.lang.depth_2],
|
||
['3', Recycler.lang.depth_3],
|
||
['4', Recycler.lang.depth_4],
|
||
['999', Recycler.lang.depth_infi]
|
||
]
|
||
}),
|
||
value: Recycler.statics.depthSelection,
|
||
listeners: {
|
||
'select': {
|
||
fn: function(cmp, rec, index) {
|
||
var depth = rec.get('depth');
|
||
gridDs.setBaseParam('depth', depth);
|
||
gridDs.load({
|
||
params: {
|
||
start: 0
|
||
}
|
||
});
|
||
|
||
Ext.getCmp('tableSelector').store.load({
|
||
params: {
|
||
depth: depth
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
},'-',{
|
||
xtype: 'tbtext',
|
||
text: Recycler.lang.tableMenu_label
|
||
},{
|
||
/****************************************************
|
||
* Table menu
|
||
****************************************************/
|
||
xtype: 'combo',
|
||
lazyRender: true,
|
||
valueField: 'valueField',
|
||
displayField: 'tableTitle',
|
||
id: 'tableSelector',
|
||
mode: 'local',
|
||
emptyText: Recycler.lang.tableMenu_emptyText,
|
||
selectOnFocus: true,
|
||
readOnly: true,
|
||
triggerAction: 'all',
|
||
editable: false,
|
||
forceSelection: true,
|
||
store: new Ext.data.Store({
|
||
autoLoad: true,
|
||
url: Recycler.statics.ajaxController + '&startUid=' + Recycler.statics.startUid + '&cmd=getTables' + '&depth=' + Recycler.statics.depthSelection,
|
||
reader: new Ext.data.ArrayReader({}, [
|
||
{name: 'table', type: 'string'},
|
||
{name: 'records', type: 'int'},
|
||
{name: 'valueField', type: 'string'},
|
||
{name: 'tableTitle', type: 'string'}
|
||
]),
|
||
listeners: {
|
||
'load': {
|
||
fn: function(store, records) {
|
||
Ext.getCmp('tableSelector').setValue(Recycler.statics.tableSelection);
|
||
},
|
||
single: true
|
||
}
|
||
}
|
||
}),
|
||
valueNotFoundText: String.format(Recycler.lang.noValueFound, Recycler.statics.tableSelection),
|
||
tpl: '<tpl for="."><tpl if="records > 0"><div ext:qtip="{table} ({records})" class="x-combo-list-item">{tableTitle} ({records}) </div></tpl><tpl if="records < 1"><div ext:qtip="{table} ({records})" class="x-combo-list-item x-item-disabled">{tableTitle} ({records}) </div></tpl></tpl>',
|
||
listeners: {
|
||
'select': {
|
||
fn: function(cmp, rec, index) {
|
||
var table = rec.get('valueField');
|
||
// do not reload if the table selected has no deleted records - hide all records
|
||
if (rec.get('records') <= 0) {
|
||
gridDs.filter('uid', '-1'); // never true
|
||
return false;
|
||
}
|
||
gridDs.setBaseParam('table', table);
|
||
gridDs.load({
|
||
params: {
|
||
start: 0
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
}, {
|
||
xtype: 'tbfill',
|
||
width: 100
|
||
}, '-', {
|
||
/****************************************************
|
||
* Delete button
|
||
****************************************************/
|
||
xtype: 'button',
|
||
id: 'deleteButton',
|
||
text: Recycler.lang.deleteButton_text,
|
||
tooltip: Recycler.lang.deleteButton_tooltip,
|
||
iconCls: 'delete',
|
||
disabled: Recycler.statics.deleteDisable,
|
||
handler: function_delete
|
||
},{
|
||
}, {
|
||
/****************************************************
|
||
* Undelete button
|
||
****************************************************/
|
||
xtype: 'button',
|
||
id: 'undeleteButton',
|
||
text: Recycler.lang.undeleteButton_text,
|
||
tooltip: Recycler.lang.undeleteButton_tooltip,
|
||
... | ... | |
handler: function_undelete
|
||
}
|
||
],
|
||
buttonAlign:'left',
|
||
items:[
|
||
{
|
||
/****************************************************
|
||
* Deleted records Tab
|
||
****************************************************/
|
||
id: 'delRecordId',
|
||
title: Recycler.lang.deletedTab,
|
||
items: [
|
||
{
|
||
/****************************************************
|
||
* Grid
|
||
****************************************************/
|
||
xtype: 'grid',
|
||
loadMask: true,
|
||
store: gridDs,
|
||
cm: new Ext.grid.ColumnModel([
|
||
sm,
|
||
expander,
|
||
{header: "UID", width: 10, sortable: true, dataIndex: 'uid'},
|
||
{header: "PID", width: 10, sortable: true, dataIndex: 'pid'},
|
||
{id:'record',header: "Records", width: 60, sortable: true, dataIndex: 'record', renderer: renderTopic},
|
||
{header: "Table", width: 20, sortable: true, dataIndex: 'tableTitle'}
|
||
]),
|
||
view: new Ext.grid.GridView({
|
||
forceFit:true
|
||
}),
|
||
bbar: [
|
||
{
|
||
/****************************************************
|
||
* Paging toolbar
|
||
****************************************************/
|
||
id: 'recordPaging',
|
||
xtype: 'paging',
|
||
store: gridDs,
|
||
pageSize: Recycler.statics.pagingSize,
|
||
displayInfo: true,
|
||
displayMsg: Recycler.lang.pagingMessage,
|
||
emptyMsg: Recycler.lang.pagingEmpty
|
||
}
|
||
],
|
||
tbar: [
|
||
Recycler.lang.search, ' ',
|
||
new Ext.app.SearchField({
|
||
store: gridDs,
|
||
width: 200
|
||
}),
|
||
'->', {
|
||
/****************************************************
|
||
* Depth menu
|
||
****************************************************/
|
||
xtype: 'combo',
|
||
lazyRender: true,
|
||
valueField: 'depth',
|
||
displayField: 'label',
|
||
id: 'depthSelector',
|
||
mode: 'local',
|
||
emptyText: Recycler.lang.depth,
|
||
selectOnFocus: true,
|
||
readOnly: true,
|
||
triggerAction: 'all',
|
||
editable: false,
|
||
forceSelection: true,
|
||
hidden: Recycler.lang.showDepthMenu,
|
||
store: new Ext.data.SimpleStore({
|
||
autoLoad: true,
|
||
fields: ['depth','label'],
|
||
data : [
|
||
['0', Recycler.lang.depth_0],
|
||
['1', Recycler.lang.depth_1],
|
||
['2', Recycler.lang.depth_2],
|
||
['3', Recycler.lang.depth_3],
|
||
['4', Recycler.lang.depth_4],
|
||
['999', Recycler.lang.depth_infi]
|
||
]
|
||
}),
|
||
value: Recycler.statics.depthSelection,
|
||
listeners: {
|
||
'select': {
|
||
fn: function(cmp, rec, index) {
|
||
var store = tabs.getComponent(0).getComponent(0).getStore();
|
||
var depth = rec.get('depth');
|
||
gridDs.setBaseParam('depth', depth);
|
||
store.load({
|
||
params: {
|
||
start: 0
|
||
}
|
||
});
|
||
Ext.getCmp('tableSelector').store.load({
|
||
params: {
|
||
depth: depth
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
},'->',{
|
||
/****************************************************
|
||
* Table menu
|
||
****************************************************/
|
||
xtype: 'combo',
|
||
lazyRender: true,
|
||
valueField: 'valueField',
|
||
displayField: 'tableTitle',
|
||
id: 'tableSelector',
|
||
mode: 'local',
|
||
emptyText: Recycler.lang.tableMenu_emptyText,
|
||
selectOnFocus: true,
|
||
readOnly: true,
|
||
triggerAction: 'all',
|
||
editable: false,
|
||
forceSelection: true,
|
||
store: new Ext.data.Store({
|
||
autoLoad: true,
|
||
url: Recycler.statics.ajaxController + '&startUid=' + Recycler.statics.startUid + '&cmd=getTables' + '&depth=' + Recycler.statics.depthSelection,
|
||
reader: new Ext.data.ArrayReader({}, [
|
||
{name: 'table', type: 'string'},
|
||
{name: 'records', type: 'int'},
|
||
{name: 'valueField', type: 'string'},
|
||
{name: 'tableTitle', type: 'string'}
|
||
]),
|
||
listeners: {
|
||
'load': {
|
||
fn: function(store, records) {
|
||
Ext.getCmp('tableSelector').setValue(Recycler.statics.tableSelection);
|
||
},
|
||
single: true
|
||
}
|
||
}
|
||
}),
|
||
valueNotFoundText: String.format(Recycler.lang.noValueFound, Recycler.statics.tableSelection),
|
||
tpl: '<tpl for="."><tpl if="records > 0"><div ext:qtip="{table} ({records})" class="x-combo-list-item">{tableTitle} ({records}) </div></tpl><tpl if="records < 1"><div ext:qtip="{table} ({records})" class="x-combo-list-item x-item-disabled">{tableTitle} ({records}) </div></tpl></tpl>',
|
||
listeners: {
|
||
'select': {
|
||
fn: function(cmp, rec, index) {
|
||
var store = gridDs;
|
||
var table = rec.get('valueField');
|
||
// do not reload if the table selected has no deleted records - hide all records
|
||
if (rec.get('records') <= 0) {
|
||
store.filter('uid', '-1'); // never true
|
||
return false;
|
||
}
|
||
gridDs.setBaseParam('table', table);
|
||
store.load({
|
||
params: {
|
||
start: 0
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
}
|
||
],
|
||
sm: sm,
|
||
plugins: expander,
|
||
loadMask: true,
|
||
stripeRows: true,
|
||
width: '100%',
|
||
height: 530,
|
||
collapsible: false,
|
||
animCollapse: false,
|
||
frame: false,
|
||
border: false,
|
||
listeners: {
|
||
'render': {
|
||
fn: function(cmp) {
|
||
cmp.getStore().load();
|
||
},
|
||
single: true
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}//,{
|
||
/****************************************************
|
||
* Lost and found Tab
|
||
****************************************************/
|
||
/*
|
||
id: 'lostAndFoundId',
|
||
title: Recycler.staticsRecycler.statics.lostFoundTab,
|
||
html:'Later'
|
||
} */
|
||
]
|
||
sm: sm,
|
||
plugins: expander,
|
||
loadMask: true,
|
||
stripeRows: true,
|
||
width: '100%',
|
||
height: 530,
|
||
collapsible: false,
|
||
animCollapse: false,
|
||
frame: false,
|
||
border: false,
|
||
listeners: {
|
||
resize: function(obj) {
|
||
//TODO: find a way to resize columns to fit in view
|
||
}
|
||
}
|
||
});
|
||
gridDs.load();
|
||
}
|
||
};
|
||