mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-10 11:22:09 +00:00
Merge branch 'lj'
This commit is contained in:
commit
be5954a669
@ -192,7 +192,12 @@ div.home-page h2 { font-style: italic; }
|
|||||||
|
|
||||||
span.small-action-link { font-size: 9px; }
|
span.small-action-link { font-size: 9px; }
|
||||||
input.ccnet_id { width: 400px; }
|
input.ccnet_id { width: 400px; }
|
||||||
.notification { background:#FDF; width:580px; margin:10px 0; border:1px solid #faf; padding:10px; }
|
.notification {
|
||||||
|
padding:5px;
|
||||||
|
width:580px;
|
||||||
|
background:#FDF;
|
||||||
|
margin:10px 0;
|
||||||
|
}
|
||||||
.repo-list {
|
.repo-list {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
@ -239,9 +244,13 @@ input.ccnet_id { width: 400px; }
|
|||||||
width:260px;
|
width:260px;
|
||||||
height:80px;
|
height:80px;
|
||||||
}
|
}
|
||||||
.text-core {
|
#repo-share-form .ui-autocomplete {
|
||||||
width:272px;
|
background:#fff;
|
||||||
}
|
}
|
||||||
.text-suggestion {
|
#repo-share-form .ui-menu-item {
|
||||||
background:none;
|
background-image:none;
|
||||||
|
}
|
||||||
|
#repo-share-form a {
|
||||||
|
color:#e83;
|
||||||
|
font-weight:normal;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -94,7 +94,6 @@
|
|||||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.simplemodal.1.4.1.min.js"></script>
|
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.simplemodal.1.4.1.min.js"></script>
|
||||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.cookie.js"></script>
|
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.cookie.js"></script>
|
||||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery-ui-1.8.16.custom.min.js"></script>
|
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery-ui-1.8.16.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.textext.js"></script>
|
|
||||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/utils.js"></script>
|
<script type="text/javascript" src="{{ MEDIA_URL }}js/utils.js"></script>
|
||||||
{% block extra_script %}{% endblock %}
|
{% block extra_script %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
@ -9,14 +9,14 @@
|
|||||||
|
|
||||||
{% block right_panel %}
|
{% block right_panel %}
|
||||||
{% if output_msg %}
|
{% if output_msg %}
|
||||||
{% for key, value in output_msg.items %}
|
{% for key, value in output_msg.items %}
|
||||||
{% if key == 'info_msg' %}
|
{% if key == 'info_msg' %}
|
||||||
<span class="info-msg" style="background-color:lightgreen">{{ value }} 前往<a href="{{ SITE_ROOT }}shareadmin/">共享管理</a>查看</span><br />
|
<p class="notification">{{ value }} 请前往<a href="{{ SITE_ROOT }}shareadmin/">共享管理</a>查看。</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if key == 'err_msg' %}
|
{% if key == 'err_msg' %}
|
||||||
<span class="err-msg" style="background-color:pink">{{ value }}</span><br />
|
<p class="error">{{ value }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h3>我拥有的同步目录</h3>
|
<h3>我拥有的同步目录</h3>
|
||||||
@ -70,48 +70,74 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form id="repo-share-form" action="{{ SITE_ROOT }}home/my/" method="post" name="repo-share-form" class="hide">
|
<form id="repo-share-form" action="{{ SITE_ROOT }}home/my/" method="post" name="repo-share-form" class="hide">
|
||||||
<label>邮箱(多个邮箱以;分隔)</label><br />
|
<label>邮箱:</label><br />
|
||||||
<textarea id="to_email" name="to_email"></textarea>
|
<textarea id="to_email" name="to_email"></textarea><br />
|
||||||
<input id="share_repo_id" type="hidden" name="share_repo_id" value="" />
|
<input id="share_repo_id" type="hidden" name="share_repo_id" value="" />
|
||||||
<input type="submit" value="提交" />
|
<p class="error hide">输入不能为空。</p>
|
||||||
|
<input type="submit" value="提交" id="share-submit-btn" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_script %}
|
{% block extra_script %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(".repo-share-btn").click(function() {
|
$(function() {
|
||||||
repo_id = $(this).attr("data");
|
//repo-share-form email autocomplete
|
||||||
$("#share_repo_id").val(repo_id);
|
var contact_list = [];
|
||||||
$("#repo-share-form").modal({appendTo: "#main", containerCss:{padding:18}});
|
|
||||||
});
|
|
||||||
|
|
||||||
addConfirmTo($('.repo-delete-btn'));
|
|
||||||
|
|
||||||
//repo-share-form email autocomplete
|
|
||||||
$('#to_email').textext({
|
|
||||||
plugins: 'autocomplete',
|
|
||||||
autocomplete: {
|
|
||||||
dropdownPosition: 'below',
|
|
||||||
render: function(suggestion) {
|
|
||||||
return suggestion;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
html: {
|
|
||||||
dropdown: '<div class="text-dropdown"><ul class="text-list"></ul></div>',
|
|
||||||
suggestion: '<li class="text-suggestion"><span class="text-label"></span></li>'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.bind('getSuggestions', function(e, data) {
|
|
||||||
var list = [],
|
|
||||||
textext = $(e.target).textext()[0],
|
|
||||||
query = (data ? data.query : '') || '';
|
|
||||||
|
|
||||||
{% for contact in contacts %}
|
{% for contact in contacts %}
|
||||||
list.push('{{ contact.contact_email }}');
|
contact_list.push('{{ contact.contact_email }}');
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
$(this).trigger('setSuggestions', { result: textext.itemManager().filter(list, query) });
|
function split(val) {
|
||||||
|
return val.split(/,\s*/);
|
||||||
|
}
|
||||||
|
function extractLast(term) {
|
||||||
|
return split(term).pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#to_email")
|
||||||
|
.bind("keydown", function(event) {
|
||||||
|
if (event.keyCode === $.ui.keyCode.TAB &&
|
||||||
|
$(this).data("autocomplete").menu.active) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.autocomplete({
|
||||||
|
appendTo: '#repo-share-form',
|
||||||
|
autoFocus: true,
|
||||||
|
delay: 100,
|
||||||
|
minLength: 0,
|
||||||
|
source: function(request, response) {
|
||||||
|
response($.ui.autocomplete.filter(contact_list, extractLast(request.term)));
|
||||||
|
},
|
||||||
|
focus: function() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
select: function(event, ui) {
|
||||||
|
var terms = split(this.value);
|
||||||
|
terms.pop();
|
||||||
|
terms.push(ui.item.value);
|
||||||
|
terms.push("");
|
||||||
|
this.value = terms.join(", ");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".repo-share-btn").click(function() {
|
||||||
|
$("#share_repo_id").val($(this).attr("data"));
|
||||||
|
$("#repo-share-form").modal({appendTo: "#main", containerCss:{padding:18}});
|
||||||
|
});
|
||||||
|
|
||||||
|
//check before post
|
||||||
|
$('#share-submit-btn').click(function() {
|
||||||
|
if (!$.trim($('#to_email').attr('value'))) {
|
||||||
|
$('#repo-share-form .error').removeClass('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
addConfirmTo($('.repo-delete-btn'));
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
{% if out_repos %}
|
{% if out_repos %}
|
||||||
<table class="repo-list">
|
<table class="repo-list">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="12%">名字</th>
|
<th width="20%">名字</th>
|
||||||
<th width="33%">共享给</th>
|
<th width="25%">共享给</th>
|
||||||
<th width="40%">描述</th>
|
<th width="45%">描述</th>
|
||||||
<th width="15%">操作</th>
|
<th width="10%">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for repo in out_repos %}
|
{% for repo in out_repos %}
|
||||||
<tr>
|
<tr>
|
||||||
|
11
views.py
11
views.py
@ -29,7 +29,7 @@ import settings
|
|||||||
def list_to_string(l):
|
def list_to_string(l):
|
||||||
tmp_str = ''
|
tmp_str = ''
|
||||||
for e in l[:-1]:
|
for e in l[:-1]:
|
||||||
tmp_str = tmp_str + e + ','
|
tmp_str = tmp_str + e + ', '
|
||||||
tmp_str = tmp_str + l[-1]
|
tmp_str = tmp_str + l[-1]
|
||||||
|
|
||||||
return tmp_str
|
return tmp_str
|
||||||
@ -426,15 +426,14 @@ def repo_add_share(request):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
from_email = request.user.username
|
from_email = request.user.username
|
||||||
repo_id = request.POST.get('share_repo_id', '')
|
repo_id = request.POST.get('share_repo_id', '')
|
||||||
to_emails = request.POST.get('to_email', '')
|
to_email_list = request.POST.get('to_email', '').split(',')
|
||||||
to_email_list = to_emails.split(';')
|
|
||||||
info_emails = []
|
info_emails = []
|
||||||
err_emails = []
|
err_emails = []
|
||||||
for to_email in to_email_list:
|
for to_email in to_email_list:
|
||||||
|
to_email = to_email.strip(' ')
|
||||||
if not to_email:
|
if not to_email:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
to_email = to_email.strip('" ')
|
|
||||||
if validate_emailuser(to_email) and validate_owner(request, repo_id):
|
if validate_emailuser(to_email) and validate_owner(request, repo_id):
|
||||||
seafserv_threaded_rpc.add_share(repo_id, from_email, to_email, 'rw')
|
seafserv_threaded_rpc.add_share(repo_id, from_email, to_email, 'rw')
|
||||||
info_emails.append(to_email)
|
info_emails.append(to_email)
|
||||||
@ -442,9 +441,9 @@ def repo_add_share(request):
|
|||||||
err_emails.append(to_email)
|
err_emails.append(to_email)
|
||||||
|
|
||||||
if info_emails:
|
if info_emails:
|
||||||
output_msg['info_msg'] = u'共享给%s成功,' % list_to_string(info_emails)
|
output_msg['info_msg'] = u'共享给%s成功,' % list_to_string(info_emails)
|
||||||
if err_emails:
|
if err_emails:
|
||||||
output_msg['err_msg'] = u'共享给%s失败: 用户不存在' % list_to_string(err_emails)
|
output_msg['err_msg'] = u'共享给%s失败:用户不存在' % list_to_string(err_emails)
|
||||||
|
|
||||||
return output_msg
|
return output_msg
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user