Merge branch 'develop' into 'develop'

Timestamp on comments

The comments are now timestamped

See merge request !66
This commit is contained in:
Olivier Perez 2015-10-12 23:39:30 +02:00
commit 76c2077100
11 changed files with 168 additions and 6 deletions

View File

@ -22,6 +22,8 @@ use Framadate\Migration\From_0_8_to_0_9_Migration;
use Framadate\Migration\AddColumn_receiveNewComments_For_0_9; use Framadate\Migration\AddColumn_receiveNewComments_For_0_9;
use Framadate\Migration\AddColumn_uniqId_In_vote_For_0_9; use Framadate\Migration\AddColumn_uniqId_In_vote_For_0_9;
use Framadate\Migration\AddColumn_hidden_In_poll_For_0_9; use Framadate\Migration\AddColumn_hidden_In_poll_For_0_9;
use Framadate\Migration\Alter_Comment_table_for_name_length;
use Framadate\Migration\Alter_Comment_table_adding_date;
use Framadate\Migration\Migration; use Framadate\Migration\Migration;
use Framadate\Utils; use Framadate\Utils;
@ -36,6 +38,8 @@ $migrations = [
new AddColumn_receiveNewComments_For_0_9(), new AddColumn_receiveNewComments_For_0_9(),
new AddColumn_uniqId_In_vote_For_0_9(), new AddColumn_uniqId_In_vote_For_0_9(),
new AddColumn_hidden_In_poll_For_0_9(), new AddColumn_hidden_In_poll_For_0_9(),
new Alter_Comment_table_for_name_length(),
new Alter_Comment_table_adding_date(),
]; ];
// --------------------------------------- // ---------------------------------------

View File

