code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231 values | license stringclasses 13 values | size int64 1 2.01M |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-04-28.
# $Id$
#
import datetime
import logging
from django import forms
from friday.common.errors import InvalidFormError
from friday.apps.notifications.models import Notification
class NotificationForm(forms.Form):
subject = forms.CharField(max_length=128, required=True)
message = forms.CharField(required=False, widget=forms.Textarea)
recipients = forms.CharField(required=False, widget=forms.Textarea)
def clean_recipients(self):
recipients = self.cleaned_data["recipients"] \
.replace(",", "\n").replace(";", "\n") \
.splitlines()
if not recipients:
message = "Recipients are required."
raise forms.ValidationError(message)
return recipients
def send(self, author):
if not self.is_valid():
raise InvalidFormError(self.errors)
notification = Notification.send(
category="TODO",
subject=self.cleaned_data["subject"],
message=self.cleaned_data["message"],
author=author,
recipients=self.cleaned_data["recipients"]
)
return notification
# EOF
| zzheng | friday/website/friday/apps/notifications/forms.py | Python | asf20 | 1,349 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-04-28.
# $Id$
#
from django.conf.urls.defaults import *
from friday.apps.notifications.views import *
urlpatterns = patterns("",
url(
r"^$",
notifications_home,
name="friday.notifications_home"
),
url(
r"^view/$",
view_notifications,
name="friday.view_notifications"
),
url(
r"^view/(?P<category>[\w\.\-]+)/$",
view_notifications,
name="friday.view_notifications"
),
url(
r"^send/$",
send_notification,
name="friday.send_notification"
),
url(
r"^(?P<notification_id>\d+)/$",
view_notification,
name="friday.view_notification"
),
url(
r"^delete/$",
delete_notifications,
name="friday.delete_notifications"
),
)
# EOF
| zzheng | friday/website/friday/apps/notifications/urls.py | Python | asf20 | 990 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-04-28.
# $Id$
#
| zzheng | friday/website/friday/apps/notifications/__init__.py | Python | asf20 | 150 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-04-28.
# $Id$
#
import logging
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from friday.common.actions import WebmasterAction
from friday.common.errors import BadRequestError, EntityNotFoundError
from friday.common.prompt import Prompt
from friday.apps.notifications.models import Notification
from friday.apps.notifications.forms import NotificationForm
class ViewNotifications(WebmasterAction):
PAGE_URL_NAME = "friday.view_notifications"
PAGE_TEMPLATE = "notifications/view_notifications.html"
def __init__(self, request, category=None):
super(ViewNotifications, self).__init__(request)
self.category = category
def get_page(self):
if self.category:
kwargs = {"category": self.category}
else:
kwargs = {}
notifications = Notification.find(**kwargs)
data = {"category": self.category, "notifications": notifications}
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
class ViewNotification(WebmasterAction):
PAGE_URL_NAME = "friday.view_notification"
PAGE_TEMPLATE = "notifications/view_notification.html"
def __init__(self, request, notification_id):
super(ViewNotification, self).__init__(request)
self.notification_id = int(notification_id)
def get_notification(self):
notification = Notification.get_unique(id=self.notification_id)
if not notification:
message = "searched by notification ID %s." % self.notification_id
raise EntityNotFoundError(Notification, message)
return notification
def get_page(self):
data = {"notification": self.get_notification()}
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
class SendNotification(WebmasterAction):
PAGE_URL_NAME = "friday.send_notification"
PAGE_TEMPLATE = "notifications/send_notification.html"
def get_page(self):
data = {"notification_form": NotificationForm()}
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
def post_page(self):
notification_form = NotificationForm(data=self.request.POST)
try:
notification = notification_form.send(self.current_user)
message = "Notification %s has been sent successfully." % notification.id
logging.info(message)
redirect_url = ViewNotification.get_page_url(notification_id=notification.id)
return HttpResponseRedirect(redirect_url)
except Exception, exc:
message = "Failed to send mail: %s" % exc
logging.error(message)
logging.exception(exc)
data = {"notification_form": notification_form, "prompt": Prompt(error=message)}
data = self.update_data(data)
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
class DeleteNotifications(WebmasterAction):
PAGE_URL_NAME = "friday.delete_notifications"
def post_page(self):
notification_id_list = self.request.POST.getlist("notification_id")
deleted, failed = 0, 0
for notification_id in notification_id_list:
try:
notification = Notification.get_unique(id=int(notification_id))
if not notification:
message = "searched by notification ID %s." % notification_id
raise EntityNotFoundError(Notification, message)
notification.delete()
deleted += 1
except Exception, exc:
message = "Failed to delete notification %s: %s" % (notification_id, exc)
logging.error(message)
logging.exception(exc)
failed += 1
if deleted + failed > 0:
logging.info("Deleted %s notifications (%s failed)." % (deleted, failed))
redirect_url = ViewNotifications.get_page_url()
return HttpResponseRedirect(redirect_url)
#---------------------------------------------------------------------------------------------------
def notifications_home(request):
return ViewNotifications(request).process()
def view_notifications(request, category=None):
return ViewNotifications(request, category).process()
def view_notification(request, notification_id):
return ViewNotification(request, notification_id).process()
def send_notification(request):
return SendNotification(request).process()
def delete_notifications(request):
return DeleteNotifications(request).process()
# EOF
| zzheng | friday/website/friday/apps/notifications/views.py | Python | asf20 | 5,066 |
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-04-28.
# $Id$
#
from django.dispatch import Signal
something_happened = Signal(providing_args=["subject", "message", "author", "recipients"])
# EOF
| zzheng | friday/website/friday/apps/notifications/signals.py | Python | asf20 | 251 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-04-27.
# $Id$
#
import random
from google.appengine.ext import db
from djangomockup import models
from friday.common.dbutils import filter_key, ord_to_key
class TagCloud(object):
class _Tag(object):
def __init__(self, tag, average_count):
super(TagCloud._Tag, self).__init__()
self._tag = tag
self._average_count = average_count
def __unicode__(self):
return unicode(self._tag)
def __str__(self):
return str(self._tag)
def category(self):
return self._tag.category
def name(self):
return self._tag.name
def count(self):
return self._tag.count
def size(self):
size = int(100 * self._tag.count / self._average_count)
return max(90, min(size, 120))
def __init__(self, tags):
super(TagCloud, self).__init__()
total_count = 0
total_tags = 0
for tag in tags:
total_count += tag.count
total_tags += 1
if total_count > 0 and total_tags > 0:
average_count = float(total_count) / total_tags
self.tags = [TagCloud._Tag(tag, average_count) for tag in tags]
random.shuffle(self.tags)
else:
self.tags = []
def __nonzero__(self):
return bool(self.tags)
class Tag(models.Model):
category = db.StringProperty(required=True)
name = db.StringProperty(required=True)
count = db.IntegerProperty(required=True, default=0)
schema_version = db.IntegerProperty(required=True, default=1)
def __unicode__(self):
return unicode(self.name)
@classmethod
def _make_pk(cls, category, name):
# Note: we do not filter category, which is a class name.
return "%s/%s" % (category, ord_to_key(name))
@classmethod
def get_unique(cls, category, name):
pk = cls._make_pk(category, name)
try:
instance = cls.objects.get(pk=pk)
except cls.DoesNotExist:
instance = None
return instance
@classmethod
def get_or_create(cls, category, name):
instance = cls.get_unique(category=category, name=name)
if instance is None:
pk = cls._make_pk(category, name)
instance = cls(key_name=pk, category=category, name=name)
instance.save()
return instance
@classmethod
def find(cls, category=None, **kwargs):
query = cls.objects.all()
if isinstance(category, type):
category = category.__name__
if category:
query = query.filter(category=category)
query = query.order_by(kwargs.get("order_by") or "-count")
if kwargs.get("cursor"):
query.with_cursor(kwargs["cursor"])
if kwargs.get("limit"):
query.set_limit(kwargs["limit"])
return query
@classmethod
def get_cloud(cls, category, limit=None):
tags = cls.find(category=category, limit=limit)
return TagCloud(tags)
class Taggable(object):
"""
Taggable mixin class. Requirements for sub-classes are:
- must have a class attribute 'tags_attr', which is the attribute name of tags.
- self.save(): saves the instance to database.
"""
tags_attr = None
force_lower_case = True
def add_tags(self, names):
existing_tags = getattr(self, self.__class__.tags_attr, [])
if self.force_lower_case:
names = names.lower()
name_list = names.replace(",", " ").replace(";", " ").split()
for name in name_list:
# Get or create the tag by name.
tag = Tag.get_or_create(category=self.__class__.__name__, name=name)
# Process the tag name on the instance.
if name not in existing_tags:
# Increase the tag counter and save.
tag.count += 1
tag.save()
# Update existing tags on the instance.
existing_tags.append(name)
# Update tags on the instance (do NOT save).
setattr(self, self.__class__.tags_attr, existing_tags)
def remove_tags(self, names):
existing_tags = getattr(self, self.__class__.tags_attr, [])
if self.force_lower_case:
names = names.lower()
name_list = names.replace(",", " ").replace(";", " ").split()
for name in name_list:
if name in existing_tags:
# Update existing tags on the instance.
while name in existing_tags:
existing_tags.remove(name)
# Decrease the tag counter and save (or delete), as necessary.
tag = Tag.get_unique(category=self.__class__.__name__, name=name)
if tag:
tag.count -= 1
if tag.count > 0:
tag.save()
else:
tag.delete()
# Update tags on the instance (do NOT save).
setattr(self, self.__class__.tags_attr, existing_tags)
@classmethod
def find_by_tag(cls, name, **kwargs):
filter_kwargs = {cls.tags_attr: name}
query = cls.objects.filter(**filter_kwargs)
if "order_by" in kwargs:
query = query.order_by(kwargs["order_by"])
if kwargs.get("cursor"):
query.with_cursor(kwargs["cursor"])
if kwargs.get("limit"):
query.set_limit(kwargs["limit"])
return query
# EOF
| zzheng | friday/website/friday/apps/tagging/models.py | Python | asf20 | 5,834 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-04.
# $Id$
#
from django.conf.urls.defaults import *
from friday.apps.tagging.views import *
urlpatterns = patterns("",
url(
r"^$",
view_tags,
name="friday.view_tags"
),
url(
r"^category/(?P<category>\w+)/$",
view_tags,
name="friday.view_tags"
),
url(
r"^cloud/(?P<category>\w+)/$",
view_tag_cloud,
name="friday.view_tag_cloud"
),
)
# EOF
| zzheng | friday/website/friday/apps/tagging/urls.py | Python | asf20 | 602 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-03.
# $Id$
#
| zzheng | friday/website/friday/apps/tagging/__init__.py | Python | asf20 | 150 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-04.
# $Id$
#
import logging
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from friday.common.errors import BadRequestError
from friday.common.actions import Action
from friday.apps.tagging.models import Tag
class ViewTags(Action):
PAGE_URL_NAME = "friday.view_tags"
PAGE_TEMPLATE = "tagging/view_tags.html"
def __init__(self, request, category=None):
super(ViewTags, self).__init__(request)
self.category = category
def get_page(self):
cursor = self.request.GET.get("cursor") or None
tags = Tag.find(category=self.category, cursor=cursor, limit=20)
data = {"category": self.category, "tags": tags}
data = self.update_data(data)
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
class ViewTagCloud(Action):
AJAX_URL_NAME = "friday.view_tag_cloud"
AJAX_TEMPLATE = "tagging/common/tag_cloud.html"
def __init__(self, request, category):
super(ViewTagCloud, self).__init__(request)
self.category = category
def get_ajax(self):
return {"category": self.category, "tag_cloud": Tag.get_cloud(category=self.category)}
#---------------------------------------------------------------------------------------------------
def view_tags(request, category=None):
return ViewTags(request, category).process()
def view_tag_cloud(request, category):
return ViewTagCloud(request, category).process()
# EOF
| zzheng | friday/website/friday/apps/tagging/views.py | Python | asf20 | 1,775 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-20.
# $Id$
#
import datetime
from google.appengine.ext import db
from djangomockup import models
from friday.auth import users
class Profile(models.Model):
GRAVATAR = "gravatar"
IMAGE_URL = "image_url"
user = db.ReferenceProperty(users.User, required=True)
biography = db.TextProperty()
tel = db.PhoneNumberProperty()
website = db.LinkProperty()
avatar_source = db.StringProperty(required=True, default=GRAVATAR)
avatar_url = db.LinkProperty()
schema_version = db.IntegerProperty(required=True, default=1)
@property
def username(self):
return self.user.username
@property
def email(self):
return self.user.email
@property
def join_date(self):
return self.user.join_date
def _get_name(self):
return self.user.name
def _set_name(self, value):
self.user.name = value
name = property(_get_name, _set_name)
def _get_alt_email(self):
return self.user.alt_email
def _set_alt_email(self, value):
self.user.alt_email = value
alt_email = property(_get_alt_email, _set_alt_email)
def __unicode__(self):
return unicode(self.user)
def save(self):
self.user.save()
return super(Profile, self).save()
@classmethod
def _make_pk(cls, user):
return user.email.lower()
@classmethod
def get_unique(cls, user):
pk = cls._make_pk(user)
try:
instance = cls.objects.get(pk=pk)
except cls.DoesNotExist:
instance = None
return instance
@classmethod
def create(cls, user, **kwargs):
pk = cls._make_pk(user)
name = kwargs.get("name")
if "name" in kwargs:
del kwargs["name"]
alt_email = kwargs.get("alt_email")
if "alt_email" in kwargs:
del kwargs["alt_email"]
instance = cls(key_name=pk, user=user, **kwargs)
instance.name = name
instance.alt_email = alt_email
return instance
@classmethod
def find_all(cls, **kwargs):
query = cls.objects.order_by(kwargs.get("order_by") or "user")
if kwargs.get("limit"):
query.set_limit(kwargs["limit"])
return query
# EOF
| zzheng | friday/website/friday/apps/profiles/models.py | Python | asf20 | 2,478 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-20.
# $Id$
#
import logging
from django import forms
from django.forms.util import ErrorList
from friday.common.errors import ProgrammingError, InvalidFormError
from friday.apps.profiles.models import Profile
class ProfileForm(forms.Form):
name = forms.CharField(required=True)
alt_email = forms.EmailField(required=False)
biography = forms.CharField(required=False, widget=forms.Textarea)
tel = forms.CharField(required=False)
website = forms.URLField(required=False)
def __init__(self, data=None, instance=None):
self._instance = instance
if instance:
initial = {
"name": instance.name,
"alt_email": instance.alt_email,
"biography": instance.biography,
"tel": instance.tel,
"website": instance.website,
}
else:
initial = None
super(ProfileForm, self).__init__(data=data, initial=initial)
@property
def instance(self):
return self._instance
def clean_alt_email(self):
return self.cleaned_data["alt_email"] or None
def clean_website(self):
return self.cleaned_data["website"] or None
def clean_tel(self):
return self.cleaned_data["tel"] or None
def create(self, user):
if self._instance is not None:
message = "Failed to create profile: this form is bound to an existing profile."
raise ProgrammingError(message)
if not self.is_valid():
raise InvalidFormError(self.errors)
instance = Profile.create(user=user, **self.cleaned_data)
instance.save()
return instance
def update(self):
if self._instance is None:
message = "Failed to update profile: this form is not bound to an profile."
raise ProgrammingError(message)
if not self.is_valid():
raise InvalidFormError(self.errors)
for name, value in self.cleaned_data.items():
setattr(self._instance, name, value)
self._instance.save()
return self._instance
class AvatarForm(forms.Form):
_AVATAR_SOURCE_CHOICES = (
(Profile.GRAVATAR, "Take my avatar image from gravatar.com."),
(Profile.IMAGE_URL, "Take my avatar image from a web URL."),
)
avatar_source = forms.ChoiceField(choices=_AVATAR_SOURCE_CHOICES, required=True)
avatar_url = forms.URLField(required=False)
def __init__(self, data=None, instance=None):
if not instance:
message = "Failed to create avatar form: this form must be bound to an profile."
raise ProgrammingError(message)
self._instance = instance
initial = {
"avatar_source": instance.avatar_source,
"avatar_url": instance.avatar_url,
}
super(AvatarForm, self).__init__(data=data, initial=initial)
@property
def instance(self):
return self._instance
def clean_avatar_url(self):
return self.cleaned_data["avatar_url"] or None
def clean(self):
cleaned_data = self.cleaned_data
avatar_source = cleaned_data.get("avatar_source")
avatar_url = cleaned_data.get("avatar_url")
if avatar_source == Profile.IMAGE_URL and not avatar_url:
message = u"The avatar image URL is required."
self._errors["avatar_url"] = ErrorList([message])
del cleaned_data["avatar_url"]
return cleaned_data
def update(self):
if not self.is_valid():
raise InvalidFormError(self.errors)
for name, value in self.cleaned_data.items():
setattr(self._instance, name, value)
self._instance.save()
return self._instance
# EOF
| zzheng | friday/website/friday/apps/profiles/forms.py | Python | asf20 | 4,016 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-08.
# $Id$
#
from django.conf.urls.defaults import *
from friday.apps.profiles.views import *
urlpatterns = patterns("",
url(
r"^(?P<username>[\w\.\-@]+)/$",
view_profile,
name="friday.view_profile"
),
url(
r"^(?P<username>[\w\.\-@]+)/avatar/$",
view_avatar,
name="friday.view_avatar"
),
url(
r"^(?P<username>[\w\.\-@]+)/edit/$",
edit_profile,
name="friday.edit_profile"
),
url(
r"^(?P<username>[\w\.\-@]+)/avatar/$",
view_avatar,
name="friday.view_avatar"
),
url(
r"^(?P<username>[\w\.\-@]+)/avatar/edit/$",
edit_avatar,
name="friday.edit_avatar"
),
)
# EOF
| zzheng | friday/website/friday/apps/profiles/urls.py | Python | asf20 | 899 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-08.
# $Id$
#
| zzheng | friday/website/friday/apps/profiles/__init__.py | Python | asf20 | 150 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-08.
# $Id$
#
import hashlib
import logging
import urllib
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from friday.auth import users
from friday.common.actions import Action
from friday.common.errors import BadRequestError, EntityNotFoundError
from friday.common.prompt import Prompt
from friday.apps.profiles.models import Profile
from friday.apps.profiles.forms import ProfileForm, AvatarForm
class BaseProfileAction(Action):
def __init__(self, request, username):
super(BaseProfileAction, self).__init__(request)
self._username = username
self._user = users.get_user(username, create=False)
def get_user(self):
if not self._user:
message = "searched by username %s." % self._username
raise EntityNotFoundError(users.User, message)
return self._user
def get_profile(self, required=True):
profile = Profile.get_unique(user=self.get_user())
if not profile and required:
message = "searched by user %s." % self.get_user().username
raise EntityNotFoundError(Profile, message)
return profile
def update_data(self, data):
data["user"] = self.get_user()
data["profile"] = self.get_profile(required=False)
return super(BaseProfileAction, self).update_data(data)
class ViewProfile(BaseProfileAction):
PAGE_URL_NAME = "friday.view_profile"
PAGE_TEMPLATE = "profiles/view_profile.html"
def get_page(self):
data = self.update_data({})
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
class EditProfile(BaseProfileAction):
PAGE_URL_NAME = "friday.edit_profile"
PAGE_TEMPLATE = "profiles/edit_profile.html"
def _check_edit_access(self):
if not self.current_user or self.current_user != self.get_user():
message = "Current user cannot edit profile of %s." % self.get_user().username
logging.error(message)
raise BadRequestError(self.request, message)
def get_page(self):
self._check_edit_access()
profile_form = ProfileForm(instance=self.get_profile(required=False))
data = {"profile_form": profile_form}
data = self.update_data(data)
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
def post_page(self):
self._check_edit_access()
profile_form = ProfileForm(
data=self.request.POST,
instance=self.get_profile(required=False)
)
try:
if not profile_form.instance:
profile = profile_form.create(self.get_user())
else:
profile = profile_form.update()
message = "Profile of %s has been updated successfully." % profile.username
logging.info(message)
redirect_url = ViewProfile.get_page_url(username=profile.username)
return HttpResponseRedirect(redirect_url)
except Exception, exc:
message = "Failed to create/update profile in datastore: %s" % exc
logging.error(message)
logging.exception(exc)
data = {"profile_form": profile_form, "prompt": Prompt(error=message)}
data = self.update_data(data)
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
class ViewAvatar(BaseProfileAction):
PAGE_URL_NAME = "friday.view_avatar"
def get_page(self):
profile = self.get_profile(required=False)
if profile and profile.avatar_source == Profile.IMAGE_URL and profile.avatar_url:
avatar_url = profile.avatar_url
else:
email_md5 = hashlib.md5(self.get_user().email).hexdigest().lower()
avatar_url = "http://www.gravatar.com/avatar/%s" % email_md5
avatar_url += "?" + urllib.urlencode({"s": 48, "d": "wavatar"})
return HttpResponseRedirect(avatar_url)
class EditAvatar(BaseProfileAction):
PAGE_URL_NAME = "friday.edit_avatar"
PAGE_TEMPLATE = "profiles/edit_avatar.html"
def _check_edit_access(self):
if not self.current_user or self.current_user != self.get_user():
message = "Current user cannot edit avatar of '%s'." % self.get_user().username
logging.error(message)
raise BadRequestError(self.request, message)
def get_page(self):
self._check_edit_access()
avatar_form = AvatarForm(instance=self.get_profile())
data = {"avatar_form": avatar_form}
data = self.update_data(data)
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
def post_page(self):
self._check_edit_access()
avatar_form = AvatarForm(data=self.request.POST, instance=self.get_profile())
try:
profile = avatar_form.update()
message = "Avatar of %s has been updated successfully." % profile.username
logging.info(message)
redirect_url = ViewProfile.get_page_url(username=profile.username)
return HttpResponseRedirect(redirect_url)
except Exception, exc:
message = "Failed to update profile avatar in datastore: %s" % exc
logging.error(message)
logging.exception(exc)
data = {"avatar_form": avatar_form, "prompt": Prompt(error=message)}
data = self.update_data(data)
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
#---------------------------------------------------------------------------------------------------
def view_profile(request, username):
return ViewProfile(request, username).process()
def edit_profile(request, username):
return EditProfile(request, username).process()
def view_avatar(request, username):
return ViewAvatar(request, username).process()
def edit_avatar(request, username):
return EditAvatar(request, username).process()
# EOF
| zzheng | friday/website/friday/apps/profiles/views.py | Python | asf20 | 6,439 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-08.
# $Id$
#
| zzheng | friday/website/friday/apps/__init__.py | Python | asf20 | 150 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-21.
# $Id$
#
from django.conf.urls.defaults import *
from friday.apps.cronjobs.views import *
urlpatterns = patterns("",
url(
r"^$",
cron_jobs_home,
name="friday.cron.cron_jobs_home"
),
url(
r"^send_top_posters/$",
send_top_posters,
name="friday.cron.send_top_posters"
),
)
# EOF
| zzheng | friday/website/friday/apps/cronjobs/urls.py | Python | asf20 | 506 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-21.
# $Id$
#
| zzheng | friday/website/friday/apps/cronjobs/__init__.py | Python | asf20 | 150 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-21.
# $Id$
#
import datetime
import logging
from django.conf import settings
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.template.loader import render_to_string
from django.shortcuts import render_to_response
from django.core.exceptions import ImproperlyConfigured
from friday.auth import users
from friday.common.actions import Action
from friday.common.prompt import Prompt
from friday.apps.groups.models import Group
from friday.apps.poststats.models import GroupStat, PosterStat
from friday.apps.notifications.signals import something_happened
class CronJobsHome(Action):
PAGE_URL_NAME = "friday.cron.cron_jobs_home"
PAGE_TEMPLATE = "cronjobs/home.html"
def get_page(self):
data = {}
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
class BaseCronAction(Action):
PAGE_TEMPLATE = "cronjobs/cron_job.html"
JOB_TITLE = None
JOB_DESCRIPTION = None
def get_job_title(self):
return self.JOB_TITLE or self.__class__.__name__
def get_job_description(self):
return self.JOB_DESCRIPTION
def check_cron(self):
"""
Checks whether the incoming request is a cron request. This function firstly checks the
request headers for AppEngine's cron key, to see if it's a scheduled cron request.
If not present, it checks the request's GET dict to see if it's a manual cron request.
According to Django's documentation, the header key "X-AppEngine-Cron" set by AppEngine's
cron service will be converted to "HTTP_X_APPENGINE_CRON":
Any HTTP headers in the request are converted to META keys by converting all characters to
uppercase, replacing any hyphens with underscores and adding an HTTP_ prefix to the name.
<http://docs.djangoproject.com/en/dev/ref/request-response/>
Returns:
A 2-tuple of bool (is_cron_request, is_scheduled).
"""
_HEADER_CRON_KEY = "HTTP_X_APPENGINE_CRON"
value = self.request.META.get(_HEADER_CRON_KEY)
logging.info("Checking cron key in request headers: %s = %s" % (_HEADER_CRON_KEY, value))
if value == "true":
return True, True
_GET_CRON_KEY = "cron_"
value = self.request.GET.get(_GET_CRON_KEY)
logging.info("Checking cron key in request GET dict: %s = %s" % (_GET_CRON_KEY, value))
if value == "true":
return True, False
logging.info("The incoming request is not a cron request.")
return False, False
def get_page(self):
is_cron_request, is_scheduled = self.check_cron()
if is_cron_request:
logging.info("About to run cron job %s..." % self.get_job_title())
try:
message = self.run_cron_job(is_scheduled)
logging.info("Cron job %s done: %s" % (self.get_job_title(), message))
prompt = Prompt(info=message)
except Exception, exc:
message = "Failed to run cron job %s: %s" % (self.get_job_title(), exc)
logging.error(message)
logging.exception(message)
prompt = Prompt(error=message)
else:
prompt = None
data = {
"job_title": self.get_job_title(),
"job_description": self.get_job_description(),
"prompt": prompt,
}
data = self.update_data(data)
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
def run_cron_job(self, is_scheduled):
raise NotImplementedError("sub-class should implement run_cron_job()")
class SendTopPosters(BaseCronAction):
PAGE_URL_NAME = "friday.cron.send_top_posters"
FROM_EMAIL = getattr(settings, "DEFAULT_FROM_EMAIL", None)
def run_cron_job(self, is_scheduled):
# Ensure that the webapp is properly configured for this cron job.
if not self.FROM_EMAIL:
raise ImproperlyConfigured("DEFAULT_FROM_EMAIL not defined in settings.py")
# If the job is scheduled, run only on the 1st day of month.
if is_scheduled:
today = datetime.date.today()
if today.day != 1:
message = "Nothing is done: %s is not the 1st day of month." % today.isoformat()
return message
# Send top posters to Google Groups.
groups = [group for group in Group.find_all() if group.google_group]
mail_sent = 0
for group in groups:
try:
mail_sent += self._send_top_posters(group)
except Exception, exc:
logging.error("Failed to send top posters of group %s: %s" % (group.uid, exc))
logging.exception(exc)
message = "Top posters sent to %s groups." % mail_sent
return message
def _send_top_posters(self, group):
group_stat = GroupStat.get_unique(group=group, date=datetime.date.today(), month_delta=-1)
if not group_stat:
return 0
top_posters = PosterStat.find_by_group_stat(group_stat=group_stat, limit=3)
if not top_posters:
return 0
data = {
"group_stat": group_stat,
"top_posters": top_posters,
"http_host": getattr(settings, "MY_HTTP_HOST", None),
}
message = render_to_string("cronjobs/mails/top_posters.txt", data)
author = users.get_user(self.FROM_EMAIL)
recipient = "%s@googlegroups.com" % group.google_group
something_happened.send(
sender=Group.__name__,
subject=None,
message=message,
author=author,
recipients=[recipient]
)
return 1
#---------------------------------------------------------------------------------------------------
def cron_jobs_home(request):
return CronJobsHome(request).process()
def send_top_posters(request):
return SendTopPosters(request).process()
# EOF
| zzheng | friday/website/friday/apps/cronjobs/views.py | Python | asf20 | 6,411 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-06.
# $Id$
#
from django.conf.urls.defaults import *
from friday.apps.codeviewer.views import *
urlpatterns = patterns("",
url(
r"^(?P<path>.*)$",
view_code,
name="friday.view_code"
),
)
# EOF
| zzheng | friday/website/friday/apps/codeviewer/urls.py | Python | asf20 | 382 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-06.
# $Id$
#
| zzheng | friday/website/friday/apps/codeviewer/__init__.py | Python | asf20 | 150 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-06.
# $Id$
#
import logging
import mimetypes
import os
from django.conf import settings
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from friday.common.actions import WebmasterAction
from friday.common.errors import ProgrammingError
_ROOT_DIR = getattr(settings, "MY_ROOT_DIR", None)
_IGNORE = (".pyc",)
#---------------------------------------------------------------------------------------------------
class Entry(object):
def __init__(self, path):
super(Entry, self).__init__()
self.path = path.strip("/") or None
if self.path:
self.name = os.path.basename(self.path)
self.abs_path = os.path.normpath(os.path.join(_ROOT_DIR, path))
else:
self.name = ""
self.abs_path = _ROOT_DIR
self._content = None
@property
def exists(self):
return os.path.exists(self.abs_path)
@property
def is_file(self):
return os.path.isfile(self.abs_path)
@property
def is_dir(self):
return os.path.isdir(self.abs_path)
@property
def mimetype(self):
if not os.path.isfile(self.abs_path):
return None
else:
ext = os.path.splitext(self.abs_path)[1].lower()
if ext in (".yaml",):
return "text/plain"
else:
return mimetypes.guess_type(self.abs_path, strict=False)[0]
@property
def is_text_file(self):
mimetype = self.mimetype
return mimetype is not None and mimetype.startswith("text/")
@property
def parents(self):
parents = []
if self.path:
parent_path = os.path.split(self.path)[0]
while parent_path:
parents.append(Entry(parent_path))
parent_path = os.path.split(parent_path)[0]
parents.reverse()
return parents
@property
def size(self):
try:
size = os.path.getsize(self.abs_path)
except os.error:
size = None
return size
@property
def content(self):
if self._content is not None:
return self._content
if self._content is None and os.path.isfile(self.abs_path):
f = open(self.abs_path, "r")
try:
self._content = f.read()
except Exception, exc:
logging.error("Failed to read file %s: %s" % (self.abs_path, exc))
logging.exception(exc)
self._content = ""
finally:
f.close()
return self._content
@property
def children(self):
children = []
if os.path.isdir(self.abs_path):
for name in os.listdir(self.abs_path):
ext = os.path.splitext(name)[1].lower()
if ext not in _IGNORE:
if self.path:
child_path = "%s/%s" % (self.path, name)
else:
child_path = name
children.append(Entry(child_path))
return children
#---------------------------------------------------------------------------------------------------
class ViewCode(WebmasterAction):
PAGE_URL_NAME = "friday.view_code"
PAGE_TEMPLATE = "codeviewer/view_code.html"
def __init__(self, request, path=None):
super(ViewCode, self).__init__(request)
self.path = path or ""
def get_page(self):
if not _ROOT_DIR:
message = "MY_ROOT_DIR not defined in settings.py"
raise ProgrammingError(message)
entry = Entry(self.path)
if self.request.GET.get("download"):
content = entry.content
if content is not None:
return HttpResponse(content, mimetype=entry.mimetype)
data = {"entry": entry}
data = self.update_data(data)
return render_to_response(self.get_page_template(), data, RequestContext(self.request))
#---------------------------------------------------------------------------------------------------
def view_code(request, path=None):
return ViewCode(request, path).process()
# EOF
| zzheng | friday/website/friday/apps/codeviewer/views.py | Python | asf20 | 4,566 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-05.
# $Id$
#
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
("ZHENG Zhong", "@".join(["heavyzheng", "gmail.com"])),
)
MANAGERS = ADMINS
# Database configurations.
# @appengine: Django models are not supported: set all DATABASE_* to empty.
DATABASE_ENGINE = ""
DATABASE_NAME = ""
DATABASE_USER = ""
DATABASE_PASSWORD = ""
DATABASE_HOST = ""
DATABASE_PORT = ""
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = "UTC"
# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = "en-us"
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ""
# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = ""
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = "/media/"
# Make this unique, and don't share it with anybody.
SECRET_KEY = "*c(^-34)gdt8=g%3##=*apdl$!w8q-$4bc96+25!%2@%6-pj*x"
# List of callables that automatically populates the context with a few variables.
TEMPLATE_CONTEXT_PROCESSORS = (
"friday.common.context_processors.common_data_processor",
"friday.common.context_processors.current_user_processor",
"friday.common.context_processors.powered_by_processor",
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
"django.template.loaders.filesystem.load_template_source",
"django.template.loaders.app_directories.load_template_source",
#"django.template.loaders.eggs.load_template_source",
)
TEMPLATE_DIRS = (os.path.normpath(os.path.join(os.path.dirname(__file__), "templates")),)
TEMPLATE_STRING_IF_INVALID = "#TEMPLATE_ERROR#"
MIDDLEWARE_CLASSES = (
"django.middleware.common.CommonMiddleware",
#"django.contrib.sessions.middleware.SessionMiddleware", # @appengine: comment this line!
#"django.middleware.locale.LocaleMiddleware",
#"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.middleware.doc.XViewMiddleware",
"friday.common.middlewares.RenderErrorMiddleware",
)
ROOT_URLCONF = "friday.urls"
#ROOT_URLCONF = "friday.apps.migration.urls" # for migrating models
DEFAULT_FROM_EMAIL = "@".join(["java.doglas", "gmail.com"])
# For serving static files.
STATIC_DOC_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", "static"))
INSTALLED_APPS = (
#"django.contrib.admin",
#"django.contrib.auth",
#"django.contrib.contenttypes",
#"django.contrib.sessions",
#"django.contrib.sites",
#"django.contrib.webdesign",
"friday", # for loading templates and extra tags
"friday.auth", # for user authentication
"friday.apps.activities",
"friday.apps.admin",
"friday.apps.codeviewer",
"friday.apps.cronjobs",
"friday.apps.comments",
"friday.apps.groups",
"friday.apps.halloffame",
"friday.apps.ilike",
"friday.apps.misc",
"friday.apps.notifications",
"friday.apps.poststats",
"friday.apps.profiles",
"friday.apps.restos",
"friday.apps.tagging",
)
#INSTALLED_APPS = ("friday", "friday.apps.migration",) # for migrating models
#---------------------------------------------------------------------------------------------------
# All the MY_* settings are website-specific.
MY_SITE_NAME = "Vive le Vendredi"
MY_STATIC_URL_PREFIX = "/static"
MY_HTTP_HOST = "www.vivelevendredi.com"
MY_ROOT_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), ".."))
MY_EMAIL_DOMAIN = "gmail.com"
MY_WEBMASTER_EMAILS = (
"@".join(["heavyzheng", MY_EMAIL_DOMAIN]),
)
MY_MIGRATION_NUM_PER_REQUEST = 2 # For model schema migration.
# EOF
| zzheng | friday/website/friday/settings.py | Python | asf20 | 4,554 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-08.
# $Id$
#
from django.conf.urls.defaults import *
urlpatterns = patterns("",
(r"^admin/", include("friday.apps.admin.urls")),
(r"^codeviewer/", include("friday.apps.codeviewer.urls")),
(r"^comments/", include("friday.apps.comments.urls")),
(r"^cron/", include("friday.apps.cronjobs.urls")),
(r"^groups/", include("friday.apps.groups.urls")),
(r"^groups/(?P<group_uid>\w+)/activities/", include("friday.apps.activities.urls")),
(r"^groups/(?P<group_uid>\w+)/halloffame/", include("friday.apps.halloffame.urls")),
(r"^groups/(?P<group_uid>\w+)/poststats/", include("friday.apps.poststats.urls")),
(r"^notifications/", include("friday.apps.notifications.urls")),
(r"^profiles/", include("friday.apps.profiles.urls")),
(r"^restos/", include("friday.apps.restos.urls")),
(r"^tagging/", include("friday.apps.tagging.urls")),
(r"^", include("friday.apps.misc.urls")),
)
# EOF
| zzheng | friday/website/friday/urls.py | Python | asf20 | 1,095 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-02-12.
# $Id$
#
| zzheng | friday/website/friday/templatetags/__init__.py | Python | asf20 | 150 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Created on 2009-11-18.
# $Id$
#
"""
To use filters defined in this module, add the following line to the templates:
{% load fridayfilters %}
"""
import datetime
import hashlib
import logging
import urllib
from django import template
register = template.Library()
@register.filter
def uniqueid(value):
return "%x" % id(value)
@register.filter
def multiply(value, arg):
"""
Multiplies the value (as an integer) by arg.
"""
if isinstance(value, int) or isinstance(value, float):
return value * arg
else:
return u"%s x %s" % (value, arg)
@register.filter
def summary(value, arg):
value = unicode(value)
if len(value) > arg:
return u"%s..." % value[:arg]
else:
return value
@register.filter
def prettify_datetime(value):
"""
Prettifies a date or a datetime, returns a humain read-able string.
"""
# Check the value argument type, and calculate dt.
if isinstance(value, datetime.datetime):
dt = datetime.datetime.now() - value
elif isinstance(value, datetime.date):
dt = datetime.date.today() - value
else:
return value
# Check if value is in the future or in the past, and abs(dt).
is_past = (dt >= datetime.timedelta(0))
dt = abs(dt)
# Generate the basic pretty string for value.
time_units = (
("year", dt.days // 365),
("month", (dt.days % 365) // 30),
("day", dt.days % 30),
("hour", dt.seconds // 3600),
("minute", (dt.seconds % 3600) // 60),
)
pretty_str = None
for unit, amount in time_units:
if amount > 0:
pretty_str = "%d %s" % (amount, unit)
if amount > 1:
pretty_str += "s"
break
# Post-process the basic pretty string.
if is_past:
if not pretty_str:
pretty_str = "just now"
else:
pretty_str += " ago"
else:
if not pretty_str:
pretty_str = "right now"
else:
pretty_str = "in " + pretty_str
# Return the final result.
return pretty_str
@register.filter
def safe_email(value):
if not isinstance(value, basestring) or len(value) <= 4:
return value
return u"%s..." % value[:-4].replace("@", " [at] ")
@register.filter
def gravatar(value):
if not isinstance(value, basestring):
return value
else:
email_md5 = hashlib.md5(value.lower()).hexdigest().lower()
gravatar_url = "http://www.gravatar.com/avatar/%s" % email_md5
gravatar_url += "?" + urllib.urlencode({"s": 48, "d": "wavatar"})
return gravatar_url
# EOF
| zzheng | friday/website/friday/templatetags/friday_extra.py | Python | asf20 | 2,822 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-07.
# $Id$
#
import logging
from google.appengine.ext import db
from djangomockup import models
class User(models.Model):
# key_name is user's email address in lower case.
user = db.UserProperty(required=True)
name = db.StringProperty()
alt_email = db.EmailProperty()
is_staff = db.BooleanProperty(required=True, default=False)
join_date = db.DateTimeProperty(required=True, auto_now_add=True)
schema_version = db.IntegerProperty(required=True, default=1)
def __unicode__(self):
return unicode(self.name or self.user.nickname())
def __nonzero__(self):
return True
@property
def username(self):
return self.user.nickname()
@property
def email(self):
return self.user.email()
def is_anonymous(self):
return False
def is_authenticated(self):
return True
def save(self):
# Force alternative email address to be lowercase.
if self.alt_email:
self.alt_email = self.alt_email.strip().lower()
return super(User, self).save()
@classmethod
def _make_pk(cls, google_user):
return google_user.email().lower()
@classmethod
def get_unique(cls, google_user):
pk = cls._make_pk(google_user)
try:
instance = cls.objects.get(pk=pk)
except cls.DoesNotExist:
instance = None
return instance
@classmethod
def get_or_create(cls, google_user):
instance = cls.get_unique(google_user=google_user)
if instance is None:
pk = cls._make_pk(google_user)
instance = cls(key_name=pk, user=google_user)
instance.save()
return instance
@classmethod
def find_by_alt_email(cls, alt_email):
query = cls.objects.filter(alt_email=alt_email.strip().lower())
return query
class AnonymousUser(object):
def __init__(self):
super(AnonymousUser, self).__init__()
self.username = None
self.email = None
self.alt_email = None
self.is_staff = False
def __unicode__(self):
return "Anonymous"
def __str__(self):
return unicode(self).encode("utf-8")
def __eq__(self, other):
return isinstance(other, self.__class__)
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return 1 # instances always return the same hash value
def __nonzero__(self):
return False
def save(self):
raise NotImplementedError()
def delete(self):
raise NotImplementedError()
def is_anonymous(self):
return True
def is_authenticated(self):
return False
# EOF
| zzheng | friday/website/friday/auth/models.py | Python | asf20 | 2,851 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-07.
# $Id$
#
| zzheng | friday/website/friday/auth/__init__.py | Python | asf20 | 152 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
#
# Created on 2010-05-07.
# $Id$
#
from __future__ import absolute_import # PEP 328
from django.conf import settings
from google.appengine.api import users
from friday.auth.models import User, AnonymousUser
__all__ = (
"User",
"AnonymousUser",
"get_current_user",
"create_login_url",
"create_logout_url",
"get_user",
"is_webmaster",
)
def get_current_user(request):
google_user = users.get_current_user()
if not google_user:
return AnonymousUser()
else:
return User.get_or_create(google_user)
def create_login_url(dest_url):
return users.create_login_url(dest_url)
def create_logout_url(dest_url):
return users.create_logout_url(dest_url)
def get_user(username_or_email, create=True):
username_or_email = username_or_email.strip()
if "@" in username_or_email:
email = username_or_email
else:
email_domain = getattr(settings, "MY_EMAIL_DOMAIN")
email = "%s@%s" % (username_or_email, email_domain)
google_user = users.User(email)
if create:
return User.get_or_create(google_user)
else:
return User.get_unique(google_user)
def get_user_by_email(email):
email = email.strip()
user = get_user(email, create=False)
if user is not None:
return user
users = User.find_by_alt_email(email)
if users:
return users[0]
else:
return None
def is_webmaster(user):
if not user:
return False
else:
webmaster_emails = getattr(settings, "MY_WEBMASTER_EMAILS", ())
return user.email in webmaster_emails
# EOF
| zzheng | friday/website/friday/auth/users.py | Python | asf20 | 1,802 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Create a new activity {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if activity_form %}
<div class="section">
<h1>Create a new activity ...</h1>
</div>
<div class="section">
{% include "activities/common/activity_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/activities/create_activity.html | HTML | asf20 | 722 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Activities {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
{% if group_access.can_contribute %}
<div class="section">
<h2><a href="{% url friday.create_activity group_uid=group.uid %}">Create an activity</a></h2>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Activities ...</h1>
</div>
<div class="section">
{% include "activities/common/activities.html" %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/activities/view_all_activities.html | HTML | asf20 | 985 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} Edit Activity: {{ activity.title|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if activity_form %}
<div class="section">
<h1>Edit activity: {{ activity.title|escape }}</h1>
</div>
<div class="section">
{% include "activities/common/activity_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/activities/edit_activity.html | HTML | asf20 | 787 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} {{ activity.title|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<!-- information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h2>Information:</h2>
{% if activity.geo_pt %}
<div id="map-canvas" class="s-map"></div>
<p><a href="#TODO">» View larger map</a></p>
<script type="text/javascript">//<![CDATA[
$(function() {
friday.showMap({{ activity.geo_pt.lat }}, {{ activity.geo_pt.lon }}, "#map-canvas");
});
//]]></script>
{% endif %}
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/address.png" alt="Address"/>
Location:
</dt>
<dd>
{{ activity.address|default:"Address not specified"|escape }}<br/>
{{ activity.city|escape }}
</dd>
</dl>
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/date.png" alt="Date"/>
Date:
</dt>
<dd>{{ activity.date|date:"l, d N Y" }}</dd>
</dl>
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/group.png" alt="Headcount"/>
Headcount:
</dt>
<dd>
{{ activity.headcount }} heads /
{% if activity.places %}
{{ activity.places }} places
{% else %}
Unlimited places
{% endif %}
</dd>
</dl>
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/status.png" alt="Status"/>
Status:
</dt>
<dd>
{% if activity.is_past %}
<img class="icon" src="{{ static_ }}/images/lock.png" alt="Past"/>
This activity is past
{% else %}
{% if activity.is_closed %}
<img class="icon" src="{{ static_ }}/images/lock.png" alt="Closed"/>
This activity is closed
{% else %}
<img class="icon" src="{{ static_ }}/images/ok.png" alt="Open"/>
This activity is open
{% endif %}
{% endif %}
</dd>
</dl>
{% if activity.related_link %}
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/website.png" alt="Website"/>
Related link:
</dt>
<dd>
<a href="{{ activity.related_link }}">{{ activity.related_link|summary:32 }}</a>
</dd>
</dl>
{% endif %}
</div>
<!-- submitter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<div class="user-box">
<div class="user-avatar">
<a href="{% url friday.view_profile username=activity.submitter.username %}">
<img src="{% url friday.view_avatar username=activity.submitter.username %}" alt="{{ activity.submitter|escape }}"/>
</a>
</div>
<div class="user-info">
Added by
<a href="{% url friday.view_profile username=activity.submitter.username %}">{{ activity.submitter|escape }}</a>
<br/>
on {{ activity.submit_date|date:"d N Y" }}
</div>
<div class="clear"></div>
</div>
</div>
<!-- administration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if activity_access.can_edit or activity_access.can_delete %}
<div class="section">
<h2>Administrate:</h2>
<ul>
{% if activity_access.can_edit %}
<li>
<a href="{% url friday.edit_activity group_uid=activity.group.uid activity_id=activity.id %}">
Edit this activity
</a>
</li>
{% endif %}
{% if activity_access.can_delete %}
<li>
<a href="{% url friday.delete_activity group_uid=activity.group.uid activity_id=activity.id %}">
Delete this activity
</a>
</li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>{{ activity.title|escape }}</h1>
<h5>
{{ activity.date|date:"l, d N Y" }}
( {{ activity.date|prettify_datetime }} )
{% if activity.is_past or activity.is_closed %}
<img class="icon" src="{{ static_ }}/images/lock.png" alt="Past or Closed"/>
{% endif %}
</h5>
</div>
<div class="section">
<h2>Description:</h2>
{{ activity.content|escape|linebreaks }}
</div>
<!-- attenders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div id="load-attenders"></div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#load-attenders").load("{% url friday.view_attenders group_uid=group.uid activity_id=activity.id %}");
});
//]]></script>
<!-- activity tabs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<div id="activity-tabs">
<ul>
<li><a href="{% url friday.view_comments ref_type=activity.model_name ref_pk=activity.id %}">Comments</a></li>
</ul>
</div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#activity-tabs").tabs({
ajaxOptions: {
error: function(xhr, status, index, anchor) {
if (index == 0) {
target = "comments";
} else {
target = "unknown objects";
}
$(anchor.hash).html("Failed to load " + target + " via AJAX: server error.");
}
}
});
});
//]]></script>
</div>
{% endblock %}{# content #}
| zzheng | friday/website/friday/templates/activities/view_activity.html | HTML | asf20 | 6,267 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-14.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Delete {{ activity.title|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if activity_access.can_delete %}
<div class="section">
<h1>Delete {{ activity.title|escape }} ?</h1>
</div>
<div class="section">
<form class="xl-form" action="." method="POST">
<div class="field">
<div class="label">Are you sure you want to delete {{ activity.title|escape }} ?</div>
<div class="help-text">
<p>This operation cannot be reverted.</p>
</div>
</div>
<div class="field">
<input class="button" type="submit" value="Yes, delete it"/>
or,
<a href="{% url view_activity group_uid=activity.group.uid activity_id=activity.id %}">
return to {{ activity.title|escape }}
</a>
</div>
</form>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/activities/delete_activity.html | HTML | asf20 | 1,325 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{% if activity_form %}
<div>
<form id="activity-form" class="xl-form" action="." method="POST">
<div class="field">
<div class="label">Title: *</div>
<div class="input required">{{ activity_form.title|safe }}</div>
{% if activity_form.title.errors %}
<div class="error-list">{{ activity_form.title.errors|safe }}</div>
{% endif %}
<div class="help-text">Give a brief summary of the activity.</div>
</div>
<div class="field">
<div class="label">Content: *</div>
<div class="input required">{{ activity_form.content|safe }}</div>
{% if activity_form.content.errors %}
<div class="error-list">{{ activity_form.content.errors|safe }}</div>
{% endif %}
<div class="help-text">Describe the activity in details.</div>
</div>
<div class="field">
<div class="label">Date: *</div>
<div id="activity-date" class="input required">{{ activity_form.date|safe }}</div>
{% if activity_form.date.errors %}
<div class="error-list">{{ activity_form.date.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Address:</div>
<div id="address" class="input">{{ activity_form.address|safe }}</div>
{% if activity_form.address.errors %}
<div class="error-list">{{ activity_form.address.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">City: *</div>
<div id="city" class="input required">{{ activity_form.city|safe }}</div>
{% if activity_form.city.errors %}
<div class="error-list">{{ activity_form.city.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Geo Location:</div>
<div id="geo-pt" class="hidden">{{ activity_form.geo_pt|safe }}</div>
{% if activity_form.geo_pt.errors %}
<div class="error-list">{{ activity_form.geo_pt.errors|safe }}</div>
{% endif %}
<div id="geo-pt-message" class="disabled-value">
{% if activity.geo_pt %}
Latitude: {{ activity.geo_pt.lat }}, longitude: {{ activity.geo_pt.lon }}.
{% else %}
Geo position not specified.
{% endif %}
</div>
<div class="help-text">
<div>
<a href="javascript:void(0);" onclick="findInMap();">find the address in map</a>
</div>
<div id="map" class="hidden">
<div id="map-canvas" class="map"></div>
<div>
<a href="javascript:void(0);" onclick="clearMap();">clear map</a>
</div>
</div>
</div>
</div>
<div class="field">
<div class="label">Places:</div>
<div class="input">{{ activity_form.places|safe }}</div>
{% if activity_form.places.errors %}
<div class="error-list">{{ activity_form.places.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Related link:</div>
<div class="input">{{ activity_form.related_link|safe }}</div>
{% if activity_form.related_link.errors %}
<div class="error-list">{{ activity_form.related_link.errors|safe }}</div>
{% endif %}
</div>
{% if activity_form.instance %}
<div class="field">
<div class="label">This activity is {{ activity_form.instance.is_closed|yesno:"closed,open" }}:</div>
<div class="checkbox">{{ activity_form.is_closed|safe }} Close this activity.</div>
{% if activity_form.is_closed.errors %}
<div class="error-list">{{ activity_form.is_closed.errors|safe }}</div>
{% endif %}
</div>
{% else %}
<div class="hidden">{{ activity_form.is_closed|safe }}</div>
{% endif %}
<div class="field">
<input class="button" type="submit" value="{{ activity_form.instance|yesno:'Update,Create' }}"/>
or,
{% if activity_form.instance %}
<a href="{% url friday.view_activity group_uid=group.uid activity_id=activity_form.instance.id %}">
return to activity
</a>
{% else %}
<a href="{% url friday.view_all_activities group_uid=group.uid %}">
view activities
</a>
{% endif %}
</div>
</form><!--/#activity-form-->
<script type="text/javascript">//<![CDATA[
$(function() {
$("#activity-date input").datepicker({
showButtonPanel: true,
dateFormat: "yy-mm-dd"
});
});
function findInMap() {
var address = jQuery.trim($("#address :input").val());
var city = jQuery.trim($("#city :input").val());
if (address == "") {
$("#map").hide();
$("#geo-pt :input").val("");
$("#geo-pt-message").text("Geo position not specified. Please specify an address.");
} else {
$("#map").show();
friday.findInMap(
address + ", " + city,
"#map-canvas",
function(lat, lon) {
$("#geo-pt :input").val(lat + "," + lon);
$("#geo-pt-message").text("Latitude: " + lat + ", longitude: " + lon + ".");
},
function(address_not_found) {
$("#map").hide();
$("#geo-pt :input").val("");
$("#geo-pt-message").text("The address you specified cannot be found.");
}
);
}
}
function clearMap() {
$("#map").hide();
$("#geo-pt :input").val("");
$("#geo-pt-message").text("Geo position not specified.");
}
//]]></script>
</div>
{% endif %}
| zzheng | friday/website/friday/templates/activities/common/activity_form.html | HTML | asf20 | 6,120 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
<div class="ajax">
{% for activity in activities %}
<div class="post">
<div class="post-head">
<span class="{{ activity.is_past|yesno:'disabled,enabled' }}">
<a href="{% url friday.view_activity group_uid=activity.group.uid activity_id=activity.id %}">
{{ activity|escape }}
</a>
{% if activity.attenders %}
<span class="aux">
<img class="icon" src="{{ static_ }}/images/group.png" alt="Attenders"/>
<b>{{ activity.attenders.count }}</b> attender{{ activity.attenders.count|pluralize }}
</span>
{% endif %}
{% if activity.is_past or activity.is_closed %}
<img class="icon" src="{{ static_ }}/images/lock.png" alt="Past or Closed"/>
{% endif %}
</span>
</div>
<div class="post-body">
{{ activity.content|summary:200|escape }}
</div>
<div class="post-foot">
<img class="icon" src="{{ static_ }}/images/date.png" alt="Date"/>
{{ activity.date|date:"l, d N Y" }}
<img class="icon" src="{{ static_ }}/images/address.png" alt="Address"/>
{% if activity.address %}
{{ activity.address|escape }},
{% endif %}
{{ activity.city|escape }}
</div>
</div>
{% empty %}
<p class="na">No activities found.</p>
{% endfor %}
</div>
| zzheng | friday/website/friday/templates/activities/common/activities.html | HTML | asf20 | 1,671 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
<div id="attenders" class="ajax">
{#______________________________________________________________________________________________#}
<div class="section">
<h2>
{% if attenders %}
{{ attenders.count }} attender{{ attenders.count|pluralize }}:
{% else %}
No attender yet.
{% endif %}
</h2>
{% if attenders %}
<div class="user-list">
{% for attender in attenders %}
<div class="user">
<div class="user-avatar">
<a href="{% url friday.view_profile username=attender.username %}">
<img src="{% url friday.view_avatar username=attender.username %}" alt="{{ attender|escape }}"/>
</a>
</div>
<div class="user-info">
<a href="{% url friday.view_profile username=attender.username %}">
{{ attender|escape }}
</a>
{% ifequal attender.user user_ %}
<b>(you)</b>
{% endifequal %}
{% if attender.with_friends %}
+{{ attender.with_friends }}
{% endif %}
</div>
</div>
{% endfor %}
<div class="clear"></div>
</div>
{% endif %}
{% if activity.is_closed %}
<p class="na">
<img class="icon" src="{{ static_ }}/images/lock.png" alt="Closed"/>
This activity is closed.
</p>
{% endif %}
</div>
{#______________________________________________________________________________________________#}
{% if activity_access.can_attend or activity_access.can_quit %}
<div class="section">
<form id="attend-quit-activity-form"
class="ajax-edit xs-form"
action="{% url friday.view_attenders group_uid=group.uid activity_id=activity.id %}"
method="POST"
onsubmit="return friday.submitAjaxForm('#attenders', '#attend-quit-activity-form');">
{% if activity_access.can_attend %}
<input type="hidden" name="action" value="attend"/>
<input class="button" type="submit" value="I'd like to attend"/>
<span class="input">
with <input type="text" name="with_friends"/> friends
</span>
{% endif %}
{% if activity_access.can_quit %}
<input type="hidden" name="action" value="quit"/>
<input class="button" type="submit" value="I would not attend"/>
{% endif %}
<span class="ajax-error hidden">
Failed to process your request: server error.
</span>
</form>
</div>
{% endif %}
</div>
| zzheng | friday/website/friday/templates/activities/common/attenders.html | HTML | asf20 | 2,877 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} {{ group|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<!-- top posters of this month ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if group.google_group %}
<div class="section">
<h2>Top Posters in {% now "N Y" %}:</h2>
<div id="load-top-posters">
<div class="ajax-loader">
<img class="icon" src="{{ static_ }}/images/ajax_loader.gif" alt="Loading"/>
Loading top posters...
</div>
<div class="ajax-error hidden">
<img class="icon" src="{{ static_ }}/images/error.png" alt="Error"/>
Failed to load top posters.
</div>
</div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#load-top-posters").load(
"{% url friday.view_top_posters group_uid=group.uid %}",
function(response, textStatus) {
if (textStatus == "error") {
$("#load-top-posters .ajax-loader").hide();
$("#load-top-posters .ajax-error").show();
}
}
);
});
//]]></script>
</div>
{% endif %}
<!-- navigation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h2>Navigation:</h2>
<ul>
<li><a href="{% url friday.view_group group_uid=group.uid %}">Group Home</a></li>
<li><a href="{% url friday.view_members group_uid=group.uid %}">Members</a></li>
<li><a href="{% url friday.view_hall_of_fame group_uid=group.uid %}">Hall of Fame</a></li>
<li><a href="{% url friday.view_all_activities group_uid=group.uid %}">Activities</a></li>
{% if group.google_group %}
<li><a href="http://groups.google.com/group/{{ group.google_group }}">Google Group</a></li>
{% endif %}
{% if group.website %}
<li><a href="{{ group.website }}">Website</a></li>
{% endif %}
{% if group_access.can_join %}
<li><a href="{% url friday.join_group group_uid=group.uid %}">Join this group</a></li>
{% endif %}
</ul>
</div>
<!-- group owner ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<div class="user-box">
<div class="user-avatar">
<a href="{% url friday.view_profile username=group.owner.username %}">
<img src="{% url friday.view_avatar username=group.owner.username %}" alt="{{ group.owner|escape }}"/>
</a>
</div>
<div class="user-info">
Owned by
<a href="{% url friday.view_profile username=group.owner.username %}">
{{ group.owner|escape }}
</a>
<br/>
since {{ group.own_date|date:"d N Y" }}
</div>
<div class="clear"></div>
</div>
</div>
<!-- administration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if group_access.can_administrate %}
<div class="section">
<h2>Administration:</h2>
<ul>
<li><a href="{% url friday.edit_group group_uid=group.uid %}">Edit group information</a></li>
<li><a href="{% url friday.prettify_group group_uid=group.uid %}">Prettify group page</a></li>
<li><a href="{% url friday.view_members group_uid=group.uid %}">Manage members</a></li>
</ul>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>{{ group.name|escape }}</h1>
<h5>{{ group.slogan|default:""|escape }}</h5>
</div>
<!-- group description ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if group.description %}
<div class="section">
<h2>Group Description:</h2>
{{ group.description|escape|linebreaks }}
</div>
{% endif %}
<!-- pending members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if pending_members %}
<div class="section">
<h2>{{ pending_members.count }} pending member{{ pending_members.count|pluralize }}:</h2>
<div class="user-list">
{% for member in pending_members %}
<div class="user">
<div class="user-avatar">
<a href="{% url friday.view_profile username=member.username %}">
<img src="{% url friday.view_avatar username=member.username %}" alt="{{ member|escape }}"/>
</a>
</div>
<div class="user-info">
<a href="{% url friday.view_profile username=member.username %}">
{{ member|escape }}
</a>
{% ifequal member.user user_ %}
<b>(you)</b>
{% endifequal %}
</div>
</div>
{% endfor %}
<div class="clear"></div>
</div>
{% if group_access.can_moderate %}
<p>
<a href="{% url friday.view_members group_uid=group.uid %}">
» Review open requests
</a>
</p>
{% endif %}
</div>
{% endif %}
<!-- group members (incomplete list) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h2>{{ group.population }} members:</h2>
<div class="user-list">
{% for member in new_members %}
<div class="user">
<div class="user-avatar">
<a href="{% url friday.view_profile username=member.username %}">
<img src="{% url friday.view_avatar username=member.username %}" alt="{{ member|escape }}"/>
</a>
</div>
<div class="user-info">
<a href="{% url friday.view_profile username=member.username %}">
{{ member|escape }}
</a>
{% ifequal member.user user_ %}
<b>(you)</b>
{% endifequal %}
</div>
</div>
{% empty %}
<p class="na">No members found.</p>
{% endfor %}
<div class="clear"></div>
</div>
<p><a href="{% url friday.view_members group_uid=group.uid %}">» More members</a></p>
</div>
<!-- auto-loaded upcoming activities ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h2>Upcoming activities:</h2>
<div id="load-upcoming-activities">
<div class="ajax-loader">
<img class="icon" src="{{ static_ }}/images/ajax_loader.gif" alt="Loading"/>
Loading upcoming activities...
</div>
<div class="ajax-error hidden">
<img class="icon" src="{{ static_ }}/images/error.png" alt="Error"/>
Failed to load upcoming activities.
</div>
</div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#load-upcoming-activities").load(
"{% url friday.view_upcoming_activities group_uid=group.uid %}",
function(response, textStatus) {
if (textStatus == "error") {
$("#load-upcoming-activities .ajax-loader").hide();
$("#load-upcoming-activities .ajax-error").show();
}
}
);
});
//]]></script>
<p><a href="{% url friday.view_all_activities group_uid=group.uid %}">» More activities</a></p>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/groups/view_group.html | HTML | asf20 | 8,010 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Edit group information {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if group_form %}
<div class="section">
<h1>Edit group information ...</h1>
</div>
<div class="section">
{% include "groups/common/group_form.html" %}
</div>
{% endif %}
{% endblock %}{# content #}
| zzheng | friday/website/friday/templates/groups/edit_group.html | HTML | asf20 | 729 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Groups {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
{% if is_webmaster_ %}
<div class="section">
<h2><a href="{% url friday.create_group %}">Create a group</a></h2>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Groups ...</h1>
</div>
<div class="section">
{% include "groups/common/groups.html" %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/groups/view_all_groups.html | HTML | asf20 | 921 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-23.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Review member {{ member|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if review_member_form %}
<div class="section">
<h1>Review pending request from {{ member|escape }} ...</h1>
</div>
<div class="section">
<form id="review-member-form" class="xl-form" action="." method="POST">
<div class="field">
<div class="label">
Message from user
<a href="{% url friday.view_profile username=member.username %}">{{ member|escape }}</a>
:
</div>
{% if member.request_message %}
<div class="disabled-value">
{{ member.request_message|escape|linebreaks }}
</div>
{% else %}
<p class="aux">No message from this user.</p>
{% endif %}
</div>
<div class="field">
<div class="label">Your decision:</div>
<div class="radio">{{ review_member_form.review|safe }}</div>
</div>
<div class="field">
<input class="button" type="submit" value="Update"/>
or,
<a href="{% url friday.view_members group_uid=group.uid %}">return to group members</a>
</div>
</form><!--/#review-member-form-->
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/groups/review_member.html | HTML | asf20 | 1,752 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Edit member {{ member|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if member_form %}
<div class="section">
<h1>Edit group settings of {{ member|escape }} ...</h1>
</div>
<div class="form">
<form id="member-form" class="xl-form" action="." method="POST">
<div class="field">
<div class="label">The role of this member:</div>
<div class="radio required">{{ member_form.role|safe }}</div>
{% if member_form.role.errors %}
<div class="error-list">{{ member_form.role.errors|safe }}</div>
{% endif %}
<div class="help-text">The current role of {{ member|escape }} is "{{ member.role }}".</div>
</div>
<div class="field">
<div class="label">Or, remove this member:</div>
<div class="checkbox required">
{{ member_form.remove_member|safe }}
<span class="caution">Remove this user from the group.</span>
</div>
{% if member_form.remove_member.errors %}
<div class="error-list">{{ member_form.remove_member.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<input class="button" type="submit" value="Update"/>
or,
<a href="{% url friday.view_members group_uid=group.uid %}">return to group members</a>
</div>
</form><!--/#member-form-->
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/groups/edit_member.html | HTML | asf20 | 1,921 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-18.
$Id$
-->
{% endcomment %}
{% block banner %}
{% if group %}
<div id="group-banner" class="{{ group.background_url|yesno:'exotic,simple' }}">
{% if group.background_url %}
<img class="background" src="{{ group.background_url }}" alt="{{ group|escape }}"/>
{% else %}
<img class="background" src="{{ static_ }}/images/none.gif" alt="{{ group|escape }}"/>
{% endif %}
<div class="banner-opaque"></div>
<div class="banner-text">
{% if group.logo_icon_url %}
<img class="icon" src="{{ group.logo_icon_url }}" alt="{{ group|escape }}"/>
{% else %}
<img class="icon" src="{{ static_ }}/images/group_icon.png" alt="{{ group|escape }}"/>
{% endif %}
<h1><a href="{% url friday.view_group group_uid=group.uid %}">{{ group|escape }}</a></h1>
<div class="links">
<a href="{% url friday.view_group group_uid=group.uid %}">Group Home</a>
• <a href="{% url friday.view_members group_uid=group.uid %}">Members</a>
• <a href="{% url friday.view_hall_of_fame group_uid=group.uid %}">Hall of Fame</a>
• <a href="{% url friday.view_all_activities group_uid=group.uid %}">Activities</a>
{% if group.google_group %}
• <a href="http://groups.google.com/group/{{ group.google_group }}">Google Group</a>
{% endif %}
{% if group.website %}
• <a href="{{ group.website }}">Website</a>
{% endif %}
{% if group_access %}
{% if group_access.can_join %}
• <a href="{% url friday.join_group group_uid=group.uid %}">Join this group</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/groups/base.html | HTML | asf20 | 2,018 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Create a new group {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if group_form %}
<div class="section">
<h1>Create a new group</h1>
</div>
<div class="section">
{% include "groups/common/group_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/groups/create_group.html | HTML | asf20 | 697 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{% if groups %}
<div class="ajax">
{% for group in groups %}
<div class="post">
<div class="post-head">
<a href="{% url friday.view_group group_uid=group.uid %}">{{ group|escape }}</a>
</div>
<div class="post-body">
{% if group.description %}
{{ group.description|summary:200|escape }}
{% else %}
<div class="aux">This group does not have a description.</div>
{% endif %}
</div>
<div class="post-foot">
<img class="icon" src="{{ static_ }}/images/group.png" alt="Group"/>
<a href="{% url friday.view_members group_uid=group.uid %}">{{ group.population }} members</a>
•
created {{ group.create_date|prettify_datetime }}
by <a href="{% url friday.view_profile username=group.creator.username %}">{{ group.creator|escape }}</a>
</div>
</div>
{% endfor %}
</div><!--/.ajax-->
{% endif %}
| zzheng | friday/website/friday/templates/groups/common/groups.html | HTML | asf20 | 1,196 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
{% if group_form %}
<form id="group-form" class="xl-form" action="." method="POST">
<div class="field">
{% if group_form.instance %}
<div class="label">The group's unique ID (this cannot be changed):</div>
<div class="hidden">{{ group_form.uid|safe }}</div>
<div class="disabled-value">{{ group_form.instance.uid|escape }}</div>
{% else %}
<div class="label">Unique ID of the group: *</div>
<div class="input required">{{ group_form.uid|safe }}</div>
{% if group_form.uid.errors %}
<div class="error-list">{{ group_form.uid.errors|safe }}</div>
{% endif %}
<div class="help-text">
This will be part of the group's page URL. It cannot be changed later.
</div>
{% endif %}
</div>
<div class="field">
<div class="label">Name your group: *</div>
<div class="input required">{{ group_form.name|safe }}</div>
{% if group_form.name.errors %}
<div class="error-list">{{ group_form.name.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Give your group a slogan:</div>
<div class="input">{{ group_form.slogan|safe }}</div>
{% if group_form.slogan.errors %}
<div class="error-list">{{ group_form.slogan.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Write a group description:</div>
<div class="input">{{ group_form.description|safe }}</div>
{% if group_form.description.errors %}
<div class="error-list">{{ group_form.description.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Group website:</div>
<div class="input">{{ group_form.website|safe }}</div>
{% if group_form.website.errors %}
<div class="error-list">{{ group_form.website.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Link with a <a href="http://groups.google.com/">Google Group</a>:</div>
<div class="input">{{ group_form.google_group|safe }}</div>
{% if group_form.google_group.errors %}
<div class="error-list">{{ group_form.google_group.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<input class="button" type="submit" value="{{ group_form.instance|yesno:'Update,Create' }}"/>
or,
{% if group_form.instance %}
<a href="{% url friday.view_group group_uid=group_form.instance.uid %}">return to group homepage</a>
{% else %}
<a href="{% url friday.groups_home %}">return to groups homepage</a>
{% endif %}
</div>
</form>
{% endif %}
| zzheng | friday/website/friday/templates/groups/common/group_form.html | HTML | asf20 | 2,943 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Prettify group page {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if prettify_group_form %}
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<script type="text/javascript">//<![CDATA[
/** Previews the prettified group banner by injecting user inputs to the banner HTML. */
function previewGroupBanner() {
// Collect user inputs.
var prettify_group_form = $("#prettify-group-form");
var background_url = jQuery.trim(
$("#background_url :input", prettify_group_form).val()
);
var is_exotic_banner = (background_url != "");
if (background_url == "") {
background_url = "{{ static_ }}/images/none.gif";
}
var logo_icon_url = jQuery.trim(
$("#logo_icon_url :input", prettify_group_form).val()
);
if (logo_icon_url == "") {
logo_icon_url = "{{ static_ }}/images/group_icon.png";
}
// Prettify the group banner.
var group_banner = $("#group-banner");
if (is_exotic_banner) {
group_banner.addClass("exotic").removeClass("simple");
} else {
group_banner.addClass("simple").removeClass("exotic");
}
$("img.background", group_banner).attr("src", background_url);
$("img.icon", group_banner).attr("src", logo_icon_url);
}
//]]></script>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h1>Prettify group page ...</h1>
</div>
<div class="section">
<form id="prettify-group-form" class="xl-form" action="." method="POST">
<div class="field">
<div class="label">Banner background image URL:</div>
<div id="background_url" class="input">{{ prettify_group_form.background_url|safe }}</div>
{% if prettify_group_form.background_url.errors %}
<div class="error-list">{{ prettify_group_form.background_url.errors|safe }}</div>
{% endif %}
<div class="help-text">
Preferred background image size is 990x160 pixels.<br/>
Currently using: {{ group.background_url|default:"none" }}
</div>
</div>
<div class="field">
<div class="label">Group logo icon URL:</div>
<div id="logo_icon_url" class="input">{{ prettify_group_form.logo_icon_url|safe }}</div>
{% if prettify_group_form.logo_icon_url.errors %}
<div class="error-list">{{ prettify_group_form.logo_icon_url.errors|safe }}</div>
{% endif %}
<div class="help-text">
Group logo icon will be resized to 48x48 pixels.<br/>
Currently using: {{ group.logo_icon_url|default:"none" }}
</div>
</div>
<div class="field">
<input class="button" type="button" value="Preview" onclick="previewGroupBanner();"/>
<input class="button" type="submit" value="Update"/>
or,
<a href="{% url friday.view_group group_uid=group.uid %}">return to group homepage</a>
</div>
</form><!--/#prettify-group-form-->
</div>
{% endif %}
{% endblock %}{# content #}
| zzheng | friday/website/friday/templates/groups/prettify_group.html | HTML | asf20 | 3,774 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Join the group {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if join_group_form %}
<div class="section">
<h1>Welcome to {{ group|escape }}</h1>
</div>
<div class="section">
<form id="join-group-form" class="xl-form" action="." method="POST">
<div class="field">
<div class="label">Tell the other members something about yourself:</div>
<div class="input">{{ join_group_form.request_message|safe }}</div>
{% if join_group_form.request_message.errors %}
<div class="error-list">{{ join_group_form.request_message.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<input class="button" type="submit" value="Join the group"/>
or,
<a href="{% url friday.view_group group_uid=group.uid %}">return to group homepage</a>
</div>
</form><!--/#join-group-form-->
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/groups/join_group.html | HTML | asf20 | 1,409 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-22.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} Members of {{ group|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block main %}
<div class="section">
<h1>Group members ...</h1>
</div>
<div class="section">
<table class="table">
<thead>
<tr>
<th><span class="nowrap">Name</span></th>
<th><span class="nowrap"><a href="?order_by=user">Email address</a></span></th>
<th><span class="nowrap"><a href="?order_by=-join_date">Join date</a></span></th>
<th><span class="nowrap">Role</span></th>
{% if group_access.can_moderate %}
<th><span class="nowrap">Manage</span></th>
{% endif %}
</tr>
</thead>
<tbody>
<!-- pending members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% for member in pending_members %}
<tr class="highlighted">
<td>
<span class="big noswap">
<a href="{% url friday.view_profile username=member.username %}">{{ member|escape }}</a>
</span>
</td>
<td><span class="nowrap">{{ member.email|safe_email }}</span></td>
<td><span class="nowrap">{{ member.join_date|prettify_datetime }}</span></td>
<td><span class="nowrap">pending</span></td>
{% if group_access.can_moderate %}
<td>
<span class="nowrap">
<a href="{% url friday.review_member group_uid=group.uid username=member.username %}">
Review
</a>
</span>
</td>
{% endif %}
</tr>
{% endfor %}
<!-- approved members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% for member in approved_members %}
<tr>
<td>
<span class="big noswap">
<a href="{% url friday.view_profile username=member.username %}">{{ member|escape }}</a>
</span>
</td>
<td><span class="nowrap">{{ member.email|safe_email }}</span></td>
<td><span class="nowrap">{{ member.join_date|prettify_datetime }}</span></td>
<td><span class="nowrap">{{ member.role|escape }}</span></td>
{% if group_access.can_moderate %}
<td>
<span class="nowrap">
{% if group_access.can_administrate %}
<a href="{% url friday.edit_member group_uid=group.uid username=member.username %}">
Edit
</a>
{% else %}
--
{% endif %}
</span>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% if approved_members.cursor %}
<div class="pagination">
<a class="pager" href="?order_by={{ ordered_by }}&cursor={{ approved_members.cursor|urlencode }}">Next »</a>
</div>
{% endif %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/groups/view_members.html | HTML | asf20 | 3,563 |
{% extends "halloffame/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-12.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Change photo of {{ inductee|escape }} :: Hall of Fame :: {{ group|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Change the photo of {{ inductee|escape }}</h1>
</div>
<div class="section">
<form id="inductee-photo-form" class="xl-form" action="." method="POST" enctype="multipart/form-data">
<div class="field">
<div class="label">Upload a photo of {{ inductee|escape }}:</div>
<div class="input">{{ inductee_photo_form.photo|safe }}</div>
{% if inductee_photo_form.photo.errors %}
<div class="error-list">{{ inductee_photo_form.photo.errors|safe }}</div>
{% endif %}
<div class="help-text">
The preferred photo size is 300x300 pixels.
</div>
</div>
{% if inductee.photo_type and inductee.photo_data %}
<div class="field">
<div class="label">Or, delete the current photo:</div>
<div>
<img class="s-photo"
src="{% url friday.view_inductee_photo group_uid=inductee.group.uid inductee_uid=inductee.uid %}"
alt="Photo of {{ inductee|escape }}"/>
</div>
<div class="checkbox">
{{ inductee_photo_form.delete_photo|safe }}
Delete the current photo of {{ inductee|escape }}.
</div>
{% if inductee_photo_form.delete_photo.errors %}
<div class="error-list">{{ inductee_photo_form.delete_photo.errors|safe }}</div>
{% endif %}
</div>
{% endif %}
<div class="field">
<input class="button" type="submit" value="Update"/>
or,
<a href="{% url friday.view_inductee group_uid=inductee.group.uid inductee_uid=inductee.uid %}">
return to inductee page
</a>
</div>
</form>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/halloffame/change_inductee_photo.html | HTML | asf20 | 2,324 |
{% extends "halloffame/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-11.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Edit inductee {{ inductee|escape }} :: Hall of Fame :: {{ group|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if inductee_form %}
<div class="section">
<h1>Edit inductee: {{ inductee|escape }}</h1>
</div>
<div class="section">
{% include "halloffame/common/inductee_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/halloffame/edit_inductee.html | HTML | asf20 | 791 |
{% extends "halloffame/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-11.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Hall of Fame :: {{ group|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
{% if is_webmaster_ %}
<div class="section">
<h2><a href="{% url friday.add_inductee group_uid=group.uid %}">Add an inductee</a></h2>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>The Inductees</h1>
</div>
<div class="section">
{% for inductee in inductees %}
<div class="post">
<div class="user-avatar right">
<a href="{% url friday.view_profile username=inductee.user.username %}">
<img src="{% url friday.view_avatar username=inductee.user.username %}" alt="{{ inductee.user|escape }}"/>
</a>
</div>
<div class="post-head">
<a href="{% url friday.view_inductee group_uid=inductee.group.uid inductee_uid=inductee.uid %}">
{{ inductee|escape }}
</a>
</div>
<div class="post-body"><span class="big">{{ inductee.summary|escape }}</span></div>
<div class="post-foot">
<img class="icon" src="{{ static_ }}/images/award.png" alt="Award"/>
Inducted on {{ inductee.induct_date|date:"d N Y" }}.
</div>
<div class="clear"></div>
</div>
{% empty %}
<p class="na">No inductees found.</p>
{% endfor %}
</div>
<div class="section">
<h1>The Induction Process</h1>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/halloffame/home.html | HTML | asf20 | 1,989 |
{% extends "halloffame/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-11.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} {{ inductee|escape }} :: Hall of Fame :: {{ group|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<!-- photo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if inductee.photo_type and inductee.photo_data %}
<div class="section">
<img class="s-photo"
src="{% url friday.view_inductee_photo group_uid=inductee.group.uid inductee_uid=inductee.uid %}"
alt="Photo of {{ inductee|escape }}"/>
</div>
{% endif %}
<!-- administration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if is_webmaster_ %}
<div class="section">
<h2>Administrate:</h2>
<ul>
<li>
<a href="{% url friday.edit_inductee group_uid=inductee.group.uid inductee_uid=inductee.uid %}">
Edit inductee information
</a>
</li>
<li>
<a href="{% url friday.change_inductee_photo group_uid=inductee.group.uid inductee_uid=inductee.uid %}">
Change photo of inductee
</a>
</li>
</ul>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>
{{ inductee.name|escape }}
{% if inductee.aka %}
aka. {{ inductee.aka|escape }}
{% endif %}
</h1>
<h5>{{ inductee.summary|default:""|escape }}</h5>
</div>
<div class="section">
<h2>Biography:</h2>
{{ inductee.biography|escape|linebreaks }}
</div>
<div class="section">
<div class="aux right">
<img class="icon" src="{{ static_ }}/images/award.png" alt="Award"/>
Inducted on {{ inductee.induct_date|date:"d N Y" }}
•
<a href="{% url friday.view_profile username=inductee.user.username %}">
Profile of {{ inductee.user|escape }}
</a>
</div>
<div class="clear"></div>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/halloffame/view_inductee.html | HTML | asf20 | 2,461 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-11.
$Id$
-->
{% endcomment %}
{% block banner %}
<div class="exotic">
<img class="background" src="http://farm4.static.flickr.com/3120/2856609186_e979b25360_b.jpg" alt="Hall of Fame"/>
<div class="banner-opaque"></div>
<div class="banner-text">
{% if group.logo_icon_url %}
<img class="icon" src="{{ group.logo_icon_url }}" alt="{{ group|escape }} Hall of Fame"/>
{% else %}
<img class="icon" src="{{ static_ }}/images/group_icon.png" alt="{{ group|escape }} Hall of Fame"/>
{% endif %}
<h1>
<a href="{% url friday.view_hall_of_fame group_uid=group.uid %}">Aux Grands Hommes le Group Reconnaissant</a>
</h1>
<div class="links">
<a href="{% url friday.view_group group_uid=group.uid %}">{{ group|escape }}</a>
</div>
</div>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/halloffame/base.html | HTML | asf20 | 1,010 |
{% extends "halloffame/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-11.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Add a new inductee :: Hall of Fame :: {{ group|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if inductee_form %}
<div class="section">
<h1>Add a new inductee</h1>
</div>
<div class="section">
{% include "halloffame/common/inductee_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/halloffame/add_inductee.html | HTML | asf20 | 756 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-11.
$Id$
-->
{% endcomment %}
{% if inductee_form %}
<form id="inductee-form" class="xl-form" action="." method="POST">
<div class="field">
{% if not inductee_form.instance %}
<div class="label">Unique ID of the inductee: *</div>
<div class="input required">{{ inductee_form.uid|safe }}</div>
{% if inductee_form.uid.errors %}
<div class="error-list">{{ inductee_form.uid.errors|safe }}</div>
{% endif %}
<div class="help-text">
The unique ID will be part of the inductee page's URL.
It cannot be changed later.
</div>
{% else %}
<div class="label">Unique ID of the inductee:</div>
<div class="hidden">{{ inductee_form.uid|safe }}</div>
<div class="disabled-value">{{ inductee_form.instance.uid|escape }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Name of the inductee: *</div>
<div class="input required">{{ inductee_form.name|safe }}</div>
{% if inductee_form.name.errors %}
<div class="error-list">{{ inductee_form.name.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Also known as (aka):</div>
<div class="input">{{ inductee_form.aka|safe }}</div>
{% if inductee_form.aka.errors %}
<div class="error-list">{{ inductee_form.aka.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Username of the inductee: *</div>
<div class="input required">{{ inductee_form.user|safe }}</div>
{% if inductee_form.user.errors %}
<div class="error-list">{{ inductee_form.user.errors|safe }}</div>
{% endif %}
<div class="help-text">
Specify the username or the email address of the inductee.
</div>
</div>
<div class="field">
<div class="label">Summary: *</div>
<div class="input required">{{ inductee_form.summary|safe }}</div>
{% if inductee_form.summary.errors %}
<div class="error-list">{{ inductee_form.summary.errors|safe }}</div>
{% endif %}
<div class="help-text">
Give a brief description of the inductee's contributions to the group.
</div>
</div>
<div class="field">
<div class="label">Biography: *</div>
<div class="input required">{{ inductee_form.biography|safe }}</div>
{% if inductee_form.biography.errors %}
<div class="error-list">{{ inductee_form.biography.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<input class="button" type="submit" value="{{ inductee_form.instance|yesno:'Update,Add' }}"/>
or,
{% if inductee_form.instance %}
{% with inductee_form.instance as inductee %}
<a href="{% url friday.view_inductee group_uid=inductee.group.uid inductee_uid=inductee.uid %}">return to inductee page</a>
{% endwith %}
{% else %}
<a href="{% url friday.view_hall_of_fame group_uid=group.uid %}">return to Hall of Fame</a>
{% endif %}
</div>
</form>
{% endif %}
| zzheng | friday/website/friday/templates/halloffame/common/inductee_form.html | HTML | asf20 | 3,332 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block no_ie %}{% endblock %}
{#________________________________________________________________________________________________#}
{% block topbar %}
<div class="topbar-logo">
<img src="{{ static_ }}/images/logo.gif" alt='{{ site_name_|escape|default:"logo" }}' height="48px"/>
</div>
<div class="topbar-text">
{% if user_ %}
<b>{{ user_|escape }}</b>
{% if is_webmaster_ %}
(webmaster)
{% endif %}
• <a href="{{ logout_url_ }}">Logout</a>
{% else %}
<a href="{{ login_url_ }}">Login</a>
{% endif %}
</div>
<div class="clear"></div>
{% endblock %}
{#________________________________________________________________________________________________#}
{% block navbar %}{% endblock %}
{#________________________________________________________________________________________________#}
{% block footer %}
{{ site_name_|escape }} • Model Migration • Version {{ website_version_|escape }}
{% endblock %}
{#________________________________________________________________________________________________#}
| zzheng | friday/website/friday/templates/migration/base.html | HTML | asf20 | 1,413 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-12.
$Id$
-->
{% endcomment %}
{% if is_complete %}
<div class="nowrap">
<img src="{{ static_ }}/images/ok.png" alt="Done"/> Done
</div>
{% else %}
<div id="migrate-{{ model_name }}" class="nowrap">
<img src="{{ static_ }}/images/ajax_loader.gif" alt="Migrating"/> {{ succeeded }} / {{ failed }}
</div>
{% endif %}
| zzheng | friday/website/friday/templates/migration/common/migrating.html | HTML | asf20 | 462 |
{% extends "migration/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-12.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Model Migration {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Model Migration (to version {{ to_schema_version }})</h1>
</div>
<div class="section">
<table class="table">
<thead>
<tr>
<th><span class="nowrap">Model</span></th>
<th><span class="nowrap">Status</span></th>
<th><span class="nowrap">Migrate</span></th>
</tr>
</thead>
<tbody>
{% for model_name, has_old in all_models.items %}
<tr>
<td><code class="nowrap">{{ model_name }}</code></td>
<td><span class="nowrap">{{ has_old|yesno:"deprecated,latest" }}</span></td>
<td>
<span id="migrate-{{ model_name }}" class="nowrap">
{% if is_webmaster_ and has_old %}
<a href="javascript:void(0);" onclick="migrateModel('{{ model_name }}');">Migrate</a>
{% else %}
----
{% endif %}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if is_webmaster_ %}
<script type="text/javascript">//<![CDATA[
function migrateModel(model_name) {
$.post(
"{% url friday.migrate_model %}",
{model_name: model_name},
function(data) {
$("#migrate-" + model_name).after(data).remove();
var more_to_migrate = $("#migrate-" + model_name);
if (more_to_migrate.length > 0) {
migrateModel(model_name);
}
}
);
}
//]]></script>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/migration/migrate_model.html | HTML | asf20 | 2,109 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-19.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Error {% endblock %}
{#________________________________________________________________________________________________#}
{% block main %}
<div class="section">
<h1>Oops! An error occurred...</h1>
</div>
<div class="section">
<div class="error-prompt">
<img class="icon" src="{{ static_ }}/images/error.png" alt="Error"/>
{{ error|escape }}
<a href="{% url friday.home %}">Return home »</a>
</div>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/error.html | HTML | asf20 | 787 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-22.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Update Datastore {% endblock %}
{#________________________________________________________________________________________________#}
{% block main %}
<div class="section">
<h1>Update Datastore ...</h1>
</div>
{% if message %}
<div class="section">
<div class="info-prompt">
<img class="icon" src="{{ static_ }}/images/info.png" alt="Info"/>
{{ message|escape }}
</div>
</div>
{% endif %}
<div class="section">
<form class="xl-form" action="." method="POST">
<div class="field">
<input class="button" type="submit" value="Launch the update!"/>
</div>
</form>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/admin/update_datastore.html | HTML | asf20 | 993 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-22.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Import Restos {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Import Restos ...</h1>
</div>
{% if prompt %}
<div class="section">
<div class="info-prompt">{{ prompt|escape }}</div>
</div>
{% endif %}
{% if import_restos_form %}
<div class="section">
<form id="import-members-form" class="xl-form" action="." method="POST" enctype="multipart/form-data">
<div class="field">
<div class="label">Import from CSV File: *</div>
<div class="input required">{{ import_restos_form.csv_file|safe }}</div>
{% if import_restos_form.csv_file.errors %}
<div class="error-list">{{ import_restos_form.csv_file.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<input class="button" type="submit" value="Import"/>
</div>
</form>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/admin/import_restos.html | HTML | asf20 | 1,369 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Admin Home {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Admin Home</h1>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/admin/home.html | HTML | asf20 | 535 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Environment {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Environment</h1>
</div>
{% if django_settings %}
<div class="section">
<h2>
Django settings
<a href="javascript:void(0);" onclick="$('#django_settings').toggle();">[toggle]</a>
</h2>
<div id="django_settings" class="code">
{% for item in django_settings %}
{{ item|escape }}<br/>
{% endfor %}
</div>
</div>
{% endif %}
{% if os_environ %}
<div class="section">
<h2>
os.environ
<a href="javascript:void(0);" onclick="$('#os_environ').toggle();">[toggle]</a>
</h2>
<div id="os_environ" class="code">
{% for item in os_environ %}
{{ item|escape }}<br/>
{% endfor %}
</div>
</div>
{% endif %}
{% if sys_path %}
<div class="section">
<h2>
sys.path
<a href="javascript:void(0);" onclick="$('#sys_path').toggle();">[toggle]</a>
</h2>
<div id="sys_path" class="code">
{% for path in sys_path %}
{{ path|escape }}<br/>
{% endfor %}
</div>
</div>
{% endif %}
{% if cookies %}
<div class="section">
<h2>
cookies
<a href="javascript:void(0);" onclick="$('#cookies').toggle();">[toggle]</a>
</h2>
<div id="cookies" class="code">
{% for item in cookies %}
{{ item|escape }}<br/>
{% endfor %}
</div>
</div>
{% endif %}
{% if request_meta %}
<div class="section">
<h2>
request.META
<a href="javascript:void(0);" onclick="$('#request_meta').toggle();">[toggle]</a>
</h2>
<div id="request_meta" class="code">
{% for item in request_meta %}
{{ item|escape }}<br/>
{% endfor %}
</div>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/admin/view_environ.html | HTML | asf20 | 2,368 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-22.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Import Members {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Import Members ...</h1>
</div>
{% if prompt %}
<div class="section">
<div class="info-prompt">{{ prompt|escape }}</div>
</div>
{% endif %}
{% if import_members_form %}
<div class="section">
<form id="import-members-form" class="xl-form" action="." method="POST" enctype="multipart/form-data">
<div class="field">
<div class="label">Group unique ID: *</div>
<div class="input required">{{ import_members_form.group|safe }}</div>
{% if import_members_form.group.errors %}
<div class="error-list">{{ import_members_form.group.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Import from CSV File: *</div>
<div class="input required">{{ import_members_form.csv_file|safe }}</div>
{% if import_members_form.csv_file.errors %}
<div class="error-list">{{ import_members_form.csv_file.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<input class="button" type="submit" value="Import"/>
</div>
</form>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/admin/import_members.html | HTML | asf20 | 1,722 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Add a new restaurant {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if resto_form %}
<div class="section">
<h1>Add a new restaurant</h1>
</div>
<div class="section">
{% include "restos/common/resto_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/restos/create_resto.html | HTML | asf20 | 699 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-28.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} All Restaurants {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<div class="section">
<h2>Categories:</h2>
<ul>
{% for category, display in categories %}
<li><a href="{% url friday.view_restos_by_category category=category %}">{{ display|escape }}</a></li>
{% endfor %}
</ul>
</div>
<div class="section">
<h2>Tag Cloud:</h2>
<div id="load-resto-tag-cloud"></div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#load-resto-tag-cloud").load("{% url friday.view_resto_tag_cloud %}");
});
//]]></script>
</div>
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>All Restaurants ...</h1>
</div>
<div class="section">
{% include "restos/common/restos.html" %}
{% if restos.cursor %}
<div class="pagination">
<a class="pager" href="?cursor={{ restos.cursor|urlencode }}">Next »</a>
</div>
{% endif %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/restos/view_all_restos.html | HTML | asf20 | 1,511 |
{% extends "restos/resto_base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-10.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Recommend a Dish :: {{ resto|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if dish_form %}
<div class="section">
<h1>{{ resto|escape }} / Recommend a Dish</h1>
</div>
<div class="section">
{% include "restos/common/dish_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/restos/recommend_dish.html | HTML | asf20 | 745 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-13.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Restaurants in category {{ category_display|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<div class="section">
<h2>Categories:</h2>
<ul>
{% for category, display in categories %}
<li><a href="{% url friday.view_restos_by_category category=category %}">{{ display|escape }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Restaurants: {{ category_display|escape }} ...</h1>
</div>
<div class="section">
{% include "restos/common/restos.html" %}
{% if restos.cursor %}
<div class="pagination">
<a class="pager" href="?cursor={{ restos.cursor|urlencode }}">Next »</a>
</div>
{% endif %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/restos/view_restos_by_category.html | HTML | asf20 | 1,287 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-13.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} Restaurants {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<div class="section">
<h2>Categories:</h2>
<ul>
{% for category, display in categories %}
<li><a href="{% url friday.view_restos_by_category category=category %}">{{ display|escape }}</a></li>
{% endfor %}
</ul>
</div>
<div class="section">
<h2>Tag Cloud:</h2>
<div id="load-resto-tag-cloud"></div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#load-resto-tag-cloud").load("{% url friday.view_resto_tag_cloud %}");
});
//]]></script>
</div>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if user_ and user_.is_staff %}
<div class="section">
<h2><a href="{% url friday.create_resto %}">Add a restaurant</a></h2>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Newly Added Restaurants ...</h1>
{% with newly_added_restos as restos %}
{% include "restos/common/restos.html" %}
{% endwith %}
<p><a href="{% url friday.view_all_restos %}">View all restaurants »</a></p>
</div>
<div class="section">
<h1>Recent Comments ...</h1>
{% for resto, comment in newly_commented_restos %}
<div id="comment-{{ comment.id }}" class="post">
<div class="user-avatar right">
<a href="{% url friday.view_profile username=comment.author.username %}">
<img src="{% url friday.view_avatar username=comment.author.username %}" alt="{{ comment.author|escape }}"/>
</a>
</div>
<div class="post-head">
<a href="{% url friday.view_profile username=comment.author.username %}">
{{ comment.author|escape }}
</a>
commented on
<a href="{% url friday.view_resto resto_id=resto.id %}">{{ resto|escape }}</a>
:
</div>
<div class="post-body">{{ comment.content|escape|linebreaks }}</div>
<div class="post-foot">
<img class="icon" src="{{ static_ }}/images/comment.png" alt="Comment"/>
Posted {{ comment.submit_date|prettify_datetime }}
</div>
<div class="clear"></div>
</div>
{% empty %}
<p class="na">No recent comments.</p>
{% endfor %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/restos/home.html | HTML | asf20 | 2,959 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-28.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Restaurants tagged by {{ tag_name|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<div class="section">
<h2>Tag Cloud:</h2>
<div id="load-resto-tag-cloud"></div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#load-resto-tag-cloud").load("{% url friday.view_resto_tag_cloud %}");
});
//]]></script>
</div>
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Restaurants tagged by "{{ tag_name|escape }}" ...</h1>
</div>
<div class="section">
{% include "restos/common/restos.html" %}
{% if restos.cursor %}
<div class="pagination">
<a class="pager" href="?tag_name={{ tag_name|urlencode }}&cursor={{ restos.cursor|urlencode }}">Next »</a>
</div>
{% endif %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/restos/view_restos_by_tag.html | HTML | asf20 | 1,342 |
{% extends "restos/resto_base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-26.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Edit: {{ resto|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if resto_form %}
<div class="section">
<h1>Edit Restaurant: {{ resto|escape }}</h1>
</div>
<div class="section">
{% include "restos/common/resto_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/restos/edit_resto.html | HTML | asf20 | 731 |
{% extends "restos/resto_base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-14.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Delete {{ dish|escape }} :: {{ resto|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if resto_access.can_edit %}
<div class="section">
<h1>Delete {{ dish|escape }} / {{ resto|escape }} ?</h1>
</div>
<div class="section">
<form class="xl-form" action="." method="POST">
<div class="field">
<div class="label">Are you sure you want to delete {{ dish|escape }} ?</div>
<div class="help-text">This operation cannot be reverted.</div>
</div>
<div class="field">
<input class="button" type="submit" value="Yes, delete it"/>
or,
<a href="{% url friday.view_resto resto_id=resto.id %}">
return to {{ resto|escape }}
</a>
</div>
</form>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/restos/delete_dish.html | HTML | asf20 | 1,266 |
{% extends "restos/resto_base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-10.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Edit Recommended Dish :: {{ resto|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if dish_form %}
<div class="section">
<h1>Edit Dish: {{ dish|escape }} / {{ resto|escape }}</h1>
</div>
<div class="section">
{% include "restos/common/dish_form.html" %}
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/restos/edit_dish.html | HTML | asf20 | 762 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-26.
$Id$
-->
{% endcomment %}
{% block banner %}
{% if resto %}
<div id="resto-banner" class="{{ resto.background_url|yesno:'exotic,simple' }}">
{% if resto.background_url %}
<img class="background" src="{{ resto.background_url }}" alt="{{ resto|escape }}"/>
{% else %}
<img class="background" src="{{ static_ }}/images/none.gif" alt="{{ resto|escape }}"/>
{% endif %}
<div class="banner-opaque"></div>
<div class="banner-text">
{% if resto.logo_icon_url %}
<img class="icon" src="{{ resto.logo_icon_url }}" alt="{{ resto|escape }}"/>
{% else %}
<img class="icon" src="{{ static_ }}/images/resto_icon.png" alt="{{ resto|escape }}"/>
{% endif %}
<h1>{{ resto|escape }}</h1>
<div class="links">
<a href="{% url friday.view_resto resto_id=resto.id %}">Resto Home</a>
{% if resto.website %}
• <a href="{{ resto.website }}">Website</a>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/restos/resto_base.html | HTML | asf20 | 1,260 |
{% extends "restos/resto_base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-10.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} {{ resto|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<!-- information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h2>Information:</h2>
{% if resto.geo_pt %}
<div id="map-canvas" class="s-map"></div>
<p><a href="#TODO">» View larger map</a></p>
<script type="text/javascript">//<![CDATA[
$(function() {
friday.showMap({{ resto.geo_pt.lat }}, {{ resto.geo_pt.lon }}, "#map-canvas");
});
//]]></script>
{% endif %}
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/address.png" alt="Address"/>
Address:
</dt>
<dd>
{{ resto.address|escape }}<br/>
{{ resto.city|escape }} {{ resto.post_code|default:""|escape }}
</dd>
</dl>
{% if resto.route %}
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/route.png" alt="Route"/>
Route:
</dt>
<dd>{{ resto.route|escape }}</dd>
</dl>
{% endif %}
{% if resto.tels %}
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/tel.png" alt="Tel"/>
Tel:
</dt>
<dd>{{ resto.tels|join:" / "|escape }}</dd>
</dl>
{% endif %}
{% if resto.hours %}
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/time.png" alt="Hours"/>
Hours:
</dt>
<dd>
{% for hours in resto.hours %}
{{ hours|escape }}<br/>
{% endfor %}
</dd>
</dl>
{% endif %}
{% if resto.places %}
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/group.png" alt="Places"/>
Places:
</dt>
<dd>{{ resto.places }} seats</dd>
</dl>
{% endif %}
<dl>
<dt>
<img class="icon" src="{{ static_ }}/images/category.png" alt="Category"/>
Category:
</dt>
<dd>
<a href="{% url friday.view_restos_by_category category=resto.category %}">
{{ resto.get_category_display }}
</a>
</dd>
</dl>
</div>
<!-- tags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h2>Tags:</h2>
<div id="load-resto-tags">
<div class="ajax-loader">
<img src="{{ static_ }}/images/ajax_loader.gif" alt="Loading"/>
Loading tags...
</div>
<div class="ajax-error hidden">
<img src="{{ static_ }}/images/error.png" alt="Error"/>
Failed to load tags.
</div>
</div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#load-resto-tags").load(
"{% url friday.view_resto_tags resto_id=resto.id %}",
function(response, textStatus) {
if (textStatus == "error") {
$("#load-resto-tags .ajax-loader").hide();
$("#load-resto-tags .ajax-error").show();
}
}
);
});
//]]></script>
</div>
<!-- submitter and updater ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
{% ifnotequal resto.submitter resto.updater %}
<div class="user-box">
<div class="user-avatar">
<a href="{% url friday.view_profile username=resto.submitter.username %}">
<img src="{% url friday.view_avatar username=resto.submitter.username %}" alt="{{ resto.submitter|escape }}"/>
</a>
</div>
<div class="user-info">
Added on {{ resto.submit_date|date:"d N Y" }}<br/>
by <a href="{% url friday.view_profile username=resto.submitter.username %}">{{ resto.submitter|escape }}</a>
</div>
<div class="clear"></div>
</div>
{% endifnotequal %}
<div class="user-box">
<div class="user-avatar">
<a href="{% url friday.view_profile username=resto.updater.username %}">
<img src="{% url friday.view_avatar username=resto.updater.username %}" alt="{{ resto.updater|escape }}"/>
</a>
</div>
<div class="user-info">
Updated on {{ resto.submit_date|date:"d N Y" }}<br/>
by <a href="{% url friday.view_profile username=resto.updater.username %}">{{ resto.updater|escape }}</a>
</div>
<div class="clear"></div>
</div>
</div>
<!-- administration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if resto_access.can_edit or resto_access.can_delete %}
<div class="section">
<h2>Administration:</h2>
<ul>
{% if resto_access.can_edit %}
<li><a href="{% url friday.edit_resto resto_id=resto.id %}">Edit resto information</a></li>
<li><a href="{% url friday.recommend_dish resto_id=resto.id %}">Recommend a dish</a></li>
{% endif %}
{% if resto_access.can_delete %}
<li><a href="{% url friday.delete_resto resto_id=resto.id %}">Delete this resto</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>{{ resto.name|escape }}</h1>
<h5>{{ resto.address|escape }}, {{ resto.city|escape }} {{ resto.post_code|default:""|escape }}</h5>
</div>
{% if resto.description %}
<div class="section">
<h2>Description:</h2>
{{ resto.description|escape|linebreaks }}
</div>
{% endif %}
{% include "restos/common/resto_faves.html" %}
<!-- resto recommended dishes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
{% if resto.dishes %}
<div class="section">
<h2>Recommended Dishes:</h2>
{% for dish in resto.dishes %}
{% include "restos/common/dish.html" %}
{% endfor %}
</div>
{% endif %}
<!-- resto tabs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<div id="resto-tabs">
<ul>
<li><a href="{% url friday.view_comments ref_type=resto.model_name ref_pk=resto.pk %}">Comments</a></li>
</ul>
</div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#resto-tabs").tabs({
ajaxOptions: {
error: function(xhr, status, index, anchor) {
if (index == 0) {
target = "comments";
} else {
target = "unknown objects";
}
$(anchor.hash).html("Failed to load " + target + " via AJAX: server error.");
}
}
});
});
//]]></script>
</div>
{% endblock %}{# content #}
| zzheng | friday/website/friday/templates/restos/view_resto.html | HTML | asf20 | 7,450 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-14.
$Id$
-->
{% endcomment %}
{% load ilike_tags %}
{#________________________________________________________________________________________________#}
{% block html_title %} {{ dish_name|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>{{ dish_name|escape }} ...</h1>
</div>
<div class="section">
{% for dish in dishes %}
<div class="post">
{% if dish.photo_url %}
<div class="right">
<img class="xs-photo" src="{{ dish.photo_url }}" alt="Photo"/>
</div>
{% endif %}
<div class="post-head">
<a href="{% url friday.view_resto resto_id=dish.resto.id %}">
{{ dish.name|escape }} / {{ dish.resto|escape }}
</a>
{% if dish.is_spicy %}
<img class="icon" src="{{ static_ }}/images/spicy.png" alt="Spicy"/>
{% endif %}
{% if dish.is_vegetarian %}
<img class="icon" src="{{ static_ }}/images/vegetarian.png" alt="Vegetarian"/>
{% endif %}
{% if dish.price %}
- {{ dish.price|escape }}
{% endif %}
</div>
{% if dish.description %}
<div class="post-body">{{ dish.description|escape|linebreaks }}</div>
{% endif %}
<div class="post-foot">
<img class="icon" src="{{ static_ }}/images/like.png" alt="Like"/>
{{ dish.fans.count }} persons like this
{% withfan dish user_ as fan %}
{{ fan|yesno:"(including you)," }}
{% endwithfan %}
</div>
<div class="clear"></div>
</div>
{% endfor %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/restos/search_dish.html | HTML | asf20 | 1,967 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
<div class="ajax">
{% for resto in restos %}
<div class="post">
<div class="post-head">
<a href="{% url friday.view_resto resto_id=resto.id %}">{{ resto|escape }}</a>
</div>
<div class="post-body">
{% if resto.description %}
{{ resto.description|summary:200|escape }}
{% else %}
<div class="na">This restaurant has no description.</div>
{% endif %}
</div>
<div class="post-foot">
<div>
<img class="icon" src="{{ static_ }}/images/address.png" alt="Address"/>
{{ resto.address|escape }},
{{ resto.city|escape }}
{{ resto.post_code|default:""|escape }}
{% if resto.tels %}
<img class="icon" src="{{ static_ }}/images/tel.png" alt="Tel"/>
{{ resto.tels|join:" / "|escape }}
{% endif %}
<img class="icon" src="{{ static_ }}/images/category.png" alt="Category"/>
<a href="{% url friday.view_restos_by_category category=resto.category %}">
{{ resto.get_category_display|escape }}
</a>
</div>
{% if resto.tags %}
<div>
{% for tag in resto.tags %}
<img class="icon" src="{{ static_ }}/images/tag.png" alt="Tag"/>
<a href="{% url friday.view_restos_by_tag %}?tag_name={{ tag|urlencode }}">{{ tag|escape }}</a>
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% empty %}
<p class="na">No restaurants found.</p>
{% endfor %}
</div>
| zzheng | friday/website/friday/templates/restos/common/restos.html | HTML | asf20 | 1,859 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
{% if resto_form %}
<form id="resto-form" class="xl-form" action="." method="POST">
<div class="field">
<div class="label">The restaurant name: *</div>
<div class="input required">{{ resto_form.name|safe }}</div>
{% if resto_form.name.errors %}
<div class="error-list">{{ resto_form.name.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Description:</div>
<div class="input">{{ resto_form.description|safe }}</div>
{% if resto_form.description.errors %}
<div class="error-list">{{ resto_form.description.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Category: *</div>
<div class="input required">{{ resto_form.category|safe }}</div>
{% if resto_form.category.errors %}
<div class="error-list">{{ resto_form.category.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Address: *</div>
<div id="address" class="input required">{{ resto_form.address|safe }}</div>
{% if resto_form.address.errors %}
<div class="error-list">{{ resto_form.address.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">City: *</div>
<div id="city" class="input required">{{ resto_form.city|safe }}</div>
{% if resto_form.city.errors %}
<div class="error-list">{{ resto_form.city.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Geo Location:</div>
<div id="geo-pt" class="hidden">{{ resto_form.geo_pt|safe }}</div>
{% if resto_form.geo_pt.errors %}
<div class="error-list">{{ resto_form.geo_pt.errors|safe }}</div>
{% endif %}
<div id="geo-pt-message" class="disabled-value">
{% if resto.geo_pt %}
Latitude: {{ resto.geo_pt.lat }}, longitude: {{ resto.geo_pt.lon }}.
{% else %}
Geo position not specified.
{% endif %}
</div>
<div class="help-text">
<div>
<a href="javascript:void(0);" onclick="findInMap();">find the address in map</a>
</div>
<div id="map" class="hidden">
<div id="map-canvas" class="map"></div>
<div>
<a href="javascript:void(0);" onclick="clearMap();">clear map</a>
</div>
</div>
</div>
</div>
<div class="field">
<div class="label">Post code:</div>
<div class="input">{{ resto_form.post_code|safe }}</div>
{% if resto_form.post_code.errors %}
<div class="error-list">{{ resto_form.post_code.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Route:</div>
<div class="input">{{ resto_form.route|safe }}</div>
{% if resto_form.route.errors %}
<div class="error-list">{{ resto_form.route.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Telephone number(s):</div>
<div class="input">{{ resto_form.tel_1|safe }}</div>
<div class="input">{{ resto_form.tel_2|safe }}</div>
{% if resto_form.tel_1.errors or resto_form.tel_2.errors %}
<div class="error-list">
{{ resto_form.tel_1.errors|safe }}
{{ resto_form.tel_2.errors|safe }}
</div>
{% endif %}
</div>
<div class="field">
<div class="label">Website:</div>
<div class="input">{{ resto_form.website|safe }}</div>
{% if resto_form.website.errors %}
<div class="error-list">{{ resto_form.website.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Hours:</div>
<div class="input">{{ resto_form.hours_1|safe }}</div>
<div class="input">{{ resto_form.hours_2|safe }}</div>
<div class="input">{{ resto_form.hours_3|safe }}</div>
{% if resto_form.hours_1.errors or resto_form.hours_2.errors or resto_form.hours_3.errors %}
<div class="error-list">
{{ resto_form.hours_1.errors|safe }}
{{ resto_form.hours_2.errors|safe }}
{{ resto_form.hours_3.errors|safe }}
</div>
{% endif %}
</div>
<div class="field">
<div class="label">Places:</div>
<div class="input">{{ resto_form.places|safe }}</div>
{% if resto_form.places.errors %}
<div class="error-list">{{ resto_form.places.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<input class="button" type="submit" value="{{ resto_form.instance|yesno:'Update,Create' }}"/>
or,
{% if resto_form.instance %}
<a href="{% url friday.view_resto resto_id=resto_form.instance.id %}">
return to {{ resto|escape }}
</a>
{% else %}
<a href="{% url friday.view_all_restos %}">
view restaurants
</a>
{% endif %}
</div>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<script type="text/javascript">//<![CDATA[
function findInMap() {
var address = jQuery.trim($("#address :input").val());
var city = jQuery.trim($("#city :input").val());
if (address == "") {
$("#map").hide();
$("#geo-pt :input").val("");
$("#geo-pt-message").text("Geo position not specified. Please specify an address.");
} else {
$("#map").show();
friday.findInMap(
address + ", " + city,
"#map-canvas",
function(lat, lon) {
$("#geo-pt :input").val(lat + "," + lon);
$("#geo-pt-message").text("Latitude: " + lat + ", longitude: " + lon + ".");
},
function(address_not_found) {
$("#map").hide();
$("#geo-pt :input").val("");
$("#geo-pt-message").text("The address you specified cannot be found.");
}
);
}
}
function clearMap() {
$("#map").hide();
$("#geo-pt :input").val("");
$("#geo-pt-message").text("Geo position not specified.");
}
//]]></script>
</form><!--/#resto-form-->
{% endif %}{# resto_form #}
| zzheng | friday/website/friday/templates/restos/common/resto_form.html | HTML | asf20 | 6,608 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-28.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
<div id="resto-tags" class="ajax-box">
{% if resto and resto.tags %}
<div class="tags">
<ul>
{% for tag in resto.tags %}
<li id="tag-{{ tag|uniqueid }}">
<img class="icon" src="{{ static_ }}/images/tag.png" alt="Tag"/>
<a href="{% url friday.view_restos_by_tag %}?tag_name={{ tag|urlencode }}">{{ tag|escape }}</a>
{% if resto_access.can_edit %}
<a class="remove-tag" href="javascript:void(0);" onclick="removeRestoTag('#tag-{{ tag|uniqueid }}', '{{ tag|escape }}');">x</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% if resto_access.can_edit %}
<script type="text/javascript">//<![CDATA[
function removeRestoTag(tag_html_id, name) {
$.post(
"{% url friday.remove_resto_tag resto_id=resto.id %}",
{name: name},
function(data) {
$(tag_html_id).after(data).remove();
}
);
}
//]]></script>
{% endif %}
{% endif %}
{% if resto_tag_form %}
<div class="ajax-view">
<p><a href="javascript:void(0);" onclick="friday.toggle('#resto-tags');">Add tags</a></p>
</div>
<form id="resto-tag-form" class="ajax-edit s-form hidden"
action="{% url friday.view_resto_tags resto_id=resto.id %}"
method="POST"
onsubmit="return friday.submitAjaxForm('#resto-tags', '#resto-tag-form');">
<input type="hidden" name="action" value="add"/>
<div class="input">{{ resto_tag_form.names|safe }}</div>
{% if resto_tag_form.names.errors %}
<div class="error-list">{{ resto_tag_form.names.errors|safe }}</div>
{% endif %}
<div>
<input class="button" type="submit" value="Add"/>
<a href="javascript:void(0);" onclick="friday.toggle('#resto-tags');">cancel</a>
</div>
</form>
{% endif %}
</div>
| zzheng | friday/website/friday/templates/restos/common/resto_tags.html | HTML | asf20 | 2,173 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
{% if tag_cloud %}
<div class="tag-cloud">
{% for tag in tag_cloud.tags %}
<span class="tag nowrap" style="font-size: {{ tag.size }}%;">
<a href="{% url friday.view_restos_by_tag %}?tag_name={{ tag.name|urlencode }}">{{ tag|escape }}</a>
</span>
{% endfor %}
</div>
{% endif %}
| zzheng | friday/website/friday/templates/restos/common/resto_tag_cloud.html | HTML | asf20 | 472 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-29.
$Id$
-->
{% endcomment %}
<li>
<img class="icon" src="{{ static_ }}/images/tag.png" alt="Tag"/>
<span class="removed-tag">{{ name|escape }} (removed)</span>
</li>
| zzheng | friday/website/friday/templates/restos/common/resto_tag_removed.html | HTML | asf20 | 292 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-11.
$Id$
-->
{% endcomment %}
{% load ilike_tags %}
{% if dish %}
<div id="dish-{{ dish.id }}" class="post">
{% if dish.photo_url %}
<div class="right">
<img class="xs-photo" src="{{ dish.photo_url }}" alt="Photo"/>
</div>
{% endif %}
<div class="post-head">
<a href="{% url friday.search_dish %}?dish_name={{ dish.name|urlencode }}">{{ dish.name|escape }}</a>
{% if dish.is_spicy %}
<img class="icon" src="{{ static_ }}/images/spicy.png" alt="Spicy"/>
{% endif %}
{% if dish.is_vegetarian %}
<img class="icon" src="{{ static_ }}/images/vegetarian.png" alt="Vegetarian"/>
{% endif %}
{% if dish.price %}
- {{ dish.price|escape }}
{% endif %}
</div>
{% if dish.description %}
<div class="post-body">{{ dish.description|escape|linebreaks }}</div>
{% endif %}
<div class="post-foot">
<img class="icon" src="{{ static_ }}/images/like.png" alt="Like"/>
<b>{{ dish.fans.count }}</b> persons like this
{% if user_ %}
{% withfan dish user_ as fan %}
{{ fan|yesno:"(including you)," }}
•
<a href="javascript:void(0);" onclick="changeDishFan_{{ dish.id }}();">
{{ fan|yesno:"Un-like,Like" }}
</a>
{% endwithfan %}
{% endif %}
{% if resto_access.can_edit %}
• <a href="{% url friday.edit_dish resto_id=dish.resto.id dish_id=dish.id %}">Edit</a>
• <a href="{% url friday.delete_dish resto_id=dish.resto.id dish_id=dish.id %}">Delete</a>
{% endif %}
</div>
<div class="clear"></div>
{% if user_ %}
<script type="text/javascript">//<![CDATA[
function changeDishFan_{{ dish.id }}() {
$.post(
"{% url friday.change_dish_fan resto_id=dish.resto.id dish_id=dish.id %}",
function(data) {
$("#dish-{{ dish.id }}").after(data).remove();
}
);
}
//]]></script>
{% endif %}
</div>
{% endif %}
| zzheng | friday/website/friday/templates/restos/common/dish.html | HTML | asf20 | 2,242 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-10.
$Id$
-->
{% endcomment %}
{% if dish_form %}
<form id="dish-form" class="xl-form" action="." method="POST">
<div class="field">
{% if dish_form.instance %}
<div class="label">Name:</div>
<div class="hidden">{{ dish_form.name|safe }}</div>
<div class="disabled-value">{{ dish_form.instance.name|escape }}</div>
{% else %}
<div class="label">Name: *</div>
<div class="input required">{{ dish_form.name|safe }}</div>
{% if dish_form.name.errors %}
<div class="error-list">{{ dish_form.name.errors|safe }}</div>
{% endif %}
{% endif %}
</div>
<div class="field">
<div class="label">Description:</div>
<div class="input">{{ dish_form.description|safe }}</div>
{% if dish_form.description.errors %}
<div class="error-list">{{ dish_form.description.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Photo URL:</div>
<div class="input">{{ dish_form.photo_url|safe }}</div>
{% if dish_form.photo_url.errors %}
<div class="error-list">{{ dish_form.photo_url.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Additional Information:</div>
<div class="checkbox">
<div>
{{ dish_form.is_spicy|safe }} This dish is spicy.
</div>
<div>
{{ dish_form.is_vegetarian|safe }} This dish is vegetarian.
</div>
</div>
{% if dish_form.is_spicy.errors or dish_form.is_vegetarian.errors %}
<div class="error-list">
{{ dish_form.is_spicy.errors|safe }}
{{ dish_form.is_vegetarian.errors|safe }}
</div>
{% endif %}
</div>
<div class="field">
<div class="label">Price:</div>
<div class="input">{{ dish_form.price|safe }}</div>
{% if dish_form.price.errors %}
<div class="error-list">{{ dish_form.price.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<input class="button" type="submit" value="{{ dish_form.instance|yesno:'Update,Recommend' }}"/>
or,
<a href="{% url friday.view_resto resto_id=resto.id %}">
return to {{ resto|escape }}
</a>
</div>
</form>
{% endif %}
| zzheng | friday/website/friday/templates/restos/common/dish_form.html | HTML | asf20 | 2,502 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-10.
$Id$
-->
{% endcomment %}
{% load ilike_tags %}
{% if resto %}
<div id="resto-faves-{{ resto.id }}" class="section">
<img class="icon" src="{{ static_ }}/images/like.png" alt="Fave"/>
<b>{{ resto.faves.count }}</b> people add this resto as a fave
{% if user_ %}
•
{% withfave resto user_ as fave %}
<a href="javascript:void(0);" onclick="changeRestoFave_{{ resto.id }}();">
{{ fave|yesno:"Remove from,Add to" }} your faves
</a>
{% endwithfave %}
{% endif %}
{% if user_ %}
<script type="text/javascript">//<![CDATA[
function changeRestoFave_{{ resto.id }}() {
$.post(
"{% url friday.change_resto_fave resto_id=resto.id %}",
function(data) {
$("#resto-faves-{{ resto.id }}").after(data).remove();
}
);
}
//]]></script>
{% endif %}
</div>
{% endif %}
| zzheng | friday/website/friday/templates/restos/common/resto_faves.html | HTML | asf20 | 1,084 |
{% extends "restos/resto_base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-14.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Delete {{ resto|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
{% if resto_access.can_delete %}
<div class="section">
<h1>Delete {{ resto|escape }} ?</h1>
</div>
<div class="section">
<form class="xl-form" action="." method="POST">
<div class="field">
<div class="label">Are you sure you want to delete {{ resto|escape }} ?</div>
<div class="help-text">
<p>
Once the restaurant is deleted, all the related information (ratings, comments,
etc.) will also be deleted.
</p>
<p>
This operation cannot be reverted.
</p>
</div>
</div>
<div class="field">
<input class="button" type="submit" value="Yes, delete it"/>
or,
<a href="{% url friday.view_resto resto_id=resto.id %}">
return to {{ resto|escape }}
</a>
</div>
</form>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/restos/delete_resto.html | HTML | asf20 | 1,464 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Home {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Welcome!</h1>
</div>
{% endblock %}{# content #}
| zzheng | friday/website/friday/templates/misc/home.html | HTML | asf20 | 542 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-12.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} About {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>About ...</h1>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/misc/about.html | HTML | asf20 | 533 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-29.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Change Log {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Change Log ...</h1>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/misc/about_versions.html | HTML | asf20 | 543 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-29.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Browser - You are using {{ browser_|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<div class="section">
<h2>Recommended Browsers:</h2>
<ul>
<li><a href="http://www.firefox.com/">Mozilla Firefox</a></li>
<li><a href="http://www.google.com/chrome/">Google Chrome</a></li>
<li><a href="http://www.apple.com/safari/">Safari</a></li>
<li><a href="http://www.opera.com/">Opera</a></li>
</ul>
</div>
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<div class="info-prompt">
{% if browser_.id %}
You are using <b>{{ browser_.name|escape }} {{ browser_.version|escape }}</b>
on a {{ browser_.platform|escape }} platform
to browse this site.
{% else %}
We are unable to detect which browser you are using...
{% endif %}
</div>
</div>
{% ifequal browser_.id "MSIE" %}
<div class="section">
<h1>Why you should change your browser...</h1>
</div>
<div>
<p>
I've detected that you are using IE (Microsoft Internet Explorer) to browse this site.
Because of IE's countless bugs and security problems, and lack of adherence to web
standards, it is highly recommended that you switch to another browser to get a (much)
better user experience.
</p>
<p>
There are plenty of web browsers in the world. You do not need to choose the best one,
but you'd better not use the worst.
</p>
<p>
The world wide web would be better if there were no IE, and so would the world be.
</p>
<p>
<a href="http://browsehappy.com/">
<img src="http://browsehappy.com/buttons/bh_185x75.gif" alt="Browse Happy"/>
</a>
</p>
</div>
{% endifequal %}
{% endblock %}
| zzheng | friday/website/friday/templates/misc/about_browser.html | HTML | asf20 | 2,363 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-14.
$Id$
-->
{% endcomment %}
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{{ site_name_|escape }}</title>
<link rel="shortcut icon" type="image/ico" href="/favicon.ico"/>
<link rel="stylesheet" type="text/css" media="screen,print" href="{{ static_ }}/css/welcome.css"/>
</head>
<body>
<div id="home-wrapper">
<!-- topbar-wrapper ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div id="topbar-wrapper">
<div class="topbar-logo">
<a href="{% url friday.home %}">
<img src="{{ static_ }}/images/logo.gif" alt="{{ site_name_|escape|default:'logo' }}"/>
</a>
</div>
<div class="clear"></div>
</div><!--/#topbar-wrapper-->
<!-- main-wrapper ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div id="main-wrapper">
<div id="splash">
<img class="image" src="{{ static_ }}/images/weekdays/{{ splash.image }}" alt="{{ splash.title|escape }}"/>
<div class="alt">
{{ splash.weekday_name|escape }}
/ {{ splash.title|escape }}
/ <a href="{{ splash.artist_url }}">{{ splash.artist|escape }}</a>
</div>
</div>
<div id="text">
<div class="big">It's {{ splash.weekday_name }} today</div>
<div class="bigger">
{% if splash.countdown %}
{{ splash.countdown }} day{{ splash.countdown|pluralize }} to Friday!
{% endif %}
{% if splash.is_friday %}
Vive le Vendredi!
{% endif %}
{% if splash.is_weekend %}
Enjoy the weekend!
{% endif %}
</div>
<div>
<a class="button" href="{{ login_url_ }}">Sign in</a>
or, <a href="{% url friday.home %}">enter the website »</a>
</div>
</div>
<div class="clear"></div>
</div><!--/#main-wrapper-->
<!-- footer-wrapper ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div id="footer-wrapper">
<div class="footer-left">
<a href="{% url friday.home %}">{{ site_name_|escape }}</a>
•
<a href="{% url friday.about topic='versions' %}">Version {{ website_version_|escape }}</a>
<br/>
Built and maintained by <a href="http://www.zhengzhong.net/">ZHENG Zhong</a>
</div>
<div class="footer-right">
<a href="http://appengine.google.com/" rel="external">Google App Engine</a>
•
<a href="http://www.python.org/" rel="external">Python {{ python_version_|escape }}</a>
•
<a href="http://www.djangoproject.com/" rel="external">Django {{ django_version_|escape }}</a>
•
<a href="http://jquery.com/" rel="external">jQuery</a>
<br/>
<a href="http://validator.w3.org/check?uri=referer" rel="external">Valid XHTML</a>
•
<a href="http://jigsaw.w3.org/css-validator/check/referer" rel="external">Valid CSS</a>
</div>
<div class="clear"></div>
</div><!--/#footer-wrapper-->
</div><!--/#outer-wrapper-->
</body>
</html>
| zzheng | friday/website/friday/templates/misc/welcome.html | HTML | asf20 | 3,711 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-12.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} {{ title|escape|default:"Untitled ..." }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1><span class="prefix">»</span> {{ title|escape|default:"Untitled ..." }}</h1>
<p>
{% if message %}
{{ message|escape }}
{% else %}
<i>No message returned.</i>
{% endif %}
</p>
</div>
{% endblock %}{# content #}
| zzheng | friday/website/friday/templates/misc/message.html | HTML | asf20 | 791 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} 404 - Page not found {% endblock %}
{#________________________________________________________________________________________________#}
{% block main %}
<div class="section">
<h1>Oops! Page not found...</h1>
</div>
<div class="section">
<div class="error-prompt">
<img class="icon" src="{{ static_ }}/images/error.png" alt="Error"/>
The URL <b>{{ bad_url|escape }}</b> you requested does not exist.
<a href="{% url friday.home %}">Return home »</a>
</div>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/misc/not_found.html | HTML | asf20 | 846 |
{% extends "groups/base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-08.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} Group Stat :: {{ group|escape }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block main %}
<div class="section">
<h1>{{ group|escape }} / Post Stat</h1>
</div>
{% if group_stat and top_posters %}
<!-- Top 3 posters of the month ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h2>Top 3 Posters as of {{ group_stat.start_date|date:"N Y" }} (total {{ group_stat.post_count }} posts):</h2>
<table class="table">
<thead>
<tr>
<th style="width: 30%;"><span class="nowrap">Champion</span></th>
<th style="width: 30%;"><span class="nowrap">Second Place</span></th>
<th style="width: 30%;"><span class="nowrap">Third Place</span></th>
</tr>
</thead>
<tbody>
<tr>
{% for top_poster in top_posters|slice:":3" %}
<td>
<div class="nowrap">
<div class="user-box">
<div class="user-avatar">
<a href="{% url friday.view_profile username=top_poster.poster.username %}">
<img src="{% url friday.view_avatar username=top_poster.poster.username %}" alt="{{ top_poster|escape }}"/>
</a>
</div>
<div class="user-info">
<img class="icon" src="{{ static_ }}/images/award.png" alt="Top poster"/>
<a href="{% url friday.view_profile username=top_poster.poster.username %}">
{{ top_poster|escape }}
</a>
<br/>
Posted <b>{{ top_poster.post_count }}</b> messages
</div>
<div class="clear"></div>
</div>
</div>
</td>
{% endfor %}
</tr>
</tbody>
</table>
</div>
<!-- Top 10 posters of the month ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<h2>Top 10 Posters:</h2>
<table class="table">
<thead>
<tr>
<th style="width: 1%;"><span class="nowrap">Place</span></th>
<th style="width: 10%;"><span class="nowrap">Poster</span></th>
<th style="width: 20%;"><span class="nowrap">Email</span></th>
<th><span class="nowrap">Stat</span></th>
</tr>
</thead>
<tbody>
{% for top_poster in top_posters %}
<tr>
<td><span class="nowrap"># {{ forloop.counter }}</span></td>
<td>
<span class="big nowrap">
<a href="{% url friday.view_profile username=top_poster.poster.username %}">
{{ top_poster.poster|escape }}
</a>
</span>
</td>
<td><span class="nowrap">{{ top_poster.poster.email|safe_email }}</span></td>
<td><span class="nowrap">{{ top_poster.post_count }} messages</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<!-- Group stat or top posters not available ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="section">
<p class="na">Top posters not available.</p>
</div>
{% endif %}
{% endblock %}
| zzheng | friday/website/friday/templates/poststats/view_group_stat.html | HTML | asf20 | 3,924 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-18.
$Id$
-->
{% endcomment %}
{% if group_stat and top_posters %}
<div>
{% for top_poster in top_posters %}
<div class="user-box">
<div class="user-avatar">
<a href="{% url friday.view_profile username=top_poster.poster.username %}">
<img src="{% url friday.view_avatar username=top_poster.poster.username %}" alt="{{ top_poster|escape }}"/>
</a>
</div>
<div class="user-info">
<img class="icon" src="{{ static_ }}/images/award.png" alt="Top poster"/>
<a href="{% url friday.view_profile username=top_poster.poster.username %}">
{{ top_poster|escape }}
</a>
<br/>
Posted <b>{{ top_poster.post_count }}</b> messages
</div>
<div class="clear"></div>
</div>
{% endfor %}
<p>
Total <b>{{ group_stat.post_count }}</b> posts in {{ group_stat.start_date|date:"N Y" }}
•
<a href="{% url friday.view_group_stat group_uid=group_stat.group.uid %}">Details »</a>
</p>
</div>
{% else %}
<p class="na">
<img class="icon" src="{{ static_ }}/images/error.png" alt="Error"/>
Group statistic not available.
</p>
{% endif %}
| zzheng | friday/website/friday/templates/poststats/common/top_posters.html | HTML | asf20 | 1,376 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-15.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
<div id="comments" class="ajax-box">
{#______________________________________________________________________________________________#}
<div class="section">
{% for comment in comments %}
<div id="comment-{{ comment.id }}" class="post">
<div class="user-avatar right">
<a href="{% url friday.view_profile username=comment.author.username %}">
<img src="{% url friday.view_avatar username=comment.author.username %}" alt="{{ comment.author|escape }}"/>
</a>
</div>
<div class="post-head">
<a href="{% url friday.view_profile username=comment.author.username %}">
{{ comment.author|escape }}
</a>
says:
</div>
<div class="post-body">{{ comment.content|escape|linebreaks }}</div>
<div class="post-foot">
<img class="icon" src="{{ static_ }}/images/comment.png" alt="Comment"/>
Posted {{ comment.submit_date|prettify_datetime }}
</div>
<div class="clear"></div>
</div>
{% empty %}
<p class="na">No comments.</p>
{% endfor %}
</div>
{#______________________________________________________________________________________________#}
{% if comment_form %}
<div class="section">
<h3>
<a href="javascript:void(0);" onclick="$('#create-comment-form').toggle();">
Add your comment
</a>
</h3>
<form id="create-comment-form" class="xl-form hidden"
action="{% url friday.view_comments ref_type=ref_type ref_pk=ref_pk %}"
method="POST"
onsubmit="return friday.submitAjaxForm('#comments', '#create-comment-form');">
<div class="field">
<div class="input required">{{ comment_form.content|safe }}</div>
<div class="error-list">{{ comment_form.content.errors|safe }}</div>
</div>
<div class="field">
<input class="button" type="submit" value="Post comment"/>
</div>
</form>
</div>
{% endif %}
</div><!--/#comments-->
| zzheng | friday/website/friday/templates/comments/common/comments.html | HTML | asf20 | 2,319 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-29.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} Notification #{{ notification.id }} {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
<div class="section">
<div class="user-box">
<div class="user-avatar">
<a href="{% url friday.view_profile username=notification.author.username %}">
<img src="{% url friday.view_avatar username=notification.author.username %}" alt="{{ notification.author|escape }}"/>
</a>
</div>
<div class="user-info">
Sent by
<a href="{% url friday.view_profile username=notification.author.username %}">
{{ notification.author|escape }}
</a>
<br/>
{{ notification.send_date|prettify_datetime }}
</div>
<div class="clear"></div>
</div><!--/.user-box-->
</div>
<div class="section">
<h2>Category:</h2>
<p>
<a href="{% url friday.view_notifications category=notification.category %}">
{{ notification.category|escape }}
</a>
</p>
</div>
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>{{ notification.subject|escape }}</h1>
</div>
<div class="section">
<h2>Message:</h2>
<p class="code">{{ notification.message|escape|linebreaksbr }}</p>
</div>
<div class="section">
<h2>Recipients ({{ notification.recipients|length }}):</h2>
<ul>
{% for recipient in notification.recipients %}
<li><code>{{ recipient|safe_email|escape }}</code></li>
{% endfor %}
</ul>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/notifications/view_notification.html | HTML | asf20 | 2,061 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-29.
$Id$
-->
{% endcomment %}
{% load friday_extra %}
{#________________________________________________________________________________________________#}
{% block html_title %} Notifications {% endblock %}
{#________________________________________________________________________________________________#}
{% block main %}
<div class="section">
<h1>
Notifications
{% if category %}
in category "{{ category|escape }}"
{% endif %}
...
</h1>
</div>
<div class="section">
<form action="{% url friday.delete_notifications %}" method="POST">
<table class="table">
<thead>
<tr>
<th style="width: 1%;"></th>
<th><span class="nowrap">Subject</span></th>
<th><span class="nowrap">Author</span></th>
<th><span class="nowrap">Recipients</span></th>
<th><span class="nowrap">Send date</span></th>
<th><span class="nowrap">Category</span></th>
</tr>
</thead>
<tbody>
{% for notification in notifications %}
<tr>
<td><input type="checkbox" name="notification_id" value="{{ notification.id }}"/></td>
<td>
<div class="big nowrap">
<a href="{% url friday.view_notification notification_id=notification.id %}">
{{ notification.subject|escape }}
</a>
</div>
</td>
<td>
<div class="nowrap">
<a href="{% url friday.view_profile username=notification.author.username %}">
{{ notification.author|escape }}
</a>
</div>
</td>
<td><div class="nowrap">{{ notification.recipients|length }}</div></td>
<td><div class="nowrap">{{ notification.send_date|prettify_datetime }}</div></td>
<td>
<div class="nowrap">
<a href="{% url friday.view_notifications category=notification.category %}">
{{ notification.category|escape }}
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="field">
<input class="button" type="submit" value="Delete selected notifications"/>
</div>
{% if category %}
<div class="table-info">
<a href="{% url friday.view_notifications %}">» View all notifications</a>
</div>
{% endif %}
</form>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/notifications/view_notifications.html | HTML | asf20 | 2,869 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-04-29.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Send Notification {% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>Send a Notification ...</h1>
</div>
<div class="section">
<form id="notification-form" class="xl-form" action="." method="POST">
<div class="field">
<div class="label">Subject: *</div>
<div class="input required">{{ notification_form.subject|safe }}</div>
{% if notification_form.subject.errors %}
<div class="error-list">{{ notification_form.subject.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Message: *</div>
<div class="input required">{{ notification_form.message|safe }}</div>
{% if notification_form.message.errors %}
<div class="error-list">{{ notification_form.message.errors|safe }}</div>
{% endif %}
</div>
<div class="field">
<div class="label">Recipients: *</div>
<div class="input required">{{ notification_form.recipients|safe }}</div>
{% if notification_form.recipients.errors %}
<div class="error-list">{{ notification_form.recipients.errors|safe }}</div>
{% endif %}
<div class="help-text">Please write one email address per line.</div>
</div>
<div class="field">
<div><input class="button" type="submit" value="Send"/></div>
<div class="help-text">
You are signed in as <a href="{% url friday.view_profile username=user_.username %}">{{ user_|escape }}</a>.
This notification will be sent in the name of you.
</div>
</div>
</form>
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/notifications/send_notification.html | HTML | asf20 | 2,102 |
{% extends "base.html" %}
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-05-04.
$Id$
-->
{% endcomment %}
{#________________________________________________________________________________________________#}
{% block html_title %} Tags {% endblock %}
{#________________________________________________________________________________________________#}
{% block sidebar %}
{% if category %}
<div class="section">
<h2>Tag Cloud ({{ category }}):</h2>
<div id="load-tag-cloud"></div>
<script type="text/javascript">//<![CDATA[
$(function() {
$("#load-tag-cloud").load("{% url friday.view_tag_cloud category=category %}");
});
//]]></script>
</div>
{% endif %}
{% endblock %}
{#________________________________________________________________________________________________#}
{% block content %}
<div class="section">
<h1>
Tags
{% if category %}
in category "{{ category|escape }}"
{% endif %}
...
</h1>
{% if category %}
<p><a href="{% url friday.view_tags %}">View all tags</a></p>
{% endif %}
</div>
<div class="section">
<table class="table">
<thead>
<tr>
<th><span class="nowrap">Tag</span></th>
<th><span class="nowrap">Category</span></th>
<th><span class="nowrap">Count</span></th>
</tr>
</thead>
<tbody>
{% for tag in tags %}
<tr>
<td><span class="nowrap">{{ tag.name|escape }}</span></td>
<td>
<span class="nowrap">
<a href="{% url friday.view_tags category=tag.category %}">{{ tag.category }}</a>
</span>
</td>
<td><span class="nowrap">{{ tag.count }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
{% if tags.cursor %}
<div class="pagination">
<a class="pager" href="?cursor={{ tags.cursor|urlencode }}">Next »</a>
</div>
{% endif %}
</div>
{% endblock %}
| zzheng | friday/website/friday/templates/tagging/view_tags.html | HTML | asf20 | 2,188 |
{% comment %}
<!--
Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
Created on 2010-02-19.
$Id$
-->
{% endcomment %}
<div class="tag-cloud">
{% for tag in tag_cloud.tags %}
<span class="tag nowrap" style="font-size: {{ tag.size }}%;">{{ tag|escape }}</span>
{% endfor %}
</div>
| zzheng | friday/website/friday/templates/tagging/common/tag_cloud.html | HTML | asf20 | 321 |