1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 14:42:10 +00:00

Remove org

This commit is contained in:
zhengxie
2013-05-02 14:07:27 +08:00
parent 06b5e22f22
commit aa911dee9c
26 changed files with 0 additions and 2371 deletions

View File

@@ -1,4 +0,0 @@
from signals import *
from handlers import *
org_user_added.connect(org_user_added_cb, sender=None)

View File

@@ -1,12 +0,0 @@
# from seahub.utils import get_cur_ctx
# def org(request):
# """
# Add org info and base template that html page will extends to context.
# """
# ctx_dict = get_cur_ctx(request)
# base_template = ctx_dict['base_template']
# org_dict = ctx_dict['org_dict']
# return {'base_template': base_template,
# 'org': org_dict}

View File

@@ -1,19 +0,0 @@
# encoding: utf-8
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from seaserv import get_user_current_org
def org_staff_required(func):
"""
Decorator for views that checks the user is org staff.
"""
def _decorated(request, *args, **kwargs):
user = request.user.username
url_prefix = kwargs.get('url_prefix', '')
org = get_user_current_org(user, url_prefix)
if org and org.is_staff:
request.user.org = org._dict
return func(request, *args, **kwargs)
return HttpResponseRedirect(reverse('myhome'))
return _decorated

View File

@@ -1,19 +0,0 @@
# encoding: utf-8
from django import forms
from seaserv import ccnet_threaded_rpc
class OrgCreateForm(forms.Form):
org_name = forms.CharField(max_length=256,
widget=forms.TextInput(),
label="Organization Name")
url_prefix = forms.RegexField(label="Url Prefix", max_length=20,
regex=r'^[a-z0-9]+$',
error_message="个性域名只能包含字母或数字")
def clean_url_prefix(self):
url_prefix = self.cleaned_data['url_prefix']
org = ccnet_threaded_rpc.get_org_by_url_prefix(url_prefix)
if not org:
return url_prefix
else:
raise forms.ValidationError("该个性域名已被注册")

View File

@@ -1,25 +0,0 @@
# encoding: utf-8
import simplejson as json
from signals import org_user_added
from seahub.notifications.models import UserNotification
from seaserv import get_org_by_id
def org_user_added_cb(sender, **kwargs):
org_id = kwargs['org_id']
from_email = kwargs['from_email']
to_email = kwargs['to_email']
org = get_org_by_id(org_id)
if not org:
return
msg_dict = {'from_email': from_email,
'org_name': org.org_name,
'org_prefix': org.url_prefix,
'creator': org.creator}
n = UserNotification(to_user=to_email, msg_type='org_join_msg',
detail=json.dumps(msg_dict))
n.save()

View File

@@ -1,7 +0,0 @@
#!/bin/sh
django-admin.py makemessages -l zh_CN -e py,html
django-admin.py makemessages -d djangojs -l zh_CN
django-admin.py compilemessages

View File

