mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 14:42:10 +00:00
[system admin] libraries: added 'history setting'
This commit is contained in:
@@ -102,9 +102,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 'js/templates.html' %}
|
||||
</div><!-- wrapper -->
|
||||
|
||||
{% include 'js/common-templates.html' %}
|
||||
{% include 'js/templates.html' %}
|
||||
<script type="text/javascript">
|
||||
var app = {
|
||||
config: {
|
||||
|
34
seahub/templates/js/common-templates.html
Normal file
34
seahub/templates/js/common-templates.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{# templates in this file are used for both 'app' & 'sysadmin-app' #}
|
||||
{% load i18n %}
|
||||
<script type="text/template" id="history-settings-dialog-tmpl">
|
||||
<h3 id="dialogTitle"><%= title %></h3>
|
||||
|
||||
<p class="history-settings-notice outstanding-tip hide">{% trans "Setting library history is disabled by Admin" %}</p>
|
||||
|
||||
<form action="" method="post">
|
||||
<label class="radio-item">
|
||||
<input type="radio" name="history" value="full_history" class="vam" />
|
||||
<span class="vam">{% trans "Keep full history" %}</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<label class="radio-item">
|
||||
<input type="radio" name="history" value="no_history" class="vam" />
|
||||
<span class="vam">{% trans "Don't keep history" %}</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<label class="radio-item">
|
||||
<input type="radio" name="history" value="partial_history" class="vam" />
|
||||
<span calss="vam">{% trans "Only keep a period of history:" %}
|
||||
<input type="text" name="days" size="4" disabled="disabled" class="input-disabled" value="<%= default_history_limit %>" /> {% trans "days" %}
|
||||
</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
||||
</form>
|
||||
|
||||
<span class="loading-icon loading-tip"></span>
|
||||
<p class="error hide"></p>
|
||||
</script>
|
@@ -406,9 +406,15 @@
|
||||
<td>
|
||||
<a href="#" class="sf2-icon-delete sf2-x repo-delete-btn op-icon vh" title="{% trans "Delete" %}" aria-label="{% trans "Delete" %}"></a>
|
||||
<a href="#" class="sf2-icon-move sf2-x repo-transfer-btn op-icon vh" title="{% trans "Transfer" %}" aria-label="{% trans "Transfer" %}"></a>
|
||||
<% if (!encrypted) { %>
|
||||
<a href="#" class="sf2-icon-share sf2-x repo-share-btn op-icon vh" title="{% trans "Share" %}" aria-label="{% trans "Share" %}"></a>
|
||||
<% } %>
|
||||
<div class="sf-dropdown sf-dropdown-inline">
|
||||
<a href="#" class="sf2-icon-caret-down more-op-icon op-icon vh sf-dropdown-toggle" title="{% trans "More Operations" %}" aria-label="{% trans "More Operations" %}"></a>
|
||||
<ul class="hidden-op repo-hidden-op hide sf-dropdown-menu">
|
||||
<% if (!encrypted) { %>
|
||||
<li><a class="op js-repo-share" href="#">{% trans "Share" %}</a></li>
|
||||
<% } %>
|
||||
<li><a class="op js-popup-history-setting" href="#">{% trans "History Setting" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</script>
|
||||
|
||||
|
@@ -1783,39 +1783,6 @@
|
||||
<% } %>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="history-settings-dialog-tmpl">
|
||||
<h3 id="dialogTitle"><%= title %></h3>
|
||||
|
||||
<p class="history-settings-notice outstanding-tip hide">{% trans "Setting library history is disabled by Admin" %}</p>
|
||||
|
||||
<form action="" method="post">
|
||||
<label class="radio-item">
|
||||
<input type="radio" name="history" value="full_history" class="vam" />
|
||||
<span class="vam">{% trans "Keep full history" %}</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<label class="radio-item">
|
||||
<input type="radio" name="history" value="no_history" class="vam" />
|
||||
<span class="vam">{% trans "Don't keep history" %}</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<label class="radio-item">
|
||||
<input type="radio" name="history" value="partial_history" class="vam" />
|
||||
<span calss="vam">{% trans "Only keep a period of history:" %}
|
||||
<input type="text" name="days" size="4" disabled="disabled" class="input-disabled" value="<%= default_history_limit %>" /> {% trans "days" %}
|
||||
</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
||||
</form>
|
||||
|
||||
<span class="loading-icon loading-tip"></span>
|
||||
<p class="error hide"></p>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="repo-shared-links-admin-dialog-tmpl">
|
||||
<h3 id="dialogTitle"><%= title %></h3>
|
||||
<div id="repo-shared-links" class="nav-con-tabs js-tabs">
|
||||
|
@@ -72,9 +72,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 'js/sysadmin-templates.html' %}
|
||||
</div><!-- wrapper -->
|
||||
|
||||
{% include 'js/common-templates.html' %}
|
||||
{% include 'js/sysadmin-templates.html' %}
|
||||
{% include "js/lib-op-popups.html" %}
|
||||
<script type="text/javascript">
|
||||
var app = {
|
||||
@@ -98,6 +99,7 @@ app["pageOptions"] = {
|
||||
thumbnail_default_size: {{ thumbnail_default_size }},
|
||||
thumbnail_size_for_grid: {{ thumbnail_size_for_grid }},
|
||||
enable_encrypted_library: {% if enable_encrypted_library %} true {% else %} false {% endif %},
|
||||
enable_repo_history_setting: {% if enable_repo_history_setting %} true {% else %} false {% endif %},
|
||||
max_upload_file_size: {% if max_upload_file_size %} {{ max_upload_file_size }} {% else %} '' {% endif %},
|
||||
folder_perm_enabled: {% if folder_perm_enabled %} true {% else %} false {% endif %},
|
||||
is_pro: {% if is_pro %} true {% else %} false {% endif %},
|
||||
|
@@ -13,6 +13,7 @@ define([
|
||||
initialize: function(options) {
|
||||
this.repo_name = options.repo_name;
|
||||
this.repo_id = options.repo_id;
|
||||
this.url_name = options.url_name;
|
||||
|
||||
this.render();
|
||||
this.$('.op-target').css({'max-width':280}); // for long repo name
|
||||
@@ -48,7 +49,7 @@ define([
|
||||
|
||||
$.ajax({
|
||||
url: Common.getUrl({
|
||||
'name': 'repo_history_limit',
|
||||
'name': this.url_name,
|
||||
'repo_id': this.repo_id
|
||||
}),
|
||||
type: 'get',
|
||||
@@ -120,7 +121,7 @@ define([
|
||||
|
||||
$.ajax({
|
||||
url: Common.getUrl({
|
||||
'name': 'repo_history_limit',
|
||||
'name': this.url_name,
|
||||
'repo_id': this.repo_id
|
||||
}),
|
||||
type: 'put',
|
||||
|
@@ -289,7 +289,8 @@ define([
|
||||
popupHistorySetting: function() {
|
||||
var options = {
|
||||
'repo_name': this.model.get('name'),
|
||||
'repo_id': this.model.get('id')
|
||||
'repo_id': this.model.get('id'),
|
||||
'url_name': 'repo_history_limit'
|
||||
};
|
||||
this.togglePopup(); // close the popup
|
||||
new HistorySettingsDialog(options);
|
||||
|
@@ -176,6 +176,7 @@ define([
|
||||
case 'admin-device-errors': return siteRoot + 'api/v2.1/admin/device-errors/';
|
||||
case 'admin-libraries': return siteRoot + 'api/v2.1/admin/libraries/';
|
||||
case 'admin-library': return siteRoot + 'api/v2.1/admin/libraries/' + options.repo_id + '/';
|
||||
case 'admin-library-history-limit': return siteRoot + 'api/v2.1/admin/libraries/' + options.repo_id + '/history-limit/';
|
||||
case 'admin-library-dirents': return siteRoot + 'api/v2.1/admin/libraries/' + options.repo_id + '/dirents/';
|
||||
case 'admin-groups': return siteRoot + 'api/v2.1/admin/groups/';
|
||||
case 'admin-group': return siteRoot + 'api/v2.1/admin/groups/' + options.group_id + '/';
|
||||
|
@@ -8,9 +8,12 @@ define([
|
||||
'select2',
|
||||
'jquery.ui.tabs',
|
||||
'sysadmin-app/views/share',
|
||||
'app/views/widgets/hl-item-view'
|
||||
'app/views/dialogs/repo-history-settings',
|
||||
'app/views/widgets/hl-item-view',
|
||||
'app/views/widgets/dropdown'
|
||||
], function($, _, Backbone, Common, Moment, Simplemodal,
|
||||
Select2, Tabs, ShareView, HLItemView) {
|
||||
Select2, Tabs, ShareView, HistorySettingsDialog,
|
||||
HLItemView, DropdownView) {
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -21,7 +24,8 @@ define([
|
||||
transferTemplate: _.template($('#library-transfer-form-tmpl').html()),
|
||||
|
||||
events: {
|
||||
'click .repo-share-btn': 'share',
|
||||
'click .js-repo-share': 'share',
|
||||
'click .js-popup-history-setting': 'popupHistorySetting',
|
||||
'click .repo-delete-btn': 'deleteLibrary',
|
||||
'click .repo-transfer-btn': 'transferLibrary'
|
||||
},
|
||||
@@ -32,9 +36,25 @@ define([
|
||||
'repo_name': this.model.get('name')
|
||||
};
|
||||
new ShareView(options);
|
||||
this.togglePopup(); // close the popup
|
||||
return false;
|
||||
},
|
||||
|
||||
popupHistorySetting: function() {
|
||||
var options = {
|
||||
'repo_name': this.model.get('name'),
|
||||
'repo_id': this.model.get('id'),
|
||||
'url_name': 'admin-library-history-limit'
|
||||
};
|
||||
this.togglePopup(); // close the popup
|
||||
new HistorySettingsDialog(options);
|
||||
return false;
|
||||
},
|
||||
|
||||
togglePopup: function() {
|
||||
this.dropdown.hide();
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
HLItemView.prototype.initialize.call(this);
|
||||
this.listenTo(this.model, "change", this.render);
|
||||
@@ -146,6 +166,11 @@ define([
|
||||
|
||||
this.$el.html(this.template(data));
|
||||
|
||||
this.dropdown = new DropdownView({
|
||||
el: this.$('.sf-dropdown'),
|
||||
right: 0
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user