Merge branch 'master' into pretender
This commit is contained in:
commit
2670a07d04
11 changed files with 128 additions and 1 deletions
|
@ -22,6 +22,11 @@ export default Ember.Controller.extend(EmberValidations.Mixin, {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
// trigger update of webshim input
|
||||
Ember.run.next(this, function(){
|
||||
Ember.$('input[type="time"]').trigger('change');
|
||||
});
|
||||
},
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Ember from "ember";
|
||||
import EmberValidations from 'ember-validations';
|
||||
/* global moment */
|
||||
|
||||
export default Ember.Controller.extend(EmberValidations.Mixin, {
|
||||
actions: {
|
||||
|
@ -91,6 +92,37 @@ export default Ember.Controller.extend(EmberValidations.Mixin, {
|
|||
];
|
||||
}.property(),
|
||||
|
||||
expirationDuration: 'P3M',
|
||||
|
||||
expirationDurations: function() {
|
||||
return [
|
||||
Ember.Object.extend(Ember.I18n.TranslateableProperties, {}).create({
|
||||
id: 'P7D',
|
||||
labelTranslation: 'create.settings.expirationDurations.P7D'
|
||||
}),
|
||||
Ember.Object.extend(Ember.I18n.TranslateableProperties, {}).create({
|
||||
id: 'P1M',
|
||||
labelTranslation: 'create.settings.expirationDurations.P1M'
|
||||
}),
|
||||
Ember.Object.extend(Ember.I18n.TranslateableProperties, {}).create({
|
||||
id: 'P3M',
|
||||
labelTranslation: 'create.settings.expirationDurations.P3M'
|
||||
}),
|
||||
Ember.Object.extend(Ember.I18n.TranslateableProperties, {}).create({
|
||||
id: 'P6M',
|
||||
labelTranslation: 'create.settings.expirationDurations.P6M'
|
||||
}),
|
||||
Ember.Object.extend(Ember.I18n.TranslateableProperties, {}).create({
|
||||
id: 'P1Y',
|
||||
labelTranslation: 'create.settings.expirationDurations.P1Y'
|
||||
}),
|
||||
Ember.Object.extend(Ember.I18n.TranslateableProperties, {}).create({
|
||||
id: '',
|
||||
labelTranslation: 'create.settings.expirationDurations.never'
|
||||
})
|
||||
];
|
||||
}.property(),
|
||||
|
||||
forceAnswer: function() {
|
||||
return this.get('model.forceAnswer');
|
||||
}.property('model.forceAnswer'),
|
||||
|
@ -114,6 +146,21 @@ export default Ember.Controller.extend(EmberValidations.Mixin, {
|
|||
}
|
||||
}.observes('model.answerType'),
|
||||
|
||||
updateExpirationDate: function() {
|
||||
var expirationDuration = this.get('expirationDuration');
|
||||
|
||||
if(Ember.isEmpty(expirationDuration)) {
|
||||
this.set('model.expirationDate', '');
|
||||
}
|
||||
else {
|
||||
this.set('model.expirationDate',
|
||||
moment().add(
|
||||
moment.duration(expirationDuration)
|
||||
).toISOString()
|
||||
);
|
||||
}
|
||||
}.observes('expirationDuration'),
|
||||
|
||||
validations: {
|
||||
anonymousUser: {
|
||||
presence: true
|
||||
|
|
|
@ -24,6 +24,13 @@ export default {
|
|||
"create.options-datetime.error.correctTimeFormat": "Check your entry: At least one time does not comply with the correct format. Hours and minutes of the time have to be separated by a colon (e.g. 13:00).",
|
||||
"create.settings.answerType.label": "Which answers should be available?",
|
||||
"create.settings.anonymousUser.label": "Allow anonymous participation in the poll?",
|
||||
"create.settings.expirationDate.label": "When should the poll expire and be deleted?",
|
||||
"create.settings.expirationDurations.P7D": "a week from today",
|
||||
"create.settings.expirationDurations.P1M": "a month from today",
|
||||
"create.settings.expirationDurations.P3M": "three month from today",
|
||||
"create.settings.expirationDurations.P6M": "six month from today",
|
||||
"create.settings.expirationDurations.P1Y": "a year from today",
|
||||
"create.settings.expirationDurations.never": "never",
|
||||
"create.settings.forceAnswer.label": "Force answer for every option?",
|
||||
"create.save": "Save",
|
||||
"errors.inclusion": "is not part of the list",
|
||||
|
@ -103,6 +110,13 @@ export default {
|
|||
"create.options-datetime.error.correctTimeFormat": "Überprüfe deine Eingabe: Mindestens eine Uhrzeit hat nicht das korrekte Format. Stunden und Minuten der Uhrzeit müssen durch einen Doppelpunkt getrennt sein (z.B. 13:00).",
|
||||
"create.settings.answerType.label": "Welche Antworten sollen verfügbar sein?",
|
||||
"create.settings.anonymousUser.label": "Anonyme Teilnahme an der Umfrage erlauben?",
|
||||
"create.settings.expirationDate.label": "Wann soll Ihre Umfrage verfallen und gelöscht werden?",
|
||||
"create.settings.expirationDurations.P7D": "in einer Woche",
|
||||
"create.settings.expirationDurations.P1M": "in einem Monat",
|
||||
"create.settings.expirationDurations.P3M": "in drei Monaten",
|
||||
"create.settings.expirationDurations.P6M": "in einem halben Jahr",
|
||||
"create.settings.expirationDurations.P1Y": "in einem Jahr",
|
||||
"create.settings.expirationDurations.never": "niemals",
|
||||
"create.settings.forceAnswer.label": "Eine Antwort für jede Option erzwingen?",
|
||||
"create.save": "Speichern",
|
||||
"errors.inclusion": "ist kein Bestandteil der Liste",
|
||||
|
@ -182,6 +196,13 @@ export default {
|
|||
"create.options-datetime.error.correctTimeFormat": "Revisa las opciones: Almenos un horario no tiene el formato correcto. Las horas y minutos del horario deben ser separadas por el caracter dospuntos (p.ej. 13:00).",
|
||||
"create.settings.answerType.label": "¿Que respuesta debería estar disponible?",
|
||||
"create.settings.anonymousUser.label": "¿permitir participantes anónimos en la encuesta?",
|
||||
"create.settings.expirationDate.label": "When should the poll expire and be deleted?",
|
||||
"create.settings.expirationDurations.P7D": "a week from today",
|
||||
"create.settings.expirationDurations.P1M": "a month from today",
|
||||
"create.settings.expirationDurations.P3M": "three month from today",
|
||||
"create.settings.expirationDurations.P6M": "six month from today",
|
||||
"create.settings.expirationDurations.P1Y": "a year from today",
|
||||
"create.settings.expirationDurations.never": "never",
|
||||
"create.settings.forceAnswer.label": "¿Obligar a responder todas las preguntas/opciones?",
|
||||
"create.save": "Guardar",
|
||||
"errors.inclusion": "no es parte de la lista",
|
||||
|
|
|
@ -39,6 +39,8 @@ export default DS.Model.extend({
|
|||
encryptedTimezone : DS.attr('string'),
|
||||
timezone : Ember.computed.encrypted('encryptedTimezone', 'string'),
|
||||
|
||||
expirationDate : DS.attr('string'),
|
||||
|
||||
version : DS.attr('string'),
|
||||
|
||||
// computed properties
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Ember from "ember";
|
||||
import generatePassphrase from "../utils/generate-passphrase";
|
||||
/* global moment */
|
||||
|
||||
export default Ember.Route.extend({
|
||||
beforeModel: function(){
|
||||
|
@ -25,6 +26,7 @@ export default Ember.Route.extend({
|
|||
datetimesInputFields: 2,
|
||||
isDateTime: false,
|
||||
timezone: '',
|
||||
expirationDate: moment().add(3, 'month').toISOString(),
|
||||
version: this.buildInfo.version + '-' + this.buildInfo.commit
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
{{#input time.value}}
|
||||
{{input-field time.value as='time'
|
||||
step='900'
|
||||
class='time'
|
||||
}}
|
||||
{{/input}}
|
||||
</td>
|
||||
|
|
|
@ -7,9 +7,19 @@
|
|||
optionLabelPath="content.label"
|
||||
labelTranslation="create.settings.answerType.label"
|
||||
}}
|
||||
|
||||
{{input expirationDuration as='select'
|
||||
collection="expirationDurations"
|
||||
value="expirationDuration"
|
||||
optionValuePath="content.id"
|
||||
optionLabelPath="content.label"
|
||||
labelTranslation="create.settings.expirationDate.label"
|
||||
}}
|
||||
|
||||
{{input model.anonymousUser as='checkbox'
|
||||
labelTranslation="create.settings.anonymousUser.label"
|
||||
}}
|
||||
|
||||
{{input model.forceAnswer as='checkbox'
|
||||
labelTranslation="create.settings.forceAnswer.label"
|
||||
}}
|
||||
|
|
|
@ -5,6 +5,8 @@ export default Ember.View.extend({
|
|||
didInsertElement: function(){
|
||||
this._super();
|
||||
|
||||
this.$('input.time').attr('type', 'time');
|
||||
|
||||
webshim.setOptions("forms-ext", {
|
||||
"time": {
|
||||
"nopicker": true,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "croodle",
|
||||
"version": "v0.3.0",
|
||||
"private": true,
|
||||
"directories": {
|
||||
"doc": "doc",
|
||||
|
@ -26,7 +27,7 @@
|
|||
"ember-cli": "0.2.7",
|
||||
"ember-cli-app-version": "0.3.3",
|
||||
"ember-cli-babel": "^5.0.0",
|
||||
"ember-cli-bootstrap-datepicker": "git://github.com/soulim/ember-cli-bootstrap-datepicker.git#5cc3fdf114cece954cbb4af60c5584e362c1cdc3",
|
||||
"ember-cli-bootstrap-datepicker": "0.5.3",
|
||||
"ember-cli-build-info": "^0.1.0",
|
||||
"ember-cli-content-security-policy": "0.4.0",
|
||||
"ember-cli-dependency-checker": "^1.0.0",
|
||||
|
|
|
@ -21,6 +21,11 @@ $query_paramter = explode("/",$_SERVER["QUERY_STRING"]);
|
|||
$type = $query_paramter[1];
|
||||
if (isset($query_paramter[2])) {
|
||||
$requested_id = $query_paramter[2];
|
||||
|
||||
// check requested id if it only contains letters and numbers
|
||||
if(preg_match('/[^A-Za-z0-9]/', $requested_id) !== 0) {
|
||||
throw new Exception('requested id must only contain letters and numbers');
|
||||
}
|
||||
}
|
||||
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
|
|
|
@ -43,6 +43,28 @@ class datahandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function deletePoll($poll_id) {
|
||||
$folder = self::DATA_FOLDER . "/" . $poll_id;
|
||||
$user_folder = $folder . "/user";
|
||||
|
||||
// delete user folder
|
||||
if (is_dir($user_folder)) {
|
||||
$dir = opendir($user_folder);
|
||||
while(false !== ($file = readdir($dir))) {
|
||||
if($file === '.' || $file === '..') {
|
||||
continue;
|
||||
}
|
||||
unlink($user_folder . '/' . $file);
|
||||
}
|
||||
closedir($dir);
|
||||
rmdir($user_folder);
|
||||
}
|
||||
|
||||
unlink($folder . '/poll_data');
|
||||
|
||||
rmdir($folder);
|
||||
}
|
||||
|
||||
/*
|
||||
* read poll data
|
||||
|
@ -61,6 +83,15 @@ class datahandler {
|
|||
$poll_data_json = file_get_contents($poll_file);
|
||||
|
||||
$poll_data = json_decode($poll_data_json);
|
||||
|
||||
// check expiration date
|
||||
if (
|
||||
!empty($poll_data->poll->expirationDate) &&
|
||||
DateTime::createFromFormat('Y-m-d\TH:i:s.uO', $poll_data->poll->expirationDate) < new DateTime()
|
||||
) {
|
||||
$this->deletePoll($poll_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
// set id to poll
|
||||
$poll_data->poll->id = $poll_id;
|
||||
|
|
Loading…
Reference in a new issue