From f5a5002f14c573e9073a6ed8bda0f9306f00653e Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 14 Nov 2008 00:45:32 +0000 Subject: [PATCH] MINOR Tidied up AssetAdmin functions MINOR Removed commented out junk git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65897 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/AssetAdmin.php | 88 ++++++--------------------------------------- 1 file changed, 11 insertions(+), 77 deletions(-) diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php index bb389f6d..ceaebfdc 100755 --- a/code/AssetAdmin.php +++ b/code/AssetAdmin.php @@ -521,22 +521,16 @@ JS; * Otherwise, it will redirect back. */ public function returnItemToUser($p) { - if($_REQUEST['ajax']) { + if(!empty($_REQUEST['ajax'])) { $parentID = (int)$p->ParentID; return <<ID, "$p->Title", "$p->class"); - tree.getTreeNodeByIdx($parentID).appendTreeNode(newNode); - newNode.selectTreeNode(); JS; - } else { - Director::redirectBack(); - } } @@ -547,86 +541,26 @@ JS; $script = ''; $ids = split(' *, *', $_REQUEST['csvIDs']); $script = ''; + + if(!$ids) return false; + foreach($ids as $id) { - - if(is_numeric($id)) { - - $record = DataObject::get_by_id($this->stat('tree_class'), $id); - -if(!$record) - - Debug::message( "Record appears to be null" ); - - - - /*if($record->hasMethod('BackLinkTracking')) { - $brokenPages = $record->BackLinkTracking(); - - foreach($brokenPages as $brokenPage) { - - $brokenPageList .= "
  • " . $brokenPage->Breadcrumbs(3, true) . "
  • "; - - $brokenPage->HasBrokenLink = true; - - $notifications[$brokenPage->OwnerID][] = $brokenPage; - - $brokenPage->write(); - - } - - }*/ - + $record = DataObject::get_by_id($this->stat('tree_class'), (int) $id); + if($record) { $record->delete(); $record->destroy(); - - - - // DataObject::delete_by_id($this->stat('tree_class'), $id); - $script .= $this->deleteTreeNodeJS($record); - } - } - - - -/*if($notifications) foreach($notifications as $memberID => $pages) { - - $email = new Page_BrokenLinkEmail(); - - $email->populateTemplate(new ArrayData(array( - - "Recipient" => DataObject::get_by_id("Member", $memberID), - - "BrokenPages" => new DataObjectSet($pages), - - ))); - - $email->debug(); - - $email->send(); - - }*/ - - - /* - $s = (sizeof($ids) > 1) ? "s" :""; - - $message = sizeof($ids) . " folder$s deleted."; - // - if(isset($brokenPageList)) $message .= " The following pages now have broken links:Their owners have been emailed and they will fix up those pages."; - */ $size = sizeof($ids); - if($size > 1) - $message = $size.' '._t('AssetAdmin.FOLDERSDELETED', 'folders deleted.'); - else - $message = $size.' '._t('AssetAdmin.FOLDERDELETED', 'folder deleted.'); + if($size > 1) $message = $size . ' ' . _t('AssetAdmin.FOLDERSDELETED', 'folders deleted.'); + else $message = $size . ' ' . _t('AssetAdmin.FOLDERDELETED', 'folder deleted.'); - if(isset($brokenPageList)) + if(isset($brokenPageList)) { $message .= ' '._t('AssetAdmin.NOWBROKEN', 'The following pages now have broken links:').''. - _t('AssetAdmin.NOWBROKEN2', 'Their owners have been emailed and they will fix up those pages.'); + _t('AssetAdmin.NOWBROKEN2', 'Their owners have been emailed and they will fix up those pages.'); + } $script .= "statusMessage('$message');"; echo $script;