/** * Form iDevice * * Released under Attribution-ShareAlike 4.0 International License. * Author: SDWEB - Innovative Digital Solutions * * License: http://creativecommons.org/licenses/by-sa/4.0/ */ var $text = { ideviceClass: 'textIdeviceContent', working: false, durationId: 'textInfoDurationInput', durationTextId: 'textInfoDurationTextInput', participantsId: 'textInfoParticipantsInput', participantsTextId: 'textInfoParticipantsTextInput', mainContentId: 'textTextarea', feedbackTitleId: 'textFeedbackInput', feedbackContentId: 'textFeedbackTextarea', defaultBtnFeedbackText: $exe_i18n.showFeedback, /** * Engine execution order: 1 * Get the base html of the idevice view */ renderView(data, accessibility, template) { let content = data.textTextarea || ''; const feedbackContent = data[this.feedbackContentId] || ''; // Add feedback from jsonProperties only if content doesn't already have it if (feedbackContent) { const temp = document.createElement('div'); temp.innerHTML = content; const hasFeedback = temp.querySelector('.feedback-button') || temp.querySelector('.feedbacktooglebutton') || temp.querySelector('.feedbackbutton') || temp.querySelector('.feedback.js-feedback') || temp.querySelector('div.feedback'); if (!hasFeedback) { const btnText = c_(data[this.feedbackTitleId]) || this.defaultBtnFeedbackText; content += this.createFeedbackHTML(btnText, feedbackContent); } } return template.replace('{content}', content); }, getHTMLView(data, pathMedia) { const isInExe = eXe.app.isInExe(); const durationText = isInExe ? c_(data[this.durationTextId]) : data[this.durationTextId]; const participantsText = isInExe ? c_(data[this.participantsTextId]) : data[this.participantsTextId]; let infoContentHTML = ''; if (data[this.durationId] || data[this.participantsId]) { infoContentHTML = this.createInfoHTML( data[this.durationId] === '' ? '' : durationText, data[this.durationId], data[this.participantsId] === '' ? '' : participantsText, data[this.participantsId] ); } let contentHtml = data[this.mainContentId]; const temp = document.createElement('div'); temp.innerHTML = contentHtml; const btnDiv = temp.querySelector('.feedback-button'); let buttonFeedBackText = data[this.feedbackTitleId]; if (btnDiv) { // Support both legacy eXe 2.9 (feedbackbutton) and modern (feedbacktooglebutton) formats const inputEl = btnDiv.querySelector('input.feedbackbutton, input.feedbacktooglebutton'); if (inputEl) buttonFeedBackText = isInExe ? c_(inputEl.value) : inputEl.value; btnDiv.remove(); } let feedBackHtml = data[this.feedbackContentId] || ''; const fbDiv = temp.querySelector('.feedback.js-feedback'); if (fbDiv) { feedBackHtml = fbDiv.innerHTML; fbDiv.remove(); } contentHtml = temp.innerHTML; if (feedBackHtml) { buttonFeedBackText = buttonFeedBackText === '' ? this.defaultBtnFeedbackText : buttonFeedBackText; if (isInExe) buttonFeedBackText = c_(buttonFeedBackText); } data['textInfoParticipantsTextInput'] = participantsText; data['textInfoDurationTextInput'] = durationText; data['textTextarea'] = contentHtml; data['textFeedbackInput'] = buttonFeedBackText; data['textFeedbackTextarea'] = feedBackHtml; const feedbackContentHTML = feedBackHtml === '' ? '' : this.createFeedbackHTML(buttonFeedBackText, feedBackHtml); const activityContent = infoContentHTML + contentHtml + feedbackContentHTML; let htmlContent = `