@@ -1,444 +0,0 @@
# This file is distributed under the same license as the PACKAGE package.
# Pierrick BRUN, pierrick.brun@gmail.com 2013
# Pi3R1k <pierrick.brun@gmail.com>, 2013.
#
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-13 19:17+0800\n"
"PO-Revision-Date: 2013-04-23 15:31+0100\n"
"Last-Translator: Pi3R1k <pierrick.brun@gmail.com>\n"
"Language-Team: français <>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 1.5.5\n"
#: views.py:205
msgid "Failed to create the library: you has not joined this organizatioin."
msgstr ""
"Échec de la création de la bibliothèque : vous n'a pas rejoint cette "
"organisation."
#: views.py:217
msgid "Failed to create."
msgstr "Impossible de créer."
#: views.py:241
msgid "Operation Succeeded."
msgstr "Opération réussie."
#: views.py:260
msgid "Group name can only contain letters, digits and underscore"
msgstr "Le nom du groupe ne peut contenir que lettres, chiffres et underscore"
#: views.py:305
msgid "Seafile Login Information"
msgstr "Informations de connexion Seafile"
#: views.py:307
msgid "Mail sent successfully"
msgstr "Le mail a été envoyé avec succès"
#: views.py:309
msgid "Failed to send the email"
msgstr "Impossible d'envoyer l'email"
#: views.py:409
msgid "Successfully deleted."
msgstr "Supprimé avec succès."
#: views.py:428
#, python-format
msgid ""
"%(from_email)s added you to Organization <a href=\"%(org_url)s\">"
"%(org_name)s</a>"
msgstr ""
"%(from_email)s vous a ajouté à l'organisation <a href=\"%(org_url)s\">"
"%(org_name)s</a>"
#: views.py:467
msgid "Failed to create: you has not joined this organization"
msgstr "Echec de la création : vous n'a pas rejoint cette organisation"
#: views.py:473
msgid "Failed to create"
msgstr "Echec de la création"
#: views.py:566
msgid "This group doesn't belong to current organazation"
msgstr "Ce groupe n'appartient pas à l'organisation actuelle"
#: views.py:606
msgid "Only the owner of this library has permission to share it."
msgstr "Seul le propriétaire de cette bibliothèque est autorisé à la partager."
#: views.py:621
msgid "Failed to share to all members"
msgstr "Échec du partage à tous les membres"
#: views.py:625
#, python-format
msgid ""
"Shared to all members successfully, you can go check it at <a href=\"%s"
"\">Share</a>."
msgstr ""
"Partagé à tous les membres avec succès, vous pouvez vérifier sur <a href=\"%s"
"\">Partages</a>."
#: views.py:646
#, python-format
msgid ""
"Shared to %(group)s successfullyyou can go check it at <a href=\"%(share)s"
"\">Share</a>."
msgstr ""
"Partagé à %(group)s avec succèsvous pouvez vérifier sur <a href=\"%(share)s"
"\">Partages</a>."
#: views.py:652 views.py:671
#, python-format
msgid "Failed to share to %s."
msgstr "Impossible de partager à %s."
#: views.py:658
#, python-format
msgid "Failed to share to %s: this user does not exist in the organization."
msgstr ""
"Impossible de partager à %s : cet utilisateur n'existe pas dans "
"l'organisation."
#: views.py:666
#, python-format
msgid ""
"Shared to %(share_to)s successfullyyou can go check it at <a href="
"\"%(share)s\">Share</a>."
msgstr ""
"Partage de %(share_to)s réussitvous pouvez vérifier sur <a href=\"%(share)s"
"\">Partages</a>."
#: views.py:713
msgid "all members"
msgstr "tous les membres"
#: views.py:719 templates/organizations/org_public.html:38
#: templates/organizations/org_seafadmin.html:19
msgid "Read-Write"
msgstr "Lecture / Écriture"
#: views.py:721 templates/organizations/org_public.html:40
msgid "Read-Only"
msgstr "Lecture seule"
#: templates/organizations/create_org.html:5
msgid "Create Orgnization"
msgstr "Créer Orgnisation"
#: templates/organizations/create_org.html:7
msgid "Organization Name"
msgstr "Nom de l'Organisation"
#: templates/organizations/create_org.html:9
msgid "Url Prefix"
msgstr "Préfixe de l'URL"
#: templates/organizations/create_org.html:11
msgid "Url prefix can only contains letters and digits."
msgstr ""
"Le préfixe de l'URL peut contenir uniquement des lettres et des chiffres."
#: templates/organizations/create_org.html:14
#: templates/organizations/org_admin.html:74
msgid "Submit"
msgstr "Envoyer"
#: templates/organizations/org_admin.html:9
#: templates/organizations/org_admin.html:20
#: templates/organizations/personal.html:25
msgid "Space Used"
msgstr "Espace utilisé"
#: templates/organizations/org_admin.html:15
msgid "All Members"
msgstr "Tous les membres"
#: templates/organizations/org_admin.html:16
msgid "Add Members"
msgstr "Ajouter des membres"
#: templates/organizations/org_admin.html:19
msgid "Email"
msgstr "Mail"
#: templates/organizations/org_admin.html:21
#: templates/organizations/org_group_admin.html:14
#: templates/organizations/org_public.html:32
#: templates/organizations/org_seafadmin.html:15
msgid "Operations"
msgstr "Opérations"
#: templates/organizations/org_admin.html:34
#: templates/organizations/org_group_admin.html:21
#: templates/organizations/org_seafadmin.html:23
msgid "Delete"
msgstr "Supprimer"
#: templates/organizations/org_admin.html:43
#: templates/organizations/org_group_admin.html:28
#: templates/organizations/org_seafadmin.html:30
msgid "Previous"
msgstr "Précédent"
#: templates/organizations/org_admin.html:46
#: templates/organizations/org_group_admin.html:31
#: templates/organizations/org_seafadmin.html:33
msgid "Next"
msgstr "Suivant"
#: templates/organizations/org_admin.html:51
#: templates/organizations/org_group_admin.html:36
#: templates/organizations/org_seafadmin.html:38
msgid "Per page: "
msgstr "Par page : "
#: templates/organizations/org_admin.html:70
msgid "Emails: "
msgstr "Mails : "
#: templates/organizations/org_admin.html:72
msgid "An invitation will be sent if the email is not registered."
msgstr "Une invitation sera envoyée si le courriel n'est pas enregistré."
#: templates/organizations/org_admin.html:73
msgid "Emails is required."
msgstr "Email est requis."
#: templates/organizations/org_admin.html:100
msgid "Delete Member"
msgstr "Supprimer des membres"
#: templates/organizations/org_admin.html:101
#: templates/organizations/org_group_admin.html:62
#: templates/organizations/org_seafadmin.html:64
#, python-format
msgid "Are you sure you want to delete %s ?"
msgstr "Êtes-vous sûr de vouloir supprimer %s ?"
#: templates/organizations/org_group_admin.html:7
#: templates/organizations/org_pubinfo.html:26
msgid "Groups"
msgstr "Groupes"
#: templates/organizations/org_group_admin.html:11
#: templates/organizations/org_public.html:28
#: templates/organizations/org_seafadmin.html:12
msgid "Name"
msgstr "Nom"
#: templates/organizations/org_group_admin.html:12
msgid "Creator"
msgstr "Créateur"
#: templates/organizations/org_group_admin.html:13
msgid "Created At"
msgstr "Créé à"
#: templates/organizations/org_group_admin.html:54
#: templates/organizations/org_pubinfo.html:20
#: templates/organizations/org_seafadmin.html:56
msgid "None"
msgstr "Aucun"
#: templates/organizations/org_group_admin.html:61
msgid "Delete Group"
msgstr "Supprimer le groupe"
#: templates/organizations/org_groups.html:13
#: templates/organizations/org_public.html:13
msgid "Tips"
msgstr "Conseils"
#: templates/organizations/org_groups.html:15
msgid "After creating a group, you can add members and share libraries to it."
msgstr ""
"Après la création d'un groupe, vous pouvez ajouter des membres et partager "
"des bibliothèques avec eux."
#: templates/organizations/org_groups.html:16
msgid "You can also share to groups that you're not in."
msgstr ""
"Vous pouvez également partager aux groupes dont vous ne faites pas partie."
#: templates/organizations/org_pubinfo.html:12
msgid "Members"
msgstr "Membres"
#: templates/organizations/org_pubinfo.html:35
msgid "Creator: "
msgstr "Créateur : "
#: templates/organizations/org_pubinfo.html:36
msgid "Time: "
msgstr "Date :"
#: templates/organizations/org_pubinfo.html:43
msgid "No one has created any groups yet"
msgstr "Personne n'a encore créé de groupes"
#: templates/organizations/org_pubinfo.html:44
msgid ""
"You can click \"Add Group\" button under \"Group\" label to create a group. "
msgstr ""
"Vous pouvez cliquer sur le bouton « Ajouter un groupe » sous l'étiquette de "
"« Groupe » pour créer un groupe. "
#: templates/organizations/org_public.html:15
msgid "A library marked as read-only can be downloaded."
msgstr "Une bibliothèque en lecture seule peut être téléchargée."
#: templates/organizations/org_public.html:16
msgid ""
"Afterwards, updates on server will be downloaded automatically, but updates "
"on local files will not be uploaded."
msgstr ""
"Par la suite, les mises à jour sur le serveur seront envoyées "
"automatiquement, mais les mises à jour sur les fichiers locaux ne seront pas "
"importées sur le serveur."
#: templates/organizations/org_public.html:22
msgid "Public Libraries"
msgstr "Bibliothèques publiques"
#: templates/organizations/org_public.html:23
msgid "New Library"
msgstr "Nouvelle bibliothèque"
#: templates/organizations/org_public.html:29
#: templates/organizations/org_seafadmin.html:14
msgid "Description"
msgstr "Description"
#: templates/organizations/org_public.html:30
msgid "UpdateTime"
msgstr "Mise à jour"
#: templates/organizations/org_public.html:31
msgid "Shared By"
msgstr "Partagé par"
#: templates/organizations/org_public.html:38
#: templates/organizations/org_public.html:40
#: templates/organizations/org_seafadmin.html:19
msgid "directory icon"
msgstr "icône du répertoire"
#: templates/organizations/org_public.html:52
msgid "Download"
msgstr "Télécharger"
#: templates/organizations/org_public.html:59
msgid "No public library"
msgstr "Aucune bibliothèque publique"
#: templates/organizations/org_public.html:60
msgid ""
"You can create a public library by clicking \"New Library\" button, others "
"can view and download this library."
msgstr ""
"Vous pouvez créer une bibliothèque publique en cliquant sur le bouton « "
"Nouvelle bibliothèque », d'autres peuvent consulter et télécharger cette "
"bibliothèque."
#: templates/organizations/org_seafadmin.html:7
msgid "All Libraries"
msgstr "Toutes les bibliothèques"
#: templates/organizations/org_seafadmin.html:13
msgid "Owner"
msgstr "Propriétaire"
#: templates/organizations/org_seafadmin.html:63
msgid "Delete Library"
msgstr "Supprimez la bibliothèque"
#: templates/organizations/org_user_add_email.html:2
#, python-format
msgid "%(user)s added you to Organization %(org_name)s on Seafile. "
msgstr "%(user)s vous a ajouté à l'organisation %(org_name)s sur Seafile. "
#: templates/organizations/org_user_add_email.html:3
#, python-format
msgid ""
"\n"
"Here is your login information:\n"
"email: %(email)s\n"
"password: %(password)s\n"
"\n"
"Please click the link to log in:\n"
msgstr ""
"\n"
"Voici vos informations d'identification:\n"
"email: %(email)s\n"
"mot de passe: %(password)s\n"
"\n"
"Cliquez ici pour vous connecter:\n"
#: templates/organizations/org_user_add_email.html:11
#, python-format
msgid ""
"\n"
"and reset your password later.\n"
"Thanks for using our site!\n"
"\n"
"The %(site_name)s team\n"
msgstr ""
"\n"
"et réinitialisez votre mot de passe plus tard.\n"
"Merci d'utiliser notre site!\n"
"\n"
"L'équipe de %(site_name)s \n"
#: templates/organizations/personal.html:13
msgid "Account"
msgstr "Compte"
#: templates/organizations/personal.html:15
#: templates/organizations/personal.html:18
msgid "Edit"
msgstr "Modifier"
#: templates/organizations/personal.html:17
msgid "No Nickname"
msgstr "Pas de surnom"
#~ msgid "'s icon"
#~ msgstr "的图标"
#~ msgid "Really want to delete this group?"
#~ msgstr "确定要删除这个群组?"
#~ msgid "Profile"
#~ msgstr "个人基本信息"
#~ msgid "Total Org Space Used"
#~ msgstr "团体已用总空间"
#~ msgid "Please type an email"
#~ msgstr "输入不能为空。"
#~ msgid "Empty"
#~ msgstr "暂无"
#~ msgid "Users"
#~ msgstr "成员列表"
#~ msgid "Last Update"
#~ msgstr "更新时间"
#~ msgid "Nickname is empty"
#~ msgstr "暂无昵称"
#~ msgid "Org Space Used"
#~ msgstr "我已用的团体空间"

View File

