diff --git a/organizations/__init__.py b/organizations/__init__.py deleted file mode 100644 index f344c1e1d4..0000000000 --- a/organizations/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from signals import * -from handlers import * - -org_user_added.connect(org_user_added_cb, sender=None) diff --git a/organizations/context_processors.py b/organizations/context_processors.py deleted file mode 100644 index 4fdfb96d3d..0000000000 --- a/organizations/context_processors.py +++ /dev/null @@ -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} - diff --git a/organizations/decorators.py b/organizations/decorators.py deleted file mode 100644 index 994852aecf..0000000000 --- a/organizations/decorators.py +++ /dev/null @@ -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 diff --git a/organizations/forms.py b/organizations/forms.py deleted file mode 100644 index e5c98ee553..0000000000 --- a/organizations/forms.py +++ /dev/null @@ -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("该个性域名已被注册") diff --git a/organizations/handlers.py b/organizations/handlers.py deleted file mode 100644 index 7fb13d69e3..0000000000 --- a/organizations/handlers.py +++ /dev/null @@ -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() diff --git a/organizations/i18n.sh.template b/organizations/i18n.sh.template deleted file mode 100755 index 9dcbe0d14a..0000000000 --- a/organizations/i18n.sh.template +++ /dev/null @@ -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 diff --git a/organizations/locale/fr/LC_MESSAGES/django.po b/organizations/locale/fr/LC_MESSAGES/django.po deleted file mode 100644 index cb78a8cb10..0000000000 --- a/organizations/locale/fr/LC_MESSAGES/django.po +++ /dev/null @@ -1,444 +0,0 @@ -# This file is distributed under the same license as the PACKAGE package. -# Pierrick BRUN, pierrick.brun@gmail.com 2013 -# Pi3R1k , 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 \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 " -"%(org_name)s" -msgstr "" -"%(from_email)s vous a ajouté à l'organisation " -"%(org_name)s" - -#: 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 Share." -msgstr "" -"Partagé à tous les membres avec succès, vous pouvez vérifier sur Partages." - -#: views.py:646 -#, python-format -msgid "" -"Shared to %(group)s successfully,you can go check it at Share." -msgstr "" -"Partagé à %(group)s avec succès,vous pouvez vérifier sur Partages." - -#: 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 successfully,you can go check it at Share." -msgstr "" -"Partage de %(share_to)s réussit,vous pouvez vérifier sur Partages." - -#: 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 "我已用的团体空间" diff --git a/organizations/locale/zh_CN/LC_MESSAGES/django.po b/organizations/locale/zh_CN/LC_MESSAGES/django.po deleted file mode 100644 index 9ae60fef9c..0000000000 --- a/organizations/locale/zh_CN/LC_MESSAGES/django.po +++ /dev/null @@ -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 , 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 \n" -"Language-Team: LANGUAGE \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 " -"%(org_name)s" -msgstr "%(from_email)s 将你加入到团体 %(org_name)s" - -#: 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 Share." -msgstr "共享到公共资料成功,请前往共享查看。" - -#: views.py:646 -#, python-format -msgid "" -"Shared to %(group)s successfully,you can go check it at Share." -msgstr "共享到 %(group)s 成功,请前往共享查看。" - -#: 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 successfully,you can go check it at Share." -msgstr "共享给 %(share_to)s 成功,请前往共享查看。" - -#: 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 "我已用的团体空间" diff --git a/organizations/models.py b/organizations/models.py deleted file mode 100644 index 71a8362390..0000000000 --- a/organizations/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/organizations/settings.py b/organizations/settings.py deleted file mode 100644 index 00719086af..0000000000 --- a/organizations/settings.py +++ /dev/null @@ -1 +0,0 @@ -from django.conf import settings diff --git a/organizations/signals.py b/organizations/signals.py deleted file mode 100644 index a19bc636e1..0000000000 --- a/organizations/signals.py +++ /dev/null @@ -1,3 +0,0 @@ -import django.dispatch - -org_user_added = django.dispatch.Signal(providing_args=["org_id", "from_email", "to_email"]) diff --git a/organizations/templates/organizations/create_org.html b/organizations/templates/organizations/create_org.html deleted file mode 100644 index 4d8abcdf04..0000000000 --- a/organizations/templates/organizations/create_org.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "myhome_base.html" %} -{% load i18n %} -{% block main_panel %} -
-