@ -0,0 +1,72 @@
<?php
/**
* This software is governed by the CeCILL-B license. If a copy of this license
* is not distributed with this file, you can obtain one at
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
*
* Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
* Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft)
*
* =============================
*
* Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
* ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
*
* Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
*/
namespace Framadate\Migration;
use Framadate\Utils;
/**
* This migration alter the comment table to add a date column.
*
* @package Framadate\Migration
* @version 1.0
*/
class Alter_Comment_table_adding_date implements Migration {
function __construct() {
}
/**
* This method should describe in english what is the purpose of the migration class.
*
* @return string The description of the migration class
*/
function description() {
return 'Alter the comment table to add a date column.';
}
/**
* This method could check if the execute method should be called.
* It is called before the execute method.
*
* @param \PDO $pdo The connection to database
* @return bool true is the Migration should be executed.
*/
function preCondition(\PDO $pdo) {
return true;
}
/**
* This methode is called only one time in the migration page.
*
* @param \PDO $pdo The connection to database
* @return bool true is the execution succeeded
*/
function execute(\PDO $pdo) {
$this->alterCommentTable($pdo);
return true;
}
private function alterCommentTable(\PDO $pdo) {
$pdo->exec('
ALTER TABLE `' . Utils::table('comment') . '`
ADD `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ;');
}
}

View File

@ -0,0 +1,72 @@
<?php
/**
* This software is governed by the CeCILL-B license. If a copy of this license
* is not distributed with this file, you can obtain one at
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
*
* Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
* Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft)
*
* =============================
*
* Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
* ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
*
* Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
*/
namespace Framadate\Migration;
use Framadate\Utils;
/**
* This migration alter the comment table to set a length to the name column.
*
* @package Framadate\Migration
* @version 1.0
*/
class Alter_Comment_table_for_name_length implements Migration {
function __construct() {
}
/**
* This method should describe in english what is the purpose of the migration class.
*
* @return string The description of the migration class
*/
function description() {
return 'Alter the comment table to set a length to the name column.';
}
/**
* This method could check if the execute method should be called.
* It is called before the execute method.
*
* @param \PDO $pdo The connection to database
* @return bool true is the Migration should be executed.
*/
function preCondition(\PDO $pdo) {
return true;
}
/**
* This methode is called only one time in the migration page.
*
* @param \PDO $pdo The connection to database
* @return bool true is the execution succeeded
*/
function execute(\PDO $pdo) {
$this->alterCommentTable($pdo);
return true;
}
private function alterCommentTable(\PDO $pdo) {
$pdo->exec('
ALTER TABLE `' . Utils::table('comment') . '`
CHANGE `name` `name` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;');
}
}

View File

@ -37,6 +37,7 @@ $date_format['txt_short'] = __('Date', 'SHORT'); // radio title
$date_format['txt_day'] = __('Date', 'DAY'); $date_format['txt_day'] = __('Date', 'DAY');
$date_format['txt_date'] = __('Date', 'DATE'); $date_format['txt_date'] = __('Date', 'DATE');
$date_format['txt_month_year'] = __('Date', 'MONTH_YEAR'); $date_format['txt_month_year'] = __('Date', 'MONTH_YEAR');
$date_format['txt_datetime_short'] = __('Date', 'DATETIME');
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { //%e can't be used on Windows platform, use %#d instead if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { //%e can't be used on Windows platform, use %#d instead
foreach ($date_format as $k => $v) { foreach ($date_format as $k => $v) {
$date_format[$k] = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $v); //replace %e by %#d for windows $date_format[$k] = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $v); //replace %e by %#d for windows

View File

@ -47,6 +47,13 @@ div.comment{
padding-left: 14px; padding-left: 14px;
} }
.comment_date {
font-style: italic;
font-size: 12px;
letter-spacing: -0.7px;
color: grey;
}
/* Règles générales */ /* Règles générales */
a:focus { /* a11y */ a:focus { /* a11y */

View File

@ -45,7 +45,8 @@
"SHORT": "%A %e %B %Y", "SHORT": "%A %e %B %Y",
"DAY": "%a %e", "DAY": "%a %e",
"DATE": "%Y-%m-%d", "DATE": "%Y-%m-%d",
"MONTH_YEAR": "%B %Y" "MONTH_YEAR": "%B %Y",
"DATETIME": "%Y-%m-%d %H:%M"
}, },
"Language selector": { "Language selector": {
"Select the language": "Sprache wählen", "Select the language": "Sprache wählen",

View File

@ -45,7 +45,8 @@
"SHORT": "%A %e %B %Y", "SHORT": "%A %e %B %Y",
"DAY": "%a %e", "DAY": "%a %e",
"DATE": "%Y-%m-%d", "DATE": "%Y-%m-%d",
"MONTH_YEAR": "%B %Y" "MONTH_YEAR": "%B %Y",
"DATETIME": "%m/%d/%Y %H:%M"
}, },
"Language selector": { "Language selector": {
"Select the language": "Select the language", "Select the language": "Select the language",

View File

@ -45,7 +45,8 @@
"SHORT": "ES_%A %e %B %Y", "SHORT": "ES_%A %e %B %Y",
"DAY": "ES_%a %e", "DAY": "ES_%a %e",
"DATE": "ES_%Y-%m-%d", "DATE": "ES_%Y-%m-%d",
"MONTH_YEAR": "ES_%B %Y" "MONTH_YEAR": "ES_%B %Y",
"DATETIME": "%d/%m/%Y %H:%M"
}, },
"Language selector": { "Language selector": {
"Select the language": "ES_Choisir la langue", "Select the language": "ES_Choisir la langue",

View File

@ -45,7 +45,8 @@
"SHORT": "%A %e %B %Y", "SHORT": "%A %e %B %Y",
"DAY": "%a %e", "DAY": "%a %e",
"DATE": "%Y-%m-%d", "DATE": "%Y-%m-%d",
"MONTH_YEAR": "%B %Y" "MONTH_YEAR": "%B %Y",
"DATETIME": "%d-%m-%Y %H:%M"
}, },
"Language selector": { "Language selector": {
"Select the language": "Choisir la langue", "Select the language": "Choisir la langue",
@ -274,7 +275,7 @@
"Deleted the poll": "Supprimer le sondage", "Deleted the poll": "Supprimer le sondage",
"Summary": "Résumé", "Summary": "Résumé",
"Success": "Réussite", "Success": "Réussite",
"Fail": "Échèc", "Fail": "Échec",
"Nothing": "Rien", "Nothing": "Rien",
"Succeeded:": "Réussit:", "Succeeded:": "Réussit:",
"Failed:": "Échoué:", "Failed:": "Échoué:",

View File

@ -45,7 +45,8 @@
"SHORT": "%A %e %B %Y", "SHORT": "%A %e %B %Y",
"DAY": "%a %e", "DAY": "%a %e",
"DATE": "%Y-%m-%d", "DATE": "%Y-%m-%d",
"MONTH_YEAR": "%B %Y" "MONTH_YEAR": "%B %Y",
"DATETIME": "%d/%m/%Y %H:%M"
}, },
"Language selector": { "Language selector": {
"Select the language": "Scegliere la lingua", "Select the language": "Scegliere la lingua",

View File

@ -10,6 +10,7 @@
{if $admin && !$expired} {if $admin && !$expired}
<button type="submit" name="delete_comment" value="{$comment->id|html}" class="btn btn-link" title="{__('Comments', 'Remove the comment')}"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{__('Generic', 'Remove')}</span></button> <button type="submit" name="delete_comment" value="{$comment->id|html}" class="btn btn-link" title="{__('Comments', 'Remove the comment')}"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{__('Generic', 'Remove')}</span></button>
{/if} {/if}
<span class="comment_date">{$comment->date|date_format:$date_format['txt_datetime_short']}</span>
<b>{$comment->name|html}</b>&nbsp; <b>{$comment->name|html}</b>&nbsp;
<span class="comment">{$comment->comment|escape|nl2br}</span> <span class="comment">{$comment->comment|escape|nl2br}</span>
</div> </div>