aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/IEventSourceFactory.php
blob: 0f6b447c0af56540ce908345523fc88074d9f550 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCP;

/**
 * @since 28.0.0
 */
interface IEventSourceFactory {
	/**
	 * Create a new event source
	 *
	 * @return IEventSource
	 * @since 28.0.0
	 */
	public function create(): IEventSource;
}
color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * Copyright (c) 2015
 *
 * This file is licensed under the Affero General Public License version 3
 * or later.
 *
 * See the COPYING-README file.
 *
 */

(function() {
	var TEMPLATE =
		'<div>' +
		'<div class="dialogContainer"></div>' +
		'</div>';

	/**
	 * @memberof OCA.Sharing
	 */
	var ShareTabView = OCA.Files.DetailTabView.extend(
		/** @lends OCA.Sharing.ShareTabView.prototype */ {
		id: 'shareTabView',
		className: 'tab shareTabView',

		template: function(params) {
			if (!this._template) {
				this._template = Handlebars.compile(TEMPLATE);
			}
			return this._template(params);
		},

		getLabel: function() {
			return t('files_sharing', 'Sharing');
		},

		/**
		 * Renders this details view
		 */
		render: function() {
			var self = this;
			if (this._dialog) {
				// remove/destroy older instance
				this._dialog.model.off();
				this._dialog.remove();
				this._dialog = null;
			}

			if (this.model) {
				this.$el.html(this.template());

				// TODO: the model should read these directly off the passed fileInfoModel
				var attributes = {
					itemType: this.model.isDirectory() ? 'folder' : 'file',
				   	itemSource: this.model.get('id'),
					possiblePermissions: this.model.get('sharePermissions')
				};
				var configModel = new OC.Share.ShareConfigModel();
				var shareModel = new OC.Share.ShareItemModel(attributes, {
					configModel: configModel,
					fileInfoModel: this.model
				});
				this._dialog = new OC.Share.ShareDialogView({
					configModel: configModel,
					model: shareModel
				});
				this.$el.find('.dialogContainer').append(this._dialog.$el);
				this._dialog.render();
				this._dialog.model.fetch();
				this._dialog.model.on('change', function() {
					self.trigger('sharesChanged', shareModel);
				});
			} else {
				this.$el.empty();
				// TODO: render placeholder text?
			}
		}
	});

	OCA.Sharing.ShareTabView = ShareTabView;
})();