# HG changeset patch
# User verrierj
# Date 1322646255 -3600
# Node ID 1105a5ed9f8fa09519af32f0e8dc7aa182eed7fa
# Parent 14b59dcd2731bf7fa55a77577d9a279f08c72972# Parent d79097e98244a8f6611a950c95323517300eb4e4
Merge with d79097e98244a8f6611a950c95323517300eb4e4
diff -r d79097e98244 -r 1105a5ed9f8f .project
--- a/.project Wed Nov 23 11:12:31 2011 +0100
+++ b/.project Wed Nov 30 10:44:15 2011 +0100
@@ -1,18 +1,18 @@
-
-
- platform
-
-
-
-
-
- org.python.pydev.PyDevBuilder
-
-
-
-
-
- org.python.pydev.pythonNature
- org.python.pydev.django.djangoNature
-
-
+
+
+ platform_group
+
+
+
+
+
+ org.python.pydev.PyDevBuilder
+
+
+
+
+
+ org.python.pydev.pythonNature
+ org.python.pydev.django.djangoNature
+
+
diff -r d79097e98244 -r 1105a5ed9f8f .pydevproject
--- a/.pydevproject Wed Nov 23 11:12:31 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-
-
-
-python_platform
-python 2.6
-
-/platform/src/ldt
-/platform/web
-
-
-DJANGO_MANAGE_LOCATION
-web/ldtplatform/manage.py
-
-
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/__init__.py
--- a/src/ldt/ldt/ldt_utils/__init__.py Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/__init__.py Wed Nov 30 10:44:15 2011 +0100
@@ -1,2 +1,2 @@
VERSION = (0, 1)
-VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION)))
+VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION)))
\ No newline at end of file
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/admin.py
--- a/src/ldt/ldt/ldt_utils/admin.py Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/admin.py Wed Nov 30 10:44:15 2011 +0100
@@ -7,11 +7,18 @@
from ldt.ldt_utils.forms import LdtImportForm, ReindexForm
from ldt.ldt_utils.models import Content, Project, Media, Author
import ldt.indexation
+from guardian.admin import GuardedModelAdmin
+class ProjectAdmin(GuardedModelAdmin):
+ pass
-admin.site.register(Project)
+class AuthorAdmin(GuardedModelAdmin):
+ pass
-class ContentAdmin(admin.ModelAdmin):
+class MediaAdmin(GuardedModelAdmin):
+ pass
+
+class ContentAdmin(GuardedModelAdmin):
def import_file(self, request):
if request.method == 'POST':
@@ -82,6 +89,7 @@
return content_urls + urls
+admin.site.register(Project, ProjectAdmin)
admin.site.register(Content, ContentAdmin)
-admin.site.register(Media)
-admin.site.register(Author)
+admin.site.register(Media, MediaAdmin)
+admin.site.register(Author, AuthorAdmin)
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/forms.py
--- a/src/ldt/ldt/ldt_utils/forms.py Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/forms.py Wed Nov 30 10:44:15 2011 +0100
@@ -1,5 +1,6 @@
from django import forms
from django.utils.translation import ugettext_lazy as _
+from django.contrib.auth.models import User, Group
from ldt.forms import widgets as ldt_widgets
from models import Project, Content, Media
from utils import generate_uuid
@@ -13,11 +14,17 @@
title = forms.CharField(required=True)
contents = forms.ModelMultipleChoiceField(Content.objects.all()) #@UndefinedVariable
description = forms.CharField(widget=forms.Textarea, required=False)
+ groups = forms.ModelMultipleChoiceField(Group.objects.all(), required=False)
# owner = forms.ModelChoiceField(Author.objects.all())
class Meta:
model = Project
exclude = ("ldt_id", "ldt", "created_by", "changed_by", "creation_date", "modification_date", "state", "owner")
+class PermissionForm(forms.Form):
+ share = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'class':'checkbox_group'}))
+ perms = forms.CharField(required=False, widget=forms.HiddenInput(attrs={'class':'perm_field'}))
+ group = forms.IntegerField(required=False, widget=forms.HiddenInput())
+
class ReindexForm(forms.Form):
contents = forms.ModelMultipleChoiceField(Content.objects.all()) #@UndefinedVariable
index_projects = forms.BooleanField(required=False, initial=False)
@@ -33,14 +40,14 @@
class CopyProjectForm (forms.Form):
title = forms.CharField()
-
+ group = forms.IntegerField()
class ContentForm(forms.ModelForm):
-
#iri_id = forms.CharField(max_length=1024, widget=forms.HiddenInput, initial=generate_uuid)
iriurl = forms.CharField(max_length=1024, widget=forms.HiddenInput, required=False)
content_creation_date = forms.SplitDateTimeField(widget=ldt_widgets.LdtSplitDateTime, required=False, label=_("content.content_creation_date"))
media_input_type = forms.ChoiceField(required=False, label=_("content.media_input_type"), choices=(("upload", _("file_upload")), ("url", _("url")), ("link", _("existing_media")), ("create", _("create_media")), ("none", _("none_media"))))
+ groups = forms.ModelMultipleChoiceField(Group.objects.all(), required=False)
def clean_iri_id(self):
data = self.cleaned_data.get('iri_id')
@@ -83,3 +90,11 @@
css = {
'all' : ('admin/css/forms.css', 'admin/css/base.css', 'admin/css/widgets.css')
}
+
+class GroupAddForm(forms.ModelForm):
+ name = forms.CharField(required=True)
+ members_list = forms.ModelMultipleChoiceField(User.objects.all(), required=False)
+ admin_list = forms.ModelMultipleChoiceField(User.objects.all(), required=False)
+
+ class Meta:
+ model = Group
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/middleware/userprofile.py
--- a/src/ldt/ldt/ldt_utils/middleware/userprofile.py Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/middleware/userprofile.py Wed Nov 30 10:44:15 2011 +0100
@@ -4,10 +4,14 @@
class LanguageMiddleware(object):
def process_request(self, request):
+
if request.user.is_authenticated():
- language = request.user.get_profile().language
+ profile = request.user.get_profile()
+ request.user.is_regular = profile.is_regular
+ language = profile.language
else:
language = settings.LANGUAGE_CODE[:2]
+ request.user.is_regular = False
translation.activate(language)
request.LANGUAGE_CODE = translation.get_language()
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/migrations/0005_add_permissions.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/migrations/0005_add_permissions.py Wed Nov 30 10:44:15 2011 +0100
@@ -0,0 +1,155 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import DataMigration
+from django.db import models
+from django.conf import settings
+from django.contrib.auth.models import Group, User
+from ldt.ldt_utils.models import Project
+from guardian.shortcuts import assign
+
+class Migration(DataMigration):
+
+ def forwards(self, orm):
+
+ for model in ["project", "content", "segment", "author", "media"]:
+ self.add_perm(orm, model)
+
+ everyone = Group.objects.create(name=settings.PUBLIC_GROUP_NAME)
+
+ for proj in Project.objects.all():
+ assign('ldt_utils.change_project', proj.owner)
+ assign('ldt_utils.view_project', proj.owner)
+
+ for user in User.objects.all():
+ if user.is_staff:
+ profile = user.get_profile()
+ profile.is_regular = True
+ profile.save()
+ user.groups.add(everyone)
+
+
+ def add_perm(self, orm, model_name):
+ # Since south does not migrate permissions, they need to
+ # be added to the database manually
+ ct, created = orm['contenttypes.ContentType'].objects.get_or_create(model=model_name, app_label='ldt_utils') # model must bei lowercase!
+ orm['auth.permission'].objects.get_or_create(content_type=ct, codename='view_%s' % model_name, defaults={'name': 'Can view %s' % model_name })
+
+ def backwards(self, orm):
+ "Write your backwards methods here."
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'ldt_utils.author': {
+ 'Meta': {'object_name': 'Author'},
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+ 'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+ 'handle': ('django.db.models.fields.CharField', [], {'max_length': '512', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'})
+ },
+ 'ldt_utils.content': {
+ 'Meta': {'ordering': "['title']", 'object_name': 'Content'},
+ 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'b6e0454f-174c-11e1-af90-001485352c9a'", 'unique': 'True', 'max_length': '1024'}),
+ 'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+ 'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}),
+ 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+ 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
+ },
+ 'ldt_utils.media': {
+ 'Meta': {'object_name': 'Media'},
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+ 'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+ 'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+ 'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+ 'src': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1024'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+ 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'})
+ },
+ 'ldt_utils.project': {
+ 'Meta': {'ordering': "['title']", 'object_name': 'Project'},
+ 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+ 'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}),
+ 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1024'}),
+ 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+ 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'})
+ },
+ 'ldt_utils.segment': {
+ 'Meta': {'unique_together': "(('project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'),)", 'object_name': 'Segment'},
+ 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+ 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}),
+ 'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+ 'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
+ 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+ 'element_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+ 'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+ 'project_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+ 'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}),
+ 'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+ 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['ldt_utils']
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/models.py
--- a/src/ldt/ldt/ldt_utils/models.py Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/models.py Wed Nov 30 10:44:15 2011 +0100
@@ -1,10 +1,13 @@
from django.conf import settings
-from django.contrib.auth.models import User
+from django.contrib.auth.models import User, Group
from django.db import models
from django.utils.translation import ugettext_lazy as _
#from ldt.core.models import Document, Owner
from ldt.core.models import Document
+from guardian.shortcuts import assign, remove_perm
import ldt.indexation
+from ldt.security.models import SafeModel
+from ldt.security.manager import SafeManager
from utils import (create_ldt, copy_ldt, create_empty_iri, update_iri,
generate_uuid, clean_description)
import lucene
@@ -14,7 +17,7 @@
import tagging.fields
import uuid
-class Author(models.Model):
+class Author(SafeModel):
handle = models.CharField(max_length=512, unique=True, blank=True, null=True)
email = models.EmailField(unique=False, blank=True, null=True)
@@ -24,7 +27,12 @@
def __unicode__(self):
return unicode(self.id) + " - " + self.handle + ", " + self.email + ", " + self.firstname + " " + self.lastname
-class Media(models.Model):
+ class Meta:
+ permissions = (
+ ('view_author', 'Can view author'),
+ )
+
+class Media(SafeModel):
external_id = models.CharField(max_length=1024, null=True, blank=True, verbose_name=_('media.external_id'))
external_permalink = models.URLField(max_length=1024, verify_exists=False, null=True, blank=True, verbose_name=_('media.external_permalink'))
external_publication_url = models.URLField(max_length=1024, verify_exists=True, null=True, blank=True, verbose_name=_('media.external_publication_url'))
@@ -40,6 +48,11 @@
src = models.CharField(max_length=1024, unique=True, verbose_name=_('media.src'))
mimetype_field = models.CharField(max_length=512, null=True, blank=True, verbose_name=_('media.mimetype'))
+ class Meta:
+ permissions = (
+ ('view_media', 'Can view media'),
+ )
+
def mimetype(): #@NoSelf
def fget(self):
if self.mimetype_field :
@@ -90,11 +103,15 @@
return "|".join(strings)
-class ContentManager(models.Manager):
+class ContentManager(SafeManager):
+
+ def __init__(self):
+ super(ContentManager, self).__init__(check_perm=False)
+
def get_by_natural_key(self, iri_id):
return self.get(iri_id=iri_id)
-class Content(models.Model):
+class Content(SafeModel):
objects = ContentManager()
iri_id = models.CharField(max_length=1024, unique=True, default=generate_uuid, verbose_name=_('content.iri_id'))
@@ -111,6 +128,9 @@
class Meta:
ordering = ["title"]
+ permissions = (
+ ('view_content', 'Can view content'),
+ )
def natural_key(self):
return self.iri_id
@@ -181,7 +201,7 @@
self.sync_iri_file()
# update it
super(Content, self).save(*args, **kwargs)
-
+
def __unicode__(self):
return str(self.id) + ": " + self.iri_id
@@ -286,10 +306,8 @@
return locals()
external_id = property(**external_id())
-
-
-
-class Project(Document):
+
+class Project(Document, SafeModel):
STATE_CHOICES = (
(1, 'edition'),
(2, 'published'),
@@ -310,6 +328,9 @@
class Meta:
ordering = ["title"]
+ permissions = (
+ ('view_project', 'Can view project'),
+ )
def __unicode__(self):
@@ -325,7 +346,7 @@
return res[0].get(u'abstract')
else:
return None
-
+
def stream_mode(): #@NoSelf
def fget(self):
modes = []
@@ -352,7 +373,7 @@
stream_mode = property(**stream_mode())
@staticmethod
- def create_project(user, title, contents, description=''):
+ def create_project(user, title, contents, description='', groups=[]):
# owner = Owner.objects.get(user=user) #@UndefinedVariable
owner = user
project = Project(title=title, owner=owner, description=description)
@@ -361,27 +382,40 @@
project.changed_by = user.username
project.state = 1
project.save()
+ assign('view_project', user, project)
+ assign('change_project', user, project)
for content in contents:
project.contents.add(content)
project.save()
return create_ldt(project, user)
- def copy_project(self, user, title, description=''):
-# owner = Owner.objects.get(user=user) #@UndefinedVariable
- owner = user
- project = Project(title=title, owner=owner, description=description)
+ def copy_project(self, user, title, description='', group=None):
+ project = Project(title=title, owner=user, description=description)
project = copy_ldt(self, project, user)
- project.save()
+ assign('view_project', user, project)
+ assign('change_project', user, project)
+ if group:
+ assign('view_project', group, project)
for content in self.contents.all():
project.contents.add(content)
project.save()
return project
+ def publish(self):
+ self.state = 2
+ everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME)
+ assign('ldt_utils.view_project', everyone, self)
+
+ def unpublish(self):
+ self.state = 1
+ everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME)
+ remove_perm('ldt_utils.view_project', everyone, self)
+
def check_access(self, user):
if (user and user.is_staff) or self.state == 2:
return True
else:
- return False
+ return False
def save(self):
if self.ldt:
@@ -409,10 +443,19 @@
desc_node = doc.xpath('/iri/project')[0]
desc_node.set('abstract', new_desc)
self.ldt = lxml.etree.tostring(doc, pretty_print=True)
+
+ super(Project, self).save()
+
+ if self.state == 2:
+ self.publish()
+ elif self.state == 1:
+ self.unpublish()
super(Project, self).save()
+
+
-class Segment(models.Model):
+class Segment(SafeModel):
project_obj = models.ForeignKey(Project, null=True)
content = models.ForeignKey(Content)
@@ -434,5 +477,8 @@
class Meta:
unique_together = (('project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'),)
+ permissions = (
+ ('view_segment', 'Can view segment'),
+ )
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html Wed Nov 30 10:44:15 2011 +0100
@@ -12,8 +12,9 @@
{% trans "Copy your project" %}
{% endblock %}
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_group.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_group.html Wed Nov 30 10:44:15 2011 +0100
@@ -0,0 +1,117 @@
+
+{% extends "ldt/ldt_raw_base.html" %}
+
+{% load i18n %}
+{% load adminmedia %}
+
+{% block js_import %}
+ {{ block.super }}
+
+
+ {{ content_form.media.js }}
+
+{% endblock %}
+
+{% block css_import %}
+ {{ block.super }}
+ {{ content_form.media.css }}
+
+
+
+{% endblock %}
+
+{% block js_declaration %}
+ {{ block.super }}
+
+
+{% endblock %}
+
+{% block body %}
+
+
+
{% if group_id %}{% trans "Update a group" %}{% else %}{% trans "Create a group" %}{% endif %}
+
+
+
+
+
+
+{% endblock %}
+
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Wed Nov 30 10:44:15 2011 +0100
@@ -15,45 +15,37 @@
-
{% endblock %}
{% block js_declaration %}
{{ block.super }}
@@ -69,9 +61,8 @@
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
- width: "470",
- plugins : "autoresize",
- entity_encoding : "raw",
+ width: "630",
+ height: "150"
});
@@ -80,10 +71,10 @@
{% endblock %}
{% block body %}
-
-
{% if ldt_id %}{% trans "Update your project" %}{% else %}{% trans "Create your project" %}{% endif %}
-
{% endblock %}
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html Wed Nov 30 10:44:15 2011 +0100
@@ -1,51 +1,56 @@
-{% extends "ldt/ldt_utils/workspace.html" %}
+{% extends "ldt/ldt_base.html" %}
{% load i18n %}
+{% block js_import %}
+{{block.super}}
+
+{% endblock %}
{% block js_declaration %}
{{block.super}}
{% endblock %}
+{% block css_import %}
+{{block.super}}
+
+{% endblock %}
+
{% block content %}
- {% if groups and groups.all|length > 0 %}
{% trans "My groups" %}
-
-
-
-
-
-
- {% for group in groups.all %}
-
- | {{ group.name }} |  |
-
- {% endfor %}
-
-
+
+ {% include "ldt/ldt_utils/partial/groupslist.html" %}
{% trans "The group's projects" %}
-
@@ -101,9 +99,6 @@
{% include "ldt/ldt_utils/partial/projectslist.html" %}
- {% else %}
-
{% trans "You do not belong to any group." %}
- {% endif %}
{% endblock %}
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html Wed Nov 30 10:44:15 2011 +0100
@@ -9,7 +9,7 @@
|
|
- {{ content.title|default:"_" }} |
+ {{ content.title|default:"_" }} |
{% endfor %}
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/groupslist.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/groupslist.html Wed Nov 30 10:44:15 2011 +0100
@@ -0,0 +1,33 @@
+{% load i18n %}
+
+
+
+
+
+
+ {% for group in groups %}
+
+
+
+
+ {% if user.is_regular %}
+ {% if group.change %}
+ | c |
+ {{ group.name }} |
+ {% else %}
+ l |
+ {{ group.name }} |
+ {% endif %}
+ {% else %}
+ |
+ {{ group.name }} |
+ {% endif %}
+
+  |
+
+
+ {% endfor %}
+
+
\ No newline at end of file
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html Wed Nov 30 10:44:15 2011 +0100
@@ -0,0 +1,95 @@
+{% load i18n %}
+
+
+
+
+
+
+
+
+
+
+ {{ management_form }}
+
+
+
+
+
+ {% for form, group in group_form %}
+
+ | {{ form.share }} |
+ {{ group.name }} |
+
+ {% trans "perm.read" %}
+ {% trans "perm.write" %}
+ |
+ {{ form.perms }}
+ {{ form.group }}
+
+ {% endfor %}
+
+
+
+
+
+
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Wed Nov 30 10:44:15 2011 +0100
@@ -6,6 +6,7 @@
{% for project in projects %}
+
{% url ldt.ldt_utils.views.project_json_id project.ldt_id as json_url_id %}
{% if is_gecko %}
@@ -14,21 +15,26 @@
|
{% endif %}
- |
+ |
|
{% ifequal project.state 2 %}
-
+
{% else %}
-
+
{% endifequal %}
|
+
- {% ifequal project.state 2 %}
- {% if show_username %}{{ project.owner.username }} : {% endif %} {{ project.title }}
+ {% if project.state == 2 %}
+ {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}
{% else %}
- {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}
- {% endifequal %}
+ {% if project.change %}
+ {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}
+ {% else %}
+ {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}
+ {% endif %}
+ {% endif %}
|
{% endfor %}
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html Wed Nov 30 10:44:15 2011 +0100
@@ -22,7 +22,7 @@
{% ifequal project.state 2 %}
{{ project.title }}
{% else %}
- {{ project.title }}
+ {{ project.title }}
{% endifequal %}
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/userslist.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/userslist.html Wed Nov 30 10:44:15 2011 +0100
@@ -0,0 +1,29 @@
+{% load i18n %}
+
+
+
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/published_projects.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/published_projects.html Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/published_projects.html Wed Nov 30 10:44:15 2011 +0100
@@ -6,7 +6,6 @@
{% endblock %}
-
{% block js_declaration %}
{{block.super}}
',endLn=stEnd.length,pos,pos2,tmp;while((pos=data.indexOf(stStart,start))>-1){pos2=data.indexOf(stEnd)+endLn;tmp=$(data.substring(pos,pos2));if(!tmp.attr('src')||tmp.attr('rel')=='forceLoad'){if(tmp.attr('rev')=='shown')this._scriptsShown.push(tmp.get(0));else this._scripts.push(tmp.get(0));}data=data.substring(0,pos)+data.substr(pos2);start=pos;}return data;},_hasFilter:function(filter){var ret=false;$.each(this.filters,function(i,f){ret=ret||f==filter;});return ret;},_delFilter:function(filter){this.filters=$.map(this.filters,function(v){if(v!=filter)return v;});},_callFilters:function(fct){this.getInternal()._debug(fct);var ret=[],self=this;$.each(this.filters,function(i,f){ret[f]=self._callFilter(f,fct);});if(this.callbacks[fct]&&$.isFunction(this.callbacks[fct]))this.callbacks[fct](this);return ret;},_callFilter:function(f,fct){if(_filters[f]&&_filters[f][fct]&&$.isFunction(_filters[f][fct]))return _filters[f][fct](this);return undefined;},_callAnim:function(fct,clb){this.getInternal()._debug(fct);this._callFilters('before'+ucfirst(fct));if(!this._animated){this._animated=true;if(!$.isFunction(clb))clb=$.noop;var set=this.anim[fct]||this.anim.def||'basic';if(!_animations[set]||!_animations[set][fct]||!$.isFunction(_animations[set][fct]))set='basic';_animations[set][fct](this,$.proxy(function(){this._animated=false;this._callFilters('after'+ucfirst(fct));clb();},this));}},_load:function(){this.getInternal()._debug('_load');if(!this.loading&&this.loadFilter){this.loading=true;this._callFilter(this.loadFilter,'load');}},_contentLoading:function(){if(!this._animated&&this._bgReady){if(!this._transition&&this.elts.cont.html().length>0)this._transition=true;this._nbContentLoading++;if(!this.loading){if(!this._opened){this._opened=true;if(this._transition){var fct=$.proxy(function(){this._writeContent();this._callFilters('beforeShowCont');this._callAnim('hideTrans',$.proxy(function(){this._transition=false;this.elts.cont.append(this._scriptsShown);this._reposition();this._callFilters('afterShowCont');},this));},this);if(this._nbContentLoading==1){this._unreposition();this._callAnim('showTrans',fct);}else{fct();}}else{this._callAnim('hideLoad',$.proxy(function(){this._writeContent();this._callAnim('showCont',$.proxy(function(){this.elts.cont.append(this._scriptsShown);this._reposition();},this));},this));}}}else if(this._nbContentLoading==1){var outer=this.getInternal()._getOuter(this.elts.load);this.elts.load .css({position:'fixed',top:(this.getInternal().fullSize.viewH-this.elts.load.height()-outer.h.margin)/2,left:(this.getInternal().fullSize.viewW-this.elts.load.width()-outer.w.margin)/2});if(this._transition){this._unreposition();this._callAnim('showTrans',$.proxy(function(){this._contentLoading();},this));}else{this._callAnim('showLoad',$.proxy(function(){this._contentLoading();},this));}}}},_writeContent:function(){this.elts.cont .empty().append(this.elts.hidden.contents()).append(this._scripts).append(this.showCloseButton?this.closeButton:'').css({position:'fixed',width:this.sizes.w,height:this.sizes.h,top:(this.getInternal().fullSize.viewH-this.sizes.h-this.sizes.hMargin)/2,left:(this.getInternal().fullSize.viewW-this.sizes.w-this.sizes.wMargin)/2});},_reposition:function(){var elts=this.elts.cont.find('.nmReposition');if(elts.length){var space=this.getInternal()._getSpaceReposition();elts.each(function(){var me=$(this),offset=me.offset();me.css({position:'fixed',top:offset.top-space.top,left:offset.left-space.left});});this.elts.cont.after(elts);}this.elts.cont.css('overflow','auto');},_unreposition:function(){this.elts.cont.css('overflow','');var elts=this.elts.all.find('.nmReposition');if(elts.length)this.elts.cont.append(elts.removeAttr('style'));}},_internal={firstInit:true,stack:[],fullSize:{w:0,h:0,wW:0,wH:0,viewW:0,viewH:0},nyroModal:function(opts,fullObj){if(_internal.firstInit){_internal._container=$('').appendTo($b);$w.smartresize($.proxy(_internal._resize,_internal));$d.bind('keydown.nyroModal',$.proxy(_internal._keyHandler,_internal));_internal._calculateFullSize();_internal.firstInit=false;}return this.nmInit(opts,fullObj).each(function(){_internal._init($(this).data('nmObj'));});},nmInit:function(opts,fullObj){return this.each(function(){var me=$(this);if(fullObj)me.data('nmObj',$.extend(true,{opener:me},opts));else me.data('nmObj',me.data('nmObj')?$.extend(true,me.data('nmObj'),opts):$.extend(true,{opener:me},_nmObj,opts));});},nmCall:function(){return this.trigger('nyroModal');},nmManual:function(url,opts){$('',{href:url}).nyroModal(opts).trigger('nyroModal');},nmObj:function(opts){$.extend(true,_nmObj,opts);},nmInternal:function(opts){$.extend(true,_internal,opts);},nmAnims:function(opts){$.extend(true,_animations,opts);},nmFilters:function(opts){$.extend(true,_filters,opts);},nmTop:function(){if(_internal.stack.length)return $(_internal.stack[_internal.stack.length-1]).data('nmObj');return undefined;},_debug:function(msg){if(window.console&&window.console.log)window.console.log(msg);},_container:undefined,_init:function(nm){nm.filters=[];$.each(_filters,function(f,obj){if($.isFunction(obj.is)&&obj.is(nm)){nm.filters.push(f);}});nm._callFilters('init');nm.opener .unbind('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal').bind({'nyroModal.nyroModal':function(e){nm.open();return false;},'nmClose.nyroModal':function(){nm.close();return false;},'nmResize.nyroModal':function(){nm.resize();return false;}});},_scrollWidth:(function(){var scrollbarWidth;if($.browser.msie){var $textarea1=$('').css({position:'absolute',top:-1000,left:-1000}).appendTo($b),$textarea2=$('').css({position:'absolute',top:-1000,left:-1000}).appendTo($b);scrollbarWidth=$textarea1.width()-$textarea2.width();$textarea1.add($textarea2).remove();}else{var $div=$('').css({width:100,height:100,overflow:'auto',position:'absolute',top:-1000,left:-1000}).prependTo($b).append('').find('div').css({width:'100%',height:200});scrollbarWidth=100-$div.width();$div.parent().remove();}return scrollbarWidth;})(),_selNyroModal:function(obj){return $(obj).data('nmObj')?true:false;},_selNyroModalOpen:function(obj){var me=$(obj);return me.data('nmObj')?me.data('nmObj')._open:false;},_keyHandler:function(e){var nmTop=$.nmTop();if(nmTop&&nmTop.useKeyHandler){return nmTop.keyHandle(e);}},_pushStack:function(obj){this.stack=$.map(this.stack,function(elA){if(elA!=obj.get(0))return elA;});this.stack.push(obj.get(0));},_removeStack:function(obj){this.stack=$.map(this.stack,function(elA){if(elA!=obj.get(0))return elA;});},_resize:function(){var opens=$(':nmOpen').each(function(){$(this).data('nmObj')._unreposition();});this._calculateFullSize();opens.trigger('nmResize');},_calculateFullSize:function(){this.fullSize={w:$d.width(),h:$d.height(),wW:$w.width(),wH:$w.height()};this.fullSize.viewW=Math.min(this.fullSize.w,this.fullSize.wW);this.fullSize.viewH=Math.min(this.fullSize.h,this.fullSize.wH);},_getCurCSS:function(elm,name){var ret=parseInt($.curCSS(elm,name,true));return isNaN(ret)?0:ret;},_getOuter:function(elm){elm=elm.get(0);var ret={h:{margin:this._getCurCSS(elm,'marginTop')+this._getCurCSS(elm,'marginBottom'),border:this._getCurCSS(elm,'borderTopWidth')+this._getCurCSS(elm,'borderBottomWidth'),padding:this._getCurCSS(elm,'paddingTop')+this._getCurCSS(elm,'paddingBottom')},w:{margin:this._getCurCSS(elm,'marginLeft')+this._getCurCSS(elm,'marginRight'),border:this._getCurCSS(elm,'borderLeftWidth')+this._getCurCSS(elm,'borderRightWidth'),padding:this._getCurCSS(elm,'paddingLeft')+this._getCurCSS(elm,'paddingRight')}};ret.h.outer=ret.h.margin+ret.h.border;ret.w.outer=ret.w.margin+ret.w.border;ret.h.inner=ret.h.padding+ret.h.border;ret.w.inner=ret.w.padding+ret.w.border;ret.h.total=ret.h.outer+ret.h.padding;ret.w.total=ret.w.outer+ret.w.padding;return ret;},_getSpaceReposition:function(){var outer=this._getOuter($b),ie7=$.browser.msie&&$.browser.version<8&&!(screen.height<=$w.height()+23);return{top:$w.scrollTop()-(!ie7?outer.h.border/2:0),left:$w.scrollLeft()-(!ie7?outer.w.border/2:0)};},_getHash:function(url){if(typeof url=='string'){var hashPos=url.indexOf('#');if(hashPos>-1)return url.substring(hashPos);}return '';},_extractUrl:function(url){var ret={url:undefined,sel:undefined};if(url){var hash=this._getHash(url),hashLoc=this._getHash(window.location.href),curLoc=window.location.href.substring(0,window.location.href.length-hashLoc.length),req=url.substring(0,url.length-hash.length);ret.sel=hash;if(req!=curLoc&&req!=baseHref)ret.url=req;}return ret;}},_animations={basic:{showBg:function(nm,clb){nm.elts.bg.css({opacity:0.7}).show();clb();},hideBg:function(nm,clb){nm.elts.bg.hide();clb();},showLoad:function(nm,clb){nm.elts.load.show();clb();},hideLoad:function(nm,clb){nm.elts.load.hide();clb();},showCont:function(nm,clb){nm.elts.cont.show();clb();},hideCont:function(nm,clb){nm.elts.cont.hide();clb();},showTrans:function(nm,clb){nm.elts.cont.hide();nm.elts.load.show();clb();},hideTrans:function(nm,clb){nm.elts.cont.show();nm.elts.load.hide();clb();},resize:function(nm,clb){nm.elts.cont.css({width:nm.sizes.w,height:nm.sizes.h,top:(nm.getInternal().fullSize.viewH-nm.sizes.h-nm.sizes.hMargin)/2,left:(nm.getInternal().fullSize.viewW-nm.sizes.w-nm.sizes.wMargin)/2});clb();}}},_filters={basic:{is:function(nm){return true;},init:function(nm){if(nm.opener.attr('rev')=='modal')nm.modal=true;if(nm.modal)nm.closeOnEscape=nm.closeOnClick=nm.showCloseButton=false;if(nm.closeOnEscape)nm.useKeyHandler=true;},initElts:function(nm){nm.elts.bg.addClass('nyroModalBg');if(nm.closeOnClick)nm.elts.bg.unbind('click.nyroModal').bind('click.nyroModal',function(e){e.preventDefault();nm.close();});nm.elts.cont.addClass('nyroModalCont');nm.elts.hidden.addClass('nyroModalCont nyroModalHidden');nm.elts.load.addClass('nyroModalCont nyroModalLoad');},error:function(nm){nm.elts.hidden.addClass('nyroModalError');nm.elts.cont.addClass('nyroModalError');nm._setCont(nm.errorMsg);},beforeShowCont:function(nm){nm.elts.cont .find('.nyroModal').nyroModal(nm.getForNewLinks(),true).end().find('.nyroModalClose').bind('click.nyroModal',function(e){e.preventDefault();nm.close();});},keyHandle:function(nm){if(nm.keyEvent.keyCode==27&&nm.closeOnEscape){nm.keyEvent.preventDefault();nm.close();}}},custom:{is:function(nm){return true;}}};$.fn.extend({nm:_internal.nyroModal,nyroModal:_internal.nyroModal,nmInit:_internal.nmInit,nmCall:_internal.nmCall});$.extend({nmManual:_internal.nmManual,nmObj:_internal.nmObj,nmInternal:_internal.nmInternal,nmAnims:_internal.nmAnims,nmFilters:_internal.nmFilters,nmTop:_internal.nmTop});$.expr[':'].nyroModal=$.expr[':'].nm=_internal._selNyroModal;$.expr[':'].nmOpen=_internal._selNyroModalOpen;});(function($,sr){var debounce=function(func,threshold,execAsap){var timeout;return function debounced(){var obj=this,args=arguments;function delayed(){if(!execAsap)func.apply(obj,args);timeout=null;};if(timeout)clearTimeout(timeout);else if(execAsap)func.apply(obj,args);timeout=setTimeout(delayed,threshold||100);};};jQuery.fn[sr]=function(fn){return fn?this.bind('resize',debounce(fn)):this.trigger(sr);};})(jQuery,'smartresize');function ucfirst(str){str+='';var f=str.charAt(0).toUpperCase();return f+str.substr(1);};
- jQuery(function($,undefined){$.nmAnims({fade:{showBg:function(nm,clb){nm.elts.bg.fadeTo(250,0.7,clb);},hideBg:function(nm,clb){nm.elts.bg.fadeOut(clb);},showLoad:function(nm,clb){nm.elts.load.fadeIn(clb);},hideLoad:function(nm,clb){nm.elts.load.fadeOut(clb);},showCont:function(nm,clb){nm.elts.cont.fadeIn(clb);},hideCont:function(nm,clb){nm.elts.cont.css('overflow','hidden').fadeOut(clb);},showTrans:function(nm,clb){nm.elts.load .css({position:nm.elts.cont.css('position'),top:nm.elts.cont.css('top'),left:nm.elts.cont.css('left'),width:nm.elts.cont.css('width'),height:nm.elts.cont.css('height'),marginTop:nm.elts.cont.css('marginTop'),marginLeft:nm.elts.cont.css('marginLeft')}).fadeIn(function(){nm.elts.cont.hide();clb();});},hideTrans:function(nm,clb){nm.elts.cont.css('visibility','hidden').show();nm.elts.load .css('position',nm.elts.cont.css('position')).animate({top:nm.elts.cont.css('top'),left:nm.elts.cont.css('left'),width:nm.elts.cont.css('width'),height:nm.elts.cont.css('height'),marginTop:nm.elts.cont.css('marginTop'),marginLeft:nm.elts.cont.css('marginLeft')},function(){nm.elts.cont.css('visibility','');nm.elts.load.fadeOut(clb);});},resize:function(nm,clb){nm.elts.cont.animate({width:nm.sizes.w,height:nm.sizes.h,top:(nm.getInternal().fullSize.viewH-nm.sizes.h-nm.sizes.hMargin)/2,left:(nm.getInternal().fullSize.viewW-nm.sizes.w-nm.sizes.wMargin)/2},clb);}}});$.nmObj({anim:{def:'fade'}});});;
- jQuery(function($,undefined){$.nmFilters({title:{is:function(nm){return nm.opener.is('[title]');},beforeShowCont:function(nm){var offset=nm.elts.cont.offset();nm.store.title=$('',{text:nm.opener.attr('title')}).addClass('nyroModalTitle nmReposition');nm.elts.cont.prepend(nm.store.title);},close:function(nm){if(nm.store.title){nm.store.title.remove();nm.store.title=undefined;delete(nm.store.title);}}}});});;
- jQuery(function($,undefined){$.nmFilters({gallery:{is:function(nm){var ret=nm.opener.is('[rel]:not([rel=external], [rel=nofollow])');if(ret&&nm.galleryCounts&&!nm._hasFilter('title'))nm.filters.push('title');return ret;},init:function(nm){nm.useKeyHandler=true;},keyHandle:function(nm){if(!nm._animated&&nm._opened){if(nm.keyEvent.keyCode==39||nm.keyEvent.keyCode==40){nm.keyEvent.preventDefault();nm._callFilters('galleryNext');}else if(nm.keyEvent.keyCode==37||nm.keyEvent.keyCode==38){nm.keyEvent.preventDefault();nm._callFilters('galleryPrev');}}},initElts:function(nm){var rel=nm.opener.attr('rel'),indexSpace=rel.indexOf(' ');nm.store.gallery=indexSpace>0?rel.substr(0,indexSpace):rel;nm.store.galleryLinks=$('[href][rel="'+nm.store.gallery+'"], [href][rel^="'+nm.store.gallery+' "]');nm.store.galleryIndex=nm.store.galleryLinks.index(nm.opener);},beforeShowCont:function(nm){if(nm.galleryCounts&&nm.store.title&&nm.store.galleryLinks.length>1){var curTitle=nm.store.title.html();nm.store.title.html((curTitle.length?curTitle+' - ':'')+(nm.store.galleryIndex+1)+'/'+nm.store.galleryLinks.length);}},filledContent:function(nm){var link=this._getGalleryLink(nm,-1),append=nm.elts.hidden.find(' > div');if(link){$('',{text:'previous',href:'#'}).addClass('nyroModalPrev').bind('click',function(e){e.preventDefault();nm._callFilters('galleryPrev');}).appendTo(append);}link=this._getGalleryLink(nm,1);if(link){$('',{text:'next',href:'#'}).addClass('nyroModalNext').bind('click',function(e){e.preventDefault();nm._callFilters('galleryNext');}).appendTo(append);}},close:function(nm){nm.store.gallery=undefined;nm.store.galleryLinks=undefined;nm.store.galleryIndex=undefined;delete(nm.store.gallery);delete(nm.store.galleryLinks);delete(nm.store.galleryIndex);if(nm.elts.cont)nm.elts.cont.find('.nyroModalNext, .nyroModalPrev').remove();},galleryNext:function(nm){this._getGalleryLink(nm,1).nyroModal(nm.getForNewLinks(),true).click();},galleryPrev:function(nm){this._getGalleryLink(nm,-1).nyroModal(nm.getForNewLinks(),true).click();},_getGalleryLink:function(nm,dir){if(nm.store.gallery){if(!nm.ltr)dir *=-1;var index=nm.store.galleryIndex+dir;if(index>=0&&index').load(function(){nm.elts.cont.addClass('nyroModalImg');nm.elts.hidden.addClass('nyroModalImg');nm._setCont(this);}).error(function(){nm._error();}).attr('src',url);},size:function(nm){if(nm.sizes.w!=nm.sizes.initW||nm.sizes.h!=nm.sizes.initH){var ratio=Math.min(nm.sizes.w/nm.sizes.initW,nm.sizes.h/nm.sizes.initH);nm.sizes.w=nm.sizes.initW * ratio;nm.sizes.h=nm.sizes.initH * ratio;}var img=nm.loading?nm.elts.hidden.find('img'):nm.elts.cont.find('img');img.attr({width:nm.sizes.w,height:nm.sizes.h});},close:function(nm){if(nm.elts.cont){nm.elts.cont.removeClass('nyroModalImg');nm.elts.hidden.removeClass('nyroModalImg');}}}});});;
- jQuery(function($,undefined){$.nmFilters({swf:{is:function(nm){return nm._hasFilter('link')&&nm.opener.is('[href$=.swf]');},init:function(nm){nm.loadFilter='swf';},load:function(nm){var url=nm.store.link.url,cont='';nm._setCont(cont);}}});});;
- jQuery(function($,undefined){$.nmFilters({form:{is:function(nm){var ret=nm.opener.is('form');if(ret)nm.store.form=nm.getInternal()._extractUrl(nm.opener.attr('action'));return ret;},init:function(nm){nm.loadFilter='form';nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){e.preventDefault();nm.opener.trigger('nyroModal');});},load:function(nm){var data=nm.opener.serializeArray();if(nm.store.form.sel)data.push({name:nm.selIndicator,value:nm.store.form.sel.substring(1)});$.ajax({url:nm.store.form.url,data:data,type:nm.opener.attr('method')?nm.opener.attr('method'):'get',success:function(data){nm._setCont(data,nm.store.form.sel);},error:function(){nm._error();}});}}});});;
- jQuery(function($,undefined){$.nmFilters({formFile:{is:function(nm){var ret=nm.opener.is('form[enctype="multipart/form-data"]');if(ret){nm._delFilter('form');if(!nm.store.form)nm.store.form=nm.getInternal()._extractUrl(nm.opener.attr('action'));}return ret;},init:function(nm){nm.loadFilter='formFile';nm.store.formFileLoading=false;nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(!nm.store.formFileIframe){e.preventDefault();nm.opener.trigger('nyroModal');}else{nm.store.formFileLoading=true;}});},initElts:function(nm){var inputSel;if(nm.store.form.sel)inputSel=$('',{'type':'hidden',name:nm.selIndicator,value:nm.store.form.sel.substring(1)}).appendTo(nm.opener);function rmFormFileElts(){if(inputSel){inputSel.remove();inputSel=undefined;delete(inputSel);}nm.store.formFileIframe.attr('src','about:blank').remove();nm.store.formFileIframe=undefined;delete(nm.store.formFileIframe);}nm.store.formFileIframe=$('').hide().load(function(){if(nm.store.formFileLoading){nm.store.formFileLoading=false;var content=nm.store.formFileIframe .unbind('load error').contents().find('body').not('script[src]');if(content&&content.html()&&content.html().length){rmFormFileElts();nm._setCont(content.html(),nm.store.form.sel);}else{var nbTry=0;fct=function(){nbTry++;var content=nm.store.formFileIframe .unbind('load error').contents().find('body').not('script[src]');if(content&&content.html()&&content.html().length){nm._setCont(content.html(),nm.store.form.sel);rmFormFileElts();}else if(nbTry<5){setTimeout(fct,25);}else{rmFormFileElts();nm._error();}};setTimeout(fct,25);}}}).error(function(){rmIframe();nm._error();});nm.elts.all.append(nm.store.formFileIframe);nm.opener .attr('target','nyroModalFormFile').submit();},close:function(nm){nm.store.formFileLoading=false;if(nm.store.formFileIframe){nm.store.formFileIframe.remove();nm.store.formFileIframe=undefined;delete(nm.store.formFileIframe);}}}});});;
- jQuery(function($,undefined){$.nmFilters({iframe:{is:function(nm){var target=nm.opener.attr('target')||'',rel=nm.opener.attr('rel')||'',opener=nm.opener.get(0);return!nm._hasFilter('image')&&(target.toLowerCase()=='_blank'||rel.toLowerCase().indexOf('external')>-1||(opener.hostname&&opener.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,'')));},init:function(nm){nm.loadFilter='iframe';},load:function(nm){nm.store.iframe=$('');nm._setCont(nm.store.iframe);},afterShowCont:function(nm){nm.store.iframe.attr('src',nm.opener.attr('href'));},close:function(nm){if(nm.store.iframe){nm.store.iframe.remove();nm.store.iframe=undefined;delete(nm.store.iframe);}}}});});;
- jQuery(function($,undefined){$.nmFilters({iframeForm:{is:function(nm){var ret=nm._hasFilter('iframe')&&nm.opener.is('form');if(ret){nm._delFilter('iframe');nm._delFilter('form');}return ret;},init:function(nm){nm.loadFilter='iframeForm';nm.store.iframeFormLoading=false;nm.store.iframeFormOrgTarget=nm.opener.attr('target');nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(!nm.store.iframeFormIframe){e.preventDefault();nm.opener.trigger('nyroModal');}else{nm.store.iframeFormLoading=true;}});},load:function(nm){nm.store.iframeFormIframe=$('');nm._setCont(nm.store.iframeFormIframe);},afterShowCont:function(nm){nm.opener .attr('target','nyroModalIframeForm').submit();},close:function(nm){nm.store.iframeFormOrgTarget?nm.opener.attr('target',nm.store.iframeFormOrgTarget):nm.opener.removeAttr('target');delete(nm.store.formFileLoading);delete(nm.store.iframeFormOrgTarget);if(nm.store.iframeFormIframe){nm.store.iframeFormIframe.remove();nm.store.iframeFormIframe=undefined;delete(nm.store.iframeFormIframe);}}}});});;
- jQuery(function($,undefined){$.nmFilters({embedly:{is:function(nm){var embedlyReg= /http:\/\/(.*youtube\.com\/watch.*|.*\.youtube\.com\/v\/.*|youtu\.be\/.*|.*\.youtube\.com\/user\/.*|.*\.youtube\.com\/.*#.*\/.*|m\.youtube\.com\/watch.*|m\.youtube\.com\/index.*|.*\.youtube\.com\/profile.*|.*justin\.tv\/.*|.*justin\.tv\/.*\/b\/.*|.*justin\.tv\/.*\/w\/.*|www\.ustream\.tv\/recorded\/.*|www\.ustream\.tv\/channel\/.*|www\.ustream\.tv\/.*|qik\.com\/video\/.*|qik\.com\/.*|qik\.ly\/.*|.*revision3\.com\/.*|.*\.dailymotion\.com\/video\/.*|.*\.dailymotion\.com\/.*\/video\/.*|www\.collegehumor\.com\/video:.*|.*twitvid\.com\/.*|www\.break\.com\/.*\/.*|vids\.myspace\.com\/index\.cfm\?fuseaction=vids\.individual&videoid.*|www\.myspace\.com\/index\.cfm\?fuseaction=.*&videoid.*|www\.metacafe\.com\/watch\/.*|www\.metacafe\.com\/w\/.*|blip\.tv\/file\/.*|.*\.blip\.tv\/file\/.*|video\.google\.com\/videoplay\?.*|.*revver\.com\/video\/.*|video\.yahoo\.com\/watch\/.*\/.*|video\.yahoo\.com\/network\/.*|.*viddler\.com\/explore\/.*\/videos\/.*|liveleak\.com\/view\?.*|www\.liveleak\.com\/view\?.*|animoto\.com\/play\/.*|dotsub\.com\/view\/.*|www\.overstream\.net\/view\.php\?oid=.*|www\.livestream\.com\/.*|www\.worldstarhiphop\.com\/videos\/video.*\.php\?v=.*|worldstarhiphop\.com\/videos\/video.*\.php\?v=.*|teachertube\.com\/viewVideo\.php.*|www\.teachertube\.com\/viewVideo\.php.*|www1\.teachertube\.com\/viewVideo\.php.*|www2\.teachertube\.com\/viewVideo\.php.*|bambuser\.com\/v\/.*|bambuser\.com\/channel\/.*|bambuser\.com\/channel\/.*\/broadcast\/.*|www\.schooltube\.com\/video\/.*\/.*|bigthink\.com\/ideas\/.*|bigthink\.com\/series\/.*|sendables\.jibjab\.com\/view\/.*|sendables\.jibjab\.com\/originals\/.*|www\.xtranormal\.com\/watch\/.*|dipdive\.com\/media\/.*|dipdive\.com\/member\/.*\/media\/.*|dipdive\.com\/v\/.*|.*\.dipdive\.com\/media\/.*|.*\.dipdive\.com\/v\/.*|.*yfrog\..*\/.*|tweetphoto\.com\/.*|www\.flickr\.com\/photos\/.*|flic\.kr\/.*|twitpic\.com\/.*|www\.twitpic\.com\/.*|twitpic\.com\/photos\/.*|www\.twitpic\.com\/photos\/.*|.*imgur\.com\/.*|.*\.posterous\.com\/.*|post\.ly\/.*|twitgoo\.com\/.*|i.*\.photobucket\.com\/albums\/.*|s.*\.photobucket\.com\/albums\/.*|phodroid\.com\/.*\/.*\/.*|www\.mobypicture\.com\/user\/.*\/view\/.*|moby\.to\/.*|xkcd\.com\/.*|www\.xkcd\.com\/.*|imgs\.xkcd\.com\/.*|www\.asofterworld\.com\/index\.php\?id=.*|www\.asofterworld\.com\/.*\.jpg|asofterworld\.com\/.*\.jpg|www\.qwantz\.com\/index\.php\?comic=.*|23hq\.com\/.*\/photo\/.*|www\.23hq\.com\/.*\/photo\/.*|.*dribbble\.com\/shots\/.*|drbl\.in\/.*|.*\.smugmug\.com\/.*|.*\.smugmug\.com\/.*#.*|emberapp\.com\/.*\/images\/.*|emberapp\.com\/.*\/images\/.*\/sizes\/.*|emberapp\.com\/.*\/collections\/.*\/.*|emberapp\.com\/.*\/categories\/.*\/.*\/.*|embr\.it\/.*|picasaweb\.google\.com.*\/.*\/.*#.*|picasaweb\.google\.com.*\/lh\/photo\/.*|picasaweb\.google\.com.*\/.*\/.*|dailybooth\.com\/.*\/.*|brizzly\.com\/pic\/.*|pics\.brizzly\.com\/.*\.jpg|img\.ly\/.*|www\.tinypic\.com\/view\.php.*|tinypic\.com\/view\.php.*|www\.tinypic\.com\/player\.php.*|tinypic\.com\/player\.php.*|www\.tinypic\.com\/r\/.*\/.*|tinypic\.com\/r\/.*\/.*|.*\.tinypic\.com\/.*\.jpg|.*\.tinypic\.com\/.*\.png|meadd\.com\/.*\/.*|meadd\.com\/.*|.*\.deviantart\.com\/art\/.*|.*\.deviantart\.com\/gallery\/.*|.*\.deviantart\.com\/#\/.*|fav\.me\/.*|.*\.deviantart\.com|.*\.deviantart\.com\/gallery|.*\.deviantart\.com\/.*\/.*\.jpg|.*\.deviantart\.com\/.*\/.*\.gif|.*\.deviantart\.net\/.*\/.*\.jpg|.*\.deviantart\.net\/.*\/.*\.gif|plixi\.com\/p\/.*|plixi\.com\/profile\/home\/.*|plixi\.com\/.*|www\.fotopedia\.com\/.*\/.*|fotopedia\.com\/.*\/.*|photozou\.jp\/photo\/show\/.*\/.*|photozou\.jp\/photo\/photo_only\/.*\/.*|instagr\.am\/p\/.*|skitch\.com\/.*\/.*\/.*|img\.skitch\.com\/.*|https:\/\/skitch\.com\/.*\/.*\/.*|https:\/\/img\.skitch\.com\/.*|share\.ovi\.com\/media\/.*\/.*|www\.questionablecontent\.net\/|questionablecontent\.net\/|www\.questionablecontent\.net\/view\.php.*|questionablecontent\.net\/view\.php.*|questionablecontent\.net\/comics\/.*\.png|www\.questionablecontent\.net\/comics\/.*\.png|picplz\.com\/user\/.*\/pic\/.*\/|twitrpix\.com\/.*|.*\.twitrpix\.com\/.*|www\.someecards\.com\/.*\/.*|someecards\.com\/.*\/.*|some\.ly\/.*|www\.some\.ly\/.*|pikchur\.com\/.*|achewood\.com\/.*|www\.achewood\.com\/.*|achewood\.com\/index\.php.*|www\.achewood\.com\/index\.php.*|www\.whitehouse\.gov\/photos-and-video\/video\/.*|www\.whitehouse\.gov\/video\/.*|wh\.gov\/photos-and-video\/video\/.*|wh\.gov\/video\/.*|www\.hulu\.com\/watch.*|www\.hulu\.com\/w\/.*|hulu\.com\/watch.*|hulu\.com\/w\/.*|.*crackle\.com\/c\/.*|www\.fancast\.com\/.*\/videos|www\.funnyordie\.com\/videos\/.*|www\.funnyordie\.com\/m\/.*|funnyordie\.com\/videos\/.*|funnyordie\.com\/m\/.*|www\.vimeo\.com\/groups\/.*\/videos\/.*|www\.vimeo\.com\/.*|vimeo\.com\/m\/#\/featured\/.*|vimeo\.com\/groups\/.*\/videos\/.*|vimeo\.com\/.*|vimeo\.com\/m\/#\/featured\/.*|www\.ted\.com\/talks\/.*\.html.*|www\.ted\.com\/talks\/lang\/.*\/.*\.html.*|www\.ted\.com\/index\.php\/talks\/.*\.html.*|www\.ted\.com\/index\.php\/talks\/lang\/.*\/.*\.html.*|.*nfb\.ca\/film\/.*|www\.thedailyshow\.com\/watch\/.*|www\.thedailyshow\.com\/full-episodes\/.*|www\.thedailyshow\.com\/collection\/.*\/.*\/.*|movies\.yahoo\.com\/movie\/.*\/video\/.*|movies\.yahoo\.com\/movie\/.*\/trailer|movies\.yahoo\.com\/movie\/.*\/video|www\.colbertnation\.com\/the-colbert-report-collections\/.*|www\.colbertnation\.com\/full-episodes\/.*|www\.colbertnation\.com\/the-colbert-report-videos\/.*|www\.comedycentral\.com\/videos\/index\.jhtml\?.*|www\.theonion\.com\/video\/.*|theonion\.com\/video\/.*|wordpress\.tv\/.*\/.*\/.*\/.*\/|www\.traileraddict\.com\/trailer\/.*|www\.traileraddict\.com\/clip\/.*|www\.traileraddict\.com\/poster\/.*|www\.escapistmagazine\.com\/videos\/.*|www\.trailerspy\.com\/trailer\/.*\/.*|www\.trailerspy\.com\/trailer\/.*|www\.trailerspy\.com\/view_video\.php.*|www\.atom\.com\/.*\/.*\/|fora\.tv\/.*\/.*\/.*\/.*|www\.spike\.com\/video\/.*|www\.gametrailers\.com\/video\/.*|gametrailers\.com\/video\/.*|www\.koldcast\.tv\/video\/.*|www\.koldcast\.tv\/#video:.*|techcrunch\.tv\/watch.*|techcrunch\.tv\/.*\/watch.*|mixergy\.com\/.*|video\.pbs\.org\/video\/.*|www\.zapiks\.com\/.*|tv\.digg\.com\/diggnation\/.*|tv\.digg\.com\/diggreel\/.*|tv\.digg\.com\/diggdialogg\/.*|www\.trutv\.com\/video\/.*|www\.nzonscreen\.com\/title\/.*|nzonscreen\.com\/title\/.*|app\.wistia\.com\/embed\/medias\/.*|https:\/\/app\.wistia\.com\/embed\/medias\/.*|www\.godtube\.com\/featured\/video\/.*|godtube\.com\/featured\/video\/.*|www\.godtube\.com\/watch\/.*|godtube\.com\/watch\/.*|www\.tangle\.com\/view_video.*|mediamatters\.org\/mmtv\/.*|www\.clikthrough\.com\/theater\/video\/.*|soundcloud\.com\/.*|soundcloud\.com\/.*\/.*|soundcloud\.com\/.*\/sets\/.*|soundcloud\.com\/groups\/.*|snd\.sc\/.*|www\.last\.fm\/music\/.*|www\.last\.fm\/music\/+videos\/.*|www\.last\.fm\/music\/+images\/.*|www\.last\.fm\/music\/.*\/_\/.*|www\.last\.fm\/music\/.*\/.*|www\.mixcloud\.com\/.*\/.*\/|www\.radionomy\.com\/.*\/radio\/.*|radionomy\.com\/.*\/radio\/.*|www\.entertonement\.com\/clips\/.*|www\.rdio\.com\/#\/artist\/.*\/album\/.*|www\.rdio\.com\/artist\/.*\/album\/.*|www\.zero-inch\.com\/.*|.*\.bandcamp\.com\/|.*\.bandcamp\.com\/track\/.*|.*\.bandcamp\.com\/album\/.*|freemusicarchive\.org\/music\/.*|www\.freemusicarchive\.org\/music\/.*|freemusicarchive\.org\/curator\/.*|www\.freemusicarchive\.org\/curator\/.*|www\.npr\.org\/.*\/.*\/.*\/.*\/.*|www\.npr\.org\/.*\/.*\/.*\/.*\/.*\/.*|www\.npr\.org\/.*\/.*\/.*\/.*\/.*\/.*\/.*|www\.npr\.org\/templates\/story\/story\.php.*|huffduffer\.com\/.*\/.*|www\.audioboo\.fm\/boos\/.*|audioboo\.fm\/boos\/.*|boo\.fm\/b.*|www\.xiami\.com\/song\/.*|xiami\.com\/song\/.*|espn\.go\.com\/video\/clip.*|espn\.go\.com\/.*\/story.*|abcnews\.com\/.*\/video\/.*|abcnews\.com\/video\/playerIndex.*|washingtonpost\.com\/wp-dyn\/.*\/video\/.*\/.*\/.*\/.*|www\.washingtonpost\.com\/wp-dyn\/.*\/video\/.*\/.*\/.*\/.*|www\.boston\.com\/video.*|boston\.com\/video.*|www\.facebook\.com\/photo\.php.*|www\.facebook\.com\/video\/video\.php.*|www\.facebook\.com\/v\/.*|cnbc\.com\/id\/.*\?.*video.*|www\.cnbc\.com\/id\/.*\?.*video.*|cnbc\.com\/id\/.*\/play\/1\/video\/.*|www\.cnbc\.com\/id\/.*\/play\/1\/video\/.*|cbsnews\.com\/video\/watch\/.*|www\.google\.com\/buzz\/.*\/.*\/.*|www\.google\.com\/buzz\/.*|www\.google\.com\/profiles\/.*|google\.com\/buzz\/.*\/.*\/.*|google\.com\/buzz\/.*|google\.com\/profiles\/.*|www\.cnn\.com\/video\/.*|edition\.cnn\.com\/video\/.*|money\.cnn\.com\/video\/.*|today\.msnbc\.msn\.com\/id\/.*\/vp\/.*|www\.msnbc\.msn\.com\/id\/.*\/vp\/.*|www\.msnbc\.msn\.com\/id\/.*\/ns\/.*|today\.msnbc\.msn\.com\/id\/.*\/ns\/.*|multimedia\.foxsports\.com\/m\/video\/.*\/.*|msn\.foxsports\.com\/video.*|www\.globalpost\.com\/video\/.*|www\.globalpost\.com\/dispatch\/.*|.*amazon\..*\/gp\/product\/.*|.*amazon\..*\/.*\/dp\/.*|.*amazon\..*\/dp\/.*|.*amazon\..*\/o\/ASIN\/.*|.*amazon\..*\/gp\/offer-listing\/.*|.*amazon\..*\/.*\/ASIN\/.*|.*amazon\..*\/gp\/product\/images\/.*|www\.amzn\.com\/.*|amzn\.com\/.*|www\.shopstyle\.com\/browse.*|www\.shopstyle\.com\/action\/apiVisitRetailer.*|www\.shopstyle\.com\/action\/viewLook.*|gist\.github\.com\/.*|twitter\.com\/.*\/status\/.*|twitter\.com\/.*\/statuses\/.*|mobile\.twitter\.com\/.*\/status\/.*|mobile\.twitter\.com\/.*\/statuses\/.*|www\.crunchbase\.com\/.*\/.*|crunchbase\.com\/.*\/.*|www\.slideshare\.net\/.*\/.*|www\.slideshare\.net\/mobile\/.*\/.*|.*\.scribd\.com\/doc\/.*|screenr\.com\/.*|polldaddy\.com\/community\/poll\/.*|polldaddy\.com\/poll\/.*|answers\.polldaddy\.com\/poll\/.*|www\.5min\.com\/Video\/.*|www\.howcast\.com\/videos\/.*|www\.screencast\.com\/.*\/media\/.*|screencast\.com\/.*\/media\/.*|www\.screencast\.com\/t\/.*|screencast\.com\/t\/.*|issuu\.com\/.*\/docs\/.*|www\.kickstarter\.com\/projects\/.*\/.*|www\.scrapblog\.com\/viewer\/viewer\.aspx.*|ping\.fm\/p\/.*|chart\.ly\/.*|maps\.google\.com\/maps\?.*|maps\.google\.com\/\?.*|maps\.google\.com\/maps\/ms\?.*|.*\.craigslist\.org\/.*\/.*|my\.opera\.com\/.*\/albums\/show\.dml\?id=.*|my\.opera\.com\/.*\/albums\/showpic\.dml\?album=.*&picture=.*|tumblr\.com\/.*|.*\.tumblr\.com\/post\/.*|www\.polleverywhere\.com\/polls\/.*|www\.polleverywhere\.com\/multiple_choice_polls\/.*|www\.polleverywhere\.com\/free_text_polls\/.*|www\.quantcast\.com\/wd:.*|www\.quantcast\.com\/.*|siteanalytics\.compete\.com\/.*|statsheet\.com\/statplot\/charts\/.*\/.*\/.*\/.*|statsheet\.com\/statplot\/charts\/e\/.*|statsheet\.com\/.*\/teams\/.*\/.*|statsheet\.com\/tools\/chartlets\?chart=.*|.*\.status\.net\/notice\/.*|identi\.ca\/notice\/.*|brainbird\.net\/notice\/.*|shitmydadsays\.com\/notice\/.*|www\.studivz\.net\/Profile\/.*|www\.studivz\.net\/l\/.*|www\.studivz\.net\/Groups\/Overview\/.*|www\.studivz\.net\/Gadgets\/Info\/.*|www\.studivz\.net\/Gadgets\/Install\/.*|www\.studivz\.net\/.*|www\.meinvz\.net\/Profile\/.*|www\.meinvz\.net\/l\/.*|www\.meinvz\.net\/Groups\/Overview\/.*|www\.meinvz\.net\/Gadgets\/Info\/.*|www\.meinvz\.net\/Gadgets\/Install\/.*|www\.meinvz\.net\/.*|www\.schuelervz\.net\/Profile\/.*|www\.schuelervz\.net\/l\/.*|www\.schuelervz\.net\/Groups\/Overview\/.*|www\.schuelervz\.net\/Gadgets\/Info\/.*|www\.schuelervz\.net\/Gadgets\/Install\/.*|www\.schuelervz\.net\/.*|myloc\.me\/.*|pastebin\.com\/.*|pastie\.org\/.*|www\.pastie\.org\/.*|redux\.com\/stream\/item\/.*\/.*|redux\.com\/f\/.*\/.*|www\.redux\.com\/stream\/item\/.*\/.*|www\.redux\.com\/f\/.*\/.*|cl\.ly\/.*|cl\.ly\/.*\/content|speakerdeck\.com\/u\/.*\/p\/.*|www\.kiva\.org\/lend\/.*|www\.timetoast\.com\/timelines\/.*|storify\.com\/.*\/.*|.*meetup\.com\/.*|meetu\.ps\/.*|www\.dailymile\.com\/people\/.*\/entries\/.*|.*\.kinomap\.com\/.*|www\.metacdn\.com\/api\/users\/.*\/content\/.*|www\.metacdn\.com\/api\/users\/.*\/media\/.*|prezi\.com\/.*\/.*|.*\.uservoice\.com\/.*\/suggestions\/.*)/i;var ret=nm._hasFilter('link')&&nm.opener.attr('href')&&nm.opener.attr('href').match(embedlyReg)!==null;if(ret)nm._delFilter('iframe');return ret;},init:function(nm){nm.loadFilter='embedly';nm.store.embedly={};},load:function(nm){$.ajax({url:'http://api.embed.ly/1/oembed',dataType:'jsonp',data:'wmode=transparent&url='+nm.opener.attr('href'),success:function(data){if(data.type=='error')nm._error();else if(data.type=='photo'){nm.filters.push('image');$('
').load(function(){nm.elts.cont.addClass('nyroModalImg');nm.elts.hidden.addClass('nyroModalImg');nm._setCont(this);}).error(function(){nm._error();}).attr('src',data.url);}else{nm.store.embedly.w=data.width;nm.store.embedly.h=data.height;nm._setCont(''+data.html+'
');}}});},size:function(nm){if(nm.store.embedly.w&&!nm.sizes.h){nm.sizes.w=nm.store.embedly.w;nm.sizes.h=nm.store.embedly.h;}}}});});;
+/*
+ * nyroModal v2.0.0
+ * Core
+ *
+ */
+jQuery(function($,undefined){var $w=$(window),$d=$(document),$b=$('body'),baseHref=$('base').attr('href'),_nmObj={filters:[],callbacks:{},loadFilter:undefined,modal:false,closeOnEscape:true,closeOnClick:true,useKeyHandler:false,showCloseButton:true,closeButton:'Close',stack:false,nonStackable:'form',header:undefined,footer:undefined,galleryLoop:true,galleryCounts:true,ltr:true,imageRegex:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',selIndicator:'nyroModalSel',swfObjectId:undefined,swf:{allowFullScreen:'true',allowscriptaccess:'always',wmode:'transparent'},store:{},errorMsg:'An error occured',elts:{all:undefined,bg:undefined,load:undefined,cont:undefined,hidden:undefined},sizes:{initW:undefined,initH:undefined,w:undefined,h:undefined,minW:undefined,minH:undefined,wMargin:undefined,hMargin:undefined},anim:{def:undefined,showBg:undefined,hideBg:undefined,showLoad:undefined,hideLoad:undefined,showCont:undefined,hideCont:undefined,showTrans:undefined,hideTrans:undefined,resize:undefined},_open:false,_bgReady:false,_opened:false,_loading:false,_animated:false,_transition:false,_nmOpener:undefined,_nbContentLoading:0,_scripts:'',_scriptsShown:'',saveObj:function(){this.opener.data('nmObj',this);},open:function(){if(this._nmOpener)this._nmOpener._close();this.getInternal()._pushStack(this.opener);this._opened=false;this._bgReady=false;this._open=true;this._initElts();this._load();this._nbContentLoading=0;this._callAnim('showBg',$.proxy(function(){this._bgReady=true;if(this._nmOpener){this._nmOpener._bgReady=false;this._nmOpener._loading=false;this._nmOpener._animated=false;this._nmOpener._opened=false;this._nmOpener._open=false;this._nmOpener.elts.cont=this._nmOpener.elts.hidden=this._nmOpener.elts.load=this._nmOpener.elts.bg=this._nmOpener.elts.all=undefined;this._nmOpener.saveObj();this._nmOpener=undefined;}this._contentLoading();},this));},resize:function(recalc){if(recalc){this.elts.hidden.append(this.elts.cont.children().first().clone());this.sizes.initW=this.sizes.w=this.elts.hidden.width();this.sizes.initH=this.sizes.h=this.elts.hidden.height();this.elts.hidden.empty();}else{this.sizes.w=this.sizes.initW;this.sizes.h=this.sizes.initH;}this._unreposition();this.size();this._callAnim('resize',$.proxy(function(){this._reposition();},this));},size:function(){var maxHeight=this.getInternal().fullSize.viewH-this.sizes.hMargin,maxWidth=this.getInternal().fullSize.viewW-this.sizes.wMargin;if(this.sizes.minW&&this.sizes.minW>this.sizes.w)this.sizes.w=this.sizes.minW;if(this.sizes.minH&&this.sizes.minH>this.sizes.h)this.sizes.h=this.sizes.minH;if(this.sizes.h>maxHeight||this.sizes.w>maxWidth){this.sizes.h=Math.min(this.sizes.h,maxHeight);this.sizes.w=Math.min(this.sizes.w,maxWidth);}this._callFilters('size');},getForNewLinks:function(elt){var ret;if(this.stack&&(!elt||this.isStackable(elt))){ret=$.extend(true,{},this);ret._nmOpener=undefined;ret.elts.all=undefined;}else{ret=$.extend({},this);ret._nmOpener=this;}ret.filters=[];ret.opener=undefined;ret._open=false;return ret;},isStackable:function(elt){return!elt.is(this.nonStackable);},keyHandle:function(e){this.keyEvent=e;this._callFilters('keyHandle');this.keyEvent=undefined;delete(this.keyEvent);},getInternal:function(){return _internal;},_close:function(){this.getInternal()._removeStack(this.opener);this._opened=false;this._open=false;this._callFilters('close');},close:function(){this._close();this._callFilters('beforeClose');var self=this;this._unreposition();self._callAnim('hideCont',function(){self._callAnim('hideLoad',function(){self._callAnim('hideBg',function(){self._callFilters('afterClose');self.elts.cont.remove();self.elts.hidden.remove();self.elts.load.remove();self.elts.bg.remove();self.elts.all.remove();self.elts.cont=self.elts.hidden=self.elts.load=self.elts.bg=self.elts.all=undefined;});});});},_initElts:function(){if(!this.stack&&this.getInternal().stack.length>1)this.elts=this.getInternal().stack[this.getInternal().stack.length-2]['nmObj'].elts;if(!this.elts.all||this.elts.all.closest('body').length==0)this.elts.all=this.elts.bg=this.elts.cont=this.elts.hidden=this.elts.load=undefined;if(!this.elts.all)this.elts.all=$('').appendTo(this.getInternal()._container);if(!this.elts.bg)this.elts.bg=$('').hide().appendTo(this.elts.all);if(!this.elts.cont)this.elts.cont=$('').hide().appendTo(this.elts.all);if(!this.elts.hidden)this.elts.hidden=$('').hide().appendTo(this.elts.all);this.elts.hidden.empty();if(!this.elts.load)this.elts.load=$('').hide().appendTo(this.elts.all);this._callFilters('initElts');},_error:function(){this._callFilters('error');},_setCont:function(html,selector){if(selector){var tmp=[],i=0;html=html.replace(/\r\n/gi,'nyroModalLN').replace(/',endLn=stEnd.length,pos,pos2,tmp;while((pos=data.indexOf(stStart,start))>-1){pos2=data.indexOf(stEnd)+endLn;tmp=$(data.substring(pos,pos2));if(!tmp.attr('src')||tmp.attr('rel')=='forceLoad'){if(tmp.attr('rev')=='shown')this._scriptsShown.push(tmp.get(0));else
+this._scripts.push(tmp.get(0));}data=data.substring(0,pos)+data.substr(pos2);start=pos;}return data;},_hasFilter:function(filter){var ret=false;$.each(this.filters,function(i,f){ret=ret||f==filter;});return ret;},_delFilter:function(filter){this.filters=$.map(this.filters,function(v){if(v!=filter)return v;});},_callFilters:function(fct){this.getInternal()._debug(fct);var ret=[],self=this;$.each(this.filters,function(i,f){ret[f]=self._callFilter(f,fct);});if(this.callbacks[fct]&&$.isFunction(this.callbacks[fct]))this.callbacks[fct](this);return ret;},_callFilter:function(f,fct){if(_filters[f]&&_filters[f][fct]&&$.isFunction(_filters[f][fct]))return _filters[f][fct](this);return undefined;},_callAnim:function(fct,clb){this.getInternal()._debug(fct);this._callFilters('before'+ucfirst(fct));if(!this._animated){this._animated=true;if(!$.isFunction(clb))clb=$.noop;var set=this.anim[fct]||this.anim.def||'basic';if(!_animations[set]||!_animations[set][fct]||!$.isFunction(_animations[set][fct]))set='basic';_animations[set][fct](this,$.proxy(function(){this._animated=false;this._callFilters('after'+ucfirst(fct));clb();},this));}},_load:function(){this.getInternal()._debug('_load');if(!this.loading&&this.loadFilter){this.loading=true;this._callFilter(this.loadFilter,'load');}},_contentLoading:function(){if(!this._animated&&this._bgReady){if(!this._transition&&this.elts.cont.html().length>0)this._transition=true;this._nbContentLoading++;if(!this.loading){if(!this._opened){this._opened=true;if(this._transition){var fct=$.proxy(function(){this._writeContent();this._callFilters('beforeShowCont');this._callAnim('hideTrans',$.proxy(function(){this._transition=false;this._callFilters('afterShowCont');this.elts.cont.append(this._scriptsShown);this._reposition();},this));},this);if(this._nbContentLoading==1){this._unreposition();this._callAnim('showTrans',fct);}else{fct();}}else{this._callAnim('hideLoad',$.proxy(function(){this._writeContent();this._callAnim('showCont',$.proxy(function(){this.elts.cont.append(this._scriptsShown);this._reposition();},this));},this));}}}else if(this._nbContentLoading==1){var outer=this.getInternal()._getOuter(this.elts.load);this.elts.load.css({position:'fixed',top:(this.getInternal().fullSize.viewH-this.elts.load.height()-outer.h.margin)/2,left:(this.getInternal().fullSize.viewW-this.elts.load.width()-outer.w.margin)/2});if(this._transition){this._unreposition();this._callAnim('showTrans',$.proxy(function(){this._contentLoading();},this));}else{this._callAnim('showLoad',$.proxy(function(){this._contentLoading();},this));}}}},_writeContent:function(){this.elts.cont.empty().append(this.elts.hidden.contents()).append(this._scripts).append(this.showCloseButton?this.closeButton:'').css({position:'fixed',width:this.sizes.w,height:this.sizes.h,top:(this.getInternal().fullSize.viewH-this.sizes.h-this.sizes.hMargin)/2,left:(this.getInternal().fullSize.viewW-this.sizes.w-this.sizes.wMargin)/2});},_reposition:function(){var elts=this.elts.cont.find('.nmReposition');if(elts.length){var space=this.getInternal()._getSpaceReposition();elts.each(function(){var me=$(this),offset=me.offset();me.css({position:'fixed',top:offset.top-space.top,left:offset.left-space.left});});this.elts.cont.after(elts);}this.elts.cont.css('overflow','auto');this._callFilters('afterReposition');},_unreposition:function(){this.elts.cont.css('overflow','');var elts=this.elts.all.find('.nmReposition');if(elts.length)this.elts.cont.append(elts.removeAttr('style'));this._callFilters('afterUnreposition');}},_internal={firstInit:true,debug:false,stack:[],fullSize:{w:0,h:0,wW:0,wH:0,viewW:0,viewH:0},nyroModal:function(opts,fullObj){if(_internal.firstInit){_internal._container=$('').appendTo($b);$w.smartresize($.proxy(_internal._resize,_internal));$d.bind('keydown.nyroModal',$.proxy(_internal._keyHandler,_internal));_internal._calculateFullSize();_internal.firstInit=false;}return this.nmInit(opts,fullObj).each(function(){_internal._init($(this).data('nmObj'));});},nmInit:function(opts,fullObj){return this.each(function(){var me=$(this);if(fullObj)me.data('nmObj',$.extend(true,{opener:me},opts));else
+me.data('nmObj',me.data('nmObj')?$.extend(true,me.data('nmObj'),opts):$.extend(true,{opener:me},_nmObj,opts));});},nmCall:function(){return this.trigger('nyroModal');},nmManual:function(url,opts){$('').nyroModal(opts).trigger('nyroModal');},nmData:function(data,opts){this.nmManual('#',$.extend({data:data},opts));},nmObj:function(opts){$.extend(true,_nmObj,opts);},nmInternal:function(opts){$.extend(true,_internal,opts);},nmAnims:function(opts){$.extend(true,_animations,opts);},nmFilters:function(opts){$.extend(true,_filters,opts);},nmTop:function(){if(_internal.stack.length)return _internal.stack[_internal.stack.length-1]['nmObj'];return undefined;},_debug:function(msg){if(this.debug&&window.console&&window.console.log)window.console.log(msg);},_container:undefined,_init:function(nm){nm.filters=[];$.each(_filters,function(f,obj){if(obj.is&&$.isFunction(obj.is)&&obj.is(nm)){nm.filters.push(f);}});nm._callFilters('initFilters');nm._callFilters('init');nm.opener.unbind('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal').bind({'nyroModal.nyroModal':function(e){nm.open();return false;},'nmClose.nyroModal':function(){nm.close();return false;},'nmResize.nyroModal':function(){nm.resize();return false;}});},_scrollWidth:(function(){var scrollbarWidth;if($.browser.msie){var $textarea1=$('').css({position:'absolute',top:-1000,left:-1000}).appendTo($b),$textarea2=$('').css({position:'absolute',top:-1000,left:-1000}).appendTo($b);scrollbarWidth=$textarea1.width()-$textarea2.width();$textarea1.add($textarea2).remove();}else{var $div=$('').css({width:100,height:100,overflow:'auto',position:'absolute',top:-1000,left:-1000}).prependTo($b).append('').find('div').css({width:'100%',height:200});scrollbarWidth=100-$div.width();$div.parent().remove();}return scrollbarWidth;})(),_selNyroModal:function(obj){return $(obj).data('nmObj')?true:false;},_selNyroModalOpen:function(obj){var me=$(obj);return me.data('nmObj')?me.data('nmObj')._open:false;},_keyHandler:function(e){var nmTop=$.nmTop();if(nmTop&&nmTop.useKeyHandler){return nmTop.keyHandle(e);}},_pushStack:function(obj){this.stack=$.map(this.stack,function(elA){if(elA['nmOpener']!=obj.get(0))return elA;});this.stack.push({nmOpener:obj.get(0),nmObj:$(obj).data('nmObj')});},_removeStack:function(obj){this.stack=$.map(this.stack,function(elA){if(elA['nmOpener']!=obj.get(0))return elA;});},_resize:function(){var opens=$(':nmOpen').each(function(){$(this).data('nmObj')._unreposition();});this._calculateFullSize();opens.trigger('nmResize');},_calculateFullSize:function(){this.fullSize={w:$d.width(),h:$d.height(),wW:$w.width(),wH:$w.height()};this.fullSize.viewW=Math.min(this.fullSize.w,this.fullSize.wW);this.fullSize.viewH=Math.min(this.fullSize.h,this.fullSize.wH);},_getCurCSS:function(elm,name){var ret=parseInt($.curCSS(elm,name,true));return isNaN(ret)?0:ret;},_getOuter:function(elm){elm=elm.get(0);var ret={h:{margin:this._getCurCSS(elm,'marginTop')+this._getCurCSS(elm,'marginBottom'),border:this._getCurCSS(elm,'borderTopWidth')+this._getCurCSS(elm,'borderBottomWidth'),padding:this._getCurCSS(elm,'paddingTop')+this._getCurCSS(elm,'paddingBottom')},w:{margin:this._getCurCSS(elm,'marginLeft')+this._getCurCSS(elm,'marginRight'),border:this._getCurCSS(elm,'borderLeftWidth')+this._getCurCSS(elm,'borderRightWidth'),padding:this._getCurCSS(elm,'paddingLeft')+this._getCurCSS(elm,'paddingRight')}};ret.h.outer=ret.h.margin+ret.h.border;ret.w.outer=ret.w.margin+ret.w.border;ret.h.inner=ret.h.padding+ret.h.border;ret.w.inner=ret.w.padding+ret.w.border;ret.h.total=ret.h.outer+ret.h.padding;ret.w.total=ret.w.outer+ret.w.padding;return ret;},_getSpaceReposition:function(){var outer=this._getOuter($b),ie7=$.browser.msie&&$.browser.version<8&&!(screen.height<=$w.height()+23);return{top:$w.scrollTop()-(!ie7?outer.h.border/2:0),left:$w.scrollLeft()-(!ie7?outer.w.border/2:0)};},_getHash:function(url){if(typeof url=='string'){var hashPos=url.indexOf('#');if(hashPos>-1)return url.substring(hashPos);}return'';},_extractUrl:function(url){var ret={url:undefined,sel:undefined};if(url){var hash=this._getHash(url),hashLoc=this._getHash(window.location.href),curLoc=window.location.href.substring(0,window.location.href.length-hashLoc.length),req=url.substring(0,url.length-hash.length);ret.sel=hash;if(req!=curLoc&&req!=baseHref)ret.url=req;}return ret;}},_animations={basic:{showBg:function(nm,clb){nm.elts.bg.css({opacity:0.7}).show();clb();},hideBg:function(nm,clb){nm.elts.bg.hide();clb();},showLoad:function(nm,clb){nm.elts.load.show();clb();},hideLoad:function(nm,clb){nm.elts.load.hide();clb();},showCont:function(nm,clb){nm.elts.cont.show();clb();},hideCont:function(nm,clb){nm.elts.cont.hide();clb();},showTrans:function(nm,clb){nm.elts.cont.hide();nm.elts.load.show();clb();},hideTrans:function(nm,clb){nm.elts.cont.show();nm.elts.load.hide();clb();},resize:function(nm,clb){nm.elts.cont.css({width:nm.sizes.w,height:nm.sizes.h,top:(nm.getInternal().fullSize.viewH-nm.sizes.h-nm.sizes.hMargin)/2,left:(nm.getInternal().fullSize.viewW-nm.sizes.w-nm.sizes.wMargin)/2});clb();}}},_filters={basic:{is:function(nm){return true;},init:function(nm){if(nm.opener.attr('rev')=='modal')nm.modal=true;if(nm.modal)nm.closeOnEscape=nm.closeOnClick=nm.showCloseButton=false;if(nm.closeOnEscape)nm.useKeyHandler=true;},initElts:function(nm){nm.elts.bg.addClass('nyroModalBg');if(nm.closeOnClick)nm.elts.bg.unbind('click.nyroModal').bind('click.nyroModal',function(e){e.preventDefault();nm.close();});nm.elts.cont.addClass('nyroModalCont');nm.elts.hidden.addClass('nyroModalCont nyroModalHidden');nm.elts.load.addClass('nyroModalCont nyroModalLoad');},error:function(nm){nm.elts.hidden.addClass('nyroModalError');nm.elts.cont.addClass('nyroModalError');nm._setCont(nm.errorMsg);},beforeShowCont:function(nm){nm.elts.cont.find('.nyroModal').each(function(){var cur=$(this);cur.nyroModal(nm.getForNewLinks(cur),true);}).end().find('.nyroModalClose').bind('click.nyroModal',function(e){e.preventDefault();nm.close();});},keyHandle:function(nm){if(nm.keyEvent.keyCode==27&&nm.closeOnEscape){nm.keyEvent.preventDefault();nm.close();}}},custom:{is:function(nm){return true;}}};$.fn.extend({nm:_internal.nyroModal,nyroModal:_internal.nyroModal,nmInit:_internal.nmInit,nmCall:_internal.nmCall});$.extend({nmManual:_internal.nmManual,nmData:_internal.nmData,nmObj:_internal.nmObj,nmInternal:_internal.nmInternal,nmAnims:_internal.nmAnims,nmFilters:_internal.nmFilters,nmTop:_internal.nmTop});$.expr[':'].nyroModal=$.expr[':'].nm=_internal._selNyroModal;$.expr[':'].nmOpen=_internal._selNyroModalOpen;});(function($,sr){var debounce=function(func,threshold,execAsap){var timeout;return function debounced(){var obj=this,args=arguments;function delayed(){if(!execAsap)func.apply(obj,args);timeout=null;};if(timeout)clearTimeout(timeout);else if(execAsap)func.apply(obj,args);timeout=setTimeout(delayed,threshold||100);};};jQuery.fn[sr]=function(fn){return fn?this.bind('resize',debounce(fn)):this.trigger(sr);};})(jQuery,'smartresize');function ucfirst(str){str+='';var f=str.charAt(0).toUpperCase();return f+str.substr(1);}jQuery(function($,undefined){$.nmAnims({fade:{showBg:function(nm,clb){nm.elts.bg.fadeTo(250,0.7,clb);},hideBg:function(nm,clb){nm.elts.bg.fadeOut(clb);},showLoad:function(nm,clb){nm.elts.load.fadeIn(clb);},hideLoad:function(nm,clb){nm.elts.load.fadeOut(clb);},showCont:function(nm,clb){nm.elts.cont.fadeIn(clb);},hideCont:function(nm,clb){nm.elts.cont.css('overflow','hidden').fadeOut(clb);},showTrans:function(nm,clb){nm.elts.load.css({position:nm.elts.cont.css('position'),top:nm.elts.cont.css('top'),left:nm.elts.cont.css('left'),width:nm.elts.cont.css('width'),height:nm.elts.cont.css('height'),marginTop:nm.elts.cont.css('marginTop'),marginLeft:nm.elts.cont.css('marginLeft')}).fadeIn(function(){nm.elts.cont.hide();clb();});},hideTrans:function(nm,clb){nm.elts.cont.css('visibility','hidden').show();nm.elts.load.css('position',nm.elts.cont.css('position')).animate({top:nm.elts.cont.css('top'),left:nm.elts.cont.css('left'),width:nm.elts.cont.css('width'),height:nm.elts.cont.css('height'),marginTop:nm.elts.cont.css('marginTop'),marginLeft:nm.elts.cont.css('marginLeft')},function(){nm.elts.cont.css('visibility','');nm.elts.load.fadeOut(clb);});},resize:function(nm,clb){nm.elts.cont.animate({width:nm.sizes.w,height:nm.sizes.h,top:(nm.getInternal().fullSize.viewH-nm.sizes.h-nm.sizes.hMargin)/2,left:(nm.getInternal().fullSize.viewW-nm.sizes.w-nm.sizes.wMargin)/2},clb);}}});$.nmObj({anim:{def:'fade'}});});jQuery(function($,undefined){$.nmFilters({title:{is:function(nm){return nm.opener.is('[title]');},beforeShowCont:function(nm){var offset=nm.elts.cont.offset();nm.store.title=$('',{text:nm.opener.attr('title')}).addClass('nyroModalTitle nmReposition');nm.elts.cont.prepend(nm.store.title);},close:function(nm){if(nm.store.title){nm.store.title.remove();nm.store.title=undefined;delete(nm.store.title);}}}});});jQuery(function($,undefined){$.nmFilters({gallery:{is:function(nm){var ret=nm.opener.is('[rel]:not([rel=external], [rel=nofollow])');if(ret){var rel=nm.opener.attr('rel'),indexSpace=rel.indexOf(' '),gal=indexSpace>0?rel.substr(0,indexSpace):rel,links=$('[href][rel="'+gal+'"], [href][rel^="'+gal+' "]');if(links.length<2)ret=false;if(ret&&nm.galleryCounts&&!nm._hasFilter('title'))nm.filters.push('title');}return ret;},init:function(nm){nm.useKeyHandler=true;},keyHandle:function(nm){if(!nm._animated&&nm._opened){if(nm.keyEvent.keyCode==39||nm.keyEvent.keyCode==40){nm.keyEvent.preventDefault();nm._callFilters('galleryNext');}else if(nm.keyEvent.keyCode==37||nm.keyEvent.keyCode==38){nm.keyEvent.preventDefault();nm._callFilters('galleryPrev');}}},initElts:function(nm){var rel=nm.opener.attr('rel'),indexSpace=rel.indexOf(' ');nm.store.gallery=indexSpace>0?rel.substr(0,indexSpace):rel;nm.store.galleryLinks=$('[href][rel="'+nm.store.gallery+'"], [href][rel^="'+nm.store.gallery+' "]');nm.store.galleryIndex=nm.store.galleryLinks.index(nm.opener);},beforeShowCont:function(nm){if(nm.galleryCounts&&nm.store.title&&nm.store.galleryLinks&&nm.store.galleryLinks.length>1){var curTitle=nm.store.title.html();nm.store.title.html((curTitle.length?curTitle+' - ':'')+(nm.store.galleryIndex+1)+'/'+nm.store.galleryLinks.length);}},filledContent:function(nm){var link=this._getGalleryLink(nm,-1),append=nm.elts.hidden.find(' > div');if(link){$('',{text:'previous',href:'#'}).addClass('nyroModalPrev').bind('click',function(e){e.preventDefault();nm._callFilters('galleryPrev');}).appendTo(append);}link=this._getGalleryLink(nm,1);if(link){$('',{text:'next',href:'#'}).addClass('nyroModalNext').bind('click',function(e){e.preventDefault();nm._callFilters('galleryNext');}).appendTo(append);}},close:function(nm){nm.store.gallery=undefined;nm.store.galleryLinks=undefined;nm.store.galleryIndex=undefined;delete(nm.store.gallery);delete(nm.store.galleryLinks);delete(nm.store.galleryIndex);if(nm.elts.cont)nm.elts.cont.find('.nyroModalNext, .nyroModalPrev').remove();},galleryNext:function(nm){this._getGalleryLink(nm,1).nyroModal(nm.getForNewLinks(),true).click();},galleryPrev:function(nm){this._getGalleryLink(nm,-1).nyroModal(nm.getForNewLinks(),true).click();},_getGalleryLink:function(nm,dir){if(nm.store.gallery){if(!nm.ltr)dir*=-1;var index=nm.store.galleryIndex+dir;if(nm.store.galleryLinks&&index>=0&&index').load(function(){nm.elts.cont.addClass('nyroModalImg');nm.elts.hidden.addClass('nyroModalImg');nm._setCont(this);}).error(function(){nm._error();}).attr('src',url);},size:function(nm){if(nm.sizes.w!=nm.sizes.initW||nm.sizes.h!=nm.sizes.initH){var ratio=Math.min(nm.sizes.w/nm.sizes.initW,nm.sizes.h/nm.sizes.initH);nm.sizes.w=nm.sizes.initW*ratio;nm.sizes.h=nm.sizes.initH*ratio;}var img=nm.loading?nm.elts.hidden.find('img'):nm.elts.cont.find('img');img.attr({width:nm.sizes.w,height:nm.sizes.h});},close:function(nm){if(nm.elts.cont){nm.elts.cont.removeClass('nyroModalImg');nm.elts.hidden.removeClass('nyroModalImg');}}}});});jQuery(function($,undefined){$.nmFilters({swf:{idCounter:1,is:function(nm){return nm._hasFilter('link')&&nm.opener.is('[href$=".swf"]');},init:function(nm){nm.loadFilter='swf';},load:function(nm){if(!nm.swfObjectId)nm.swfObjectId='nyroModalSwf-'+(this.idCounter++);var url=nm.store.link.url,cont='';nm._setCont(cont);}}});});jQuery(function($,undefined){$.nmFilters({form:{is:function(nm){var ret=nm.opener.is('form');if(ret)nm.store.form=nm.getInternal()._extractUrl(nm.opener.attr('action'));return ret;},init:function(nm){nm.loadFilter='form';nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){e.preventDefault();nm.opener.trigger('nyroModal');});},load:function(nm){var data=nm.opener.serializeArray();if(nm.store.form.sel)data.push({name:nm.selIndicator,value:nm.store.form.sel.substring(1)});$.ajax({url:nm.store.form.url,data:data,type:nm.opener.attr('method')?nm.opener.attr('method'):'get',success:function(data){nm._setCont(data,nm.store.form.sel);},error:function(){nm._error();}});}}});});jQuery(function($,undefined){$.nmFilters({formFile:{is:function(nm){var ret=nm.opener.is('form[enctype="multipart/form-data"]');if(ret){nm._delFilter('form');if(!nm.store.form)nm.store.form=nm.getInternal()._extractUrl(nm.opener.attr('action'));}return ret;},init:function(nm){nm.loadFilter='formFile';nm.store.formFileLoading=false;nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(!nm.store.formFileIframe){e.preventDefault();nm.opener.trigger('nyroModal');}else{nm.store.formFileLoading=true;}});},initElts:function(nm){var inputSel;if(nm.store.form.sel)inputSel=$('',{'type':'hidden',name:nm.selIndicator,value:nm.store.form.sel.substring(1)}).appendTo(nm.opener);function rmFormFileElts(){if(inputSel){inputSel.remove();inputSel=undefined;delete(inputSel);}nm.store.formFileIframe.attr('src','about:blank').remove();nm.store.formFileIframe=undefined;delete(nm.store.formFileIframe);}nm.store.formFileIframe=$('').hide().load(function(){if(nm.store.formFileLoading){nm.store.formFileLoading=false;var content=nm.store.formFileIframe.unbind('load error').contents().find('body').not('script[src]');if(content&&content.html()&&content.html().length){rmFormFileElts();nm._setCont(content.html(),nm.store.form.sel);}else{var nbTry=0;fct=function(){nbTry++;var content=nm.store.formFileIframe.unbind('load error').contents().find('body').not('script[src]');if(content&&content.html()&&content.html().length){nm._setCont(content.html(),nm.store.form.sel);rmFormFileElts();}else if(nbTry<5){setTimeout(fct,25);}else{rmFormFileElts();nm._error();}};setTimeout(fct,25);}}}).error(function(){rmFormFileElts();nm._error();});nm.elts.all.append(nm.store.formFileIframe);nm.opener.attr('target','nyroModalFormFile').submit();},close:function(nm){nm.store.formFileLoading=false;if(nm.store.formFileIframe){nm.store.formFileIframe.remove();nm.store.formFileIframe=undefined;delete(nm.store.formFileIframe);}}}});});jQuery(function($,undefined){$.nmFilters({iframe:{is:function(nm){var target=nm.opener.attr('target')||'',rel=nm.opener.attr('rel')||'',opener=nm.opener.get(0);return!nm._hasFilter('image')&&(target.toLowerCase()=='_blank'||rel.toLowerCase().indexOf('external')>-1||(opener.hostname&&opener.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,'')));},init:function(nm){nm.loadFilter='iframe';},load:function(nm){nm.store.iframe=$('');nm._setCont(nm.store.iframe);},afterShowCont:function(nm){nm.store.iframe.attr('src',nm.opener.attr('href'));},close:function(nm){if(nm.store.iframe){nm.store.iframe.remove();nm.store.iframe=undefined;delete(nm.store.iframe);}}}});});jQuery(function($,undefined){$.nmFilters({iframeForm:{is:function(nm){var ret=nm._hasFilter('iframe')&&nm.opener.is('form');if(ret){nm._delFilter('iframe');nm._delFilter('form');}return ret;},init:function(nm){nm.loadFilter='iframeForm';nm.store.iframeFormLoading=false;nm.store.iframeFormOrgTarget=nm.opener.attr('target');nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(!nm.store.iframeFormIframe){e.preventDefault();nm.opener.trigger('nyroModal');}else{nm.store.iframeFormLoading=true;}});},load:function(nm){nm.store.iframeFormIframe=$('');nm._setCont(nm.store.iframeFormIframe);},afterShowCont:function(nm){nm.opener.attr('target','nyroModalIframeForm').submit();},close:function(nm){nm.store.iframeFormOrgTarget?nm.opener.attr('target',nm.store.iframeFormOrgTarget):nm.opener.removeAttr('target');delete(nm.store.formFileLoading);delete(nm.store.iframeFormOrgTarget);if(nm.store.iframeFormIframe){nm.store.iframeFormIframe.remove();nm.store.iframeFormIframe=undefined;delete(nm.store.iframeFormIframe);}}}});});jQuery(function($,undefined){$.nmObj({embedlyUrl:'http://api.embed.ly/1/oembed',embedly:{key:undefined,wmode:'transparent',allowscripts:true,format:'json'}});var cache=[];$.nmFilters({embedly:{is:function(nm){if(nm._hasFilter('link')&&nm._hasFilter('iframe')&&nm.opener.attr('href')&&nm.embedly.key){if(cache[nm.opener.attr('href')]){nm.store.embedly=cache[nm.opener.attr('href')];nm._delFilter('iframe');return true;}nm.store.embedly=false;var data=nm.embedly;data.url=nm.opener.attr('href');$.ajax({url:nm.embedlyUrl,dataType:'jsonp',data:data,success:function(data){if(data.type!='error'){nm.store.embedly=data;cache[nm.opener.attr('href')]=data;nm._delFilter('iframe');nm.filters.push('embedly');nm._callFilters('initFilters');nm._callFilters('init');}}});}return false;},init:function(nm){nm.loadFilter='embedly';},load:function(nm){if(nm.store.embedly.type=='photo'){nm.filters.push('image');$('
').load(function(){nm.elts.cont.addClass('nyroModalImg');nm.elts.hidden.addClass('nyroModalImg');nm._setCont(this);}).error(function(){nm._error();}).attr('src',nm.store.embedly.url);}else{nm._setCont(''+nm.store.embedly.html+'
');}},size:function(nm){if(nm.store.embedly.width&&!nm.sizes.height){nm.sizes.w=nm.store.embedly.width;nm.sizes.h=nm.store.embedly.height;}}}});});
\ No newline at end of file
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/static/ldt/js/projectscontents.js
--- a/src/ldt/ldt/static/ldt/js/projectscontents.js Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/static/ldt/js/projectscontents.js Wed Nov 30 10:44:15 2011 +0100
@@ -1,4 +1,4 @@
-
+
$.fn.realVal = function() {
var obj = $(this[0]);
if(obj.val) {
@@ -176,12 +176,12 @@
filters: ['iframe'],
sizes: {
minW: 730,
- minH: 480
+ minH: 840
},
closeOnClick:false,
callbacks: {
afterClose: function(nm) {
- searchCallback($('#searchprojectsinput'), "#contentslistcontainer", content_filter_url);
+ searchCallback($('#searchprojectsinput'), "#contentslistcontainer", content_filter_url, 0);
},
afterShowCont: function(nm) {
nm.store.iframe.load(function() {
@@ -192,7 +192,7 @@
});
nm.store.iframe.width(730);
- nm.store.iframe.height(470);
+ nm.store.iframe.height(830);
}
}
});
@@ -266,7 +266,7 @@
},
afterClose: function(nm) {
// Can't do that because searchprojectfilterurl is not defined in init_events_base params
- searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
+ searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
}
}
});
@@ -282,10 +282,9 @@
function init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
init_modal_window ('.ldt_link_open_ldt', 1035, 670, 1025, 660, base_node, searchprojectfilterurl);
- init_modal_window ('.ldt_link_create_project', 520, 660, 510, 650, base_node, searchprojectfilterurl);
+ init_modal_window ('.ldt_link_create_project', 950, 700, 940, 690, base_node, searchprojectfilterurl);
init_modal_window ('.ldt_link_copy_project', 500, 150, 500, 150, base_node, searchprojectfilterurl);
-
-
+
$('.publishedproject', base_node).click(function(e) {
e.preventDefault();
display_loading_icon($(this));
@@ -332,8 +331,8 @@
$('.projecttitlelink').nyroModal({
filters: ['iframe'],
sizes: {
- minW: '520',
- minH: '700'
+ minW: '950',
+ minH: '710'
},
closeOnClick:false,
callbacks: {
@@ -349,8 +348,8 @@
}
});
- nm.store.iframe.width(510);
- nm.store.iframe.height(690);
+ nm.store.iframe.width(940);
+ nm.store.iframe.height(740);
}
}
});
@@ -361,6 +360,50 @@
project.attr('src', LDT_MEDIA_PREFIX + "img/ajax-loader-transp.gif");
}
+function init_events_group (base_node, embed_url, groupfilterurl) {
+
+ $('.create_group',base_node).each(function(i){
+ $(this).attr("target","_iri");
+ });
+
+ $('.create_group',base_node).nyroModal({
+ filters: ['iriIframe'],
+ sizes: {
+ minW: '520',
+ minH: '530'
+ },
+ showCloseButton: true,
+ closeOnEscape:false,
+ closeOnClick:false,
+ callbacks: {
+ afterShowCont: function(nm) {
+ var iframe = nm.store.iframe;
+ iframe.load(function(){
+ var form_status = $(this).contents().find("#project_form_status").val();
+ if(form_status === 'saved' || form_status === 'deleted' ) {
+ $.nmTop().close();
+ }
+
+ });
+ nm.store.iframe.width(510);
+ nm.store.iframe.height(520);
+ },
+ afterClose: function(nm) {
+ searchCallback($("#searchprojectsinput"), $("#groupslistcontainer"), groupfilterurl, 0);
+ }
+ }
+ });
+
+
+ $('.create_group',base_node).each(function(i, e) {
+ nm = $(e).data('nmObj');
+ $(e).data('nmObj', $.extend(true, nm, {
+ close: testAndClose(nm.close)
+ }));
+ });
+
+}
+
function init_events_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
init_events_base(base_node, embed_url);
init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl);
@@ -371,6 +414,7 @@
init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl);
}
+
function searchFieldInit(input_list_init) {
$(".searchfieldinputbase").keydown(function (e) {
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/templates/ldt/ldt_raw_base.html
--- a/src/ldt/ldt/templates/ldt/ldt_raw_base.html Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/templates/ldt/ldt_raw_base.html Wed Nov 30 10:44:15 2011 +0100
@@ -13,6 +13,27 @@
{% block title %}{% trans "page_title" %}{% endblock %}
{% block js_import %}
+
{% endblock %}
{% block css_declaration %}
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/user/admin.py
--- a/src/ldt/ldt/user/admin.py Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/user/admin.py Wed Nov 30 10:44:15 2011 +0100
@@ -1,11 +1,22 @@
from copy import deepcopy #@UnresolvedImport
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
+from django.contrib.auth.models import Group, User
from django.utils.translation import ugettext as _
from forms import LdtForm
-from models import Ldt
+from guardian.admin import GuardedModelAdmin
+from models import Ldt, UserProfile
+
+class GroupAdmin(GuardedModelAdmin):
+ pass
-class LdtAdmin(UserAdmin):
+class UserProfileInline(admin.StackedInline):
+ model = UserProfile
+
+class UserProfileAdmin(UserAdmin):
+ inlines = [UserProfileInline, ]
+
+class LdtAdmin(UserProfileAdmin):
list_display = ('username', 'email', 'first_name', 'last_name')
fieldsets = [
@@ -17,6 +28,7 @@
form = LdtForm
model = Ldt
filter_horizontal = ('user_permissions',)
+ inlines = [UserProfileInline, ]
def get_fieldsets(self, request, obj=None):
fieldsets = deepcopy(self.fieldsets)
@@ -26,7 +38,15 @@
return fieldsets
def add_view(self, request):
- return super(UserAdmin, self).add_view(request)
-
-admin.site.unregister(Ldt)
+ return super(UserAdmin, self).add_view(request)
+
+
+
+admin.site.unregister(Group)
+admin.site.register(Group, GroupAdmin)
+
+admin.site.unregister(Ldt)
admin.site.register(Ldt, LdtAdmin)
+
+admin.site.unregister(User)
+admin.site.register(User, UserProfileAdmin)
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/user/migrations/0005_auto__add_field_userprofile_is_regular.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/user/migrations/0005_auto__add_field_userprofile_is_regular.py Wed Nov 30 10:44:15 2011 +0100
@@ -0,0 +1,71 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding field 'UserProfile.is_regular'
+ db.add_column('user_userprofile', 'is_regular', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
+
+
+ def backwards(self, orm):
+
+ # Deleting field 'UserProfile.is_regular'
+ db.delete_column('user_userprofile', 'is_regular')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'user.ldt': {
+ 'Meta': {'object_name': 'Ldt', '_ormbases': ['auth.User']},
+ 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
+ },
+ 'user.userprofile': {
+ 'Meta': {'object_name': 'UserProfile'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_regular': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}),
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
+ }
+ }
+
+ complete_apps = ['user']
diff -r d79097e98244 -r 1105a5ed9f8f src/ldt/ldt/user/models.py
--- a/src/ldt/ldt/user/models.py Wed Nov 23 11:12:31 2011 +0100
+++ b/src/ldt/ldt/user/models.py Wed Nov 30 10:44:15 2011 +0100
@@ -1,8 +1,9 @@
from django.conf import settings
from django.contrib import admin
-from django.contrib.auth.models import User, UserManager
+from django.contrib.auth.models import User, UserManager, Group
from django.db import models
from django.db.models.signals import post_save
+from django.utils.translation import ugettext as _
import datetime
@@ -27,18 +28,20 @@
else:
new_user.set_unusable_password()
new_user.save()
- return new_user
+ new_user.groups.add(Group.objects.get(name=settings.PUBLIC_GROUP_NAME))
+ return new_user
class UserProfile (models.Model):
user = models.OneToOneField(User)
language = models.CharField(max_length=2, default=settings.LANGUAGE_CODE[:2])
+ is_regular = models.BooleanField(default=False, help_text=_("Designates whether the user can create and leave groups."))
@staticmethod
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user=instance)
-
+
post_save.connect(UserProfile.create_user_profile, sender=User)
diff -r d79097e98244 -r 1105a5ed9f8f virtualenv/res/lib/lib_create_env.py
--- a/virtualenv/res/lib/lib_create_env.py Wed Nov 23 11:12:31 2011 +0100
+++ b/virtualenv/res/lib/lib_create_env.py Wed Nov 30 10:44:15 2011 +0100
@@ -30,6 +30,7 @@
'DJANGO_OPENID_CONSUMER': {'setup':'django_openid_consumer', 'url':'http://pypi.python.org/packages/source/d/django-openid-consumer/django-openid-consumer-0.1.1.tar.gz', 'local':"django-openid-consumer-0.1.1.tar.gz"},
'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/django-social-auth/tarball/v0.3.10', 'local':"omab-django-social-auth-v0.3.10-modified.tar.gz"},
'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.7.3.tar.gz', 'local':"south-0.7.3.tar.gz"},
+ 'DJANGO_GUARDIAN' : { 'setup': 'django-guardian', 'url':'http://pypi.python.org/packages/source/d/django-guardian/django-guardian-1.0.3.tar.gz', 'local':"django-guardian-1.0.3.tar.gz"},
}
if system_str == 'Windows':
diff -r d79097e98244 -r 1105a5ed9f8f virtualenv/res/src/django-guardian-1.0.3.tar.gz
Binary file virtualenv/res/src/django-guardian-1.0.3.tar.gz has changed
diff -r d79097e98244 -r 1105a5ed9f8f virtualenv/web/res/res_create_env.py
--- a/virtualenv/web/res/res_create_env.py Wed Nov 23 11:12:31 2011 +0100
+++ b/virtualenv/web/res/res_create_env.py Wed Nov 30 10:44:15 2011 +0100
@@ -37,6 +37,7 @@
('OPENID', 'pip', None, None),
('DJANGO_OPENID_CONSUMER', 'pip', None, None),
('SOCIAL_AUTH', 'easy_install', None, None),
+ ('DJANGO_GUARDIAN', 'pip', None, None),
])
if system_str == "Darwin":
diff -r d79097e98244 -r 1105a5ed9f8f web/ldtplatform/config.py.tmpl
--- a/web/ldtplatform/config.py.tmpl Wed Nov 23 11:12:31 2011 +0100
+++ b/web/ldtplatform/config.py.tmpl Wed Nov 30 10:44:15 2011 +0100
@@ -82,3 +82,7 @@
EMPTY_MEDIA_EXTERNALID = None
AUTO_INDEX_AFTER_SAVE = True
+
+USE_GROUP_PERMISSIONS = ['Project', 'Content']
+FORBIDDEN_STREAM_URL = "empty-video"
+PUBLIC_GROUP_NAME = 'everyone'
diff -r d79097e98244 -r 1105a5ed9f8f web/ldtplatform/settings.py
--- a/web/ldtplatform/settings.py Wed Nov 23 11:12:31 2011 +0100
+++ b/web/ldtplatform/settings.py Wed Nov 30 10:44:15 2011 +0100
@@ -88,6 +88,7 @@
'django.contrib.messages.middleware.MessageMiddleware',
'django_openid_consumer.middleware.OpenIDMiddleware',
'ldt.ldt_utils.middleware.userprofile.LanguageMiddleware',
+ 'ldt.security.middleware.SecurityMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
@@ -138,6 +139,7 @@
'piston',
'social_auth',
'south',
+ 'guardian',
)
AUTH_PROFILE_MODULE = 'user.UserProfile'
@@ -162,6 +164,7 @@
# 'social_auth.backends.contrib.orkut.OrkutBackend',
'social_auth.backends.OpenIDBackend',
'django.contrib.auth.backends.ModelBackend',
+ 'guardian.backends.ObjectPermissionBackend',
)
SOCIAL_AUTH_IMPORT_BACKENDS = (
'myproy.social_auth_extra_services',
@@ -202,6 +205,8 @@
AUTO_INDEX_AFTER_SAVE = True
+ANONYMOUS_USER_ID = -1
+
WEB_VERSION = ldtplatform.get_version()
from config import *