Skip to content

Commit

Permalink
Display a message for each deleted file, not just the last one.
Browse files Browse the repository at this point in the history
  • Loading branch information
okonomiyaki3000 committed Jan 22, 2016
1 parent 27f3371 commit ab719f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions administrator/components/com_media/controllers/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ public function delete()
return false;
}

// Need this to enqueue messages.
$app = JFactory::getApplication();

// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');

Expand Down Expand Up @@ -268,7 +271,7 @@ public function delete()

// Trigger the onContentAfterDelete event.
$dispatcher->trigger('onContentAfterDelete', array('com_media.file', &$object_file));
$this->setMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
$app->enqueueMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));

continue;
}
Expand Down Expand Up @@ -302,10 +305,12 @@ public function delete()

// Trigger the onContentAfterDelete event.
$dispatcher->trigger('onContentAfterDelete', array('com_media.folder', &$object_file));
$this->setMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
$app->enqueueMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
}

print_r($app); die();

return $ret;
}
}
7 changes: 5 additions & 2 deletions administrator/components/com_media/controllers/folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public function delete()
return false;
}

// Need this to enqueue messages.
$app = JFactory::getApplication();

// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');

Expand Down Expand Up @@ -102,7 +105,7 @@ public function delete()

// Trigger the onContentAfterDelete event.
$dispatcher->trigger('onContentAfterDelete', array('com_media.file', &$object_file));
$this->setMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
$app->enqueueMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
elseif (is_dir($object_file->filepath))
{
Expand All @@ -125,7 +128,7 @@ public function delete()

// Trigger the onContentAfterDelete event.
$dispatcher->trigger('onContentAfterDelete', array('com_media.folder', &$object_file));
$this->setMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
$app->enqueueMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
else
{
Expand Down

0 comments on commit ab719f4

Please sign in to comment.