Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_retention.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-08-08 22:06:24 +0300
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2022-10-18 17:06:14 +0300
commit10e84df05faa702f22fa2c77b62741f26a5012bc (patch)
treefdbabf188e9ca813884d5837aea2c39f235f158c
parent04519e05305dfa233f1ddebbf94da28879d8ceb5 (diff)
Remove old code
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--css/retention.css32
-rw-r--r--js/admin.js178
-rw-r--r--js/retentioncollection.js37
-rw-r--r--js/retentionmodel.js51
-rw-r--r--js/retentionview.js100
-rw-r--r--js/template.handlebars8
-rw-r--r--js/template.js27
-rw-r--r--lib/Settings/Admin.php8
-rw-r--r--templates/admin.php46
9 files changed, 0 insertions, 487 deletions
diff --git a/css/retention.css b/css/retention.css
deleted file mode 100644
index aad0678..0000000
--- a/css/retention.css
+++ /dev/null
@@ -1,32 +0,0 @@
-#retention table {
- width: 100%;
- min-height: 50px;
- padding-top: 5px;
- max-width: 580px;
-}
-
-#retention table th {
- opacity: .5;
-}
-
-#retention table th,
-#retention table td {
- padding: 10px 10px 10px 0;
-}
-
-#retention #retention-list td {
- border-top: 1px solid #DDD;
- text-overflow: ellipsis;
- max-width: 200px;
- white-space: nowrap;
- overflow: hidden;
-}
-
-#retention tr *:nth-child(2) {
- text-align: right;
-}
-
-#retention #retention-list td a.icon-delete {
- display: block;
- opacity: 0.6;
-} \ No newline at end of file
diff --git a/js/admin.js b/js/admin.js
deleted file mode 100644
index 48c851e..0000000
--- a/js/admin.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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() {
- if (!OCA.File_Retention) {
- /**
- * @namespace
- */
- OCA.File_Retention = {};
- }
-
- OCA.File_Retention.Admin = {
-
- tagCollection: null,
-
- collection: null,
- view: null,
-
- currentTagId: null,
-
- notifyCheckbox: null,
-
- init: function() {
- var self = this;
-
- this.tagCollection = OC.SystemTags.collection;
- var loadingTags = this.tagCollection.fetch({
- success: function() {
- $('#retention_tag').select2(_.extend(self.select2));
- }
- });
-
- this.collection = new OCA.File_Retention.RetentionCollection();
- var loadingRetentions = this.collection.fetch();
-
- $.when(loadingTags, loadingRetentions).done(function () {
- self.view = new OCA.File_Retention.RetentionView({
- collection: self.collection,
- tagCollection: self.tagCollection
- });
-
- self.view.render();
- });
-
- $('#retention_submit').on('click', _.bind(this._onClickSubmit, this));
-
- this.notifyCheckbox = $('#retention_notify');
- this.notifyCheckbox.prop('checked', OCP.InitialState.loadState('files_retention', 'notify_before'));
- this.notifyCheckbox.change(function() {
- OCP.AppConfig.setValue('files_retention', 'notify_before', $(this).is(":checked") ? 'yes' : 'no')
- });
- },
-
- /**
- * Selecting a systemtag in select2
- *
- * @param {OC.SystemTags.SystemTagModel} tag
- */
- onSelectTag: function (tag) {
- this.currentTagId = parseInt(tag.id, 10);
-
- $('#retention_submit').prop('disabled', false);
- },
-
- /**
- * Clicking the Create button
- */
- _onClickSubmit: function () {
- var $el = $('#retention_amount');
- var amount = $el.val();
- if (!/^\d+$/.test(amount)) {
- $el.tooltip({
- title: t('files_retention', 'Not a number'),
- placement: 'bottom',
- trigger: 'manual'
- })
- .tooltip('show');
- return;
- }
- $el.tooltip('hide');
-
- var after = parseInt($('#retention_after').val(), 10);
- var unit = parseInt($('#retention_unit').val(), 10);
- amount = parseInt(amount, 10);
-
- if (isNaN(amount)) {
- amount = 10;
- }
-
- this.collection.create({
- tagid: this.currentTagId,
- timeunit: unit,
- timeamount: amount,
- timeafter: after,
- }, {
- success: function () {
- OC.Notification.showTemporary(t('files_retention', 'Retention rule saved'), {type: 'success'});
- },
- error: function (_, xhr) {
- OC.Notification.showTemporary(t('files_retention', 'An error occurred while trying to save the retention rule'), {type: 'error'});
- console.error(xhr)
- }
- });
-
- $('#retention_submit').prop('disabled', true);
- $('#retention_tag').select2('val', '');
- this.view.render();
- },
-
- /**
- * Select2 options for the SystemTag dropdown
- */
- select2: {
- allowClear: false,
- multiple: false,
- placeholder: t('files_retention', 'Select tag…'),
- query: _.debounce(function(query) {
- // Filter tag list by search
- var tags = OCA.File_Retention.Admin.tagCollection.filterByName(query.term);
-
- // Get all the tags already in used for retention rules
- var usedTagIds = OCA.File_Retention.Admin.collection.map(function(retention) {
- return retention.attributes.tagid;
- });
-
- // Filter tag list by tags already in use
- tags = tags.filter(function(tag) {
- return $.inArray(parseInt(tag.id, 10), usedTagIds) === -1;
- });
-
- query.callback({
- results: tags
- });
- }, 100, true),
- id: function(element) {
- return element;
- },
- initSelection: function(element, callback) {
- var selection = ($(element).val() || []).split('|').sort();
- callback(selection);
- },
- formatResult: function (tag) {
- return OC.SystemTags.getDescriptiveTag(tag);
- },
- formatSelection: function (tag) {
- OCA.File_Retention.Admin.onSelectTag(tag);
- return OC.SystemTags.getDescriptiveTag(tag);
- },
- escapeMarkup: function(m) {
- return m;
- }
- }
- };
-})();
-
-$(document).ready(function() {
- OCA.File_Retention.Admin.init();
-});
-
diff --git a/js/retentioncollection.js b/js/retentioncollection.js
deleted file mode 100644
index 31d1f7f..0000000
--- a/js/retentioncollection.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* global Backbone */
-
-/**
- * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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.File_Retention = OCA.File_Retention || {};
-
- var RetentionCollection = OC.Backbone.Collection.extend({
- model: OCA.File_Retention.RetentionModel,
-
- url: OC.generateUrl('/apps/files_retention/api/v1/retentions')
-
- });
-
- OCA.File_Retention.RetentionCollection = RetentionCollection;
-})();
diff --git a/js/retentionmodel.js b/js/retentionmodel.js
deleted file mode 100644
index 35834e6..0000000
--- a/js/retentionmodel.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* global Backbone */
-
-/**
- * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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.File_Retention = _.extend(OCA.File_Retention || {}, {
- RETENTION_UNIT_DAY: 0,
- RETENTION_UNIT_WEEK: 1,
- RETENTION_UNIT_MONTH: 2,
- RETENTION_UNIT_YEAR: 3,
-
- RETENTION_UNIT_MAP: {
- 0: t('files_retention', 'Days'),
- 1: t('files_retention', 'Weeks'),
- 2: t('files_retention', 'Months'),
- 3: t('files_retention', 'Years')
- },
-
- RETENTION_AFTER_MAP: {
- 0: t('files_retention', 'Creation'),
- 1: t('files_retention', 'Last modification'),
- },
- });
-
- var RetentionModel = OC.Backbone.Model.extend({
- });
-
-
- OCA.File_Retention.RetentionModel = RetentionModel;
-})();
diff --git a/js/retentionview.js b/js/retentionview.js
deleted file mode 100644
index aade6e0..0000000
--- a/js/retentionview.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/* global Handlebars, moment */
-
-/**
- * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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.File_Retention = OCA.File_Retention || {};
-
- var RetentionView = OC.Backbone.View.extend({
- collection: null,
- tagCollection: null,
-
- initialize: function(options) {
- this.collection = options.collection;
- this.tagCollection = options.tagCollection;
-
- var $el = $('#retention-list');
- $el.on('click', 'a.icon-delete', _.bind(this._onDeleteRetention, this));
- },
-
- template: function (data) {
- data.deleteString = t('files_retention', 'Delete');
-
- return OCA.File_Retention.Templates.template(data);
- },
-
- render: function () {
- var _this = this;
- var list = $('#retention-list');
- list.html('');
-
- if (this.collection.length > 0) {
- $('#retention-list-header').toggleClass('hidden', false);
- } else {
- $('#retention-list-header').toggleClass('hidden', true);
- }
-
- this.collection.forEach(function (model) {
- var data = {
- id: model.attributes.id,
- tagName: _this.tagCollection.get(model.attributes.tagid).attributes.name,
- timeAmount: model.attributes.timeamount,
- timeUnit: OCA.File_Retention.RETENTION_UNIT_MAP[model.attributes.timeunit],
- timeAfter: OCA.File_Retention.RETENTION_AFTER_MAP[model.attributes.timeafter],
- hasJob: model.attributes.hasJob ? t('files_retention', 'Yes') : t('files_retention', 'No'),
- };
- var html = _this.template(data);
- var $html = $(html);
- list.append($html);
- });
- },
-
- _onDeleteRetention: function(event) {
- var $target = $(event.target);
- var $row = $target.closest('tr');
- var id = $row.data('id');
-
- var retention = this.collection.get(id);
-
- if (_.isUndefined(retention)) {
- // Ignore event
- return;
- }
-
- var destroyingRetention = retention.destroy();
-
- $row.find('.icon-delete').tooltip('hide');
-
- var _this = this;
- $.when(destroyingRetention).fail(function () {
- OC.Notification.showTemporary(t('files_retention', 'Error while deleting the retention rule'));
- });
- $.when(destroyingRetention).always(function () {
- _this.render();
- });
- }
- });
-
- OCA.File_Retention.RetentionView = RetentionView;
-})();
diff --git a/js/template.handlebars b/js/template.handlebars
deleted file mode 100644
index 479f378..0000000
--- a/js/template.handlebars
+++ /dev/null
@@ -1,8 +0,0 @@
-<tr data-id="{{id}}">
- <td><span>{{tagName}}</span></td>
- <td><span>{{timeAmount}}</span></td>
- <td><span>{{timeUnit}}</span></td>
- <td><span>{{timeAfter}}</span></td>
- <td><span>{{hasJob}}</span></td>
- <td><a class="icon-delete has-tooltip" title="{{deleteString}}"></a></td>
-<tr>
diff --git a/js/template.js b/js/template.js
deleted file mode 100644
index 34c73e5..0000000
--- a/js/template.js
+++ /dev/null
@@ -1,27 +0,0 @@
-(function() {
- var template = Handlebars.template, templates = OCA.File_Retention.Templates = OCA.File_Retention.Templates || {};
-templates['template'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
- var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
- if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
- return parent[propertyName];
- }
- return undefined
- };
-
- return "<tr data-id=\""
- + alias4(((helper = (helper = lookupProperty(helpers,"id") || (depth0 != null ? lookupProperty(depth0,"id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"id","hash":{},"data":data,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}}) : helper)))
- + "\">\n <td><span>"
- + alias4(((helper = (helper = lookupProperty(helpers,"tagName") || (depth0 != null ? lookupProperty(depth0,"tagName") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"tagName","hash":{},"data":data,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":22}}}) : helper)))
- + "</span></td>\n <td><span>"
- + alias4(((helper = (helper = lookupProperty(helpers,"timeAmount") || (depth0 != null ? lookupProperty(depth0,"timeAmount") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"timeAmount","hash":{},"data":data,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":25}}}) : helper)))
- + "</span></td>\n <td><span>"
- + alias4(((helper = (helper = lookupProperty(helpers,"timeUnit") || (depth0 != null ? lookupProperty(depth0,"timeUnit") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"timeUnit","hash":{},"data":data,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":23}}}) : helper)))
- + "</span></td>\n <td><span>"
- + alias4(((helper = (helper = lookupProperty(helpers,"timeAfter") || (depth0 != null ? lookupProperty(depth0,"timeAfter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"timeAfter","hash":{},"data":data,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":24}}}) : helper)))
- + "</span></td>\n <td><span>"
- + alias4(((helper = (helper = lookupProperty(helpers,"hasJob") || (depth0 != null ? lookupProperty(depth0,"hasJob") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"hasJob","hash":{},"data":data,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":21}}}) : helper)))
- + "</span></td>\n <td><a class=\"icon-delete has-tooltip\" title=\""
- + alias4(((helper = (helper = lookupProperty(helpers,"deleteString") || (depth0 != null ? lookupProperty(depth0,"deleteString") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"deleteString","hash":{},"data":data,"loc":{"start":{"line":7,"column":47},"end":{"line":7,"column":63}}}) : helper)))
- + "\"></a></td>\n<tr>\n";
-},"useData":true});
-})(); \ No newline at end of file
diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php
index e22bc5f..cb7f50a 100644
--- a/lib/Settings/Admin.php
+++ b/lib/Settings/Admin.php
@@ -44,14 +44,6 @@ class Admin implements ISettings {
}
public function getForm(): TemplateResponse {
- Util::addScript('files_retention', 'retentionmodel');
- Util::addScript('files_retention', 'template');
- Util::addScript('files_retention', 'retentioncollection');
- Util::addScript('files_retention', 'retentionview');
- Util::addScript('files_retention', 'admin');
-
- Util::addStyle('files_retention', 'retention');
-
Util::addScript('files_retention', 'files_retention-main');
$this->initialStateService->provideInitialState(
diff --git a/templates/admin.php b/templates/admin.php
index b856e86..157a62f 100644
--- a/templates/admin.php
+++ b/templates/admin.php
@@ -1,47 +1 @@
-<?php
-/**
- * @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/>.
- *
- */
-
-/** @var \OCP\IL10N $l */
-?>
-
<div id="files_retention"></div>
-
-<form id="retention" class="section" data-systemtag-id="">
- <input type="hidden" name="retention_tag" id="retention_tag" placeholder="<?php p($l->t('Select tag…')); ?>" style="width: 400px;" />
- <br>
- <input type="number" id="retention_amount" name="retention_amount" value="10" style="width: 200px;">
-
- <select id="retention_unit">
- <option value="0"><?php p($l->t('Days')); ?></option>
- <option value="1"><?php p($l->t('Weeks')); ?></option>
- <option value="2"><?php p($l->t('Months')); ?></option>
- <option value="3"><?php p($l->t('Years')); ?></option>
- </select>
-
- <?php p($l->t('after')); ?>
-
- <select id="retention_after">
- <option value="0"><?php p($l->t('Creation')); ?></option>
- <option value="1"><?php p($l->t('Last modification')); ?></option>
- </select>
-
- <input type="button" id="retention_submit" value="<?php p($l->t('Create')); ?>" disabled>
-</form>