summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/js
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-07-28 15:09:57 +0200
committerJoas Schilling <coding@schilljs.com>2016-08-01 17:19:05 +0200
commite0b5949a9f6ba661c2927d559231289517c0fe34 (patch)
tree606a058f66717093cc4bb0b2c6ab2d1055168267 /apps/workflowengine/js
parent2cfd67e13b6f5f9e37f0dbd7988aad6a23be45c5 (diff)
downloadnextcloud-server-e0b5949a9f6ba661c2927d559231289517c0fe34.tar.gz
nextcloud-server-e0b5949a9f6ba661c2927d559231289517c0fe34.zip
Add request time
Diffstat (limited to 'apps/workflowengine/js')
-rw-r--r--apps/workflowengine/js/requesttimeplugin.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/apps/workflowengine/js/requesttimeplugin.js b/apps/workflowengine/js/requesttimeplugin.js
new file mode 100644
index 00000000000..aee0e773c9e
--- /dev/null
+++ b/apps/workflowengine/js/requesttimeplugin.js
@@ -0,0 +1,54 @@
+/**
+ * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
+ *
+ * @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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+(function() {
+
+ OCA.WorkflowEngine = OCA.WorkflowEngine || {};
+ OCA.WorkflowEngine.Plugins = OCA.WorkflowEngine.Plugins || {};
+
+ OCA.WorkflowEngine.Plugins.RequestTimePlugin = {
+ getCheck: function() {
+ return {
+ 'class': 'OCA\\WorkflowEngine\\Check\\RequestTime',
+ 'name': t('workflowengine', 'Request time'),
+ 'operators': [
+ {'operator': 'in', 'name': t('workflowengine', 'between')},
+ {'operator': '!in', 'name': t('workflowengine', 'not between')}
+ ]
+ };
+ },
+ render: function(element, check) {
+ if (check['class'] !== 'OCA\\WorkflowEngine\\Check\\RequestTime') {
+ return;
+ }
+
+ var placeholder = '["10:00 Europe\\/Berlin","16:00 Europe\\/Berlin"]'; // FIXME need a time picker JS plugin
+ $(element).css('width', '300px')
+ .attr('placeholder', placeholder)
+ .attr('title', t('workflowengine', 'Example: {placeholder}', {placeholder: placeholder}, undefined, {escape: false}))
+ .addClass('has-tooltip')
+ .tooltip({
+ placement: 'bottom'
+ });
+ }
+ };
+})();
+
+OC.Plugins.register('OCA.WorkflowEngine.CheckPlugins', OCA.WorkflowEngine.Plugins.RequestTimePlugin);