| @@ 1334-1367 (lines=34) @@ | ||
| 1331 | return parent::__actionIndex(ResourceManager::RESOURCE_TYPE_DS); |
|
| 1332 | } |
|
| 1333 | ||
| 1334 | public function __actionEdit() |
|
| 1335 | { |
|
| 1336 | if (array_key_exists('save', $_POST['action'])) { |
|
| 1337 | return $this->__formAction(); |
|
| 1338 | } elseif (array_key_exists('delete', $_POST['action'])) { |
|
| 1339 | /** |
|
| 1340 | * Prior to deleting the Datasource file. Target file path is provided. |
|
| 1341 | * |
|
| 1342 | * @delegate DatasourcePreDelete |
|
| 1343 | * @since Symphony 2.2 |
|
| 1344 | * @param string $context |
|
| 1345 | * '/blueprints/datasources/' |
|
| 1346 | * @param string $file |
|
| 1347 | * The path to the Datasource file |
|
| 1348 | */ |
|
| 1349 | Symphony::ExtensionManager()->notifyMembers('DatasourcePreDelete', '/blueprints/datasources/', |
|
| 1350 | array('file' => DATASOURCES . "/data." . $this->_context['handle'] . ".php")); |
|
| 1351 | ||
| 1352 | if (!General::deleteFile(DATASOURCES . '/data.' . $this->_context['handle'] . '.php')) { |
|
| 1353 | $this->pageAlert( |
|
| 1354 | __('Failed to delete %s.', array('<code>' . $this->_context['handle'] . '</code>')) |
|
| 1355 | . ' ' . __('Please check permissions on %s.', array('<code>/workspace/data-sources</code>')), |
|
| 1356 | Alert::ERROR |
|
| 1357 | ); |
|
| 1358 | } else { |
|
| 1359 | $pages = ResourceManager::getAttachedPages(ResourceManager::RESOURCE_TYPE_DS, |
|
| 1360 | $this->_context['handle']); |
|
| 1361 | ||
| 1362 | foreach ($pages as $page) { |
|
| 1363 | ResourceManager::detach(ResourceManager::RESOURCE_TYPE_DS, $this->_context['handle'], |
|
| 1364 | $page['id']); |
|
| 1365 | } |
|
| 1366 | ||
| 1367 | redirect(SYMPHONY_URL . '/blueprints/datasources/'); |
|
| 1368 | } |
|
| 1369 | } |
|
| 1370 | } |
|
| @@ 677-710 (lines=34) @@ | ||
| 674 | $shell); |
|
| 675 | } |
|
| 676 | ||
| 677 | public function __actionEdit() |
|
| 678 | { |
|
| 679 | if (array_key_exists('save', $_POST['action'])) { |
|
| 680 | return $this->__formAction(); |
|
| 681 | } elseif (array_key_exists('delete', $_POST['action'])) { |
|
| 682 | /** |
|
| 683 | * Prior to deleting the Event file. Target file path is provided. |
|
| 684 | * |
|
| 685 | * @delegate EventPreDelete |
|
| 686 | * @since Symphony 2.2 |
|
| 687 | * @param string $context |
|
| 688 | * '/blueprints/events/' |
|
| 689 | * @param string $file |
|
| 690 | * The path to the Event file |
|
| 691 | */ |
|
| 692 | Symphony::ExtensionManager()->notifyMembers('EventPreDelete', '/blueprints/events/', |
|
| 693 | array('file' => EVENTS . "/event." . $this->_context['handle'] . ".php")); |
|
| 694 | ||
| 695 | if (!General::deleteFile(EVENTS . '/event.' . $this->_context['handle'] . '.php')) { |
|
| 696 | $this->pageAlert( |
|
| 697 | __('Failed to delete %s.', array('<code>' . $this->_context['handle'] . '</code>')) |
|
| 698 | . ' ' . __('Please check permissions on %s.', array('<code>/workspace/events</code>')), |
|
| 699 | Alert::ERROR |
|
| 700 | ); |
|
| 701 | } else { |
|
| 702 | $pages = ResourceManager::getAttachedPages(ResourceManager::RESOURCE_TYPE_EVENT, |
|
| 703 | $this->_context['handle']); |
|
| 704 | ||
| 705 | foreach ($pages as $page) { |
|
| 706 | ResourceManager::detach(ResourceManager::RESOURCE_TYPE_EVENT, $this->_context['handle'], |
|
| 707 | $page['id']); |
|
| 708 | } |
|
| 709 | ||
| 710 | redirect(SYMPHONY_URL . '/blueprints/events/'); |
|
| 711 | } |
|
| 712 | } |
|
| 713 | } |
|