Author: sevein Date: Mon Sep 28 12:33:56 2009 New Revision: 3566 Log: I forgot to add term moveAction in last commit r3565.
Added: trunk/apps/qubit/modules/term/actions/moveAction.class.php (contents, props changed) Added: trunk/apps/qubit/modules/term/actions/moveAction.class.php ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/apps/qubit/modules/term/actions/moveAction.class.php Mon Sep 28 12:33:56 2009 (r3566) @@ -0,0 +1,51 @@ +<?php + +/* + * This file is part of Qubit Toolkit. + * + * Qubit Toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Qubit Toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>. + */ + +class TermMoveAction extends sfAction +{ + public function execute($request) + { + $this->form = new sfForm; + + $this->term = QubitTerm::getById($request->id); + + // Check that object exists and that it is not the root + if (!isset($this->term) || !isset($this->term->parent)) + { + $this->forward404(); + } + + $this->form->setValidator('parent', new sfValidatorString); + + if ($request->isMethod('post')) + { + $this->form->bind($request->getPostParameters()); + + if ($this->form->isValid()) + { + $params = $this->context->routing->parse(preg_replace('/.*'.preg_quote($this->request->getPathInfoPrefix(), '/').'/', null, $this->form->getValue('parent'))); + $this->term->parentId = $params['id']; + + $this->term->save(); + + return $this->renderText(''); + } + } + } +} --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Qubit Toolkit Commits" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.ca/group/qubit-commits?hl=en -~----------~----~----~----~------~----~------~--~---
