New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress between Stage5 to Stage6 #5

Closed
wants to merge 1 commit into
base: stage5
from
Jump to file or symbol
Failed to load files and symbols.
+37 −8
Diff settings

Always

Just for now

@@ -77,17 +77,20 @@ Ext.extend(MODx.tree.Menu, MODx.tree.Tree, {
this.windows.update_category.show(e.target);
}
,removeMenu: function(n,e) {
,removeCategory: function(n, e) {
MODx.msg.confirm({
title: _('warning')
,text: _('menu_confirm_remove')
,url: this.config.url
,text: _('testing.category_remove_text')
,url: Testing.config.connectorUrl
,params: {
action: 'system/menu/remove'
,text: this.cm.activeNode.attributes.pk
action: 'mgr/remove'
,id: this.cm.activeNode.attributes.pk
}
,listeners: {
'success':{fn:this.refresh,scope:this}
'success':{
fn: this.refresh
,scope: this
}
}
});
}
@@ -102,8 +105,8 @@ Ext.extend(MODx.tree.Menu, MODx.tree.Tree, {
});
m.push('-');
m.push({
text: _('menu_remove')
,handler: this.removeMenu
text: _('testing.category_remove')
,handler: this.removeCategory
});
break;
default:
@@ -4,6 +4,8 @@
$_lang['testing.desc'] = 'Description';
$_lang['testing.category_create'] = 'Create new category';
$_lang['testing.category_update'] = 'Edit category';
$_lang['testing.category_remove'] = 'Remove category';
$_lang['testing.category_remove_text'] = 'Are you sure you want to remove this category? This can not be undone.';
$_lang['testing.parent'] = 'Parent category';
$_lang['testing.name'] = 'Category name';
$_lang['testing.no_parents'] = 'No parents';
@@ -0,0 +1,24 @@
<?php
class TestingCategoryRemoveProcessor extends modProcessor {
public $classKey = 'TestingCategory';
public $languageTopics = array('testing:default');
public $objectType = 'testing.category';
public function process() {
$category = $this->modx->getObject('TestingCategory', $this->getProperty('id'));
if (!$category) {
return $this->failure();
}
if ($category->get('parent') == null) {
$this->modx->removeCollection('TestingCategory', [
'parent' => $category->get('id')
]);
}
$category->remove();
return $this->success();
}
}
return 'TestingCategoryRemoveProcessor';
ProTip! Use n and p to navigate between commits in a pull request.