Skip to content

Commit

Permalink
Related to [#2638], prevent a JS error if the previous node doesn't e…
Browse files Browse the repository at this point in the history
…xist (e.g. on element create)
  • Loading branch information
garryn committed Jul 9, 2011
1 parent 1a92f53 commit 9a1ff1b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions manager/assets/modext/widgets/element/modx.panel.chunk.js
Expand Up @@ -158,8 +158,9 @@ Ext.extend(MODx.panel.Chunk,MODx.FormPanel,{
var n = c !== '' && c !== null && c != 0 ? 'n_chunk_category_'+c : 'n_type_chunk';
var t = Ext.getCmp('modx-element-tree');
if (t) {
t.getNodeById('n_chunk_element_' + Ext.getCmp('modx-chunk-id').getValue() + '_' + r.result.object.previous_category).destroy();
t.refreshNode(n,true);
var node = t.getNodeById('n_chunk_element_' + Ext.getCmp('modx-chunk-id').getValue() + '_' + r.result.object.previous_category);
if (node) node.destroy();
t.refreshNode(n,true);
}
}

Expand Down
3 changes: 2 additions & 1 deletion manager/assets/modext/widgets/element/modx.panel.plugin.js
Expand Up @@ -184,7 +184,8 @@ Ext.extend(MODx.panel.Plugin,MODx.FormPanel,{
if (t) {
var c = Ext.getCmp('modx-plugin-category').getValue();
var u = c != '' && c != null && c != 0 ? 'n_plugin_category_'+c : 'n_type_plugin';
t.getNodeById('n_plugin_element_' + Ext.getCmp('modx-plugin-id').getValue() + '_' + o.result.object.previous_category).destroy();
var node = t.getNodeById('n_plugin_element_' + Ext.getCmp('modx-plugin-id').getValue() + '_' + o.result.object.previous_category);
if (node) node.destroy();
t.refreshNode(u,true);
}
}
Expand Down
3 changes: 2 additions & 1 deletion manager/assets/modext/widgets/element/modx.panel.snippet.js
Expand Up @@ -156,7 +156,8 @@ Ext.extend(MODx.panel.Snippet,MODx.FormPanel,{
if (t) {
var c = Ext.getCmp('modx-snippet-category').getValue();
var u = c != '' && c != null && c != 0 ? 'n_snippet_category_'+c : 'n_type_snippet';
t.getNodeById('n_snippet_element_' + Ext.getCmp('modx-snippet-id').getValue() + '_' + r.result.object.previous_category).destroy();
var node = t.getNodeById('n_snippet_element_' + Ext.getCmp('modx-snippet-id').getValue() + '_' + r.result.object.previous_category);
if (node) node.destroy();
t.refreshNode(u,true);
}
}
Expand Down
3 changes: 2 additions & 1 deletion manager/assets/modext/widgets/element/modx.panel.template.js
Expand Up @@ -182,7 +182,8 @@ Ext.extend(MODx.panel.Template,MODx.FormPanel,{
if (t) {
var c = Ext.getCmp('modx-template-category').getValue();
var u = c != '' && c != null && c != 0 ? 'n_template_category_'+c : 'n_type_template';
t.getNodeById('n_template_element_' + Ext.getCmp('modx-template-id').getValue() + '_' + r.result.object.previous_category).destroy();
var node = t.getNodeById('n_template_element_' + Ext.getCmp('modx-template-id').getValue() + '_' + r.result.object.previous_category);
if (node) node.destroy();
t.refreshNode(u,true);
}
}
Expand Down
3 changes: 2 additions & 1 deletion manager/assets/modext/widgets/element/modx.panel.tv.js
Expand Up @@ -228,7 +228,8 @@ Ext.extend(MODx.panel.TV,MODx.FormPanel,{
if (t) {
var c = Ext.getCmp('modx-tv-category').getValue();
var u = c != '' && c != null && c != 0 ? 'n_tv_category_'+c : 'n_type_tv';
t.getNodeById('n_tv_element_' + Ext.getCmp('modx-tv-id').getValue() + '_' + r.result.object.previous_category).destroy();
var node = t.getNodeById('n_tv_element_' + Ext.getCmp('modx-tv-id').getValue() + '_' + r.result.object.previous_category);
if (node) node.destroy();
t.refreshNode(u,true);
}
}
Expand Down

0 comments on commit 9a1ff1b

Please sign in to comment.