@@ -1,423 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-13 19:17+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
#: views.py:205
msgid "Failed to create the library: you has not joined this organizatioin."
msgstr "资料库创建失败:你还没有加入这个团体。"
#: views.py:217
msgid "Failed to create."
msgstr "创建失败"
#: views.py:241
msgid "Operation Succeeded."
msgstr "操作成功"
#: views.py:260
msgid "Group name can only contain letters, digits and underscore"
msgstr "群组名称只能包含中英文字符,数字及下划线。"
#: views.py:305
msgid "Seafile Login Information"
msgstr "Seafile 登录信息"
#: views.py:307
msgid "Mail sent successfully"
msgstr "邮件发送成功"
#: views.py:309
msgid "Failed to send the email"
msgstr "邮件发送失败"
#: views.py:409
msgid "Successfully deleted."
msgstr "删除成功"
#: views.py:428
#, python-format
msgid ""
"%(from_email)s added you to Organization <a href=\"%(org_url)s\">"
"%(org_name)s</a>"
msgstr "%(from_email)s 将你加入到团体 <a href=\"%(org_url)s\">%(org_name)s</a>"
#: views.py:467
msgid "Failed to create: you has not joined this organization"
msgstr "创建失败:你还没有加入这个团体。"
#: views.py:473
msgid "Failed to create"
msgstr "创建失败"
#: views.py:566
msgid "This group doesn't belong to current organazation"
msgstr "该群组不属于当前团体。"
#: views.py:606
msgid "Only the owner of this library has permission to share it."
msgstr "只有资料库拥有者有权共享。"
#: views.py:621
msgid "Failed to share to all members"
msgstr "共享到公共资料失败"
#: views.py:625
#, python-format
msgid ""
"Shared to all members successfully, you can go check it at <a href=\"%s"
"\">Share</a>."
msgstr "共享到公共资料成功,请前往<a href=\"%s\">共享</a>查看。"
#: views.py:646
#, python-format
msgid ""
"Shared to %(group)s successfullyyou can go check it at <a href=\"%(share)s"
"\">Share</a>."
msgstr "共享到 %(group)s 成功,请前往<a href=\"%(share)s\">共享</a>查看。"
#: views.py:652 views.py:671
#, python-format
msgid "Failed to share to %s."
msgstr "共享给 %s 失败。"
#: views.py:658
#, python-format
msgid "Failed to share to %s: this user does not exist in the organization."
msgstr "共享给 %s 失败:该用户不在这个团体中。"
#: views.py:666
#, python-format
msgid ""
"Shared to %(share_to)s successfullyyou can go check it at <a href="
"\"%(share)s\">Share</a>."
msgstr "共享给 %(share_to)s 成功,请前往<a href=\"%(share)s\">共享</a>查看。"
#: views.py:713
msgid "all members"
msgstr "所有成员"
#: views.py:719 templates/organizations/org_public.html:38
#: templates/organizations/org_seafadmin.html:19
msgid "Read-Write"
msgstr "可读写"
#: views.py:721 templates/organizations/org_public.html:40
msgid "Read-Only"
msgstr "只读"
#: templates/organizations/create_org.html:5
msgid "Create Orgnization"
msgstr "创建团体"
#: templates/organizations/create_org.html:7
msgid "Organization Name"
msgstr "团体名称"
#: templates/organizations/create_org.html:9
msgid "Url Prefix"
msgstr "个性域名"
#: templates/organizations/create_org.html:11
msgid "Url prefix can only contains letters and digits."
msgstr "个性域名只能包含字母和数字"
#: templates/organizations/create_org.html:14
#: templates/organizations/org_admin.html:74
msgid "Submit"
msgstr "提交"
#: templates/organizations/org_admin.html:9
#: templates/organizations/org_admin.html:20
#: templates/organizations/personal.html:25
msgid "Space Used"
msgstr "已用空间"
#: templates/organizations/org_admin.html:15
msgid "All Members"
msgstr "所有成员"
#: templates/organizations/org_admin.html:16
msgid "Add Members"
msgstr "添加成员"
#: templates/organizations/org_admin.html:19
msgid "Email"
msgstr "邮箱"
#: templates/organizations/org_admin.html:21
#: templates/organizations/org_group_admin.html:14
#: templates/organizations/org_public.html:32
#: templates/organizations/org_seafadmin.html:15
msgid "Operations"
msgstr "操作"
#: templates/organizations/org_admin.html:34
#: templates/organizations/org_group_admin.html:21
#: templates/organizations/org_seafadmin.html:23
msgid "Delete"
msgstr "删除"
#: templates/organizations/org_admin.html:43
#: templates/organizations/org_group_admin.html:28
#: templates/organizations/org_seafadmin.html:30
msgid "Previous"
msgstr "上一页"
#: templates/organizations/org_admin.html:46
#: templates/organizations/org_group_admin.html:31
#: templates/organizations/org_seafadmin.html:33
msgid "Next"
msgstr "下一页"
#: templates/organizations/org_admin.html:51
#: templates/organizations/org_group_admin.html:36
#: templates/organizations/org_seafadmin.html:38
msgid "Per page: "
msgstr "每页:"
#: templates/organizations/org_admin.html:70
msgid "Emails: "
msgstr "邮箱:"
#: templates/organizations/org_admin.html:72
msgid "An invitation will be sent if the email is not registered."
msgstr "如果该邮箱还未注册,我们将给其发送邀请。"
#: templates/organizations/org_admin.html:73
msgid "Emails is required."
msgstr "邮箱为必填项。"
#: templates/organizations/org_admin.html:100
msgid "Delete Member"
msgstr "删除成员"
#: templates/organizations/org_admin.html:101
#: templates/organizations/org_group_admin.html:62
#: templates/organizations/org_seafadmin.html:64
#, python-format
msgid "Are you sure you want to delete %s ?"
msgstr "确定要删除 %s 吗?"
#: templates/organizations/org_group_admin.html:7
#: templates/organizations/org_pubinfo.html:26
msgid "Groups"
msgstr "群组"
#: templates/organizations/org_group_admin.html:11
#: templates/organizations/org_public.html:28
#: templates/organizations/org_seafadmin.html:12
msgid "Name"
msgstr "名称"
#: templates/organizations/org_group_admin.html:12
msgid "Creator"
msgstr "创建者"
#: templates/organizations/org_group_admin.html:13
msgid "Created At"
msgstr "创建时间"
#: templates/organizations/org_group_admin.html:54
#: templates/organizations/org_pubinfo.html:20
#: templates/organizations/org_seafadmin.html:56
msgid "None"
msgstr "暂无"
#: templates/organizations/org_group_admin.html:61
msgid "Delete Group"
msgstr "删除群组"
#: templates/organizations/org_groups.html:13
#: templates/organizations/org_public.html:13
msgid "Tips"
msgstr "小提示"
#: templates/organizations/org_groups.html:15
msgid "After creating a group, you can add members and share libraries to it."
msgstr "群组创建后,可以给其添加成员,共享资料库。"
#: templates/organizations/org_groups.html:16
msgid "You can also share to groups that you're not in."
msgstr "也可将资料库共享到你没有参加的群组。"
#: templates/organizations/org_pubinfo.html:12
msgid "Members"
msgstr "成员"
#: templates/organizations/org_pubinfo.html:35
msgid "Creator: "
msgstr "创建者:"
#: templates/organizations/org_pubinfo.html:36
msgid "Time: "
msgstr "创建时间:"
#: templates/organizations/org_pubinfo.html:43
msgid "No one has created any groups yet"
msgstr "还没有群组被创建"
#: templates/organizations/org_pubinfo.html:44
msgid ""
"You can click \"Add Group\" button under \"Group\" label to create a group. "
msgstr "你可以到“群组”页面点击“新建群组”按钮创建一个群组。"
#: templates/organizations/org_public.html:15
msgid "A library marked as read-only can be downloaded."
msgstr "标记为只读的资料库可以被下载。"
#: templates/organizations/org_public.html:16
msgid ""
"Afterwards, updates on server will be downloaded automatically, but updates "
"on local files will not be uploaded."
msgstr ""
"之后,服务器上的修改会自动同步到本地,而本地文件的修改无法上传到服务器。"
#: templates/organizations/org_public.html:22
msgid "Public Libraries"
msgstr "公共资料库"
#: templates/organizations/org_public.html:23
msgid "New Library"
msgstr "新建资料库"
#: templates/organizations/org_public.html:29
#: templates/organizations/org_seafadmin.html:14
msgid "Description"
msgstr "描述"
#: templates/organizations/org_public.html:30
msgid "UpdateTime"
msgstr "更新时间"
#: templates/organizations/org_public.html:31
msgid "Shared By"
msgstr "共享来源"
#: templates/organizations/org_public.html:38
#: templates/organizations/org_public.html:40
#: templates/organizations/org_seafadmin.html:19
msgid "directory icon"
msgstr "目录图标"
#: templates/organizations/org_public.html:52
msgid "Download"
msgstr "下载"
#: templates/organizations/org_public.html:59
msgid "No public library"
msgstr "当前没有公共资料"
#: templates/organizations/org_public.html:60
msgid ""
"You can create a public library by clicking \"New Library\" button, others "
"can view and download this library."
msgstr ""
"你可以点击“新建资料库”按钮创建一个公开的资料库,网站内的其他人都可以查看下载"
"这个资料库。"
#: templates/organizations/org_seafadmin.html:7
msgid "All Libraries"
msgstr "所有资料库"
#: templates/organizations/org_seafadmin.html:13
msgid "Owner"
msgstr "拥有者"
#: templates/organizations/org_seafadmin.html:63
msgid "Delete Library"
msgstr "删除资料库"
#: templates/organizations/org_user_add_email.html:2
#, python-format
msgid "%(user)s added you to Organization %(org_name)s on Seafile. "
msgstr "%(user)s 已将你加入到 Seafile 上的 %(org_name)s 团体。"
#: templates/organizations/org_user_add_email.html:3
#, python-format
msgid ""
"\n"
"Here is your login information:\n"
"email: %(email)s\n"
"password: %(password)s\n"
"\n"
"Please click the link to log in:\n"
msgstr ""
"\n"
"以下是你的登录信息:\n"
"邮箱:%(email)s\n"
"密码:%(password)s\n"
"\n"
"请点击以下链接登录:\n"
#: templates/organizations/org_user_add_email.html:11
#, python-format
msgid ""
"\n"
"and reset your password later.\n"
"Thanks for using our site!\n"
"\n"
"The %(site_name)s team\n"
msgstr ""
"\n"
"随后请重置你的密码。\n"
"感谢使用!\n"
"\n"
"%(site_name)s 团队\n"
#: templates/organizations/personal.html:13
msgid "Account"
msgstr "我的基本信息"
#: templates/organizations/personal.html:15
#: templates/organizations/personal.html:18
msgid "Edit"
msgstr "编辑"
#: templates/organizations/personal.html:17
msgid "No Nickname"
msgstr "暂无昵称"
#~ msgid "'s icon"
#~ msgstr "的图标"
#~ msgid "Really want to delete this group?"
#~ msgstr "确定要删除这个群组?"
#~ msgid "Profile"
#~ msgstr "个人基本信息"
#~ msgid "Total Org Space Used"
#~ msgstr "团体已用总空间"
#~ msgid "Please type an email"
#~ msgstr "输入不能为空。"
#~ msgid "Empty"
#~ msgstr "暂无"
#~ msgid "Users"
#~ msgstr "成员列表"
#~ msgid "Last Update"
#~ msgstr "更新时间"
#~ msgid "Nickname is empty"
#~ msgstr "暂无昵称"
#~ msgid "Org Space Used"
#~ msgstr "我已用的团体空间"

