Initial Commit

This commit is contained in:
2019-11-21 12:25:31 +01:00
commit f4aabcb9b1
13959 changed files with 787761 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<loop name="comment" class="Comment\Loop\CommentLoop" />
</loops>
<forms>
<form name="comment.add.form" class="Comment\Form\AddCommentForm" />
<form name="comment.abuse.form" class="Comment\Form\CommentAbuseForm" />
<form name="comment.configuration.form" class="Comment\Form\ConfigurationForm" />
<form name="admin.comment.modification.form" class="Comment\Form\CommentModificationForm" />
</forms>
<commands>
<!--
<command class="MyModule\Command\MySuperCommand" />
-->
</commands>
<services>
<service id="comment.action" class="Comment\Action\CommentAction" scope="request">
<argument type="service" id="thelia.translator" />
<argument type="service" id="thelia.parser" />
<argument type="service" id="mailer"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="comment.form.type.field.comment_id" class="Comment\Form\Field\CommentIdType">
<argument type="service" id="thelia.translator" />
<tag name="thelia.form.type" />
</service>
</services>
<!--
<exports>
</exports>
-->
<!--
<imports>
</imports>
-->
<hooks>
<!-- front -->
<hook id="comment.hook.front" class="Comment\Hook\FrontHook" scope="request">
<tag name="hook.event_listener" event="product.additional" method="onShowBlockComment" />
<tag name="hook.event_listener" event="content.main-bottom" method="onShowComment" />
<tag name="hook.event_listener" event="main.javascript-initialization" method="jsComment" />
</hook>
<!-- back -->
<hook id="comment.hook.back" class="Comment\Hook\BackHook" scope="request">
<tag name="hook.event_listener" event="module.configuration" type="back" />
<tag name="hook.event_listener" event="main.top-menu-tools" type="back" />
<tag name="hook.event_listener" event="main.footer-js" type="back" method="onMainFooterJs" />
<tag name="hook.event_listener" event="product.tab-content" type="back" method="onProductTabContent" />
<tag name="hook.event_listener" event="product.edit-js" type="back" method="onJsTabContent" />
<tag name="hook.event_listener" event="content.tab-content" type="back" method="onContentTabContent" />
<tag name="hook.event_listener" event="content.edit-js" type="back" method="onJsTabContent" />
</hook>
</hooks>
</config>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
<fullnamespace>Comment\Comment</fullnamespace>
<descriptive locale="en_US">
<title>Comment system</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Système de commentaire</title>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>0.1</version>
<author>
<name>Julien Chanséaume</name>
<email>jchanseaume@openstudio.fr</email>
</author>
<type>classic</type>
<thelia>2.1.0</thelia>
<stability>alpha</stability>
</module>

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<!-- Front -->
<route id="front.comment.get" path="/comment/get">
<default key="_controller">Comment\Controller\Front\CommentController::getAction</default>
</route>
<route id="front.comment.add" path="/comment/add" methods="post">
<default key="_controller">Comment\Controller\Front\CommentController::createAction</default>
</route>
<route id="front.comment.delete" path="/comment/delete/{commentId}">
<default key="_controller">Comment\Controller\Front\CommentController::deleteAction</default>
<requirement key="commentId">\d+</requirement>
</route>
<route id="front.comment.abuse" path="/comment/abuse" methods="post">
<default key="_controller">Comment\Controller\Front\CommentController::abuseAction</default>
</route>
<!-- Admin -->
<route id="admin.comment.configuration" path="/admin/module/comment/configuration" methods="post">
<default key="_controller">Comment\Controller\Back\CommentController::saveConfiguration</default>
</route>
<!-- crud -->
<route id="admin.comment.comments.default" path="/admin/module/comments">
<default key="_controller">Comment\Controller\Back\CommentController::defaultAction</default>
</route>
<route id="admin.comment.comments.create" path="/admin/module/comment/create">
<default key="_controller">Comment\Controller\Back\CommentController::createAction</default>
</route>
<route id="admin.comment.comments.update" path="/admin/module/comment/update/{comment_id}">
<default key="_controller">Comment\Controller\Back\CommentController::updateAction</default>
<requirement key="comment_id">\d+</requirement>
</route>
<route id="admin.comment.comments.save" path="/admin/module/comment/save/{comment_id}" methods="post">
<default key="_controller">Comment\Controller\Back\CommentController::processUpdateAction</default>
<requirement key="comment_id">\d+</requirement>
</route>
<route id="admin.comment.comments.delete" path="/admin/module/comment/delete" methods="post">
<default key="_controller">Comment\Controller\Back\CommentController::deleteAction</default>
</route>
<route id="admin.comment.comments.status" path="/admin/module/comment/status" methods="post">
<default key="_controller">Comment\Controller\Back\CommentController::changeStatusAction</default>
</route>
<route id="admin.comment.comments.activation" path="/admin/module/comment/activation/{ref}/{refId}" methods="post">
<default key="_controller">Comment\Controller\Back\CommentController::activationAction</default>
<requirement key="ref">.*</requirement>
<requirement key="refId">\d+</requirement>
</route>
<route id="admin.comment.comments.request-customer-comment" path="/admin/module/comment/request-customer">
<default key="_controller">Comment\Controller\Back\CommentController::requestCustomerCommentAction</default>
</route>
</routes>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia" namespace="Comment\Model">
<table name="comment">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="username" size="255" type="VARCHAR" />
<column name="customer_id" type="INTEGER" />
<column name="ref" size="255" type="VARCHAR" />
<column name="ref_id" type="INTEGER" />
<column name="email" size="255" type="VARCHAR" />
<column name="title" size="255" type="VARCHAR" />
<column name="content" type="CLOB" />
<column name="rating" type="TINYINT" />
<column name="status" type="TINYINT" default="0" />
<column name="verified" type="TINYINT" />
<column name="abuse" type="INTEGER" />
<column name="locale" size="10" type="VARCHAR" />
<behavior name="timestampable" />
<foreign-key foreignTable="customer" name="fk_comment_customer_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="customer_id" />
</foreign-key>
<index name="idx_comment_user_id">
<index-column name="customer_id" />
</index>
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,39 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- comment
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`username` VARCHAR(255),
`customer_id` INTEGER,
`ref` VARCHAR(255),
`ref_id` INTEGER,
`email` VARCHAR(255),
`title` VARCHAR(255),
`content` LONGTEXT,
`rating` TINYINT,
`status` TINYINT DEFAULT 0,
`verified` TINYINT,
`abuse` INTEGER,
`locale` VARCHAR(10),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_comment_user_id` (`customer_id`),
CONSTRAINT `fk_comment_customer_id`
FOREIGN KEY (`customer_id`)
REFERENCES `customer` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;