{% trans "Create Orgnization" %}

-
- - {{ form.org_name}} - {% trans "Url Prefix" %} - {{ form.url_prefix }} -

{% trans "Url prefix can only contains letters and digits." %}

-

- {{ form.url_prefix.errors }} - - -
-{% endblock %} diff --git a/organizations/templates/organizations/new_msg.html b/organizations/templates/organizations/new_msg.html deleted file mode 100644 index e525020e37..0000000000 --- a/organizations/templates/organizations/new_msg.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends 'myhome_base.html' %} -{% load seahub_tags avatar_tags %} - -{% block main_panel %} -
-{% if orgmsg_list %} -{% autoescape off %} -
    - {% for msg in orgmsg_list %} -
  • -

    {{ msg }}

    -
  • - {% endfor %} -
-{% endautoescape %} -{% else %} -

暂无

-{% endif %} -
-{% endblock %} - -{% block extra_script %} -{% endblock %} diff --git a/organizations/templates/organizations/org_admin.html b/organizations/templates/organizations/org_admin.html deleted file mode 100644 index 18156fa2f3..0000000000 --- a/organizations/templates/organizations/org_admin.html +++ /dev/null @@ -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 %} -
-

{% trans "Space Used" %}

-

{{ org_quota_usage|filesizeformat }} {% if org_quota > 0 %} / {{ org_quota|filesizeformat }} {% endif %}

-
-{% endblock %} - -{% block right_panel %} -

{% trans "All Members" %}

- - - - - - - - - {% for user in users %} - - - - - - {% endfor %} -
{% trans "Email" %}{% trans "Space Used" %}{% trans "Operations" %}
{{ user.props.email }} - {% if user.quota_usage >= 0 %} - {{ user.quota_usage|filesizeformat }} - {% endif %} - - {% if not user.is_self %} - {% trans "Delete" %} - {% endif %} -
- -
- {% if current_page != 1 %} - {% trans "Previous" %} - {% endif %} - {% if page_next %} - {% trans "Next" %} - {% endif %} - {% if current_page != 1 or page_next %} - | - {% endif %} - {% trans "Per page: "%} - {% if per_page == 25 %} - 25 - {% else %} - 25 - {% endif %} - {% if per_page == 50 %} - 50 - {% else %} - 50 - {% endif %} - {% if per_page == 100 %} - 100 - {% else %} - 100 - {% endif %} -
- -
-
- -

{% trans "An invitation will be sent if the email is not registered." %}

-

{% trans "Emails is required." %}

- -
- -{% endblock %} - -{% block extra_script %} - -{% endblock %} diff --git a/organizations/templates/organizations/org_group_admin.html b/organizations/templates/organizations/org_group_admin.html deleted file mode 100644 index e4e9136f15..0000000000 --- a/organizations/templates/organizations/org_group_admin.html +++ /dev/null @@ -1,66 +0,0 @@ -{% extends "org_admin_base.html" %} -{% load seahub_tags i18n %} - -{% block nav_groupadmin_class %}class="cur"{% endblock %} - -{% block right_panel %} -

{% trans "Groups" %}

-{% if groups %} - - - - - - - - {% for group in groups %} - - - - - - - {% endfor %} -
{% trans "Name" %}{% trans "Creator" %}{% trans "Created At" %}{% trans "Operations" %}
{{ group.props.group_name }}{{ group.props.creator_name }}{{ group.props.timestamp|tsstr_sec }}{% trans "Delete" %}
- -
- {% if current_page != 1 %} - {% trans "Previous" %} - {% endif %} - {% if page_next %} - {% trans "Next" %} - {% endif %} - {% if current_page != 1 or page_next %} - | - {% endif %} - {% trans "Per page: "%} - {% if per_page == 25 %} - 25 - {% else %} - 25 - {% endif %} - {% if per_page == 50 %} - 50 - {% else %} - 50 - {% endif %} - {% if per_page == 100 %} - 100 - {% else %} - 100 - {% endif %} -
-{% else %} -

{% trans "None" %}

-{% endif %} -{% endblock %} - -{% block extra_script %} - -{% endblock %} - diff --git a/organizations/templates/organizations/org_groups.html b/organizations/templates/organizations/org_groups.html deleted file mode 100644 index 35bb6ab59c..0000000000 --- a/organizations/templates/organizations/org_groups.html +++ /dev/null @@ -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 %} -

