From 81b2e9a5375832e99d42b7832864862783cce738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 28 Apr 2020 09:04:53 +0200 Subject: [PATCH] Initial template cleanup and submit config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- js/submit.js | 9566 +++++++++++++++++++++++- js/survey.jquery.min.js | 11 - lib/Controller/PageController.php | 60 +- src/main.js | 3 +- src/submit.js | 36 + src/views/{Fill.vue => Submit.vue} | 2 +- .stylelintrc.js => stylelint.config.js | 0 templates/expired.php | 31 + templates/expired.tmpl.php | 35 - templates/forms.tmpl.php | 28 - templates/no.acc.tmpl.php | 35 - templates/no.create.tmpl.php | 35 - templates/no.delete.tmpl.php | 35 - templates/notfound.php | 31 + templates/submit.tmpl.php | 45 - webpack.common.js | 29 +- 16 files changed, 9657 insertions(+), 325 deletions(-) delete mode 100644 js/survey.jquery.min.js create mode 100644 src/submit.js rename src/views/{Fill.vue => Submit.vue} (98%) rename .stylelintrc.js => stylelint.config.js (100%) create mode 100644 templates/expired.php delete mode 100644 templates/expired.tmpl.php delete mode 100644 templates/forms.tmpl.php delete mode 100644 templates/no.acc.tmpl.php delete mode 100644 templates/no.create.tmpl.php delete mode 100644 templates/no.delete.tmpl.php create mode 100644 templates/notfound.php delete mode 100644 templates/submit.tmpl.php diff --git a/js/submit.js b/js/submit.js index a86d81c2..a8e4fe62 100644 --- a/js/submit.js +++ b/js/submit.js @@ -1,60 +1,9516 @@ -var form = [] -var questions = [] +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "/js/"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./src/submit.js"); +/******/ }) +/************************************************************************/ +/******/ ({ -function sendDataToServer(survey) { - form.answers = survey.data; - form.userId = OC.getCurrentUser().uid; - if(form.userId == ''){ - form.userId = 'anon_' + Date.now() + '_' + Math.floor(Math.random() * 10000) - } - form.questions = questions; - $.post(OC.generateUrl('apps/forms/insert/submission'), form) - .then((response) => { - }, (error) => { - /* eslint-disable-next-line no-console */ - console.log(error.response) - }); -} +/***/ "./node_modules/@nextcloud/l10n/dist/index.js": +/*!****************************************************!*\ + !*** ./node_modules/@nextcloud/l10n/dist/index.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { -function cssUpdate(survey, options){ - console.log(options.cssClasses) - var classes = options.cssClasses - classes.root = 'sq-root' - classes.title = 'sq-title' - classes.item = 'sq-item' - classes.label = 'sq-label' - classes.description = 'sv-q-description' +"use strict"; - if (options.question.isRequired) { - classes.title = 'sq-title sq-title-required' - classes.root = 'sq-root sq-root-required' - } -} -$(document).ready(function () { - var formJSON = $('#surveyContainer').attr('form') - var questionJSON = $('#surveyContainer').attr('questions') - - form = JSON.parse(formJSON) - questions = JSON.parse(questionJSON) - - var surveyJSON = { - title: form.title, - description: form.description, - questions: [] - }; - - questions.forEach(q => { - var qChoices = [] - q.options.forEach(o => { - qChoices.push(o.text); - }); - surveyJSON.questions.push({type: q.type, name: q.text, choices: qChoices, isRequired: 'true'}); - }); - - $('#surveyContainer').Survey({ - model: new Survey.Model(surveyJSON), - onUpdateQuestionCssClasses: cssUpdate, - onComplete: sendDataToServer, - }); +Object.defineProperty(exports, "__esModule", { + value: true }); +exports.getLocale = getLocale; +exports.getLanguage = getLanguage; +exports.translate = translate; +exports.translatePlural = translatePlural; +exports.getFirstDay = getFirstDay; +exports.getDayNames = getDayNames; +exports.getDayNamesShort = getDayNamesShort; +exports.getDayNamesMin = getDayNamesMin; +exports.getMonthNames = getMonthNames; +exports.getMonthNamesShort = getMonthNamesShort; + +/// + +/** + * Returns the user's locale + */ +function getLocale() { + if (typeof OC === 'undefined') { + console.warn('No OC found'); + return 'en'; + } + + return OC.getLocale(); +} +/** + * Returns the user's language + */ + + +function getLanguage() { + if (typeof OC === 'undefined') { + console.warn('No OC found'); + return 'en'; + } + + return OC.getLanguage(); +} + +/** + * Translate a string + * + * @param {string} app the id of the app for which to translate the string + * @param {string} text the string to translate + * @param {object} vars map of placeholder key to value + * @param {number} number to replace %n with + * @param {object} [options] options object + * @return {string} + */ +function translate(app, text, vars, count, options) { + if (typeof OC === 'undefined') { + console.warn('No OC found'); + return text; + } + + return OC.L10N.translate(app, text, vars, count, options); +} +/** + * Translate a plural string + * + * @param {string} app the id of the app for which to translate the string + * @param {string} textSingular the string to translate for exactly one object + * @param {string} textPlural the string to translate for n objects + * @param {number} count number to determine whether to use singular or plural + * @param {Object} vars of placeholder key to value + * @param {object} options options object + * @return {string} + */ + + +function translatePlural(app, textSingular, textPlural, count, vars, options) { + if (typeof OC === 'undefined') { + console.warn('No OC found'); + return textSingular; + } + + return OC.L10N.translatePlural(app, textSingular, textPlural, count, vars, options); +} +/** + * Get the first day of the week + * + * @return {number} + */ + + +function getFirstDay() { + if (typeof window.firstDay === 'undefined') { + console.warn('No firstDay found'); + return 1; + } + + return window.firstDay; +} +/** + * Get a list of day names (full names) + * + * @return {string[]} + */ + + +function getDayNames() { + if (typeof window.dayNames === 'undefined') { + console.warn('No dayNames found'); + return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; + } + + return window.dayNames; +} +/** + * Get a list of day names (short names) + * + * @return {string[]} + */ + + +function getDayNamesShort() { + if (typeof window.dayNamesShort === 'undefined') { + console.warn('No dayNamesShort found'); + return ['Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.']; + } + + return window.dayNamesShort; +} +/** + * Get a list of day names (minified names) + * + * @return {string[]} + */ + + +function getDayNamesMin() { + if (typeof window.dayNamesMin === 'undefined') { + console.warn('No dayNamesMin found'); + return ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']; + } + + return window.dayNamesMin; +} +/** + * Get a list of month names (full names) + * + * @return {string[]} + */ + + +function getMonthNames() { + if (typeof window.monthNames === 'undefined') { + console.warn('No monthNames found'); + return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; + } + + return window.monthNames; +} +/** + * Get a list of month names (short names) + * + * @return {string[]} + */ + + +function getMonthNamesShort() { + if (typeof window.monthNamesShort === 'undefined') { + console.warn('No monthNamesShort found'); + return ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.']; + } + + return window.monthNamesShort; +} +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js?!./src/views/Submit.vue?vue&type=script&lang=js&": +/*!*****************************************************************************************************************************************!*\ + !*** ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Submit.vue?vue&type=script&lang=js& ***! + \*****************************************************************************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +/* harmony default export */ __webpack_exports__["default"] = ({ + name: 'Submit' +}); + +/***/ }), + +/***/ "./node_modules/process/browser.js": +/*!*****************************************!*\ + !*** ./node_modules/process/browser.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), + +/***/ "./node_modules/setimmediate/setImmediate.js": +/*!***************************************************!*\ + !*** ./node_modules/setimmediate/setImmediate.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { + "use strict"; + + if (global.setImmediate) { + return; + } + + var nextHandle = 1; // Spec says greater than zero + var tasksByHandle = {}; + var currentlyRunningATask = false; + var doc = global.document; + var registerImmediate; + + function setImmediate(callback) { + // Callback can either be a function or a string + if (typeof callback !== "function") { + callback = new Function("" + callback); + } + // Copy function arguments + var args = new Array(arguments.length - 1); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i + 1]; + } + // Store and register the task + var task = { callback: callback, args: args }; + tasksByHandle[nextHandle] = task; + registerImmediate(nextHandle); + return nextHandle++; + } + + function clearImmediate(handle) { + delete tasksByHandle[handle]; + } + + function run(task) { + var callback = task.callback; + var args = task.args; + switch (args.length) { + case 0: + callback(); + break; + case 1: + callback(args[0]); + break; + case 2: + callback(args[0], args[1]); + break; + case 3: + callback(args[0], args[1], args[2]); + break; + default: + callback.apply(undefined, args); + break; + } + } + + function runIfPresent(handle) { + // From the spec: "Wait until any invocations of this algorithm started before this one have completed." + // So if we're currently running a task, we'll need to delay this invocation. + if (currentlyRunningATask) { + // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a + // "too much recursion" error. + setTimeout(runIfPresent, 0, handle); + } else { + var task = tasksByHandle[handle]; + if (task) { + currentlyRunningATask = true; + try { + run(task); + } finally { + clearImmediate(handle); + currentlyRunningATask = false; + } + } + } + } + + function installNextTickImplementation() { + registerImmediate = function(handle) { + process.nextTick(function () { runIfPresent(handle); }); + }; + } + + function canUsePostMessage() { + // The test against `importScripts` prevents this implementation from being installed inside a web worker, + // where `global.postMessage` means something completely different and can't be used for this purpose. + if (global.postMessage && !global.importScripts) { + var postMessageIsAsynchronous = true; + var oldOnMessage = global.onmessage; + global.onmessage = function() { + postMessageIsAsynchronous = false; + }; + global.postMessage("", "*"); + global.onmessage = oldOnMessage; + return postMessageIsAsynchronous; + } + } + + function installPostMessageImplementation() { + // Installs an event handler on `global` for the `message` event: see + // * https://developer.mozilla.org/en/DOM/window.postMessage + // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages + + var messagePrefix = "setImmediate$" + Math.random() + "$"; + var onGlobalMessage = function(event) { + if (event.source === global && + typeof event.data === "string" && + event.data.indexOf(messagePrefix) === 0) { + runIfPresent(+event.data.slice(messagePrefix.length)); + } + }; + + if (global.addEventListener) { + global.addEventListener("message", onGlobalMessage, false); + } else { + global.attachEvent("onmessage", onGlobalMessage); + } + + registerImmediate = function(handle) { + global.postMessage(messagePrefix + handle, "*"); + }; + } + + function installMessageChannelImplementation() { + var channel = new MessageChannel(); + channel.port1.onmessage = function(event) { + var handle = event.data; + runIfPresent(handle); + }; + + registerImmediate = function(handle) { + channel.port2.postMessage(handle); + }; + } + + function installReadyStateChangeImplementation() { + var html = doc.documentElement; + registerImmediate = function(handle) { + // Create a diff --git a/.stylelintrc.js b/stylelint.config.js similarity index 100% rename from .stylelintrc.js rename to stylelint.config.js diff --git a/templates/expired.php b/templates/expired.php new file mode 100644 index 00000000..0b479779 --- /dev/null +++ b/templates/expired.php @@ -0,0 +1,31 @@ + + * + * @author Inigo Jiron + * @author John Molakvoæ + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +?> +
+
+

t('Form Expired')); ?>

+

t('This Form has expired and is no longer taking answers')); ?>

+
diff --git a/templates/expired.tmpl.php b/templates/expired.tmpl.php deleted file mode 100644 index 0583d664..00000000 --- a/templates/expired.tmpl.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * @author Inigo Jiron - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - - use OCP\Util; - Util::addStyle('forms', 'main'); -?> -
-
-

- t('Form Expired')); ?> -

-

- t('This Form has expired and is no longer taking answers.')); ?> -

-
diff --git a/templates/forms.tmpl.php b/templates/forms.tmpl.php deleted file mode 100644 index 3cdbf44f..00000000 --- a/templates/forms.tmpl.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * @author Vinzenz Rosenkranz - * @author René Gieling - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -?> - - -
diff --git a/templates/no.acc.tmpl.php b/templates/no.acc.tmpl.php deleted file mode 100644 index cc16b016..00000000 --- a/templates/no.acc.tmpl.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * @author Vinzenz Rosenkranz - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - - use OCP\Util; - Util::addStyle('forms', 'main'); -?> -
-
-

- t('Access denied')); ?> -

-

- t('You are not allowed to view this form or the form does not exist.')); ?> -

-
diff --git a/templates/no.create.tmpl.php b/templates/no.create.tmpl.php deleted file mode 100644 index cd562855..00000000 --- a/templates/no.create.tmpl.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * @author Vinzenz Rosenkranz - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - - use OCP\Util; - Util::addStyle('forms', 'main'); -?> -
-
-

- t('Access denied')); ?> -

-

- t('You are not allowed to edit this form or the form does not exist.')); ?> -

-
diff --git a/templates/no.delete.tmpl.php b/templates/no.delete.tmpl.php deleted file mode 100644 index f847d269..00000000 --- a/templates/no.delete.tmpl.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * @author Vinzenz Rosenkranz - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - - use OCP\Util; - Util::addStyle('forms', 'main'); -?> -
-
-

- t('Access denied')); ?> -

-

- t('You are either not allowed to delete this form or it doesn\'t exist.')); ?> -

-
diff --git a/templates/notfound.php b/templates/notfound.php new file mode 100644 index 00000000..c2bb0cd1 --- /dev/null +++ b/templates/notfound.php @@ -0,0 +1,31 @@ + + * + * @author Inigo Jiron + * @author John Molakvoæ + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +?> +
+
+

t('Form not found')); ?>

+

t('This form does not exists')); ?>

+
diff --git a/templates/submit.tmpl.php b/templates/submit.tmpl.php deleted file mode 100644 index b2c9f575..00000000 --- a/templates/submit.tmpl.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * @author Vinzenz Rosenkranz - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - - use OCP\Util; - - Util::addStyle('forms', 'submit'); - - Util::addScript('forms', 'submit'); - Util::addScript('forms', 'survey.jquery.min'); - - /** @var \OCA\Forms\Db\Form $form */ - $form = $_['form']; - /** @var OCA\Forms\Db\Question[] $questions */ - $questions = $_['questions']; - -?> - -getIsAnonymous()):?> -*NOTE: This form is anonymous - - -
diff --git a/webpack.common.js b/webpack.common.js index 8e996bab..7c70b115 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,14 +1,23 @@ const path = require('path') -const { VueLoaderPlugin } = require('vue-loader') +const webpack = require('webpack') + const StyleLintPlugin = require('stylelint-webpack-plugin') +const VueLoaderPlugin = require('vue-loader/lib/plugin') + +const appName = process.env.npm_package_name +const appVersion = process.env.npm_package_version +console.info('Building', appName, appVersion, '\n') module.exports = { - entry: path.join(__dirname, 'src', 'main.js'), + entry: { + forms: path.resolve(path.join('src', 'main.js')), + submit: path.resolve(path.join('src', 'submit.js')), + }, output: { - path: path.resolve(__dirname, './js'), + path: path.resolve('./js'), publicPath: '/js/', - filename: 'forms.js', - chunkFilename: 'chunks/[name].js', + filename: `[name].js`, + chunkFilename: `${appName}.[name].js?v=[contenthash]`, }, module: { rules: [ @@ -36,18 +45,14 @@ module.exports = { loader: 'babel-loader', exclude: /node_modules/, }, - { - test: /\.(png|jpg|gif|svg)$/, - loader: 'url-loader', - options: { - limit: 8192, - }, - }, ], }, plugins: [ new VueLoaderPlugin(), new StyleLintPlugin(), + // Make appName & appVersion available as a constant + new webpack.DefinePlugin({ appName }), + new webpack.DefinePlugin({ appVersion }), ], resolve: { extensions: ['*', '.js', '.vue'],