mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-23 20:37:42 +00:00
review again
This commit is contained in:
@@ -7,20 +7,20 @@
|
||||
<h3>{% trans "Search Link"%}</h3>
|
||||
|
||||
<form id="search-link-form" method="get" action=".">
|
||||
<label>{% trans "Token" %}</label><input type="text" name="token" class="input" value="{{token}}" placeholder="{% trans "please input at least 3 characters" %}" title="{% trans "please input at least 3 characters" %}"/><br />
|
||||
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
||||
<label>{% trans "Token" %}</label><input type="text" name="token" class="input" value="{{token}}" placeholder="{% trans "please input at least 3 characters" %}" title="{% trans "please input at least 3 characters" %}" /><br />
|
||||
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
||||
</form>
|
||||
<div class="ovhd">
|
||||
<h3 class="fleft">{% trans "Result"%}</h3>
|
||||
</div>
|
||||
|
||||
<h3>{% trans "Result" %}</h3>
|
||||
|
||||
{% if publinks %}
|
||||
<table>
|
||||
<tr>
|
||||
<th width="25%">{% trans "Name" %}</th>
|
||||
<th width="25%">{% trans "Owner" %}</th>
|
||||
<th width="20%"><a href="#">{% trans "Create At" %}</a></th>
|
||||
<th width="12%"><a href="#">{% trans "Count" %}</a></th>
|
||||
<th width="18%">{% trans "Operations" %}</th>
|
||||
<th width="20%">{% trans "Create At" %}</th>
|
||||
<th width="12%">{% trans "Count" %}</th>
|
||||
<th width="18%"></th>
|
||||
</tr>
|
||||
{% for publink in publinks %}
|
||||
<tr>
|
||||
@@ -61,6 +61,7 @@ $('.rm-link').click(function() {
|
||||
beforeSend: prepareCSRFToken,
|
||||
success: function() {
|
||||
_this.closest('tr').remove();
|
||||
feedback("{% trans "Successfully deleted the link." %}", 'success');
|
||||
},
|
||||
error: ajaxErrorHandler
|
||||
});
|
||||
|
@@ -28,7 +28,7 @@
|
||||
<th width="25%">{% trans "Owner" %}</th>
|
||||
<th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Create At" %} {% if sort_by == 'time_down' %}<span class="sort-icon icon-caret-down"></span>{% elif sort_by == 'time_up' %}<span class="sort-icon icon-caret-up"></span>{% endif %}</a></th>
|
||||
<th width="12%"><a class="table-sort-op by-count" href="#">{% trans "Count" %} {% if sort_by == 'count_down' %}<span class="sort-icon icon-caret-up"></span>{% elif sort_by == 'count_up' %}<span class="sort-icon icon-caret-down"></span>{% endif %}</a></th>
|
||||
<th width="18%">{% trans "Operations" %}</th>
|
||||
<th width="18%"></th>
|
||||
</tr>
|
||||
{% for publink in publinks %}
|
||||
<tr>
|
||||
|
@@ -22,7 +22,7 @@
|
||||
<th width="25%">{% trans "Owner" %}</th>
|
||||
<th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Create At" %} {% if sort_by == 'time' %}<span class="sort-icon icon-caret-down"></span>{% elif sort_by == '-time' %}<span class="sort-icon icon-caret-up"></span>{% endif %}</a></th>
|
||||
<th width="12%"><a class="table-sort-op by-count" href="#">{% trans "Visits" %} {% if sort_by == 'count' %}<span class="sort-icon icon-caret-up"></span>{% elif sort_by == '-count' %}<span class="sort-icon icon-caret-down"></span>{% endif %}</a></th>
|
||||
<th width="18%">{% trans "Operations" %}</th>
|
||||
<th width="18%"></th>
|
||||
</tr>
|
||||
{% for uploadlink in uploadlinks %}
|
||||
<tr>
|
||||
|
@@ -1618,21 +1618,22 @@ def sys_upload_link_remove(request):
|
||||
@login_required
|
||||
@sys_staff_required
|
||||
def link_search(request):
|
||||
sort_by = request.GET.get('sort_by', 'time_up')
|
||||
token = request.GET.get('token', '')
|
||||
|
||||
publinks = FileShare.objects.filter(token__startswith=token)
|
||||
if len(token) < 3:
|
||||
publinks = []
|
||||
else:
|
||||
publinks = FileShare.objects.filter(token__startswith=token)
|
||||
|
||||
for l in publinks:
|
||||
if l.is_file_share_link():
|
||||
l.name = os.path.basename(l.path)
|
||||
else:
|
||||
l.name = os.path.dirname(l.path)
|
||||
for l in publinks:
|
||||
if l.is_file_share_link():
|
||||
l.name = os.path.basename(l.path)
|
||||
else:
|
||||
l.name = os.path.dirname(l.path)
|
||||
|
||||
return render_to_response(
|
||||
'sysadmin/link_search.html', {
|
||||
'publinks': publinks,
|
||||
'sort_by': sort_by,
|
||||
'token': token
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
|
@@ -55,3 +55,11 @@ class AdminSearchShareLinkText(BaseTestCase):
|
||||
resp = self.client.get(url)
|
||||
self.assertEqual(200, resp.status_code)
|
||||
self.assertEqual(0, len(resp.context['publinks']))
|
||||
|
||||
def test_search_file_share_link_info_by_short_token(self):
|
||||
self.login_as(self.admin)
|
||||
|
||||
url = reverse('link_search') + '?token=' + 'i'
|
||||
resp = self.client.get(url)
|
||||
self.assertEqual(200, resp.status_code)
|
||||
self.assertEqual(0, len(resp.context['publinks']))
|
||||
|
Reference in New Issue
Block a user