{{ org.org_name }}

-{% endblock %} - -{% block left_panel %} -
-

{% trans "Tips" %}

-
-

{% trans "After creating a group, you can add members and share libraries to it." %}

-

{% trans "You can also share to groups that you're not in." %}

-
-
-{% endblock %} - -{% block right_panel %} -{% include "group/groups_right_panel.html" %} -{% endblock %} - -{% block extra_script %} - -{% endblock %} diff --git a/organizations/templates/organizations/org_pubinfo.html b/organizations/templates/organizations/org_pubinfo.html deleted file mode 100644 index c504105605..0000000000 --- a/organizations/templates/organizations/org_pubinfo.html +++ /dev/null @@ -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 %} -

{{ org.org_name }}

-{% endblock %} - -{% block left_panel %} -

{% trans "Members" %}

-{% if org_members %} - -{% else %} -

{% trans "None" %}

-{% endif %} -{% endblock %} - -{% block right_panel %} -{% if groups %} -

{% trans "Groups"%}

- -{% else %} -
-

{% trans "No one has created any groups yet" %}

-

{% blocktrans %}You can click "Add Group" button under "Group" label to create a group. {% endblocktrans %}

-
-{% endif %} - -{% include "snippets/user_profile_html.html" %} -{% endblock %} - -{% block extra_script %} -{% include "snippets/user_profile_js.html" %} - -{% endblock %} diff --git a/organizations/templates/organizations/org_public.html b/organizations/templates/organizations/org_public.html deleted file mode 100644 index bb629177bb..0000000000 --- a/organizations/templates/organizations/org_public.html +++ /dev/null @@ -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 %} -

{{ org.org_name }}

-{% endblock %} - -{% block left_panel %} -
-

{% trans "Tips"%}

-
-

{% trans "A library marked as read-only can be downloaded." %}

-

{% trans "Afterwards, updates on server will be downloaded automatically, but updates on local files will not be uploaded."%}

-
-
-{% endblock %} - -{% block right_panel %} -

{% trans "Public Libraries"%}

