summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/js
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-07-27 15:37:03 +0200
committerJoas Schilling <coding@schilljs.com>2016-08-01 17:19:04 +0200
commitc6bf641ebeda790320ff58ba083e654b50e16900 (patch)
treef049915be3b8f52ed2cd693b7ceeaf3fb281d767 /apps/workflowengine/js
parent306d725bc3bb5f7d921887e5af7a5df95f215ec0 (diff)
downloadnextcloud-server-c6bf641ebeda790320ff58ba083e654b50e16900.tar.gz
nextcloud-server-c6bf641ebeda790320ff58ba083e654b50e16900.zip
Add system tag check
Diffstat (limited to 'apps/workflowengine/js')
-rw-r--r--apps/workflowengine/js/admin.js1
-rw-r--r--apps/workflowengine/js/filesystemtagsplugin.js82
2 files changed, 82 insertions, 1 deletions
diff --git a/apps/workflowengine/js/admin.js b/apps/workflowengine/js/admin.js
index b9f0744732f..e6df4b75f70 100644
--- a/apps/workflowengine/js/admin.js
+++ b/apps/workflowengine/js/admin.js
@@ -348,7 +348,6 @@
this.renderOperation(operation);
},
renderOperation: function(operation){
- console.log(operation);
var subView = new OCA.WorkflowEngine.OperationView({
model: operation
}),
diff --git a/apps/workflowengine/js/filesystemtagsplugin.js b/apps/workflowengine/js/filesystemtagsplugin.js
new file mode 100644
index 00000000000..6f2f231c5e7
--- /dev/null
+++ b/apps/workflowengine/js/filesystemtagsplugin.js
@@ -0,0 +1,82 @@
+/**
+ * @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.FileSystemTagsPlugin = {
+ getCheck: function() {
+ this.collection = OC.SystemTags.collection;
+ this.collection.fetch({
+ success: function() {
+ console.log('done loading tags');
+ }
+ });
+
+ return {
+ 'class': 'OCA\\WorkflowEngine\\Check\\FileSystemTags',
+ 'name': t('workflowengine', 'File system tag'),
+ 'operators': [
+ {'operator': 'is', 'name': t('workflowengine', 'is tagged with')},
+ {'operator': '!is', 'name': t('workflowengine', 'is not tagged with')}
+ ]
+ };
+ },
+ render: function(element, classname, value) {
+ if (classname !== 'OCA\\WorkflowEngine\\Check\\FileSystemTags') {
+ return;
+ }
+
+ $(element).css('width', '400px');
+
+ $(element).select2({
+ allowClear: false,
+ multiple: false,
+ placeholder: t('workflowengine', 'Select tag…'),
+ query: _.debounce(function(query) {
+ query.callback({
+ results: OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin.collection.filterByName(query.term)
+ });
+ }, 100, true),
+ id: function(element) {
+ return element.get('id');
+ },
+ initSelection: function(element, callback) {
+ var selection = ($(element).val() || []).split('|').sort();
+ callback(selection);
+ },
+ formatResult: function (tag) {
+ return OC.SystemTags.getDescriptiveTag(tag);
+ },
+ formatSelection: function (tagId) {
+ tag = OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin.collection.get(tagId);
+ return OC.SystemTags.getDescriptiveTag(tag);
+ },
+ escapeMarkup: function(m) {
+ return m;
+ }
+ });
+ }
+ };
+})();
+
+OC.Plugins.register('OCA.WorkflowEngine.CheckPlugins', OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin);