|
|
@ -1060,7 +1060,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
printResults: function () { return; },
|
|
|
|
printResults: function () { return; },
|
|
|
|
icon: h('i.fa.fa-question')
|
|
|
|
icon: h('i.cptools.cptools-form-conditional')
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -2329,7 +2329,7 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var viewOnly = content.answers.cantEdit || APP.isClosed;
|
|
|
|
var viewOnly = content.answers.cantEdit || APP.isClosed;
|
|
|
|
var action = h('button.btn.btn-primary', [
|
|
|
|
var action = h(viewOnly ? 'button.btn.btn-secondary' : 'button.btn.btn-primary', [
|
|
|
|
viewOnly ? h('i.fa.fa-bar-chart') : h('i.fa.fa-pencil'),
|
|
|
|
viewOnly ? h('i.fa.fa-bar-chart') : h('i.fa.fa-pencil'),
|
|
|
|
h('span', viewOnly ? Messages.form_viewAnswer : Messages.form_editAnswer)
|
|
|
|
h('span', viewOnly ? Messages.form_viewAnswer : Messages.form_editAnswer)
|
|
|
|
]);
|
|
|
|
]);
|
|
|
@ -2351,19 +2351,20 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
if (answers._time) { APP.lastAnswerTime = answers._time; }
|
|
|
|
if (answers._time) { APP.lastAnswerTime = answers._time; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Messages.form_viewAllAnswers = "View all responses ({0})"; // XXX
|
|
|
|
// If responses are public, show button to view them
|
|
|
|
// If responses are public, show button to view them
|
|
|
|
var responses;
|
|
|
|
var responses;
|
|
|
|
if (content.answers.privateKey) {
|
|
|
|
if (content.answers.privateKey) {
|
|
|
|
var l = getAnswersLength(answers);
|
|
|
|
var l = getAnswersLength(answers);
|
|
|
|
responses = h('button.btn.btn-default', [
|
|
|
|
responses = h('button.btn.btn-secondary', [
|
|
|
|
h('i.fa.fa-bar-chart'),
|
|
|
|
h('i.fa.fa-bar-chart'),
|
|
|
|
h('span.cp-button-name', Messages._getKey('form_results', [l]))
|
|
|
|
h('span.cp-button-name', Messages._getKey('form_viewAllAnswers', [l]))
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
var sframeChan = framework._.sfCommon.getSframeChannel();
|
|
|
|
var sframeChan = framework._.sfCommon.getSframeChannel();
|
|
|
|
sframeChan.query("Q_FORM_FETCH_ANSWERS", content.answers, function (err, obj) {
|
|
|
|
sframeChan.query("Q_FORM_FETCH_ANSWERS", content.answers, function (err, obj) {
|
|
|
|
var answers = obj && obj.results;
|
|
|
|
var answers = obj && obj.results;
|
|
|
|
var l = getAnswersLength(answers);
|
|
|
|
var l = getAnswersLength(answers);
|
|
|
|
$(responses).find('.cp-button-name').text(Messages._getKey('form_results', [l]));
|
|
|
|
$(responses).find('.cp-button-name').text(Messages._getKey('form_viewAllAnswers', [l]));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$(responses).click(function () {
|
|
|
|
$(responses).click(function () {
|
|
|
|
sframeChan.query("Q_FORM_FETCH_ANSWERS", content.answers, function (err, obj) {
|
|
|
|
sframeChan.query("Q_FORM_FETCH_ANSWERS", content.answers, function (err, obj) {
|
|
|
@ -3014,16 +3015,16 @@ define([
|
|
|
|
}).filter(Boolean);
|
|
|
|
}).filter(Boolean);
|
|
|
|
return values;
|
|
|
|
return values;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
Messages.form_conditional_add = "Add condition OR";
|
|
|
|
Messages.form_conditional_add = "Add condition OR"; // XXX
|
|
|
|
Messages.form_conditional_addAnd = "Add condition AND";
|
|
|
|
Messages.form_conditional_addAnd = "Add condition AND"; // XXX
|
|
|
|
var addCondition = h('button.btn.btn-default', [
|
|
|
|
var addCondition = h('button.btn.btn-secondary', [
|
|
|
|
h('i.fa.fa-plus'),
|
|
|
|
h('i.fa.fa-plus'),
|
|
|
|
h('span', Messages.form_conditional_add)
|
|
|
|
h('span', Messages.form_conditional_add)
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
var $addC = $(addCondition);
|
|
|
|
var $addC = $(addCondition);
|
|
|
|
var getConditions;
|
|
|
|
var getConditions;
|
|
|
|
var getAddAndButton = function ($container, rules) {
|
|
|
|
var getAddAndButton = function ($container, rules) {
|
|
|
|
var btn = h('button.btn.btn-default.cp-form-add-and', [
|
|
|
|
var btn = h('button.btn.btn-secondary.cp-form-add-and', [
|
|
|
|
h('i.fa.fa-plus'),
|
|
|
|
h('i.fa.fa-plus'),
|
|
|
|
h('span', Messages.form_conditional_addAnd)
|
|
|
|
h('span', Messages.form_conditional_addAnd)
|
|
|
|
]);
|
|
|
|
]);
|
|
|
@ -3055,7 +3056,7 @@ define([
|
|
|
|
options: qOptions, // Entries displayed in the menu
|
|
|
|
options: qOptions, // Entries displayed in the menu
|
|
|
|
isSelect: true,
|
|
|
|
isSelect: true,
|
|
|
|
caretDown: true,
|
|
|
|
caretDown: true,
|
|
|
|
buttonCls: 'btn btn-secondary'
|
|
|
|
buttonCls: 'btn btn-default'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var qSelect = UIElements.createDropdown(qConfig);
|
|
|
|
var qSelect = UIElements.createDropdown(qConfig);
|
|
|
|
Messages.form_condition_is = 'is'; // XXX
|
|
|
|
Messages.form_condition_is = 'is'; // XXX
|
|
|
@ -3083,14 +3084,14 @@ define([
|
|
|
|
options: iOptions, // Entries displayed in the menu
|
|
|
|
options: iOptions, // Entries displayed in the menu
|
|
|
|
isSelect: true,
|
|
|
|
isSelect: true,
|
|
|
|
caretDown: true,
|
|
|
|
caretDown: true,
|
|
|
|
buttonCls: 'btn btn-secondary'
|
|
|
|
buttonCls: 'btn btn-default'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var iSelect = UIElements.createDropdown(iConfig);
|
|
|
|
var iSelect = UIElements.createDropdown(iConfig);
|
|
|
|
iSelect.setValue(isOn ? 1 : 0);
|
|
|
|
iSelect.setValue(isOn ? 1 : 0);
|
|
|
|
$(iSelect).hide();
|
|
|
|
$(iSelect).hide();
|
|
|
|
|
|
|
|
|
|
|
|
var remove = h('button.btn.btn-danger-alt.cp-condition-remove', [
|
|
|
|
var remove = h('button.btn.btn-danger-alt.cp-condition-remove', [
|
|
|
|
h('i.fa.fa-times')
|
|
|
|
h('i.fa.fa-times.nomargin')
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
$(remove).on('click', function () {
|
|
|
|
$(remove).on('click', function () {
|
|
|
|
$content.remove();
|
|
|
|
$content.remove();
|
|
|
@ -3147,7 +3148,7 @@ define([
|
|
|
|
//container: $(type),
|
|
|
|
//container: $(type),
|
|
|
|
isSelect: true,
|
|
|
|
isSelect: true,
|
|
|
|
caretDown: true,
|
|
|
|
caretDown: true,
|
|
|
|
buttonCls: 'btn btn-secondary'
|
|
|
|
buttonCls: 'btn btn-default'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var vSelect = UIElements.createDropdown(vConfig);
|
|
|
|
var vSelect = UIElements.createDropdown(vConfig);
|
|
|
|
vSelect.addClass('cp-form-condition-values');
|
|
|
|
vSelect.addClass('cp-form-condition-values');
|
|
|
@ -3829,7 +3830,7 @@ define([
|
|
|
|
refreshResponse();
|
|
|
|
refreshResponse();
|
|
|
|
|
|
|
|
|
|
|
|
// Make answers anonymous
|
|
|
|
// Make answers anonymous
|
|
|
|
Messages.form_makeAnon = "Anonymous responses"; // XXX
|
|
|
|
Messages.form_makeAnon = "Anonymize responses"; // XXX
|
|
|
|
var anonContainer = h('div.cp-form-anon-container');
|
|
|
|
var anonContainer = h('div.cp-form-anon-container');
|
|
|
|
var $anon = $(anonContainer);
|
|
|
|
var $anon = $(anonContainer);
|
|
|
|
var refreshAnon = function () {
|
|
|
|
var refreshAnon = function () {
|
|
|
|