- -{% if repos %} - - - - - - - - - - {% for repo in repos %} - - - - - {% if repo.last_modified %} - - {% else %} - - {% endif %} - - - - {% endfor %} -
{% trans "Name"%}{% trans "Description"%}{% trans "UpdateTime"%}{% trans "Shared By"%}{% trans "Operations"%}
- {% if repo.user_perm == 'rw' %} - {% trans - {% else %} - {% trans - {% endif %} - {{ repo.props.repo_name }}{{ repo.props.repo_desc }}{{ repo.last_modified|translate_seahub_time }}--{{ repo.props.user|email2nickname }} - {% trans -
-{% else %} -
-

{% trans "No public library" %}

-

{% blocktrans %}You can create a public library by clicking "New Library" button, others can view and download this library.{% endblocktrans %}

-
-{% 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" %} - -{% endblock %} diff --git a/organizations/templates/organizations/org_seafadmin.html b/organizations/templates/organizations/org_seafadmin.html deleted file mode 100644 index 294ff40e52..0000000000 --- a/organizations/templates/organizations/org_seafadmin.html +++ /dev/null @@ -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 %} -

{% trans "All Libraries" %}

-{% if repos %} - - - - - - - - - {% for repo in repos %} - - - - - - - - {% endfor %} -
{% trans "Name" %}{% trans "Owner" %}{% trans "Description" %}{% trans "Operations" %}
{% trans {{ repo.props.name }}{{ repo.owner }}{{ repo.props.desc }}{% trans "Delete" %}
- -
- {% if current_page != 1 %} - {% trans "Previous" %} - {% endif %} - {% if page_next %} - {% trans "Next" %} - {% endif %} - {% if current_page != 1 or page_next %} - | - {% endif %} - {% trans "Per page: " %} - {% if per_page == 25 %} - 25 - {% else %} - 25 - {% endif %} - {% if per_page == 50 %} - 50 - {% else %} - 50 - {% endif %} - {% if per_page == 100 %} - 100 - {% else %} - 100 - {% endif %} -
-{% else %} -

{% trans "None" %}

-{% endif %} -{% endblock %} - -{% block extra_script %} - -{% endblock %} diff --git a/organizations/templates/organizations/org_user_add_email.html b/organizations/templates/organizations/org_user_add_email.html deleted file mode 100644 index b715d5883c..0000000000 --- a/organizations/templates/organizations/org_user_add_email.html +++ /dev/null @@ -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 %} diff --git a/organizations/templates/organizations/personal.html b/organizations/templates/organizations/personal.html deleted file mode 100644 index 7ce7817283..0000000000 --- a/organizations/templates/organizations/personal.html +++ /dev/null @@ -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 %} -

{{ org.org_name }}

-{% endblock %} - -{% block left_panel %} -
-

{% trans "Account" %}

-
- {% avatar request.user 48 %} -
-

{% if nickname %}{{ nickname }}{% else %}{% trans "No Nickname" %}{% endif %}

- {% trans "Edit" %} -
-
-
- - -
-

{% trans "Space Used" %}

-

{{ quota_usage|filesizeformat }}

-
- -{% 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 %} - -{% endblock %} diff --git a/organizations/tests.py b/organizations/tests.py deleted file mode 100644 index 501deb776c..0000000000 --- a/organizations/tests.py +++ /dev/null @@ -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) diff --git a/organizations/urls.py b/organizations/urls.py deleted file mode 100644 index 178ba2802b..0000000000 --- a/organizations/urls.py +++ /dev/null @@ -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[^/]+)/$', org_root, name='org_root'), - url(r'^(?P[^/]+)/public/$', org_public, name='org_public'), - url(r'^(?P[^/]+)/personal/$', org_personal, name='org_personal'), - url(r'^(?P[^/]+)/repo/create/$', org_repo_create, name='org_repo_create'), - url(r'^(?P[^/]+)/innerpubrepo/create/$', org_inner_pub_repo_create, name='org_inner_pub_repo_create'), - url(r'^(?P[^/]+)/innerpubrepo/unset/(?P[^/]+)/$', unset_org_inner_pub_repo, name='unset_org_inner_pub_repo'), - url(r'^(?P[^/]+)/groups/$', org_groups, name='org_groups'), - url(r'^([^/]+)/repo/create/$', org_repo_create, name='org_repo_create'), -# url(r'^([^/]+)/repo/history/(?P[^/]+)/$', repo_history, name='org_repo_history'), - url(r'^(?P[^/]+)/pubinfo/$', org_pubinfo, name='org_pubinfo'), - - - # repo share - url(r'^(?P[^/]+)/share/$', org_shareadmin, name='org_shareadmin'), - url(r'^(?P[^/]+)/repo/share/$', org_repo_share, name='org_repo_share'), - url(r'^(?P[^/]+)/share/permission_admin/$', org_share_permission_admin, name='org_share_permission_admin'), - -# url(r'^([^/]+)/repo/(?P[^/]+)/$', RepoView.as_view(), name='repo'), - - ### Org admin ### - url(r'^(?P[^/]+)/seafadmin/$', org_seafadmin, name='org_seafadmin'), - url(r'^(?P[^/]+)/orgadmin/$', org_admin, name='org_admin'), - url(r'^(?P[^/]+)/useradmin/remove/(?P[^/]+)/$', org_user_remove, name='org_user_remove'), - url(r'^(?P[^/]+)/groupadmin/$', org_group_admin, name='org_groupadmin'), - url(r'^(?P[^/]+)/group/remove/(?P[\d]+)/$', org_group_remove, name='org_group_remove'), -) diff --git a/organizations/utils.py b/organizations/utils.py deleted file mode 100644 index 2e8dc03eb8..0000000000 --- a/organizations/utils.py +++ /dev/null @@ -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 diff --git a/organizations/views.py b/organizations/views.py deleted file mode 100644 index c2b486d313..0000000000 --- a/organizations/views.py +++ /dev/null @@ -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 %(org_name)s') % \ - {'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 Share.') % \ - (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 successfully,you can go check it at Share.') % \ - {'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 successfully,you can go check it at Share.') % \ - {"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)) diff --git a/settings.py b/settings.py index 7663f432c4..35f6f0c108 100644 --- a/settings.py +++ b/settings.py @@ -138,7 +138,6 @@ INSTALLED_APPS = ( 'seahub.wiki', 'seahub.group', 'seahub.notifications', - # 'seahub.organizations', 'seahub.profile', 'seahub.share', 'api2',