View File

@@ -1,3 +0,0 @@
from django.db import models
# Create your models here.

View File

@@ -1 +0,0 @@
from django.conf import settings

View File

@@ -1,3 +0,0 @@
import django.dispatch
org_user_added = django.dispatch.Signal(providing_args=["org_id", "from_email", "to_email"])

View File

@@ -1,17 +0,0 @@
{% extends "myhome_base.html" %}
{% load i18n %}
{% block main_panel %}
<div class="narrow-panel">
<h2>{% trans "Create Orgnization" %}</h2>
<form action="" method="post">
<label for="id_org_name">{% trans "Organization Name" %}</label>
{{ form.org_name}}
<lable for="id_url_prefix">{% trans "Url Prefix" %}</label>
{{ form.url_prefix }}
<p class="note">{% trans "Url prefix can only contains letters and digits." %}</p>
<p class="error hide"></p>
{{ form.url_prefix.errors }}
<input type="submit" value="{% trans "Submit" %}" class="submit" />
</form>
</div>
{% endblock %}

View File

@@ -1,23 +0,0 @@
{% extends 'myhome_base.html' %}
{% load seahub_tags avatar_tags %}
{% block main_panel %}
<div class="text-panel">
{% if orgmsg_list %}
{% autoescape off %}
<ul class="">
{% for msg in orgmsg_list %}
<li class="">
<p>{{ msg }}</p>
</li>
{% endfor %}
</ul>
{% endautoescape %}
{% else %}
<p>暂无</p>
{% endif %}
</div>
{% endblock %}
{% block extra_script %}
{% endblock %}

View File

@@ -1,104 +0,0 @@
{% extends "org_admin_base.html" %}
{% load url from future %}
{% load i18n %}
{% block nav_useradmin_class %}class="cur"{% endblock %}
{% block left_panel %}
<div class="info-item">
<h3 class="info-item-top">{% trans "Space Used" %}</h3>
<p class="info-item-bottom">{{ org_quota_usage|filesizeformat }} {% if org_quota > 0 %} / {{ org_quota|filesizeformat }} {% endif %}</p>
</div>
{% endblock %}
{% block right_panel %}
<h3>{% trans "All Members" %}</h3>
<button id="org-user-add" class="add">{% trans "Add Members" %}</button>
<table>
<tr>
<th width="60%">{% trans "Email" %}</th>
<th width="20%">{% trans "Space Used" %}</th>
<th width="20%">{% trans "Operations" %}</th>
</tr>
{% for user in users %}
<tr>
<td><a href="{% url 'user_profile' user.email %}" target="_blank">{{ user.props.email }}</a></td>
<td>
{% if user.quota_usage >= 0 %}
{{ user.quota_usage|filesizeformat }}
{% endif %}
</td>
<td>
{% if not user.is_self %}
<a href="#" class="remove-user-btn op" data-url="{% url 'org_user_remove' request.user.org.url_prefix user.email %}" data-target="{{ user.props.email }}">{% trans "Delete" %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
<div id="paginator">
{% if current_page != 1 %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/useradmin/?page={{ prev_page }}&per_page={{ per_page }}">{% trans "Previous" %}</a>
{% endif %}
{% if page_next %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/useradmin/?page={{ next_page }}&per_page={{ per_page }}">{% trans "Next" %}</a>
{% endif %}
{% if current_page != 1 or page_next %}
|
{% endif %}
<span>{% trans "Per page: "%}</span>
{% if per_page == 25 %}
<span> 25 </span>
{% else %}
<a href="{{ SITE_ROOT}}organizations/{{ org.url_prefix }}/useradmin/?per_page=25" class="per-page">25</a>
{% endif %}
{% if per_page == 50 %}
<span> 50 </span>
{% else %}
<a href="{{ SITE_ROOT}}organizations/{{ org.url_prefix }}/useradmin/?per_page=50" class="per-page">50</a>
{% endif %}
{% if per_page == 100 %}
<span> 100 </span>
{% else %}
<a href="{{ SITE_ROOT}}organizations/{{ org.url_prefix }}/useradmin/?per_page=100" class="per-page">100</a>
{% endif %}
</div>
<form id="user-add-form" action="" method="post" name="user-add-form" class="hide">
<label>{% trans "Emails: " %}</label><br />
<textarea id="added-member-name" name="added-member-name"></textarea>
<p class="tip">{% trans "An invitation will be sent if the email is not registered." %}</p>
<p class="error hide">{% trans "Emails is required." %}</p>
<input type="submit" value="{% trans "Submit" %}" />
</form>
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
$('#org-user-add').click(function() {
$("#user-add-form").modal({appendTo: "#main"});
var contacts_list = [], contact_email;
{% for contact in contacts %}
contact_email = '{{ contact.contact_email }}';
contacts_list.push({value:contact_email, label:contact_email});
{% endfor %}
addAutocomplete('#added-member-name', '#user-add-form', contacts_list);
})
.hover(
function() {
$(this).css({'background-color': '#fff', 'cursor': 'pointer'});
},
function() {
$(this).css('background-color', '#f5f5f5');
}
);
addConfirmTo($('.remove-user-btn'), {
'title':'{% trans "Delete Member" %}',
'con':'{% trans "Are you sure you want to delete %s ?" %}'
});
</script>
{% endblock %}

View File

@@ -1,66 +0,0 @@
{% extends "org_admin_base.html" %}
{% load seahub_tags i18n %}
{% block nav_groupadmin_class %}class="cur"{% endblock %}
{% block right_panel %}
<h3>{% trans "Groups" %}</h3>
{% if groups %}
<table>
<tr>
<th width="30%">{% trans "Name" %}</th>
<th width="35%">{% trans "Creator" %}</th>
<th width="23%">{% trans "Created At" %}</th>
<th width="12%">{% trans "Operations" %}</th>
</tr>
{% for group in groups %}
<tr>
<td><a href="{{ SITE_ROOT }}group/{{ group.props.id }}/" target="_blank">{{ group.props.group_name }}</a></td>
<td>{{ group.props.creator_name }}</td>
<td>{{ group.props.timestamp|tsstr_sec }}</td>
<td><a href="#" data-url="{{ SITE_ROOT}}organizations/{{ org.url_prefix }}/group/remove/{{ group.id }}/" data-target="{{ group.props.group_name }}" class="group-remove-btn op">{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</table>
<div id="paginator">
{% if current_page != 1 %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/groupadmin/?page={{ prev_page }}&per_page={{ per_page }}">{% trans "Previous" %}</a>
{% endif %}
{% if page_next %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/groupadmin/?page={{ next_page }}&per_page={{ per_page }}">{% trans "Next" %}</a>
{% endif %}
{% if current_page != 1 or page_next %}
|
{% endif %}
<span>{% trans "Per page: "%}</span>
{% if per_page == 25 %}
<span> 25 </span>
{% else %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/groupadmin/?per_page=25" class="per-page">25</a>
{% endif %}
{% if per_page == 50 %}
<span> 50 </span>
{% else %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/groupadmin/?per_page=50" class="per-page">50</a>
{% endif %}
{% if per_page == 100 %}
<span> 100 </span>
{% else %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/groupadmin/?per_page=100" class="per-page">100</a>
{% endif %}
</div>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.group-remove-btn'), {
'title':'{% trans "Delete Group" %}',
'con':'{% trans "Are you sure you want to delete %s ?" %}'
});
</script>
{% endblock %}

View File

@@ -1,32 +0,0 @@
{% extends "org_base.html" %}
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
{% load url from future %}
{% block nav_group_class %}class="cur"{% endblock %}
{% block title_panel %}
<h2>{{ org.org_name }}</h2>
{% endblock %}
{% block left_panel %}
<div class="info-item">
<h3 class="info-item-top">{% trans "Tips" %}</h3>
<div class="info-item-bottom">
<p class="not-last">{% trans "After creating a group, you can add members and share libraries to it." %}</p>
<p>{% trans "You can also share to groups that you're not in." %}</p>
</div>
</div>
{% endblock %}
{% block right_panel %}
{% include "group/groups_right_panel.html" %}
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
{% url 'org_groups' org.url_prefix as group_add_url %}
{% with post_url=group_add_url %}
{% include "snippets/group_add_js.html" %}
{% endwith %}
</script>
{% endblock %}

View File

@@ -1,59 +0,0 @@
{% extends "org_base.html" %}
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
{% load url from future %}
{% block nav_pubinfo_class %}class="cur"{% endblock %}
{% block title_panel %}
<h2>{{ org.org_name }}</h2>
{% endblock %}
{% block left_panel %}
<h3>{% trans "Members" %}</h3>
{% if org_members %}
<ul>
{% for member in org_members %}
<li class="member">{% avatar member.email 16 %}<a class="name" href="{{ SITE_ROOT }}profile/{{ member.email }}/" target="_blank">{{ member.email|email2nickname }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
{% endblock %}
{% block right_panel %}
{% if groups %}
<h3>{% trans "Groups"%}</h3>
<ul class="group-list w100 ovhd">
{% for group in groups %}
<li class="group fleft">
<a href="{{ SITE_ROOT }}group/{{ group.props.id }}/" class="no-deco 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 %}
<!-- user profile -->
{% include "snippets/user_profile_html.html" %}
{% endblock %}
{% block extra_script %}
{% include "snippets/user_profile_js.html" %}
<script type="text/javascript">
{% url 'group_list' as group_add_url %}
{% with post_url=group_add_url %}
{% include "snippets/group_add_js.html" %}
{% endwith %}
</script>
{% endblock %}

View File

@@ -1,79 +0,0 @@
{% extends "org_base.html" %}
{% load seahub_tags avatar_tags i18n %}
{% load url from future %}
{% block nav_org_class %}class="cur"{% endblock %}
{% block title_panel %}
<h2>{{ org.org_name }}</h2>
{% endblock %}
{% block left_panel %}
<div class="info-item">
<h3 class="info-item-top">{% trans "Tips"%}</h3>
<div class="info-item-bottom">
<p class="not-last">{% trans "A library marked as read-only can be downloaded." %}</p>
<p>{% trans "Afterwards, updates on server will be downloaded automatically, but updates on local files will not be uploaded."%}</p>
</div>
</div>
{% endblock %}
{% block right_panel %}
<h3>{% trans "Public Libraries"%}</h3>
<button id="repo-create" class="add">{% trans "New Library"%}</button>
{% if repos %}
<table>
<tr>
<th width="4%"><!--icon--></th>
<th width="20%">{% trans "Name"%}</th>
<th width="33%">{% trans "Description"%}</th>
<th width="16%">{% trans "UpdateTime"%}</th>
<th width="15%">{% trans "Shared By"%}</th>
<th width="12%">{% trans "Operations"%}</th>
</tr>
{% for repo in 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="{{ SITE_ROOT }}repo/{{ repo.props.repo_id }}/">{{ repo.props.repo_name }}</a></td>
<td>{{ repo.props.repo_desc }}</td>
{% if repo.last_modified %}
<td>{{ repo.last_modified|translate_seahub_time }}</td>
{% else %}
<td>--</td>
{% endif %}
<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_share_form.html" %}
{% include "snippets/repo_create_form.html" %}
{% include "snippets/user_profile_html.html" %}
{% endblock %}
{% block extra_script %}
{% include "snippets/user_profile_js.html" %}
<script type="text/javascript">
{% include "snippets/myhome_extra_script.html" %}
{% url 'org_inner_pub_repo_create' org.url_prefix as repo_create_url %}
{% with post_url=repo_create_url %}
{% include "snippets/repo_create_js.html" %}
{% endwith %}
</script>
{% endblock %}

View File

@@ -1,67 +0,0 @@
{% extends "org_admin_base.html" %}
{% block nav_seafadmin_class %}class="cur"{% endblock %}
{% load url from future %}
{% load i18n %}
{% block right_panel %}
<h3>{% trans "All Libraries" %}</h3>
{% if repos %}
<table>
<tr>
<th width="4%"><!--icon--></th>
<th width="25%">{% trans "Name" %}</th>
<th width="25%">{% trans "Owner" %}</th>
<th width="34%">{% trans "Description" %}</th>
<th width="12%">{% trans "Operations" %}</th>
</tr>
{% for repo in repos %}
<tr>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="{% trans "directory icon" %}" /></td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/" target="_blank">{{ repo.props.name }}</a></td>
<td><a href="{% url 'user_profile' repo.owner %}" target="_blank">{{ repo.owner }}</a></td>
<td>{{ repo.props.desc }}</td>
<td><a href="#" data-url="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" data-target="{{repo.props.name}}" class="repo-delete-btn op">{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</table>
<div id="paginator">
{% if current_page != 1 %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/seafadmin/?page={{ prev_page }}&per_page={{ per_page }}">{% trans "Previous" %}</a>
{% endif %}
{% if page_next %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/seafadmin/?page={{ next_page }}&per_page={{ per_page }}">{% trans "Next" %}</a>
{% endif %}
{% if current_page != 1 or page_next %}
|
{% endif %}
<span>{% trans "Per page: " %}</span>
{% if per_page == 25 %}
<span> 25 </span>
{% else %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/seafadmin/?per_page=25" class="per-page">25</a>
{% endif %}
{% if per_page == 50 %}
<span> 50 </span>
{% else %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/seafadmin/?per_page=50" class="per-page">50</a>
{% endif %}
{% if per_page == 100 %}
<span> 100 </span>
{% else %}
<a href="{{ SITE_ROOT }}organizations/{{ org.url_prefix }}/seafadmin/?per_page=100" class="per-page">100</a>
{% endif %}
</div>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.repo-delete-btn'), {
'title':'{% trans "Delete Library" %}',
'con':'{% trans "Are you sure you want to delete %s ?" %}'
});
</script>
{% endblock %}

View File

@@ -1,18 +0,0 @@
{% load i18n %}{% autoescape off %}
{% blocktrans %}{{ user }} added you to Organization {{ org_name }} on Seafile. {% endblocktrans %}
{% blocktrans %}
Here is your login information:
email: {{ email }}
password: {{ password }}
Please click the link to log in:
{% endblocktrans %}
{{ protocol }}://{{ domain }}{% url auth_login %}
{% blocktrans %}
and reset your password later.
Thanks for using our site!
The {{ site_name }} team
{% endblocktrans%}
{% endautoescape %}

View File

@@ -1,62 +0,0 @@
{% extends "org_base.html" %}
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
{% load url from future %}
{% block nav_org_personal_class %}class="cur"{% endblock %}
{% block title_panel %}
<h2>{{ org.org_name }}</h2>
{% endblock %}
{% block left_panel %}
<div class="info-item">
<h3 class="info-item-top">{% trans "Account" %}</h3>
<div class="info-item-bottom home-profile ovhd">
<a href="{{ SITE_ROOT }}profile/" class="pic no-deco fleft" title="{% trans "Edit" %}">{% avatar request.user 48 %}</a>
<div class="txt fright">
<p>{% if nickname %}{{ nickname }}{% else %}{% trans "No Nickname" %}{% endif %}</p>
<a href="{{ SITE_ROOT }}profile/" class="edit">{% trans "Edit" %}</a>
</div>
</div>
</div>
<div class="info-item">
<h3 class="info-item-top">{% trans "Space Used" %}</h3>
<p class="info-item-bottom">{{ quota_usage|filesizeformat }}</p>
</div>
{% include "snippets/my_groups.html" %}
{% endblock %}
{% block right_panel %}
{% include "snippets/my_owned_repos.html" %}
{% if events %}
{% include "snippets/events.html" %}
{% endif %}
{% url 'org_repo_share' org.url_prefix as repo_share_url %}
{% with post_url=repo_share_url groups=org_groups %}
{% include "snippets/repo_share_form.html" %}
{% endwith %}
{% include "snippets/repo_create_form.html" %}
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
{% with groups=org_groups %}
{% include "snippets/myhome_extra_script.html" %}
{% endwith %}
{% url 'org_repo_create' org.url_prefix as repo_create_url %}
{% with post_url=repo_create_url %}
{% include "snippets/repo_create_js.html" %}
{% endwith %}
{% if events %}
{% include "snippets/events_js.html" %}
{% endif %}
</script>
{% endblock %}

View File

@@ -1,16 +0,0 @@
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)

View File

@@ -1,33 +0,0 @@
from django.conf.urls.defaults import *
from views import *
urlpatterns = patterns('',
url(r'^create/$', create_org, name='create_org'),
url(r'^messages/$', org_msg, name='org_msg'),
url(r'^(?P<url_prefix>[^/]+)/$', org_root, name='org_root'),
url(r'^(?P<url_prefix>[^/]+)/public/$', org_public, name='org_public'),
url(r'^(?P<url_prefix>[^/]+)/personal/$', org_personal, name='org_personal'),
url(r'^(?P<url_prefix>[^/]+)/repo/create/$', org_repo_create, name='org_repo_create'),
url(r'^(?P<url_prefix>[^/]+)/innerpubrepo/create/$', org_inner_pub_repo_create, name='org_inner_pub_repo_create'),
url(r'^(?P<url_prefix>[^/]+)/innerpubrepo/unset/(?P<repo_id>[^/]+)/$', unset_org_inner_pub_repo, name='unset_org_inner_pub_repo'),
url(r'^(?P<url_prefix>[^/]+)/groups/$', org_groups, name='org_groups'),
url(r'^([^/]+)/repo/create/$', org_repo_create, name='org_repo_create'),
# url(r'^([^/]+)/repo/history/(?P<repo_id>[^/]+)/$', repo_history, name='org_repo_history'),
url(r'^(?P<url_prefix>[^/]+)/pubinfo/$', org_pubinfo, name='org_pubinfo'),
# repo share
url(r'^(?P<url_prefix>[^/]+)/share/$', org_shareadmin, name='org_shareadmin'),
url(r'^(?P<url_prefix>[^/]+)/repo/share/$', org_repo_share, name='org_repo_share'),
url(r'^(?P<url_prefix>[^/]+)/share/permission_admin/$', org_share_permission_admin, name='org_share_permission_admin'),
# url(r'^([^/]+)/repo/(?P<repo_id>[^/]+)/$', RepoView.as_view(), name='repo'),
### Org admin ###
url(r'^(?P<url_prefix>[^/]+)/seafadmin/$', org_seafadmin, name='org_seafadmin'),
url(r'^(?P<url_prefix>[^/]+)/orgadmin/$', org_admin, name='org_admin'),
url(r'^(?P<url_prefix>[^/]+)/useradmin/remove/(?P<user>[^/]+)/$', org_user_remove, name='org_user_remove'),
url(r'^(?P<url_prefix>[^/]+)/groupadmin/$', org_group_admin, name='org_groupadmin'),
url(r'^(?P<url_prefix>[^/]+)/group/remove/(?P<group_id>[\d]+)/$', org_group_remove, name='org_group_remove'),
)

View File

@@ -1,24 +0,0 @@
import sys
from seaserv import get_org_id_by_repo_id, list_org_repos_by_owner
def access_org_repo(request, repo_id):
"""
Check whether user can view org repo.
"""
if not request.user.org:
return False
cur_org_id = request.user.org['org_id']
org_id = get_org_id_by_repo_id(repo_id)
return True if cur_org_id == org_id else False
def validate_org_repo_owner(org_id, repo_id, user):
"""
Check whether user is the owner of org repo.
"""
org_repos = list_org_repos_by_owner(org_id, user)
print org_id, user, org_repos
for r in org_repos:
if r.id == repo_id:
return True
return False

View File

@@ -1,810 +0,0 @@
# encoding: utf-8
import os
import simplejson as json
import sys
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.core.mail import send_mail
from django.contrib.sites.models import Site, RequestSite
from django.http import HttpResponse, HttpResponseBadRequest, Http404, \
HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import Context, loader, RequestContext
from django.utils.translation import ugettext as _
from auth.decorators import login_required
from pysearpc import SearpcError
from seaserv import ccnet_threaded_rpc, seafserv_rpc, seafserv_threaded_rpc,\
get_orgs_by_user, get_org_repos, list_org_inner_pub_repos, \
get_org_by_url_prefix, create_org, get_user_current_org, add_org_user, \
remove_org_user, get_org_groups, is_valid_filename, org_user_exists, \
create_org_repo, get_org_id_by_group, get_org_groups_by_user, \
get_org_users_by_url_prefix, list_org_shared_repos, is_personal_repo, \
get_org_group_repoids, is_org_repo_owner, get_repo, get_commits, \
check_permission, get_org_repo_owner
from decorators import org_staff_required
from forms import OrgCreateForm
from signals import org_user_added
from utils import validate_org_repo_owner
from notifications.models import UserNotification
from profile.models import Profile
from share.models import FileShare
from share.forms import RepoShareForm
from registration.models import RegistrationProfile
from base.accounts import User
from contacts import Contact
from seahub.forms import RepoCreateForm, SharedRepoCreateForm
import seahub.settings as seahub_settings
from seahub.utils import render_error, render_permission_error, gen_token, \
validate_group_name, string2list, calculate_repo_last_modify, MAX_INT, \
EVENTS_ENABLED, get_starred_files, gen_shared_link
from seahub.views import myhome
from seahub.signals import repo_created
@login_required
def create_org(request):
"""
Create org account.
"""
if request.method == 'POST':
form = OrgCreateForm(request.POST)
if form.is_valid():
org_name = form.cleaned_data['org_name']
url_prefix = form.cleaned_data['url_prefix']
username = request.user.username
try:
# create_org(org_name, url_prefix, username)
ccnet_threaded_rpc.create_org(org_name, url_prefix, username)
return HttpResponseRedirect(\
reverse(org_personal, args=[url_prefix]))
except SearpcError, e:
return render_error(request, e.msg, extra_ctx={
'base_template': 'myhome_base.html',
})
else:
form = OrgCreateForm()
return render_to_response('organizations/create_org.html', {
'form': form,
}, context_instance=RequestContext(request))
@login_required
def org_root(request, url_prefix):
return HttpResponseRedirect(reverse(org_personal, args=[url_prefix]))
@login_required
def org_public(request, url_prefix):
"""
Show org info page, list org inner pub repos.
"""
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponseRedirect(reverse(myhome))
repos = list_org_inner_pub_repos(org.org_id, request.user.username)
return render_to_response('organizations/org_public.html', {
'org': org,
'repos': repos,
'create_shared_repo': True,
}, context_instance=RequestContext(request))
@login_required
def org_personal(request, url_prefix):
"""
Show org personal page.
"""
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponseRedirect(reverse(myhome))
user = request.user.username
# Org repos that I own
owned_repos = seafserv_threaded_rpc.list_org_repos_by_owner(org.org_id,
user)
calculate_repo_last_modify(owned_repos)
owned_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify))
# Org groups user created
groups = get_org_groups_by_user(org.org_id, user)
# Org repos others shared to me
in_repos = list_org_shared_repos(org.org_id, user,'to_email', -1, -1)
# For each org group I joined...
for grp in groups:
# Get org group repos, and for each group repos...
for r_id in get_org_group_repoids(org.org_id, grp.id):
# No need to list my own repo
if is_org_repo_owner(org.org_id, r_id, user):
continue
# Convert repo properties due to the different collumns in Repo
# and SharedRepo
r = get_repo(r_id)
if not r:
continue
r.repo_id = r.id
r.repo_name = r.name
r.repo_desc = r.desc
last_commit = get_commits(r_id, 0, 1)[0]
r.last_modified = last_commit.ctime if last_commit else 0
r.share_type = 'group'
r.user = get_org_repo_owner(r_id)
r.user_perm = check_permission(r_id, user)
in_repos.append(r)
in_repos.sort(lambda x, y: cmp(y.last_modified, x.last_modified))
# All org groups used in auto complete.
org_groups = get_org_groups(org.org_id, -1, -1)
# Org members used in auto complete
contacts = []
org_members = get_org_users_by_url_prefix(org.url_prefix, 0, MAX_INT)
for m in org_members:
if m.email == user: # shouldn' show my'email in auto complete
continue
m.contact_email = m.email
contacts.append(m)
# Get nickname
if not Profile.objects.filter(user=request.user.username):
nickname = ''
else:
profile = Profile.objects.filter(user=request.user.username)[0]
nickname = profile.nickname
# events
if EVENTS_ENABLED:
events = True
else:
events = False
quota_usage = seafserv_threaded_rpc.get_org_user_quota_usage(org.org_id, user)
starred_files = get_starred_files(user, org_id=org.org_id)
return render_to_response('organizations/personal.html', {
'owned_repos': owned_repos,
"in_repos": in_repos,
'org': org,
'groups': groups,
'org_groups': org_groups,
'contacts': contacts,
'create_shared_repo': False,
'allow_public_share': True,
'nickname': nickname,
'events': events,
'quota_usage': quota_usage,
'starred_files': starred_files,
}, context_instance=RequestContext(request))
@login_required
def org_inner_pub_repo_create(request, url_prefix):
"""
Handle ajax post to create org inner pub repo, this repo is accessiable by
all org members.
"""
if not request.is_ajax() or request.method != 'POST':
return Http404
result = {}
content_type = 'application/json; charset=utf-8'
form = SharedRepoCreateForm(request.POST)
if form.is_valid():
repo_name = form.cleaned_data['repo_name']
repo_desc = form.cleaned_data['repo_desc']
permission = form.cleaned_data['permission']
passwd = form.cleaned_data['passwd']
user = request.user.username
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponse(json.dumps(_(u'Failed to create the library: you has not joined this organizatioin.')),
content_type=content_type)
try:
# create a org repo
repo_id = create_org_repo(repo_name, repo_desc, user, passwd,
org.org_id)
# set org inner pub
seafserv_threaded_rpc.set_org_inner_pub_repo(org.org_id, repo_id, permission)
except:
repo_id = None
if not repo_id:
result['error'] = _(u"Failed to create.")
else:
result['success'] = True
repo_created.send(sender=None,
org_id=org.org_id,
creator=user,
repo_id=repo_id,
repo_name=repo_name)
return HttpResponse(json.dumps(result), content_type=content_type)
else:
return HttpResponseBadRequest(json.dumps(form.errors),
content_type=content_type)
@login_required
def unset_org_inner_pub_repo(request, url_prefix, repo_id):
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponseRedirect(reverse(org_public, args=[url_prefix]))
try:
seafserv_threaded_rpc.unset_org_inner_pub_repo(org.org_id, repo_id)
except SearpcError:
pass
messages.add_message(request, messages.INFO, _('Operation Succeeded.'))
return HttpResponseRedirect(reverse(org_shareadmin, args=[url_prefix]))
@login_required
def org_groups(request, url_prefix):
"""
List org groups and add org group.
"""
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponseRedirect(reverse(myhome))
if request.method == 'POST':
result = {}
content_type = 'application/json; charset=utf-8'
group_name = request.POST.get('group_name')
if not validate_group_name(group_name):
result['error'] = _(u'Group name can only contain letters, digits and underscore')
return HttpResponse(json.dumps(result), content_type=content_type)
try:
e_grpname = group_name.encode('utf-8')
user = request.user.username
group_id = ccnet_threaded_rpc.create_org_group(org.org_id,
e_grpname,
user)
except SearpcError, e:
result['error'] = _(e.msg)
return HttpResponse(json.dumps(result), content_type=content_type)
return HttpResponse(json.dumps({'success': True}),
content_type=content_type)
joined_groups = get_org_groups_by_user(org.org_id, request.user.username)
groups = get_org_groups(org.org_id, -1, -1)
org_members = get_org_users_by_url_prefix(url_prefix, 0, MAX_INT)
return render_to_response('organizations/org_groups.html', {
'org': org,
'groups': groups,
'joined_groups': joined_groups,
'org_members': org_members,
}, context_instance=RequestContext(request))
def send_org_user_add_mail(request, email, password, org_name):
"""
Send email when add new user.
"""
use_https = request.is_secure()
domain = RequestSite(request).domain
t = loader.get_template('organizations/org_user_add_email.html')
c = {
'user': request.user.username,
'org_name': org_name,
'email': email,
'password': password,
'domain': domain,
'protocol': use_https and 'https' or 'http',
'site_name': seahub_settings.SITE_NAME,
}
try:
send_mail(_(u'Seafile Login Information'), t.render(Context(c)),
None, [email], fail_silently=False)
messages.add_message(request, messages.INFO, _(u'Mail sent successfully'))
except:
messages.add_message(request, messages.ERROR, _(u'Failed to send the email'))
@login_required
@org_staff_required
def org_admin(request, url_prefix):
"""
List and add org users.
"""
if request.method == 'POST':
emails = request.POST.get('added-member-name')
email_list = string2list(emails)
for email in email_list:
if not email or email.find('@') <= 0 :
continue
org_id = request.user.org['org_id']
try:
User.objects.get(email=email)
email = email.strip(' ')
org_id = request.user.org['org_id']
add_org_user(org_id, email, 0)
# send signal
org_user_added.send(sender=None, org_id=org_id,
from_email=request.user.username,
to_email=email)
except User.DoesNotExist:
# User is not registered, just create account and
# add that account to org
password = gen_token(max_length=6)
if Site._meta.installed:
site = Site.objects.get_current()
else:
site = RequestSite(request)
RegistrationProfile.objects.create_active_user(\
email, email, password, site, send_email=False)
add_org_user(org_id, email, 0)
if hasattr(seahub_settings, 'EMAIL_HOST'):
org_name = request.user.org['org_name']
send_org_user_add_mail(request, email, password, org_name)
# Make sure page request is an int. If not, deliver first page.
try:
current_page = int(request.GET.get('page', '1'))
per_page= int(request.GET.get('per_page', '25'))
except ValueError:
current_page = 1
per_page = 25
users_plus_one = get_org_users_by_url_prefix(
url_prefix, per_page * (current_page - 1), per_page + 1)
if len(users_plus_one) == per_page + 1:
page_next = True
else:
page_next = False
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponseRedirect(reverse(myhome))
users = users_plus_one[:per_page]
for user in users:
if user.props.id == request.user.id:
user.is_self = True
try:
user.quota_usage = seafserv_threaded_rpc.get_org_user_quota_usage(org.org_id, user.email)
except:
user.quota_usage = -1
# My contacts
contacts = Contact.objects.filter(user_email=request.user.username)
org_quota_usage = seafserv_threaded_rpc.get_org_quota_usage(org.org_id)
org_quota = seafserv_threaded_rpc.get_org_quota(org.org_id)
return render_to_response(
'organizations/org_admin.html', {
'users': users,
'contacts': contacts,
'current_page': current_page,
'prev_page': current_page-1,
'next_page': current_page+1,
'per_page': per_page,
'page_next': page_next,
'org_quota_usage': org_quota_usage,
'org_quota': org_quota,
},
context_instance=RequestContext(request))
@login_required
@org_staff_required
def org_user_remove(request, url_prefix, user):
"""
Remove org user.
"""
org_id = request.user.org['org_id']
url_prefix = request.user.org['url_prefix']
remove_org_user(org_id, user)
messages.success(request, _(u"Successfully deleted."))
return HttpResponseRedirect(reverse('org_admin', args=[url_prefix]))
def org_msg(request):
"""
Show organization user added messages.
"""
orgmsg_list = []
notes = UserNotification.objects.filter(to_user=request.user.username)
for n in notes:
if n.msg_type == 'org_join_msg':
try:
d = json.loads(n.detail)
from_email = d['from_email']
org_name = d['org_name']
org_prefix = d['org_prefix']
org_url = reverse('org_public', args=[org_prefix])
msg = _(u'%(from_email)s added you to Organization <a href="%(org_url)s">%(org_name)s</a>') % \
{'from_email':from_email,
'org_url': org_url,
'org_name': org_name}
orgmsg_list.append(msg)
except json.decoder.JSONDecodeError:
# This message is not json format, just list to user.
orgmsg_list.append(n.detail)
# remove new org msg notification
UserNotification.objects.filter(to_user=request.user.username,
msg_type='org_join_msg').delete()
return render_to_response('organizations/new_msg.html', {
'orgmsg_list': orgmsg_list,
}, context_instance=RequestContext(request))
@login_required
def org_repo_create(request, url_prefix):
"""
Handle ajax post to create org repo, this repo is only accessiable by owner.
"""
if not request.is_ajax() or request.method != 'POST':
return Http404
result = {}
content_type = 'application/json; charset=utf-8'
form = RepoCreateForm(request.POST)
if form.is_valid():
repo_name = form.cleaned_data['repo_name']
repo_desc = form.cleaned_data['repo_desc']
encrypted = form.cleaned_data['encryption']
passwd = form.cleaned_data['passwd']
passwd_again = form.cleaned_data['passwd_again']
user = request.user.username
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponse(json.dumps(_(u'Failed to create: you has not joined this organization')),
content_type=content_type)
repo_id = create_org_repo(repo_name, repo_desc, user, passwd,
org.org_id)
if not repo_id:
result['error'] = _(u'Failed to create')
else:
result['success'] = True
repo_created.send(sender=None,
org_id=org.org_id,
creator=user,
repo_id=repo_id,
repo_name=repo_name)
return HttpResponse(json.dumps(result), content_type=content_type)
else:
return HttpResponseBadRequest(json.dumps(form.errors),
content_type=content_type)
@login_required
@org_staff_required
def org_seafadmin(request, url_prefix):
# Make sure page request is an int. If not, deliver first page.
try:
current_page = int(request.GET.get('page', '1'))
per_page= int(request.GET.get('per_page', '25'))
except ValueError:
current_page = 1
per_page = 25
repos_all = get_org_repos(request.user.org['org_id'],
per_page * (current_page -1),
per_page + 1)
repos = repos_all[:per_page]
if len(repos_all) == per_page + 1:
page_next = True
else:
page_next = False
return render_to_response(
'organizations/org_seafadmin.html', {
'repos': repos,
'current_page': current_page,
'prev_page': current_page-1,
'next_page': current_page+1,
'per_page': per_page,
'page_next': page_next,
},
context_instance=RequestContext(request))
@login_required
@org_staff_required
def org_group_admin(request, url_prefix):
# Make sure page request is an int. If not, deliver first page.
try:
current_page = int(request.GET.get('page', '1'))
per_page= int(request.GET.get('per_page', '25'))
except ValueError:
current_page = 1
per_page = 25
groups_plus_one = get_org_groups (request.user.org['org_id'],
per_page * (current_page -1),
per_page +1)
groups = groups_plus_one[:per_page]
if len(groups_plus_one) == per_page + 1:
page_next = True
else:
page_next = False
return render_to_response('organizations/org_group_admin.html', {
'groups': groups,
'current_page': current_page,
'prev_page': current_page-1,
'next_page': current_page+1,
'per_page': per_page,
'page_next': page_next,
}, context_instance=RequestContext(request))
@login_required
@org_staff_required
def org_group_remove(request, url_prefix, group_id):
# Request header may missing HTTP_REFERER, we need to handle that case.
next = request.META.get('HTTP_REFERER', None)
if not next:
next = seahub_settings.SITE_ROOT
try:
group_id_int = int(group_id)
except ValueError:
return HttpResponseRedirect(next)
# Check whether is the org group.
org_id = get_org_id_by_group(group_id_int)
if request.user.org['org_id'] != org_id:
return render_permission_error(request, _(u"This group doesn't belong to current organazation"),
extra_ctx={'org': request.user.org,
'base_template': 'org_base.html'})
try:
ccnet_threaded_rpc.remove_group(group_id_int, request.user.username)
seafserv_threaded_rpc.remove_repo_group(group_id_int, None)
ccnet_threaded_rpc.remove_org_group(org_id, group_id_int)
except SearpcError, e:
return render_error(request, e.msg, extra_ctx={
'org': request.user.org,
'base_template': 'org_base.html',
})
return HttpResponseRedirect(next)
@login_required
def org_repo_share(request, url_prefix):
"""
Share org repo to members or groups in current org.
"""
if request.method != 'POST':
raise Http404
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponseRedirect(reverse(myhome))
form = RepoShareForm(request.POST)
if not form.is_valid():
# TODO: may display error msg on form
raise Http404
email_or_group = form.cleaned_data['email_or_group']
repo_id = form.cleaned_data['repo_id']
permission = form.cleaned_data['permission']
from_email = request.user.username
# Test whether user is the repo owner
if not validate_org_repo_owner(org.org_id, repo_id, request.user.username):
return render_permission_error(request, _(u'Only the owner of this library has permission to share it.'),
extra_ctx={
'org': org,
'base_template': 'org_base.html',
})
share_to_list = string2list(email_or_group)
for share_to in share_to_list:
if share_to == 'all':
''' Share to public '''
try:
seafserv_threaded_rpc.set_org_inner_pub_repo(org.org_id,
repo_id, permission)
except:
msg = _(u'Failed to share to all members')
messages.add_message(request, messages.ERROR, msg)
continue
msg = _(u'Shared to all members successfully, you can go check it at <a href="%s">Share</a>.') % \
(reverse('org_shareadmin', args=[org.url_prefix]))
messages.add_message(request, messages.INFO, msg)
elif (share_to.find('@') == -1):
''' Share repo to group '''
# TODO: if we know group id, then we can simplly call group_share_repo
group_name = share_to
# Get all org groups.
groups = get_org_groups(org.org_id, -1, -1)
find = False
for group in groups:
# for every group that user joined, if group name and
# group creator matchs, then has finded the group
if group.props.group_name == group_name:
seafserv_threaded_rpc.add_org_group_repo(repo_id,
org.org_id,
group.id,
from_email,
permission)
find = True
msg = _(u'Shared to %(group)s successfullyyou can go check it at <a href="%(share)s">Share</a>.') % \
{'group':group_name, 'share':reverse('org_shareadmin', args=[org.url_prefix])}
messages.add_message(request, messages.INFO, msg)
break
if not find:
msg = _(u'Failed to share to %s.') % group_name
messages.add_message(request, messages.ERROR, msg)
else:
''' Share repo to user '''
# Test whether share_to is in this org
if not org_user_exists(org.org_id, share_to):
msg = _(u'Failed to share to %s: this user does not exist in the organization.') % share_to
messages.add_message(request, messages.ERROR, msg)
continue
# Record share info to db.
try:
seafserv_threaded_rpc.add_share(repo_id, from_email, share_to,
permission)
msg = _(u'Shared to %(share_to)s successfullyyou can go check it at <a href="%(share)s">Share</a>.') % \
{"share_to":share_to,
"share": reverse('org_shareadmin', args=[org.url_prefix])}
messages.add_message(request, messages.INFO, msg)
except SearpcError, e:
msg = _(u'Failed to share to %s.') % share_to
messages.add_message(request, messages.ERROR, msg)
continue
return HttpResponseRedirect(reverse(org_personal, args=[org.url_prefix]))
@login_required
def org_shareadmin(request, url_prefix):
"""
List org shared repos and org shared links.
"""
username = request.user.username
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponseRedirect(reverse(myhome))
shared_repos = []
# org repos shared by this user
shared_repos += seafserv_threaded_rpc.list_org_share_repos(org.org_id,
username,
'from_email',
-1, -1)
# repos shared to groups
group_repos = seafserv_threaded_rpc.get_org_group_repos_by_owner(org.org_id,
username)
for repo in group_repos:
group = ccnet_threaded_rpc.get_group(int(repo.group_id))
if not group:
repo.props.user = ''
continue
repo.props.user = group.props.group_name
repo.props.user_info = repo.group_id
shared_repos += group_repos
# public repos shared by this user
pub_repos = seafserv_threaded_rpc.list_org_inner_pub_repos_by_owner(org.org_id,
username)
for repo in pub_repos:
repo.props.user = _(u'all members')
repo.props.user_info = 'all'
shared_repos += pub_repos
for repo in shared_repos:
if repo.props.permission == 'rw':
repo.share_permission = _(u'Read-Write')
elif repo.props.permission == 'r':
repo.share_permission = _(u'Read-Only')
else:
repo.share_permission = ''
if repo.props.share_type == 'personal':
repo.props.user_info = repo.props.user
shared_repos.sort(lambda x, y: cmp(x.repo_id, y.repo_id))
# shared links
fileshares = FileShare.objects.filter(username=request.user.username)
o_fileshares = [] # shared links in org repos
for fs in fileshares:
if not is_personal_repo(fs.repo_id): # only list links in org repos
if fs.s_type == 'f':
fs.filename = os.path.basename(fs.path)
fs.shared_link = gen_shared_link(request, fs.token, 'f')
else:
fs.filename = os.path.basename(fs.path[:-1])
fs.shared_link = gen_shared_link(request, fs.token, 'd')
r = get_repo(fs.repo_id) # get_repo may returns None
if not r:
continue
fs.repo = r
o_fileshares.append(fs)
# use org base template
request.base_template = 'org_base.html'
return render_to_response('repo/share_admin.html', {
"org": org,
"shared_repos": shared_repos,
"fileshares": o_fileshares,
"protocol": request.is_secure() and 'https' or 'http',
"domain": RequestSite(request).domain,
}, context_instance=RequestContext(request))
@login_required
def org_share_permission_admin(request, url_prefix):
org_id = int(request.GET.get('org_id', ''))
share_type = request.GET.get('share_type', '')
content_type = 'application/json; charset=utf-8'
form = RepoShareForm(request.POST)
form.is_valid()
email_or_group = form.cleaned_data['email_or_group']
repo_id = form.cleaned_data['repo_id']
permission = form.cleaned_data['permission']
from_email = request.user.username
if share_type == 'personal':
try:
seafserv_threaded_rpc.set_share_permission(repo_id, from_email, email_or_group, permission)
except:
return HttpResponse(json.dumps({'success': False}), status=500, content_type=content_type)
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
if share_type == 'group':
group_id = int(email_or_group)
try:
seafserv_threaded_rpc.set_org_group_repo_permission(org_id, group_id, repo_id, permission)
except:
return HttpResponse(json.dumps({'success': False}), status=500, content_type=content_type)
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
if share_type == 'public':
try:
seafserv_threaded_rpc.set_org_inner_pub_repo(org_id, repo_id, permission)
except:
return HttpResponse(json.dumps({'success': False}), status=500, content_type=content_type)
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
@login_required
def org_pubinfo(request, url_prefix):
"""
Show org public information.
"""
org = get_user_current_org(request.user.username, url_prefix)
if not org:
return HttpResponseRedirect(reverse(myhome))
groups = get_org_groups(org.org_id, -1, -1)
org_members = get_org_users_by_url_prefix(url_prefix, 0, MAX_INT)
return render_to_response('organizations/org_pubinfo.html', {
'org': org,
'groups': groups,
'org_members': org_members,
}, context_instance=RequestContext(request))

View File

@@ -138,7 +138,6 @@ INSTALLED_APPS = (
'seahub.wiki',
'seahub.group',
'seahub.notifications',
# 'seahub.organizations',
'seahub.profile',
'seahub.share',
'api2',