summaryrefslogtreecommitdiff
path: root/src/meetingtools/apps
diff options
context:
space:
mode:
Diffstat (limited to 'src/meetingtools/apps')
-rw-r--r--src/meetingtools/apps/auth/views.py3
-rw-r--r--src/meetingtools/apps/room/forms.py7
-rw-r--r--src/meetingtools/apps/room/models.py6
-rw-r--r--src/meetingtools/apps/room/views.py46
4 files changed, 55 insertions, 7 deletions
diff --git a/src/meetingtools/apps/auth/views.py b/src/meetingtools/apps/auth/views.py
index 0c46338..8b0a8fd 100644
--- a/src/meetingtools/apps/auth/views.py
+++ b/src/meetingtools/apps/auth/views.py
@@ -141,10 +141,11 @@ def accounts_login_federated(request):
'last-name':ln,
'email':mail,
'send-email': 0,
- 'password': key,
'login':request.user.username,
'ext-login':request.user.username})
+ connect_api.request("user-update-pwd",{"user-id": principal.get('principal-id'),'password': key,'password-verify': key},True)
+
co_import_from_request(request)
member_or_employee = _is_member_or_employee(request.user)
diff --git a/src/meetingtools/apps/room/forms.py b/src/meetingtools/apps/room/forms.py
index 143551a..ed4287f 100644
--- a/src/meetingtools/apps/room/forms.py
+++ b/src/meetingtools/apps/room/forms.py
@@ -6,7 +6,7 @@ Created on Feb 1, 2011
from meetingtools.apps.room.models import Room
from django.forms.widgets import Select, TextInput, RadioSelect
-from django.forms.fields import BooleanField, ChoiceField
+from django.forms.fields import BooleanField, ChoiceField, CharField
from django.forms.forms import Form
from form_utils.forms import BetterModelForm
from django.utils.safestring import mark_safe
@@ -81,4 +81,7 @@ class CreateRoomForm(BetterModelForm):
'name': TextInput(attrs={'size': '40'})}
class DeleteRoomForm(Form):
- confirm = BooleanField(label="Confirm remove room") \ No newline at end of file
+ confirm = BooleanField(label="Confirm remove room")
+
+class TagRoomForm(Form):
+ tag = CharField(max_length=256) \ No newline at end of file
diff --git a/src/meetingtools/apps/room/models.py b/src/meetingtools/apps/room/models.py
index 736c63f..a71e608 100644
--- a/src/meetingtools/apps/room/models.py
+++ b/src/meetingtools/apps/room/models.py
@@ -11,7 +11,7 @@ from django.db.models.fields.related import ForeignKey
from django.contrib.auth.models import User
from meetingtools.apps.cluster.models import ACCluster
import time
-from django_co_acls.models import AccessControlEntry
+import tagging
class Room(models.Model):
creator = ForeignKey(User,editable=False)
@@ -38,4 +38,6 @@ class Room(models.Model):
if not self.lastvisited:
return 0
else:
- return int(time.mktime(self.lastvisited.timetuple())*1000) \ No newline at end of file
+ return int(time.mktime(self.lastvisited.timetuple())*1000)
+
+tagging.register(Room) \ No newline at end of file
diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py
index 81ce1dc..201509e 100644
--- a/src/meetingtools/apps/room/views.py
+++ b/src/meetingtools/apps/room/views.py
@@ -6,7 +6,7 @@ Created on Jan 31, 2011
from meetingtools.apps.room.models import Room, ACCluster
from meetingtools.multiresponse import respond_to, redirect_to
from meetingtools.apps.room.forms import DeleteRoomForm,\
- CreateRoomForm, ModifyRoomForm
+ CreateRoomForm, ModifyRoomForm, TagRoomForm
from django.shortcuts import get_object_or_404
from meetingtools.ac import ac_api_client, api
import re
@@ -22,6 +22,7 @@ from django.http import HttpResponseRedirect
from django.core.exceptions import ObjectDoesNotExist
from django_co_acls.models import allow, deny, acl, clear_acl
from meetingtools.ac.api import ACPClient
+from tagging.models import Tag, TaggedItem
def _acc_for_user(user):
(local,domain) = user.username.split('@')
@@ -348,4 +349,45 @@ def goto(request,room):
return user_client.redirect_to(room.acc.url+urlpath)
else:
return HttpResponseRedirect(room.acc.url+urlpath)
- \ No newline at end of file
+
+## Tagging
+
+@login_required
+def list_by_tag(request,tn):
+ tags = tn.split('+')
+ rooms = TaggedItem.objects.get_by_model(Room, tags)
+
+
+def _can_tag(request,tag):
+ if tag in ('selfcleaning','public','private'):
+ return False,"'%s' is reserved" % tag
+ # XXX implement access model for tags here soon
+ return True,""
+
+@login_required
+def untag(request,rid,tag):
+ room = get_object_or_404(Room,pk=rid)
+ new_tags = []
+ for t in Tag.objects.get_for_object(room):
+ if t.name != tag:
+ new_tags.append(t.name)
+
+ Tag.objects.update_tags(room, ' '.join(new_tags))
+ return redirect_to("/room/%d/tag" % room.id)
+
+@login_required
+def tag(request,rid):
+ room = get_object_or_404(Room,pk=rid)
+ if request.method == 'POST':
+ form = TagRoomForm(request.POST)
+ if form.is_valid():
+ tag = form.cleaned_data['tag']
+ ok,reason = _can_tag(request,tag)
+ if ok:
+ Tag.objects.add_tag(room, tag)
+ else:
+ form._errors['tag'] = form.error_class([u'%s ... please choose another tag!' % reason])
+ else:
+ form = TagRoomForm()
+
+ return respond_to(request, {'text/html': "apps/room/tag.html"}, {'form': form,'formtitle': 'Add Tag','submitname': 'Add Tag','room': room, 'tags': Tag.objects.get_for_object(room)}) \ No newline at end of file