mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
Merge branch 'pubinfo'
Conflicts: thirdpart/seaserv/__init__.py views.py
This commit is contained in:
@@ -11,10 +11,13 @@ form,input,textarea,button,img {
|
|||||||
}
|
}
|
||||||
body,
|
body,
|
||||||
input, textarea, button, select {
|
input, textarea, button, select {
|
||||||
font: 13px/19px Arial, Helvetica, sans-serif;/* 19px : for ff*/
|
font: 13px/1.5 Arial, Helvetica, sans-serif;
|
||||||
color: #333;
|
color: #333;
|
||||||
word-wrap:break-word; /* for en */
|
word-wrap:break-word; /* for en */
|
||||||
}
|
}
|
||||||
|
input, button, select {
|
||||||
|
line-height:19px;/*for ff*/
|
||||||
|
}
|
||||||
h1 {
|
h1 {
|
||||||
font-size:1.9em;
|
font-size:1.9em;
|
||||||
margin:1.1em 0 0.5em;
|
margin:1.1em 0 0.5em;
|
||||||
@@ -303,7 +306,33 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
.center-contents {
|
.center-contents {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.tabnav {
|
||||||
|
height:37px;
|
||||||
|
border-bottom:1px solid #ddd;
|
||||||
|
}
|
||||||
|
.tabnav-tabs {
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
.tabnav-tab {
|
||||||
|
display:inline-block;
|
||||||
|
font-size:14px;
|
||||||
|
padding:8px 10px;
|
||||||
|
border:1px solid transparent;
|
||||||
|
border-bottom:0;
|
||||||
|
}
|
||||||
|
.tabnav-tab a {
|
||||||
|
color:#666;
|
||||||
|
font-weight:normal;
|
||||||
|
}
|
||||||
|
.tabnav-tab a:hover {
|
||||||
|
}
|
||||||
|
.tabnav-tab-cur {
|
||||||
|
font-weight:bold;
|
||||||
|
border-color:#ddd;
|
||||||
|
border-radius:3px 3px 0 0;
|
||||||
|
background:#fff;
|
||||||
|
margin-bottom:-1px;
|
||||||
|
}
|
||||||
/* container */
|
/* container */
|
||||||
#main, #footer { width:950px; }
|
#main, #footer { width:950px; }
|
||||||
#main { margin:0 auto; }
|
#main { margin:0 auto; }
|
||||||
@@ -1180,19 +1209,23 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
height:80px;
|
height:80px;
|
||||||
}
|
}
|
||||||
/* group, org */
|
/* group, org */
|
||||||
.group-list {
|
.group-list,
|
||||||
margin-top:20px;
|
.user-list {
|
||||||
|
margin-top:30px;
|
||||||
}
|
}
|
||||||
.group-list .group {
|
.group-list .group,
|
||||||
|
.user-list .user {
|
||||||
display:inline-block; /*to handle different height of items*/
|
display:inline-block; /*to handle different height of items*/
|
||||||
vertical-align:top;
|
vertical-align:top;
|
||||||
width:315px;
|
width:315px;
|
||||||
margin:0 17px 25px 0;
|
margin:0 17px 25px 0;
|
||||||
}
|
}
|
||||||
.group-list .group {
|
.group-list .group,
|
||||||
|
.user-list .user {
|
||||||
*display:inline; /* for ie 6,7 */
|
*display:inline; /* for ie 6,7 */
|
||||||
}
|
}
|
||||||
.group .txt {
|
.group .txt,
|
||||||
|
.user-list .user .txt {
|
||||||
color:#333;
|
color:#333;
|
||||||
width:250px;
|
width:250px;
|
||||||
}
|
}
|
||||||
@@ -1745,3 +1778,17 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
.diff-chg {
|
.diff-chg {
|
||||||
color: #c3f;
|
color: #c3f;
|
||||||
}
|
}
|
||||||
|
.pubinfo-item {
|
||||||
|
display:inline-block;
|
||||||
|
min-width:66px;
|
||||||
|
}
|
||||||
|
.pubinfo-item .amount {
|
||||||
|
font-size:28px;
|
||||||
|
line-height:1;
|
||||||
|
font-weight:bold;
|
||||||
|
color:#222;
|
||||||
|
}
|
||||||
|
.pubinfo-item .obj {
|
||||||
|
font-size:11px;
|
||||||
|
color:#999;
|
||||||
|
}
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{% if not cloud_mode %}
|
{% if not cloud_mode %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'seahub.views.pubinfo' %}" {% block nav_pubinfo_class %}{% endblock %}>{% trans "Public Info" %}</a>
|
<a href="{% url 'pubrepo' %}" {% block nav_pubinfo_class %}{% endblock %}>{% trans "Public Info" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
38
templates/pubgrp.html
Normal file
38
templates/pubgrp.html
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{% extends "myhome_base.html" %}
|
||||||
|
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
|
||||||
|
{% load url from future %}
|
||||||
|
|
||||||
|
{% block nav_pubinfo_class %}class="cur"{% endblock %}
|
||||||
|
|
||||||
|
{% block left_panel %}
|
||||||
|
{% include 'snippets/pubinfo.html' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block right_panel %}
|
||||||
|
<div class="tabnav">
|
||||||
|
<ul class="tabnav-tabs">
|
||||||
|
<li class="tabnav-tab"><a href="{% url 'pubrepo' %}">{% trans "Libraries" %}</a></li>
|
||||||
|
<li class="tabnav-tab tabnav-tab-cur">{% trans "Groups" %}</li>
|
||||||
|
<li class="tabnav-tab"><a href="{% url 'pubuser' %}">{% trans "Users" %}</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% if groups %}
|
||||||
|
<ul class="group-list">
|
||||||
|
{% for group in groups %}
|
||||||
|
<li class="group ovhd">
|
||||||
|
<a href="{{ SITE_ROOT }}group/{{ group.props.id }}/" class="no-deco pic fleft">{% grp_avatar group.props.id 48 %}</a>
|
||||||
|
<div class="txt fright">
|
||||||
|
<h4><a href="{{ SITE_ROOT }}group/{{ group.props.id }}/">{{ group.props.group_name }}</a></h4>
|
||||||
|
<p><span class="item-name">{% trans "Creator: "%}</span>{{ group.props.creator_name }}</p>
|
||||||
|
<p><span class="item-name">{% trans "Time: "%}</span>{{ group.props.timestamp|tsstr_sec }}</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<div class="empty-tips">
|
||||||
|
<h2 class="center-contents">{% trans "No one has created any groups yet" %}</h2>
|
||||||
|
<p> {% blocktrans %}You can click "Add Group" button under "Group" label to create a group. {% endblocktrans %}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
@@ -1,113 +0,0 @@
|
|||||||
{% extends "myhome_base.html" %}
|
|
||||||
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
|
|
||||||
{% load url from future %}
|
|
||||||
|
|
||||||
{% block nav_pubinfo_class %}class="cur"{% endblock %}
|
|
||||||
|
|
||||||
{% block left_panel %}
|
|
||||||
<h3>{% trans "Users" %}</h3>
|
|
||||||
{% if users %}
|
|
||||||
<ul>
|
|
||||||
{% for member in users %}
|
|
||||||
<li class="member">{% avatar member.email 16 %}<a class="name" href="{{ SITE_ROOT }}profile/{{ member.email }}/">{{ member.email|email2nickname }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% include "snippets/user_profile_html.html" %}
|
|
||||||
{% else %}
|
|
||||||
<p>{% trans "None"%}</p>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block right_panel %}
|
|
||||||
<h3>{% trans "Libraries & Groups" %}</h3>
|
|
||||||
<div id="tabs">
|
|
||||||
<div class="ovhd">
|
|
||||||
<ul id="tabs-nav" class="fleft">
|
|
||||||
<li><a href="#repos">{% trans "Libraries" %}</a></li>
|
|
||||||
<li><a href="#grps">{% trans "Groups" %}</a></li>
|
|
||||||
</ul>
|
|
||||||
<button id="repo-create" class="add fright">{% trans "New Library"%}</button>
|
|
||||||
</div>
|
|
||||||
<div id="repos" class="hide">
|
|
||||||
{% if public_repos %}
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th width="4%"></th>
|
|
||||||
<th width="20%">{% trans "Name"%}</th>
|
|
||||||
<th width="33%">{% trans "Description"%}</th>
|
|
||||||
<th width="15%">{% trans "Last Update"%}</th>
|
|
||||||
<th width="15%">{% trans "Share From"%}</th>
|
|
||||||
<th width="13%">{% trans "Operations"%}</th>
|
|
||||||
</tr>
|
|
||||||
{% for repo in public_repos %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{% if repo.user_perm == 'rw' %}
|
|
||||||
<img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write"%}" alt="{% trans "Directory icon"%}" />
|
|
||||||
{% else %}
|
|
||||||
<img src="{{MEDIA_URL}}img/folder-no-write-20.png" title="{% trans "Read-Only"%}" alt="{% trans "Directory icon"%}" />
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td><a href="{% url 'repo' repo.props.repo_id %}">{{ repo.props.repo_name }}</a></td>
|
|
||||||
<td>{{ repo.props.repo_desc }}</td>
|
|
||||||
<td>{% if repo.props.last_modified %}{{ repo.props.last_modified|translate_seahub_time }}{% else %}--{% endif %}</td>
|
|
||||||
<td>{{ repo.props.user|email2nickname }}</td>
|
|
||||||
<td>
|
|
||||||
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.repo_id }}" class="download-btn op-icon vh" title="{% trans "Download"%}" alt="{% trans "Download"%}" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<div class="empty-tips">
|
|
||||||
<h2 class="center-contents">{% trans "No public library" %}</h2>
|
|
||||||
<p>{% blocktrans %}You can create a public library by clicking "New Library" button, others can view and download this library.{% endblocktrans %}</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% include "snippets/repo_create_form.html" %}
|
|
||||||
</div>
|
|
||||||
<div id="grps" class="hide">
|
|
||||||
{% if groups %}
|
|
||||||
<ul class="group-list w100 ovhd">
|
|
||||||
{% for group in groups %}
|
|
||||||
<li class="group ovhd">
|
|
||||||
<a href="{{ SITE_ROOT }}group/{{ group.props.id }}/" class="no-deco pic fleft">{% grp_avatar group.props.id 48 %}</a>
|
|
||||||
<div class="txt fright">
|
|
||||||
<h4><a href="{{ SITE_ROOT }}group/{{ group.props.id }}/">{{ group.props.group_name }}</a></h4>
|
|
||||||
<p><span class="item-name">{% trans "Creator: "%}</span>{{ group.props.creator_name }}</p>
|
|
||||||
<p><span class="item-name">{% trans "Time: "%}</span>{{ group.props.timestamp|tsstr_sec }}</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<div class="empty-tips">
|
|
||||||
<h2 class="center-contents">{% trans "No one has created any groups yet" %}</h2>
|
|
||||||
<p> {% blocktrans %}You can click "Add Group" button under "Group" label to create a group. {% endblocktrans %}</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block extra_script %}
|
|
||||||
{% include "snippets/user_profile_js.html" %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(".download-btn").click(function() {
|
|
||||||
window.open('{{ SITE_ROOT }}seafile_access_check/?repo_id=' + $(this).attr('data'));
|
|
||||||
});
|
|
||||||
|
|
||||||
$("table tr:gt(0)").hover(
|
|
||||||
function() {
|
|
||||||
$(this).find('.op-icon').css('cursor', 'pointer').removeClass('vh');
|
|
||||||
},
|
|
||||||
function() {
|
|
||||||
$(this).find('.op-icon').addClass('vh');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
{% url 'seahub.views.public_repo_create' as repo_create_url %}
|
|
||||||
{% with post_url=repo_create_url %}
|
|
||||||
{% include "snippets/repo_create_js.html" %}
|
|
||||||
{% endwith %}
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
77
templates/pubrepo.html
Normal file
77
templates/pubrepo.html
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
{% extends "myhome_base.html" %}
|
||||||
|
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
|
||||||
|
{% load url from future %}
|
||||||
|
|
||||||
|
{% block nav_pubinfo_class %}class="cur"{% endblock %}
|
||||||
|
|
||||||
|
{% block left_panel %}
|
||||||
|
{% include 'snippets/pubinfo.html' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block right_panel %}
|
||||||
|
<div class="tabnav">
|
||||||
|
<ul class="tabnav-tabs">
|
||||||
|
<li class="tabnav-tab tabnav-tab-cur">{% trans "Libraries" %}</li>
|
||||||
|
<li class="tabnav-tab"><a href="{% url 'pubgrp' %}">{% trans "Groups" %}</a></li>
|
||||||
|
<li class="tabnav-tab"><a href="{% url 'pubuser' %}">{% trans "Users" %}</a></li>
|
||||||
|
</ul>
|
||||||
|
<button id="repo-create" class="add fright">{% trans "New Library"%}</button>
|
||||||
|
</div>
|
||||||
|
{% if public_repos %}
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th width="4%"></th>
|
||||||
|
<th width="20%">{% trans "Name"%}</th>
|
||||||
|
<th width="33%">{% trans "Description"%}</th>
|
||||||
|
<th width="15%">{% trans "Last Update"%}</th>
|
||||||
|
<th width="15%">{% trans "Share From"%}</th>
|
||||||
|
<th width="13%">{% trans "Operations"%}</th>
|
||||||
|
</tr>
|
||||||
|
{% for repo in public_repos %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{% if repo.user_perm == 'rw' %}
|
||||||
|
<img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write"%}" alt="{% trans "Directory icon"%}" />
|
||||||
|
{% else %}
|
||||||
|
<img src="{{MEDIA_URL}}img/folder-no-write-20.png" title="{% trans "Read-Only"%}" alt="{% trans "Directory icon"%}" />
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td><a href="{% url 'repo' repo.props.repo_id %}">{{ repo.props.repo_name }}</a></td>
|
||||||
|
<td>{{ repo.props.repo_desc }}</td>
|
||||||
|
<td>{% if repo.props.last_modified %}{{ repo.props.last_modified|translate_seahub_time }}{% else %}--{% endif %}</td>
|
||||||
|
<td>{{ repo.props.user|email2nickname }}</td>
|
||||||
|
<td>
|
||||||
|
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.repo_id }}" class="download-btn op-icon vh" title="{% trans "Download"%}" alt="{% trans "Download"%}" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<div class="empty-tips">
|
||||||
|
<h2 class="center-contents">{% trans "No public library" %}</h2>
|
||||||
|
<p>{% blocktrans %}You can create a public library by clicking "New Library" button, others can view and download this library.{% endblocktrans %}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% include "snippets/repo_create_form.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extra_script %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(".download-btn").click(function() {
|
||||||
|
window.open('{{ SITE_ROOT }}seafile_access_check/?repo_id=' + $(this).attr('data'));
|
||||||
|
});
|
||||||
|
|
||||||
|
$("table tr:gt(0)").hover(
|
||||||
|
function() {
|
||||||
|
$(this).find('.op-icon').css('cursor', 'pointer').removeClass('vh');
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
$(this).find('.op-icon').addClass('vh');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
{% url 'seahub.views.public_repo_create' as repo_create_url %}
|
||||||
|
{% with post_url=repo_create_url %}
|
||||||
|
{% include "snippets/repo_create_js.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
34
templates/pubuser.html
Normal file
34
templates/pubuser.html
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends "myhome_base.html" %}
|
||||||
|
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
|
||||||
|
{% load url from future %}
|
||||||
|
|
||||||
|
{% block nav_pubinfo_class %}class="cur"{% endblock %}
|
||||||
|
|
||||||
|
{% block left_panel %}
|
||||||
|
{% include 'snippets/pubinfo.html' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block right_panel %}
|
||||||
|
<div class="tabnav">
|
||||||
|
<ul id="tabnav-tabs">
|
||||||
|
<li class="tabnav-tab"><a href="{% url 'pubrepo' %}">{% trans "Libraries" %}</a></li>
|
||||||
|
<li class="tabnav-tab"><a href="{% url 'pubgrp' %}">{% trans "Groups" %}</a></li>
|
||||||
|
<li class="tabnav-tab tabnav-tab-cur">{% trans "Users" %}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% if users %}
|
||||||
|
<ul class="user-list">
|
||||||
|
{% for member in users %}
|
||||||
|
<li class="user ovhd">
|
||||||
|
<a href="{{ SITE_ROOT }}profile/{{ member.email }}/" class="pic fleft">{% avatar member.email 48 %}</a>
|
||||||
|
<div class="txt fright">
|
||||||
|
<a class="name" href="{{ SITE_ROOT }}profile/{{ member.email }}/">{{ member.email|email2nickname }}</a>
|
||||||
|
<p>{{ member.email }}</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<p>{% trans "None"%}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
@@ -9,14 +9,14 @@
|
|||||||
<input type="text" id="id_email" name="username" value="" />
|
<input type="text" id="id_email" name="username" value="" />
|
||||||
<label for="password">{% trans "Password" %}</label>
|
<label for="password">{% trans "Password" %}</label>
|
||||||
<input type="password" id="id_password" name="password" value="" />
|
<input type="password" id="id_password" name="password" value="" />
|
||||||
|
<input type="hidden" name="next" value="{% if next %}{{ next|escape }}{% else %}{{ SITE_ROOT }}{% endif %}" />
|
||||||
|
{% if form.errors %}
|
||||||
|
<p class="error">{% trans "Incorrect email or password" %}</p>
|
||||||
|
{% else %}
|
||||||
<p class="error hide"></p>
|
<p class="error hide"></p>
|
||||||
|
{% endif %}
|
||||||
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
||||||
<a href="{{ SITE_ROOT }}accounts/password/reset/">{% trans "Forgot password?" %}</a>
|
<a href="{{ SITE_ROOT }}accounts/password/reset/">{% trans "Forgot password?" %}</a>
|
||||||
{% if next %}
|
|
||||||
<input type="hidden" name="next" value="{{ next|escape }}" />
|
|
||||||
{% else %}
|
|
||||||
<input type="hidden" name="next" value="{{ SITE_ROOT }}" />
|
|
||||||
{% endif %}
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -24,17 +24,14 @@
|
|||||||
{% block extra_script %}
|
{% block extra_script %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('input[type="submit"]').click(function(){
|
$('input[type="submit"]').click(function(){
|
||||||
if (!$.trim($('input[name="username"]').attr('value'))) {
|
if (!$.trim($('input[name="username"]').attr('value'))) {
|
||||||
$('.error').removeClass('hide').html('{% trans "Email cannot be blank" %}');
|
$('.error').removeClass('hide').html('{% trans "Email cannot be blank" %}');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!$.trim($('input[name="password"]').attr('value'))) {
|
if (!$.trim($('input[name="password"]').attr('value'))) {
|
||||||
$('.error').removeClass('hide').html('{% trans "Password cannot be blank" %}');
|
$('.error').removeClass('hide').html('{% trans "Password cannot be blank" %}');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
{% if form.errors %}
|
|
||||||
$('.error').removeClass('hide').html('{% trans "Incorrect email or password" %}');
|
|
||||||
{% endif %}
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
9
templates/snippets/pubinfo.html
Normal file
9
templates/snippets/pubinfo.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
<div class="info-item">
|
||||||
|
<h3 class="info-item-top">{% trans "Organization Info"%}</h3>
|
||||||
|
<ul class="info-item-bottom">
|
||||||
|
<li class="pubinfo-item"><span class="amount">{{ pubrepos_count }}</span><br /><span class="obj">{% trans 'Libraries' %}</span></li>
|
||||||
|
<li class="pubinfo-item"><span class="amount">{{ groups_count }}</span><br /><span class="obj">{% trans 'Groups' %}</span></li>
|
||||||
|
<li class="pubinfo-item"><span class="amount">{{ emailusers_count}}</span><br /><span class="obj">{% trans 'Users' %}</span></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
@@ -3,7 +3,7 @@ import service
|
|||||||
from service import ccnet_rpc, monitor_rpc, seafserv_rpc, \
|
from service import ccnet_rpc, monitor_rpc, seafserv_rpc, \
|
||||||
seafserv_threaded_rpc, ccnet_threaded_rpc
|
seafserv_threaded_rpc, ccnet_threaded_rpc
|
||||||
from service import send_command, check_quota, web_get_access_token, unset_repo_passwd
|
from service import send_command, check_quota, web_get_access_token, unset_repo_passwd
|
||||||
from service import get_emailusers, get_session_info
|
from service import get_emailusers, count_emailusers, get_session_info
|
||||||
from service import get_org_groups, get_personal_groups_by_user, \
|
from service import get_org_groups, get_personal_groups_by_user, \
|
||||||
get_group_repoids, get_personal_groups, list_share_repos, remove_share, \
|
get_group_repoids, get_personal_groups, list_share_repos, remove_share, \
|
||||||
check_group_staff, remove_group_user, get_group, get_org_id_by_group, \
|
check_group_staff, remove_group_user, get_group, get_org_id_by_group, \
|
||||||
@@ -18,7 +18,8 @@ from service import get_repos, get_repo, get_commits, get_branches, remove_repo,
|
|||||||
is_org_repo_owner, get_org_repo_owner, is_org_repo, get_file_size,\
|
is_org_repo_owner, get_org_repo_owner, is_org_repo, get_file_size,\
|
||||||
list_personal_repos_by_owner, get_repo_token_nonnull, get_repo_owner, \
|
list_personal_repos_by_owner, get_repo_token_nonnull, get_repo_owner, \
|
||||||
server_repo_size, get_file_id_by_path, get_commit, set_repo_history_limit,\
|
server_repo_size, get_file_id_by_path, get_commit, set_repo_history_limit,\
|
||||||
get_repo_history_limit, list_inner_pub_repos_by_owner, unset_inner_pub_repo
|
get_repo_history_limit, list_inner_pub_repos_by_owner, unset_inner_pub_repo,\
|
||||||
|
count_inner_pub_repos
|
||||||
|
|
||||||
from service import get_binding_peerids, is_valid_filename, check_permission,\
|
from service import get_binding_peerids, is_valid_filename, check_permission,\
|
||||||
is_passwd_set
|
is_passwd_set
|
||||||
|
@@ -153,6 +153,13 @@ def get_emailusers(start, limit):
|
|||||||
users = []
|
users = []
|
||||||
return users
|
return users
|
||||||
|
|
||||||
|
def count_emailusers():
|
||||||
|
try:
|
||||||
|
ret = ccnet_threaded_rpc.count_emailusers()
|
||||||
|
except SearpcError:
|
||||||
|
ret = 0
|
||||||
|
return ret
|
||||||
|
|
||||||
def get_session_info():
|
def get_session_info():
|
||||||
return ccnet_rpc.get_session_info()
|
return ccnet_rpc.get_session_info()
|
||||||
|
|
||||||
@@ -647,6 +654,13 @@ def list_inner_pub_repos(username):
|
|||||||
shared_repos.sort(lambda x, y: cmp(y.props.last_modified, x.props.last_modified))
|
shared_repos.sort(lambda x, y: cmp(y.props.last_modified, x.props.last_modified))
|
||||||
return shared_repos
|
return shared_repos
|
||||||
|
|
||||||
|
def count_inner_pub_repos():
|
||||||
|
try:
|
||||||
|
ret = seafserv_threaded_rpc.count_inner_pub_repos()
|
||||||
|
except SearpcError:
|
||||||
|
ret = 0
|
||||||
|
return ret
|
||||||
|
|
||||||
def is_inner_pub_repo(repo_id):
|
def is_inner_pub_repo(repo_id):
|
||||||
"""
|
"""
|
||||||
Check whether a repo is public.
|
Check whether a repo is public.
|
||||||
|
4
urls.py
4
urls.py
@@ -114,7 +114,9 @@ if CLOUD_MODE:
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
urlpatterns += patterns('',
|
urlpatterns += patterns('',
|
||||||
(r'^pubinfo/$', pubinfo),
|
url(r'^pubinfo/libraries/$', pubrepo, name='pubrepo'),
|
||||||
(r'^publicrepo/create/$', public_repo_create),
|
(r'^publicrepo/create/$', public_repo_create),
|
||||||
|
url(r'^pubinfo/groups/$', pubgrp, name='pubgrp'),
|
||||||
|
url(r'^pubinfo/users/$', pubuser, name='pubuser'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
61
views.py
61
views.py
@@ -42,7 +42,8 @@ from seaserv import ccnet_rpc, ccnet_threaded_rpc, get_repos, get_emailusers, \
|
|||||||
get_related_users_by_repo, get_related_users_by_org_repo, HtmlDiff, \
|
get_related_users_by_repo, get_related_users_by_org_repo, HtmlDiff, \
|
||||||
get_session_info, get_group_repoids, get_repo_owner, get_file_id_by_path, \
|
get_session_info, get_group_repoids, get_repo_owner, get_file_id_by_path, \
|
||||||
get_repo_history_limit, set_repo_history_limit, MAX_UPLOAD_FILE_SIZE, \
|
get_repo_history_limit, set_repo_history_limit, MAX_UPLOAD_FILE_SIZE, \
|
||||||
get_commit, MAX_DOWNLOAD_DIR_SIZE, CALC_SHARE_USAGE, unset_inner_pub_repo
|
get_commit, MAX_DOWNLOAD_DIR_SIZE, CALC_SHARE_USAGE, count_emailusers, \
|
||||||
|
count_inner_pub_repos, unset_inner_pub_repo
|
||||||
from pysearpc import SearpcError
|
from pysearpc import SearpcError
|
||||||
|
|
||||||
from base.accounts import User
|
from base.accounts import User
|
||||||
@@ -2735,24 +2736,66 @@ def demo(request):
|
|||||||
return HttpResponseRedirect(redirect_to)
|
return HttpResponseRedirect(redirect_to)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def pubinfo(request):
|
def pubrepo(request):
|
||||||
"""
|
"""
|
||||||
Show public information.
|
Show public libraries.
|
||||||
"""
|
"""
|
||||||
if request.cloud_mode:
|
if request.cloud_mode:
|
||||||
# Users are not allowed to see public information when in cloud mode.
|
# Users are not allowed to see public information when in cloud mode.
|
||||||
raise Http404
|
raise Http404
|
||||||
else:
|
else:
|
||||||
public_repos = list_inner_pub_repos(request.user.username)
|
public_repos = list_inner_pub_repos(request.user.username)
|
||||||
groups = get_personal_groups(-1, -1)
|
pubrepos_count = len(public_repos)
|
||||||
users = get_emailusers(-1, -1)
|
groups_count = len(get_personal_groups(-1, -1))
|
||||||
return render_to_response('pubinfo.html', {
|
emailusers_count = count_emailusers()
|
||||||
'groups': groups,
|
return render_to_response('pubrepo.html', {
|
||||||
'users': users,
|
|
||||||
'public_repos': public_repos,
|
'public_repos': public_repos,
|
||||||
'create_shared_repo': True,
|
'create_shared_repo': True,
|
||||||
|
'pubrepos_count': pubrepos_count,
|
||||||
|
'groups_count': groups_count,
|
||||||
|
'emailusers_count': emailusers_count,
|
||||||
}, context_instance=RequestContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def pubgrp(request):
|
||||||
|
"""
|
||||||
|
Show public groups.
|
||||||
|
"""
|
||||||
|
if request.cloud_mode:
|
||||||
|
# Users are not allowed to see public information when in cloud mode.
|
||||||
|
raise Http404
|
||||||
|
else:
|
||||||
|
groups = get_personal_groups(-1, -1)
|
||||||
|
pubrepos_count = count_inner_pub_repos()
|
||||||
|
groups_count = len(groups)
|
||||||
|
emailusers_count = count_emailusers()
|
||||||
|
return render_to_response('pubgrp.html', {
|
||||||
|
'groups': groups,
|
||||||
|
'pubrepos_count': pubrepos_count,
|
||||||
|
'groups_count': groups_count,
|
||||||
|
'emailusers_count': emailusers_count,
|
||||||
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def pubuser(request):
|
||||||
|
"""
|
||||||
|
Show public users.
|
||||||
|
"""
|
||||||
|
if request.cloud_mode:
|
||||||
|
# Users are not allowed to see public information when in cloud mode.
|
||||||
|
raise Http404
|
||||||
|
else:
|
||||||
|
users = get_emailusers(-1, -1)
|
||||||
|
pubrepos_count = count_inner_pub_repos()
|
||||||
|
groups_count = len(get_personal_groups(-1, -1))
|
||||||
|
emailusers_count = count_emailusers()
|
||||||
|
return render_to_response('pubuser.html', {
|
||||||
|
'users': users,
|
||||||
|
'pubrepos_count': pubrepos_count,
|
||||||
|
'groups_count': groups_count,
|
||||||
|
'emailusers_count': emailusers_count,
|
||||||
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
def repo_set_password(request):
|
def repo_set_password(request):
|
||||||
content_type = 'application/json; charset=utf-8'
|
content_type = 'application/json; charset=utf-8'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user