Permalink
Browse files

cleanup

  • Loading branch information...
1 parent 3d56ac6 commit 238ba757c9897dc6abf580f49b353bdead530b5e @krispypen krispypen committed Oct 2, 2012
@@ -2,15 +2,13 @@
namespace Kunstmaan\MediaBundle\Controller;
-use Kunstmaan\MediaBundle\Helper\File\FileHelper;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Kunstmaan\MediaBundle\Entity\Image;
use Kunstmaan\MediaBundle\Entity\Folder;
-use Kunstmaan\MediaBundle\Helper\MediaHelper;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\RedirectResponse;
+use Kunstmaan\MediaBundle\Entity\Media;
+use Kunstmaan\MediaBundle\Helper\MediaManager;
/**
* controllerclass which Aviary can use to upload the edited image and add it to the database
@@ -3,7 +3,6 @@
namespace Kunstmaan\MediaBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Kunstmaan\MediaBundle\Form\FolderType;
use Kunstmaan\MediaBundle\Entity\Folder;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
@@ -2,20 +2,11 @@
namespace Kunstmaan\MediaBundle\Controller;
-use Kunstmaan\MediaBundle\AdminList\MediaListConfigurator;
-
use Symfony\Component\HttpFoundation\Response;
-use Kunstmaan\AdminListBundle\AdminList\AdminList;
-use Kunstmaan\MediaBundle\Helper\FolderFactory;
-use Kunstmaan\MediaBundle\Entity\Video;
-use Kunstmaan\MediaBundle\Entity\Slide;
-use Kunstmaan\MediaBundle\Entity\Image;
-use Kunstmaan\MediaBundle\Entity\File;
use Kunstmaan\MediaBundle\Entity\Folder;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Kunstmaan\MediaBundle\Form\FolderType;
-use Kunstmaan\MediaBundle\Form\SubFolderType;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
@@ -115,52 +106,4 @@ public function subCreateAction($folderId)
));
}
- /**
- * @Route("/movenodes", name="KunstmaanMediaBundle_folder_movenodes")
- * @Method({"GET", "POST"})
- *
- * @return array
- */
- public function moveNodesAction()
- {
- $request = $this->getRequest();
- $em = $this->getDoctrine()->getManager();
-
- /* @var string $parentid */
- $parentid = $request->get('parentid');
- /* @var Folder $parent */
- $parent = $em->getRepository('KunstmaanMediaBundle:Folder')->getFolder($parentid);
-
- /* @var int $fromposition */
- $fromposition = $request->get('fromposition');
- /* @var int $afterposition */
- $afterposition = $request->get('afterposition');
-
- foreach ($parent->getChildren() as $child) {
- if ($child->getSequencenumber() == $fromposition) {
- if ($child->getSequencenumber() > $afterposition) {
- $child->setSequencenumber($afterposition + 1);
- $em->persist($child);
- } else {
- $child->setSequencenumber($afterposition);
- $em->persist($child);
- }
- } else {
- if ($child->getSequencenumber() > $fromposition && $child->getSequencenumber() <= $afterposition) {
- $newpos = $child->getSequencenumber()-1;
- $child->setSequencenumber($newpos);
- $em->persist($child);
- } else {
- if ($child->getSequencenumber() < $fromposition && $child->getSequencenumber() > $afterposition) {
- $newpos = $child->getSequencenumber()+1;
- $child->setSequencenumber($newpos);
- $em->persist($child);
- }
- }
- }
- $em->flush();
- }
-
- return array("success" => true);
- }
}
@@ -4,25 +4,10 @@
use Symfony\Component\HttpFoundation\Response;
-use Kunstmaan\MediaBundle\Entity\AbstractMediaMetadata;
-use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
-
-use Kunstmaan\AdminBundle\Helper\ClassLookup;
-use Kunstmaan\MediaBundle\Event\MediaEvent;
-use Kunstmaan\MediaBundle\Event\Events;
use Kunstmaan\MediaBundle\Form\BulkUploadType;
-use Doctrine\ORM\EntityRepository;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Kunstmaan\MediaBundle\Entity\Media;
-use Kunstmaan\MediaBundle\Form\VideoType;
-use Kunstmaan\MediaBundle\Entity\Video;
-use Kunstmaan\MediaBundle\Form\SlideType;
-use Kunstmaan\MediaBundle\Entity\Slide;
-use Kunstmaan\MediaBundle\Entity\Image;
-use Kunstmaan\MediaBundle\Entity\File;
-use Kunstmaan\MediaBundle\Form\MediaType;
-use Kunstmaan\MediaBundle\Helper\MediaHelper;
use Kunstmaan\MediaBundle\Helper\BulkUploadHelper;
use Kunstmaan\MediaBundle\Entity\Folder;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
@@ -164,11 +149,8 @@ public function dropAction($folderId)
/* @var Folder $folder */
$folder = $em->getRepository('KunstmaanMediaBundle:Folder')->getFolder($folderId);
- $request = $this->getRequest();
-
$drop = null;
if (array_key_exists('files', $_FILES) && $_FILES['files']['error'] == 0 ) {
- $pic = $_FILES['files'];
$drop = $this->getRequest()->files->get('files');
} else {
$drop = $this->getRequest()->get('text');
@@ -2,14 +2,6 @@
namespace Kunstmaan\MediaBundle\DataFixtures\ORM;
-use Kunstmaan\MediaBundle\Helper\RemoteVideo\RemoteVideoHelper;
-
-use Kunstmaan\MediaBundle\Entity\Media;
-
-use Kunstmaan\MediaBundle\Entity\FileGallery;
-use Kunstmaan\MediaBundle\Entity\SlideGallery;
-use Kunstmaan\MediaBundle\Entity\VideoGallery;
-use Kunstmaan\MediaBundle\Entity\ImageGallery;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Kunstmaan\MediaBundle\Entity\Folder;
@@ -3,7 +3,6 @@
namespace Kunstmaan\MediaBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
-use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
@@ -3,9 +3,7 @@
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader;
-use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
View
@@ -3,14 +3,9 @@
namespace Kunstmaan\MediaBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
-
-use Doctrine\ORM\EntityManager;
use Kunstmaan\AdminBundle\Entity\AbstractEntity;
-use Kunstmaan\MediaBundle\Form\FolderType;
-use Kunstmaan\MediaBundle\Helper\FolderStrategy;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
-use Gedmo\Translatable\Translatable;
/**
* Class that defines a folder from the MediaBundle in the database
View
@@ -5,7 +5,6 @@
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
use Kunstmaan\AdminBundle\Entity\AbstractEntity;
-use Assetic\Asset\FileAsset;
/**
* Media
View
@@ -9,7 +9,6 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\AbstractType;
-use Kunstmaan\MediaBundle\Entity\File;
/**
* FolderType
View
@@ -3,16 +3,12 @@
namespace Kunstmaan\MediaBundle\Form\Type;
use Symfony\Component\Form\FormView;
-
use Symfony\Component\Form\FormInterface;
-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
-
use Symfony\Component\Form\FormBuilderInterface;
-
use Symfony\Component\Form\AbstractType;
-
use Doctrine\Common\Persistence\ObjectManager;
+use Kunstmaan\MediaBundle\Helper\MediaManager;
/**
* MediaType
@@ -96,8 +92,8 @@ public function getName()
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
- $view->set('chooser', $form->getAttribute('chooser'));
- $view->set('mediatype', $form->getAttribute('mediatype'));
- $view->set('mediamanager', $this->mediaManager);
+ $view->vars['chooser'] = $form->getAttribute('chooser');
+ $view->vars['mediatype'] = $form->getAttribute('mediatype');
+ $view->vars['mediamanager'] = $this->mediaManager;
}
}
@@ -2,10 +2,7 @@
namespace Kunstmaan\MediaBundle\Helper;
-use Kunstmaan\MediaBundle\Entity\Media;
-
use Symfony\Component\HttpFoundation\File\UploadedFile;
-use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
/**
* BulkUploadHelper
@@ -3,30 +3,14 @@
namespace Kunstmaan\MediaBundle\Helper\File;
use Kunstmaan\MediaBundle\Helper\Media\AbstractMediaHandler;
-
use Kunstmaan\MediaBundle\Form\File\FileType;
-
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
-
use Gaufrette\Filesystem;
-
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
-
use Gaufrette\Adapter\Local;
-
use Symfony\Component\HttpFoundation\File\File;
-
use Kunstmaan\MediaBundle\Entity\Media;
-
-use Kunstmaan\MediaBundle\Helper\StrategyInterface;
-
-use Kunstmaan\MediaBundle\Entity\Folder;
-
-use Doctrine\ORM\EntityManager;
-use Kunstmaan\MediaBundle\Entity\VideoGallery;
-use Kunstmaan\MediaBundle\Form\VideoType;
-use Kunstmaan\MediaBundle\AdminList\VideoListConfigurator;
-use Kunstmaan\MediaBundle\Entity\Video;
+use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
/**
* FileHandler
@@ -75,7 +59,7 @@ public function getType()
}
/**
- * @return \Kunstmaan\MediaBundle\Form\VideoType
+ * @return FileType
*/
public function getFormType()
{
@@ -99,7 +83,7 @@ public function canHandle(Media $media)
/**
* @param Media $media
*
- * @return Video
+ * @return FileHelper
*/
public function getFormHelper(Media $media)
{
@@ -171,18 +155,6 @@ public function getOriginalFile(Media $media)
*/
public function removeMedia(Media $media)
{
- foreach ($this->formats as $format => $options) {
- $path = $this->generateRelativePath($media, $format);
- if ($this->getFilesystem()->has($path)) {
- $this->getFilesystem()->delete($path);
- }
- }
-
- // Original
- $path = $this->getOriginalFilePath($media);
- if ($this->getFilesystem()->has($path)) {
- $this->getFilesystem()->delete($path);
- }
}
/**
@@ -220,7 +192,7 @@ public function getShowTemplate(Media $media)
}
/**
- * @return multitype:string
+ * @return array
*/
public function getAddFolderActions()
{
@@ -2,55 +2,26 @@
namespace Kunstmaan\MediaBundle\Helper\Image;
-use Kunstmaan\MediaBundle\Helper\Manipulator\ImageManipulatorInterface;
-
use Kunstmaan\MediaBundle\Helper\File\FileHandler;
-
-use Kunstmaan\MediaBundle\Form\File\FileType;
-
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
-
-use Gaufrette\Filesystem;
-
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
-
-use Gaufrette\Adapter\Local;
-
-use Symfony\Component\HttpFoundation\File\File;
-
use Kunstmaan\MediaBundle\Entity\Media;
-use Kunstmaan\MediaBundle\Helper\StrategyInterface;
-
-use Kunstmaan\MediaBundle\Entity\Folder;
-
-use Doctrine\ORM\EntityManager;
-use Kunstmaan\MediaBundle\Entity\VideoGallery;
-use Kunstmaan\MediaBundle\Form\VideoType;
-use Kunstmaan\MediaBundle\AdminList\VideoListConfigurator;
-use Kunstmaan\MediaBundle\Entity\Video;
-
/**
* FileHandler
*/
class ImageHandler extends FileHandler
{
- /**
- * @var ImageManipulatorInterface
- */
- protected $imageManipulator;
-
protected $aviaryApiKey;
/**
* @param ImageManipulatorInterface $imageManipulator The image manipulator
* @param string $aviaryApiKey The aviary key
*/
- public function __construct(ImageManipulatorInterface $imageManipulator, $aviaryApiKey)
+ public function __construct($aviaryApiKey)
{
parent::__construct();
- $this->imageManipulator = $imageManipulator;
$this->aviaryApiKey = $aviaryApiKey;
}
Oops, something went wrong.

0 comments on commit 238ba75

Please sign in to comment.