diff --git a/app/DoctrineMigrations/Version20120826132126.php b/app/DoctrineMigrations/Version20120826132126.php new file mode 100644 index 0000000..5cd3a09 --- /dev/null +++ b/app/DoctrineMigrations/Version20120826132126.php @@ -0,0 +1,39 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); + + $this->addSql("CREATE TABLE upload_namespaces (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, slug VARCHAR(50) NOT NULL, UNIQUE INDEX UNIQ_32D9781A5E237E06 (name), UNIQUE INDEX UNIQ_32D9781A989D9B62 (slug), PRIMARY KEY(id)) ENGINE = InnoDB"); + $this->addSql("CREATE TABLE uploaded_files (id INT AUTO_INCREMENT NOT NULL, upload_namespace_id INT NOT NULL, filename VARCHAR(100) NOT NULL, mimeType VARCHAR(50) NOT NULL, description LONGTEXT DEFAULT NULL, INDEX IDX_E60EFB5609DE9D8 (upload_namespace_id), UNIQUE INDEX UNIQ_E60EFB5609DE9D83C0BE965 (upload_namespace_id, filename), PRIMARY KEY(id)) ENGINE = InnoDB"); + $this->addSql("ALTER TABLE uploaded_files ADD CONSTRAINT FK_E60EFB5609DE9D8 FOREIGN KEY (upload_namespace_id) REFERENCES upload_namespaces (id)"); + $this->addSql("ALTER TABLE user_data ADD avatar_image_id INT DEFAULT NULL"); + $this->addSql("ALTER TABLE user_data ADD CONSTRAINT FK_D772BFAA5C18B4B1 FOREIGN KEY (avatar_image_id) REFERENCES uploaded_files (id)"); + $this->addSql("CREATE INDEX IDX_D772BFAA5C18B4B1 ON user_data (avatar_image_id)"); + } + + public function down(Schema $schema) + { + // this down() migration is autogenerated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); + + $this->addSql("ALTER TABLE uploaded_files DROP FOREIGN KEY FK_E60EFB5609DE9D8"); + $this->addSql("ALTER TABLE user_data DROP FOREIGN KEY FK_D772BFAA5C18B4B1"); + $this->addSql("DROP TABLE upload_namespaces"); + $this->addSql("DROP TABLE uploaded_files"); + $this->addSql("ALTER TABLE user_data DROP FOREIGN KEY FK_D772BFAA5C18B4B1"); + $this->addSql("DROP INDEX IDX_D772BFAA5C18B4B1 ON user_data"); + $this->addSql("ALTER TABLE user_data DROP avatar_image_id"); + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/BlogPost.php b/src/KekRozsak/FrontBundle/Entity/BlogPost.php index 52a7464..9559069 100644 --- a/src/KekRozsak/FrontBundle/Entity/BlogPost.php +++ b/src/KekRozsak/FrontBundle/Entity/BlogPost.php @@ -30,7 +30,7 @@ class BlogPost { return $this->id; } - + /** * True if the BlogPost is published. If not, only the author and the * administrators can see it. @@ -63,7 +63,7 @@ class BlogPost { return $this->published; } - + /** * The Group which this BlogPost is associated with * diff --git a/src/KekRozsak/FrontBundle/Entity/News.php b/src/KekRozsak/FrontBundle/Entity/News.php index 2b28601..bbf2366 100644 --- a/src/KekRozsak/FrontBundle/Entity/News.php +++ b/src/KekRozsak/FrontBundle/Entity/News.php @@ -224,7 +224,7 @@ class News $this->sticky = $sticky; return $this; } - + /** * Get sticky * diff --git a/src/KekRozsak/FrontBundle/Entity/UploadNamespace.php b/src/KekRozsak/FrontBundle/Entity/UploadNamespace.php new file mode 100644 index 0000000..ef90797 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/UploadNamespace.php @@ -0,0 +1,104 @@ +id; + } + + /** + * The name of the namespace. This will be used when displaying the + * namespace list. + * + * @var string $name + * + * @ORM\Column(type="string", length=50, unique=true, nullable=false) + * + * @Assert\NotBlank() + */ + protected $name; + + /** + * Set name + * + * @param string $name + * @return UploadNamespace + */ + public function setName($name) + { + // TODO: Check if not null! + $this->name = $name; + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The slugified name of the namespace. This will be used in URLs + * + * @var string $slug + * + * @ORM\Column(type="string", length=50, unique=true, nullable=false) + */ + protected $slug; + + /** + * Set slug + * + * @param string $slug + * @return UploadNamespace + */ + public function setSlug($slug) + { + // TODO: Check if not null! + $this->slug = $slug; + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/UploadedFile.php b/src/KekRozsak/FrontBundle/Entity/UploadedFile.php new file mode 100644 index 0000000..691a197 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/UploadedFile.php @@ -0,0 +1,181 @@ +id; + } + + /** + * Namespace of the file + * + * @var UploadNamespace $namespace + * + * @ORM\ManyToOne(targetEntity="KekRozsak\FrontBundle\Entity\UploadNamespace") + * @ORM\JoinColumn(name="upload_namespace_id", nullable=false) + */ + protected $namespace; + + /** + * Set namespace + * + * @param KekRozsak\FrontBundle\Entity\UploadNamespace $namespace + * @return UploadedFile + */ + public function setNamespace(UploadNamespace $namespace) + { + // TODO: Check if not null! + $this->namespace = $namespace; + return $this; + } + + /** + * Get namespace + * + * @return KekRozsak\FrontBundle\Entity\UploadNamespace + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * The file name, as seen in the filesystem + * + * @var string $filename + * + * @ORM\Column(type="string", length=100, nullable=false) + */ + protected $filename; + + /** + * Set filename + * + * @param string $filename + * @return UploadedFile + */ + public function setFilename($filename) + { + // TODO: Check if not null nor empty! + $this->filename = $filename; + return $this; + } + + /** + * Get filename + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Get filename with namespace + * + * @return string + */ + public function getNsFilename() + { + return $this->namespace->getSlug() . DIRECTORY_SEPARATOR . $this->filename; + } + + /** + * MIME type of the file + * + * @var string $mimetype + * + * @ORM\Column(type="string", length=50, nullable=false) + */ + protected $mimeType; + + /** + * Set mimeType + * + * @param string $mimeType + * @return UploadedFile + */ + public function setMimeType($mimeType) + { + // TODO: Check if not null nor empty! + $this->mimeType = $mimeType; + return $this; + } + + /** + * Get mimeType + * + * @return string + */ + public function getMimeType() + { + return $this->mimeType; + } + + /** + * Description of the file + * + * @var string $description + * + * @ORM\Column(type="text", nullable=true) + */ + protected $description; + + /** + * Set description + * + * @param string $description + * @return UploadedFile + */ + public function setDescription($description) + { + if ($description === '') { + $description = null; + } + + $this->description = $description; + return $this; + } + + /** + * Get description + * + * @return string + */ + public function getDescription() + { + return $this->description; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/UserData.php b/src/KekRozsak/FrontBundle/Entity/UserData.php index 93a0be2..728d4b7 100644 --- a/src/KekRozsak/FrontBundle/Entity/UserData.php +++ b/src/KekRozsak/FrontBundle/Entity/UserData.php @@ -516,4 +516,36 @@ class UserData { return $this->favouriteTopics->contains($topic); } + + /** + * The avatar image of the user + * + * @var UploadedFile $avatarImage + * + * @ORM\ManyToOne(targetEntity="KekRozsak\FrontBundle\Entity\UploadedFile") + * @ORM\JoinColumn(name="avatar_image_id", nullable=true) + */ + protected $avatarImage; + + /** + * Set avaratImage + * + * @param KekRozsak\FrontBundle\Entity\UploadedFile $avatarImage + * @return UserData + */ + public function setAvatarImage(UploadedFile $avatarImage) + { + $this->avatarImage = $avatarImage; + return $this; + } + + /** + * Get avatarImage + * + * @return KekRozsak\FrontBundle\Entity\UploadedFile + */ + public function getAvatarImage() + { + return $this->avatarImage; + } } diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/book.css b/src/KekRozsak/FrontBundle/Resources/public/css/book.css index 8fbd2bf..ee7ad7d 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/book.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/book.css @@ -1,4 +1,4 @@ -/* +/* Document : book.css Created on : 2012.08.17., 18:23:37 Author : Gergely Polonkai @@ -31,4 +31,4 @@ #book-list tbody tr.even td { background-color: #c6ecfe; -} \ No newline at end of file +} diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/eventbox.css b/src/KekRozsak/FrontBundle/Resources/public/css/eventbox.css index 9872fca..122f636 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/eventbox.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/eventbox.css @@ -1,4 +1,4 @@ -/* +/* Document : eventbox Created on : 2012.08.15., 11:34:17 Author : Gergely Polonkai diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/forum.css b/src/KekRozsak/FrontBundle/Resources/public/css/forum.css index fcbab28..f5f2ede 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/forum.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/forum.css @@ -1,4 +1,4 @@ -/* +/* Document : forum.css Created on : 2012.08.15., 11:40:39 Author : Gergely diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/library.css b/src/KekRozsak/FrontBundle/Resources/public/css/library.css index 564b3d4..13f28cb 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/library.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/library.css @@ -1,4 +1,4 @@ -/* +/* Document : books.css Created on : 2012.08.15., 11:41:37 Author : Gergely Polonkai diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/loginbox.css b/src/KekRozsak/FrontBundle/Resources/public/css/loginbox.css index 82d68ec..9ae433e 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/loginbox.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/loginbox.css @@ -1,4 +1,4 @@ -/* +/* Document : loginbox Created on : 2012.08.15., 11:32:19 Author : Gergely Polonkai diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/main.css b/src/KekRozsak/FrontBundle/Resources/public/css/main.css index 31152d0..ee7ccad 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/main.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/main.css @@ -1,4 +1,4 @@ -/* +/* Document : main Created on : 2012.08.15., 10:58:08 Author : Gergely Polonkai @@ -96,4 +96,4 @@ h3 a { #help-button { display: block; float: right; -} \ No newline at end of file +} diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/menu.css b/src/KekRozsak/FrontBundle/Resources/public/css/menu.css index 6a51dd2..e6604fb 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/menu.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/menu.css @@ -1,4 +1,4 @@ -/* +/* Document : menu.css Created on : 2012.08.15., 11:10:44 Author : Gergely Polonkai diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/news.css b/src/KekRozsak/FrontBundle/Resources/public/css/news.css index b15eab9..f30ec6e 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/news.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/news.css @@ -1,4 +1,4 @@ -/* +/* Document : news Created on : 2012.08.16., 16:26:16 Author : Gergely Polonkai diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/popup.css b/src/KekRozsak/FrontBundle/Resources/public/css/popup.css index f58cc3b..08ba3eb 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/popup.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/popup.css @@ -1,4 +1,4 @@ -/* +/* Document : popup Created on : 2012.08.15., 11:29:58 Author : Gergely Polonkai diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/profilebox.css b/src/KekRozsak/FrontBundle/Resources/public/css/profilebox.css index 2359ae8..a8c6e76 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/profilebox.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/profilebox.css @@ -1,4 +1,4 @@ -/* +/* Document : profilebox Created on : 2012.08.15., 11:31:41 Author : Gergely Polonkai diff --git a/src/KekRozsak/FrontBundle/Resources/public/css/statuslines.css b/src/KekRozsak/FrontBundle/Resources/public/css/statuslines.css index 7343d19..4726f37 100644 --- a/src/KekRozsak/FrontBundle/Resources/public/css/statuslines.css +++ b/src/KekRozsak/FrontBundle/Resources/public/css/statuslines.css @@ -1,4 +1,4 @@ -/* +/* Document : statuslines Created on : 2012.08.16., 16:28:11 Author : Gergely Polonkai diff --git a/src/KekRozsak/FrontBundle/Twig/HelpUrlExtension.php b/src/KekRozsak/FrontBundle/Twig/HelpUrlExtension.php index 7081c81..26c8de7 100644 --- a/src/KekRozsak/FrontBundle/Twig/HelpUrlExtension.php +++ b/src/KekRozsak/FrontBundle/Twig/HelpUrlExtension.php @@ -11,7 +11,7 @@ use Symfony\Component\Routing\Exception\RouteNotFoundException; * Description of HelpUrlExtension * * @author Gergely Polonkai - * + * * @DI\Service * @DI\Tag("twig.extension") */ @@ -33,7 +33,7 @@ class HelpUrlExtension extends \Twig_Extension public function getGlobals() { parent::getGlobals(); - + $request = $this->container->get('request'); $router = $this->container->get('router'); @@ -61,7 +61,7 @@ class HelpUrlExtension extends \Twig_Extension 'helpUrl' => $helpUrl, ); } - + public function getName() { return 'HelpUrl';