summaryrefslogtreecommitdiffstats
path: root/forum
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-05-05 20:45:47 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-05-05 20:45:47 -0400
commit3e7728f6a8ed952e1071223dc8ec2b4ede5a9462 (patch)
tree466ea5d9a324d566cc53e1a923884cbab931ba38 /forum
parent8130338044d635ce9038d7dd58af06f59cc330bc (diff)
parente76b6412adbc73b259598c13520219b5f568071b (diff)
downloadaskbot-3e7728f6a8ed952e1071223dc8ec2b4ede5a9462.tar.gz
askbot-3e7728f6a8ed952e1071223dc8ec2b4ede5a9462.tar.bz2
askbot-3e7728f6a8ed952e1071223dc8ec2b4ede5a9462.zip
Merge branch 'master' into admin-interface
Diffstat (limited to 'forum')
-rw-r--r--forum/forms.py2
-rw-r--r--forum/management/commands/once_award_badges.py16
-rw-r--r--forum/migrations/0005_install_badges.py417
-rw-r--r--[-rwxr-xr-x]forum/skins/default/media/js/com.cnprog.i18n.js387
-rwxr-xr-xforum/skins/default/media/style/style.css3
-rw-r--r--forum/skins/default/templates/badge.html8
-rw-r--r--forum/skins/default/templates/badges.html9
-rw-r--r--forum/skins/default/templates/base.html3
-rw-r--r--forum/skins/default/templates/post_contributor_info.html6
-rw-r--r--forum/skins/default/templates/question.html23
-rw-r--r--forum/skins/default/templates/user.html6
-rw-r--r--forum/skins/default/templates/user_recent.html3
-rw-r--r--forum/skins/default/templates/user_stats.html54
-rw-r--r--forum/templatetags/extra_filters.py3
-rw-r--r--forum/views/commands.py2
-rw-r--r--forum/views/meta.py8
-rw-r--r--forum/views/readers.py33
-rw-r--r--forum/views/users.py12
-rw-r--r--forum/views/writers.py14
19 files changed, 728 insertions, 281 deletions
diff --git a/forum/forms.py b/forum/forms.py
index e0452d82..e9781dc9 100644
--- a/forum/forms.py
+++ b/forum/forms.py
@@ -77,7 +77,7 @@ class TagNamesField(forms.CharField):
#singular form is odd in english, but required for pluralization
#in other languages
msg = ungettext('each tag must be shorter than %(max_chars)d character',#odd but added for completeness
- 'each tag must be shorter than %(max_shars)d characters',
+ 'each tag must be shorter than %(max_chars)d characters',
tag_length) % {'max_chars':tag_length}
raise forms.ValidationError(msg)
diff --git a/forum/management/commands/once_award_badges.py b/forum/management/commands/once_award_badges.py
index 372eb3aa..60457373 100644
--- a/forum/management/commands/once_award_badges.py
+++ b/forum/management/commands/once_award_badges.py
@@ -144,22 +144,10 @@ class Command(BaseCommand):
new_award.save()
def first_type_award(self):
- """
- This will award below badges for users first behaviors:
-
- (7, '巡逻兵', 3, '巡逻兵', '第一次标记垃圾帖子', 0, 0),
- (8, '清洁工', 3, '清洁工', '第一次撤销投票', 0, 0),
- (9, '批评家', 3, '批评家', '第一次反对票', 0, 0),
- (10, '小编', 3, '小编', '第一次编辑更新', 0, 0),
- (11, '村长', 3, '村长', '第一次重新标签', 0, 0),
- (12, '学者', 3, '学者', '第一次标记答案', 0, 0),
- (14, '支持者', 3, '支持者', '第一次赞成票', 0, 0),
- (16, '自传作者', 3, '自传作者', '完整填写用户资料所有选项', 0, 0),
- """
+
activity_types = ','.join('%s' % item for item in BADGE_AWARD_TYPE_FIRST.keys())
# ORDER BY user_id, activity_type
query = "SELECT id, user_id, activity_type, content_type_id, object_id FROM activity WHERE is_auditted = 0 AND activity_type IN (%s) ORDER BY user_id, activity_type" % activity_types
-
cursor = connection.cursor()
try:
cursor.execute(query)
@@ -203,8 +191,6 @@ class Command(BaseCommand):
def first_ask_be_voted(self):
"""
For user asked question and got first upvote, we award him following badge:
-
- (13, '学生', 3, '学生', '第一次提问并且有一次以上赞成票', 0, 0),
"""
query = "SELECT act.user_id, q.vote_up_count, act.object_id FROM " \
"activity act, question q WHERE act.activity_type = %s AND " \
diff --git a/forum/migrations/0005_install_badges.py b/forum/migrations/0005_install_badges.py
new file mode 100644
index 00000000..5c05ecdd
--- /dev/null
+++ b/forum/migrations/0005_install_badges.py
@@ -0,0 +1,417 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import DataMigration
+from django.db import models
+
+_ = lambda v:v #fake translation function so that badges are translated, but database takes keys
+
+INITIAL_BADGE_DATA = (
+ (_('Disciplined'), 3, _('disciplined'), _('Deleted own post with score of 3 or higher'), True, 0),
+ (_('Peer Pressure'), 3, _('peer-pressure'), _('Deleted own post with score of -3 or lower'), True, 0),
+ (_('Nice answer'), 3, _('nice-answer'), _('Answer voted up 10 times'), True, 0),
+ (_('Nice Question'), 3, _('nice-question'), _('Question voted up 10 times'), True, 0),
+ (_('Pundit'), 3, _('pundit'), _('Left 10 comments with score of 10 or more'), False, 0),
+ (_('Popular Question'), 3, _('popular-question'), _('Asked a question with 1,000 views'), True, 0),
+ (_('Citizen patrol'), 3, _('citizen-patrol'), _('First flagged post'), False, 0),
+ (_('Cleanup'), 3, _('cleanup'), _('First rollback'), False, 0),
+ (_('Critic'), 3, _('critic'), _('First down vote'), False, 0),
+ (_('Editor'), 3, _('editor'), _('First edit'), False, 0),
+ (_('Organizer'), 3, _('organizer'), _('First retag'), False, 0),
+ (_('Scholar'), 3, _('scholar'), _('First accepted answer on your own question'), False, 0),
+ (_('Student'), 3, _('student'), _('Asked first question with at least one up vote'), False, 0),
+ (_('Supporter'), 3, _('supporter'), _('First up vote'), False, 0),
+ (_('Teacher'), 3, _('teacher'), _('Answered first question with at least one up vote'), False, 0),
+ (_('Autobiographer'), 3, _('autobiographer'), _('Completed all user profile fields'), False, 0),
+ (_('Self-Learner'), 3, _('self-learner'), _('Answered your own question with at least 3 up votes'), True, 0),
+ (_('Great Answer'), 1, _('great-answer'), _('Answer voted up 100 times'), True, 0),
+ (_('Great Question'), 1, _('great-question'), _('Question voted up 100 times'), True, 0),
+ (_('Stellar Question'), 1, _('stellar-question'), _('Question favorited by 100 users'), True, 0),
+ (_('Famous question'), 1, _('famous-question'), _('Asked a question with 10,000 views'), True, 0),
+ (_('Alpha'), 2, _('alpha'), _('Actively participated in the private alpha'), False, 0),
+ (_('Good Answer'), 2, _('good-answer'), _('Answer voted up 25 times'), True, 0),
+ (_('Good Question'), 2, _('good-question'), _('Question voted up 25 times'), True, 0),
+ (_('Favorite Question'), 2, _('favorite-question'), _('Question favorited by 25 users'), True, 0),
+ (_('Civic duty'), 2, _('civic-duty'), _('Voted 300 times'), False, 0),
+ (_('Strunk & White'), 2, _('strunk-and-white'), _('Edited 100 entries'), False, 0),
+ (_('Generalist'), 2, _('generalist'), _('Active in many different tags'), False, 0),
+ (_('Expert'), 2, _('expert'), _('Very active in one tag'), False, 0),
+ (_('Yearling'), 2, _('yearling'), _('Active member for a year'), False, 0),
+ (_('Notable Question'), 2, _('notable-question'), _('Asked a question with 2,500 views'), True, 0),
+ (_('Enlightened'), 2, _('enlightened'), _('First answer was accepted with at least 10 up votes'), False, 0),
+ (_('Beta'), 2, _('beta'), _('Actively participated in the private beta'), False, 0),
+ (_('Guru'), 2, _('guru'), _('Accepted answer and voted up 40 times'), True, 0),
+ (_('Necromancer'), 2, _('necromancer'), _('Answered a question more than 60 days later with at least 5 votes'), True, 0),
+ (_('Taxonomist'), 2, _('taxonomist'), _('Created a tag used by 50 questions'), True, 0)
+)
+
+class Migration(DataMigration):
+
+ def forwards(self, orm):
+ "Write your forwards methods here."
+
+ for entry in INITIAL_BADGE_DATA:
+ name = entry[0]
+ type = entry[1]
+ slug = entry[2]
+ description = entry[3]
+ multiple = entry[4]
+
+ try:
+ badge = orm.Badge.objects.get(name=name)
+ print 'already have badge %s' % name
+ except orm.Badge.DoesNotExist:
+ print 'adding new badge %s' % name
+ badge = orm.Badge()
+ badge.name = name
+
+ badge.type = type
+ badge.slug = slug
+ badge.description = description
+ badge.multiple = multiple
+ badge.save()
+
+
+ def backwards(self, orm):
+ "Write your backwards methods here."
+ for entry in INITIAL_BADGE_DATA:
+ name = entry[0]
+ try:
+ badge = orm.Badge.objects.get(name = name)
+ badge.award_badge.clear()
+ badge.delete()
+ print 'deleted badge %s' % name
+ except orm.Badge.DoesNotExist:
+ print 'no such badge %s - so skipping' % name
+ pass
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'about': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'bronze': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'email_isvalid': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'email_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'gold': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),
+ 'gravatar': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}),
+ 'hide_ignored_questions': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'is_approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'questions_per_page': ('django.db.models.fields.SmallIntegerField', [], {'default': '10'}),
+ 'real_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+ 'reputation': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
+ 'silver': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),
+ 'tag_filter_setting': ('django.db.models.fields.CharField', [], {'default': "'ignored'", 'max_length': '16'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
+ 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'forum.activity': {
+ 'Meta': {'object_name': 'Activity', 'db_table': "u'activity'"},
+ 'active_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'activity_type': ('django.db.models.fields.SmallIntegerField', [], {}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_auditted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'forum.anonymousanswer': {
+ 'Meta': {'object_name': 'AnonymousAnswer'},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
+ 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'anonymous_answers'", 'to': "orm['forum.Question']"}),
+ 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+ 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}),
+ 'text': ('django.db.models.fields.TextField', [], {}),
+ 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
+ },
+ 'forum.anonymousquestion': {
+ 'Meta': {'object_name': 'AnonymousQuestion'},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
+ 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+ 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}),
+ 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}),
+ 'text': ('django.db.models.fields.TextField', [], {}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
+ 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
+ },
+ 'forum.answer': {
+ 'Meta': {'object_name': 'Answer', 'db_table': "u'answer'"},
+ 'accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'accepted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['auth.User']"}),
+ 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_answers'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_answers'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_answers'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),
+ 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['forum.Question']"}),
+ 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'forum.answerrevision': {
+ 'Meta': {'object_name': 'AnswerRevision', 'db_table': "u'answer_revision'"},
+ 'answer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Answer']"}),
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answerrevisions'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'revised_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}),
+ 'text': ('django.db.models.fields.TextField', [], {})
+ },
+ 'forum.authkeyuserassociation': {
+ 'Meta': {'object_name': 'AuthKeyUserAssociation'},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+ 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_keys'", 'to': "orm['auth.User']"})
+ },
+ 'forum.award': {
+ 'Meta': {'object_name': 'Award', 'db_table': "u'award'"},
+ 'awarded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'badge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_badge'", 'to': "orm['forum.Badge']"}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'notified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_user'", 'to': "orm['auth.User']"})
+ },
+ 'forum.badge': {
+ 'Meta': {'unique_together': "(('name', 'type'),)", 'object_name': 'Badge', 'db_table': "u'badge'"},
+ 'awarded_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'awarded_to': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'badges'", 'through': "'Award'", 'to': "orm['auth.User']"}),
+ 'description': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'multiple': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}),
+ 'type': ('django.db.models.fields.SmallIntegerField', [], {})
+ },
+ 'forum.book': {
+ 'Meta': {'object_name': 'Book', 'db_table': "u'book'"},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'cover_img': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'pages': ('django.db.models.fields.SmallIntegerField', [], {}),
+ 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+ 'publication': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'published_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'questions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'book'", 'db_table': "'book_question'", 'to': "orm['forum.Question']"}),
+ 'short_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'forum.bookauthorinfo': {
+ 'Meta': {'object_name': 'BookAuthorInfo', 'db_table': "u'book_author_info'"},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'blog_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'forum.bookauthorrss': {
+ 'Meta': {'object_name': 'BookAuthorRss', 'db_table': "u'book_author_rss'"},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'rss_created_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'forum.comment': {
+ 'Meta': {'object_name': 'Comment', 'db_table': "u'comment'"},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'comment': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'comments'", 'to': "orm['auth.User']"})
+ },
+ 'forum.emailfeedsetting': {
+ 'Meta': {'object_name': 'EmailFeedSetting'},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'feed_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
+ 'frequency': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '8'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'reported_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'subscriber': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'forum.favoritequestion': {
+ 'Meta': {'object_name': 'FavoriteQuestion', 'db_table': "u'favorite_question'"},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_favorite_questions'", 'to': "orm['auth.User']"})
+ },
+ 'forum.flaggeditem': {
+ 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'FlaggedItem', 'db_table': "u'flagged_item'"},
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'flagged_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flaggeditems'", 'to': "orm['auth.User']"})
+ },
+ 'forum.markedtag': {
+ 'Meta': {'object_name': 'MarkedTag'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'reason': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
+ 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_selections'", 'to': "orm['forum.Tag']"}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tag_selections'", 'to': "orm['auth.User']"})
+ },
+ 'forum.question': {
+ 'Meta': {'object_name': 'Question', 'db_table': "u'question'"},
+ 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'answer_accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'answer_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questions'", 'to': "orm['auth.User']"}),
+ 'close_reason': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'closed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'closed_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'closed_questions'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_questions'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'favorited_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'favorite_questions'", 'through': "'FavoriteQuestion'", 'to': "orm['auth.User']"}),
+ 'favourite_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'followed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'followed_questions'", 'to': "orm['auth.User']"}),
+ 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_activity_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_activity_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'last_active_in_questions'", 'to': "orm['auth.User']"}),
+ 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_questions'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_questions'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),
+ 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}),
+ 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}),
+ 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'questions'", 'to': "orm['forum.Tag']"}),
+ 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
+ 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'forum.questionrevision': {
+ 'Meta': {'object_name': 'QuestionRevision', 'db_table': "u'question_revision'"},
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questionrevisions'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Question']"}),
+ 'revised_at': ('django.db.models.fields.DateTimeField', [], {}),
+ 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}),
+ 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}),
+ 'text': ('django.db.models.fields.TextField', [], {}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'})
+ },
+ 'forum.questionview': {
+ 'Meta': {'object_name': 'QuestionView'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'viewed'", 'to': "orm['forum.Question']"}),
+ 'when': ('django.db.models.fields.DateTimeField', [], {}),
+ 'who': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'question_views'", 'to': "orm['auth.User']"})
+ },
+ 'forum.repute': {
+ 'Meta': {'object_name': 'Repute', 'db_table': "u'repute'"},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'negative': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),
+ 'positive': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),
+ 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}),
+ 'reputation': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+ 'reputation_type': ('django.db.models.fields.SmallIntegerField', [], {}),
+ 'reputed_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'forum.tag': {
+ 'Meta': {'object_name': 'Tag', 'db_table': "u'tag'"},
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'created_tags'", 'to': "orm['auth.User']"}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_tags'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+ 'used_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
+ },
+ 'forum.validationhash': {
+ 'Meta': {'unique_together': "(('user', 'type'),)", 'object_name': 'ValidationHash'},
+ 'expiration': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 5, 2, 12, 29, 51, 920204)'}),
+ 'hash_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'seed': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'forum.vote': {
+ 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'Vote', 'db_table': "u'vote'"},
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['auth.User']"}),
+ 'vote': ('django.db.models.fields.SmallIntegerField', [], {}),
+ 'voted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'})
+ }
+ }
+
+ complete_apps = ['forum']
diff --git a/forum/skins/default/media/js/com.cnprog.i18n.js b/forum/skins/default/media/js/com.cnprog.i18n.js
index 23164aab..03690dc5 100755..100644
--- a/forum/skins/default/media/js/com.cnprog.i18n.js
+++ b/forum/skins/default/media/js/com.cnprog.i18n.js
@@ -1,162 +1,225 @@
-
-//var i18nLang;
-var i18nZh = {
- 'insufficient privilege':'用户权限不在操作范围',
- 'cannot pick own answer as best':'不能设置自己的回答为最佳答案',
- 'anonymous users cannot select favorite questions':'匿名用户不能收藏问题,请先',
- 'please login':'注册或者登录',
- 'anonymous users cannot vote':'匿名用户不能投票',
- '>15 points requried to upvote':'需要+15积分才能投支持票。',
- '>100 points required to downvote':'需要+100积分才能投反对票。',
- 'please see': '查看',
- 'cannot vote for own posts':'不能给自己的帖子投票',
- 'daily vote cap exhausted':'对不起,您已用完今日所有的投票。',
- 'cannot revoke old vote':'这个投票已经过时,不能撤销。',
- 'please confirm offensive':"确定要归类该帖为广告、人身攻击、恶意言论吗?",
- 'anonymous users cannot flag offensive posts':'匿名用户不能操作,请先',
- 'cannot flag message as offensive twice':'不能重复操作。',
- 'flag offensive cap exhausted':'对不起,您已用完今日所有的5次‘水帖’操作。',
- 'need >15 points to report spam':"需要+15积分才能归类‘垃圾帖’。",
- 'confirm delete':"确定要删除/撤销删除该帖吗?",
- 'anonymous users cannot delete/undelete':"匿名用户不能删除或撤销删除帖子",
- 'post recovered':"操作成功!该帖子已被恢复。",
- 'post deleted':"操作成功!该帖子已删除。",
- 'add comment':'添加评论',
- 'community karma points':'社区积分',
- 'to comment, need':'评论需要',
- 'delete this comment':'删除此评论',
- 'hide comments':"隐藏评论",
- 'add a comment':"添加评论",
- 'comments':"评论",
- 'confirm delete comment':"真要删除此评论吗?",
- 'characters':'字符',
- 'can write':'还可写',
- 'click to close':'点击消息框关闭',
- 'loading...':'读取中...',
- 'tags cannot be empty':'标签不能为空。',
- 'tablimits info':"最多5个标签,每个标签长度小于20个字符。",
- 'content cannot be empty':'内容不能为空。',
- 'content minchars': '请输入至少 {0} 字符。',
- 'please enter title':'请输入标题。',
- 'title minchars':"请输入至少 {0} 字符。",
- 'delete':'删除',
- 'undelete': '取消',
- 'bold':'粗体',
- 'italic':'斜体',
- 'link':'超链接',
- 'quote':'引用',
- 'preformatted text':'代码',
- 'image':'图片',
- 'numbered list':'数字编号列表',
- 'bulleted list':'项目符号列表',
- 'heading':'标题',
- 'horizontal bar':'水平线',
- 'undo':'撤销',
- 'redo':'重做',
- 'enter image url':'<b>输入图片地址</b></p><p>示例:<br />http://www.example.com/image.jpg \"我的截图\"',
- 'enter url':'<b>输入Web地址</b></p><p>示例:<br />http://www.cnprog.com/ \"我的网站\"</p>"',
- 'upload image':'或者上传本地图片:'
-};
-
-var i18nEn = {
- 'need >15 points to report spam':'need >15 points to report spam ',
- '>15 points requried to upvote':'>15 points required to upvote ',
- 'tags cannot be empty':'please enter at least one tag',
- 'anonymous users cannot vote':'sorry, anonymous users cannot vote ',
- 'anonymous users cannot select favorite questions':'sorry, anonymous users cannot select favorite questions ',
- 'to comment, need': '(to comment other people\'s posts, karma ',
- 'please see':'please see ',
- 'community karma points':' or more is necessary) - ',
- 'upload image':'Upload image:',
- 'enter image url':'enter URL of the image, e.g. http://www.example.com/image.jpg \"image title\"',
- 'enter url':'enter Web address, e.g. http://www.example.com \"page title\"',
- 'daily vote cap exhausted':'sorry, you\'ve used up todays vote cap',
- 'cannot pick own answer as best':'sorry, you cannot accept your own answer',
- 'cannot revoke old vote':'sorry, older votes cannot be revoked',
- 'please confirm offensive':'are you sure this post is offensive, contains spam, advertising, malicious remarks, etc.?',
- 'flag offensive cap exhausted':'sorry, you\'ve used up todays cap of flagging offensive messages ',
- 'confirm delete':'are you sure you want to delete this?',
- 'anonymous users cannot delete/undelete':'sorry, anonymous users cannot delete or undelete posts',
- 'post recovered':'your post is now restored!',
- 'post deleted':'your post has been deleted',
- 'confirm delete comment':'do you really want to delete this comment?',
- 'can write':'have ',
- 'tablimits info':'up to 5 tags, no more than 20 characters each',
- 'content minchars': 'please enter more than {0} characters',
- 'title minchars':"please enter at least {0} characters",
- 'characters':'characters left',
- 'cannot vote for own posts':'sorry, you cannot vote for your own posts',
- 'cannot flag message as offensive twice':'cannot flag message as offensive twice ',
- '>100 points required to downvote':'>100 points required to downvote '
-};
-
-var i18nEs = {
- 'insufficient privilege':'privilegio insuficiente',
- 'cannot pick own answer as best':'no puede escoger su propia respuesta como la mejor',
- 'anonymous users cannot select favorite questions':'usuarios anonimos no pueden seleccionar',
- 'please login':'por favor inicie sesión',
- 'anonymous users cannot vote':'usuarios anónimos no pueden votar',
- '>15 points requried to upvote': '>15 puntos requeridos para votar positivamente',
- '>100 points required to downvote':'>100 puntos requeridos para votar negativamente',
- 'please see': 'por favor vea',
- 'cannot vote for own posts':'no se puede votar por sus propias publicaciones',
- 'daily vote cap exhausted':'cuota de votos diarios excedida',
- 'cannot revoke old vote':'no puede revocar un voto viejo',
- 'please confirm offensive':"por favor confirme ofensiva",
- 'anonymous users cannot flag offensive posts':'usuarios anónimos no pueden marcar publicaciones como ofensivas',
- 'cannot flag message as offensive twice':'no puede marcar mensaje como ofensivo dos veces',
- 'flag offensive cap exhausted':'cuota para marcar ofensivas ha sido excedida',
- 'need >15 points to report spam':"necesita >15 puntos para reportar spam",
- 'confirm delete':"¿Está seguro que desea borrar esto?",
- 'anonymous users cannot delete/undelete':"usuarios anónimos no pueden borrar o recuperar publicaciones",
- 'post recovered':"publicación recuperada",
- 'post deleted':"publicación borrada。",
- 'add comment':'agregar comentario',
- 'community karma points':'reputación comunitaria',
- 'to comment, need':'para comentar, necesita reputación',
- 'delete this comment':'borrar este comentario',
- 'hide comments':"ocultar comentarios",
- 'add a comment':"agregar comentarios",
- 'comments':"comentarios",
- 'confirm delete comment':"¿Realmente desea borrar este comentario?",
- 'characters':'caracteres faltantes',
- 'can write':'tiene ',
- 'click to close':'haga click para cerrar',
- 'loading...':'cargando...',
- 'tags cannot be empty':'las etiquetas no pueden estar vacías',
- 'tablimits info':"hasta 5 etiquetas de no mas de 20 caracteres cada una",
- 'content cannot be empty':'el contenido no puede estar vacío',
- 'content minchars': 'por favor introduzca mas de {0} caracteres',
- 'please enter title':'por favor ingrese un título',
- 'title minchars':"por favor introduzca al menos {0} caracteres",
- 'delete':'borrar',
- 'undelete': 'recuperar',
- 'bold': 'negrita',
- 'italic':'cursiva',
- 'link':'enlace',
- 'quote':'citar',
- 'preformatted text':'texto preformateado',
- 'image':'imagen',
- 'numbered list':'lista numerada',
- 'bulleted list':'lista no numerada',
- 'heading':'标题',
- 'horizontal bar':'barra horizontal',
- 'undo':'deshacer',
- 'redo':'rehacer',
- 'enter image url':'introduzca la URL de la imagen, por ejemplo:<br />http://www.example.com/image.jpg \"titulo de imagen\"',
- 'enter url':'introduzca direcciones web, ejemplo:<br />http://www.cnprog.com/ \"titulo del enlace\"</p>"',
- 'upload image':'cargar imagen:',
- 'questions/' : 'preguntas/',
- 'answers/' : 'respuestas/',
- 'comments/' : 'comentarios/',
- 'vote/' : 'votar/',
- 'delete/' : 'eliminar/'
-};
-
-var i18n = {
- 'en':i18nEn,
- 'zh_CN':i18nZh,
- 'es':i18nEs
-};
-
-var i18n_dict = i18n[i18nLang];
+//var i18nLang;
+var i18nZh = {
+ 'insufficient privilege':'用户权限不在操作范围',
+ 'cannot pick own answer as best':'不能设置自己的回答为最佳答案',
+ 'anonymous users cannot select favorite questions':'匿名用户不能收藏问题,请先',
+ 'please login':'注册或者登录',
+ 'anonymous users cannot vote':'匿名用户不能投票',
+ '>15 points requried to upvote':'需要+15积分才能投支持票。',
+ '>100 points required to downvote':'需要+100积分才能投反对票。',
+ 'please see': '查看',
+ 'cannot vote for own posts':'不能给自己的帖子投票',
+ 'daily vote cap exhausted':'对不起,您已用完今日所有的投票。',
+ 'cannot revoke old vote':'这个投票已经过时,不能撤销。',
+ 'please confirm offensive':"确定要归类该帖为广告、人身攻击、恶意言论吗?",
+ 'anonymous users cannot flag offensive posts':'匿名用户不能操作,请先',
+ 'cannot flag message as offensive twice':'不能重复操作。',
+ 'flag offensive cap exhausted':'对不起,您已用完今日所有的5次‘水帖’操作。',
+ 'need >15 points to report spam':"需要+15积分才能归类‘垃圾帖’。",
+ 'confirm delete':"确定要删除/撤销删除该帖吗?",
+ 'anonymous users cannot delete/undelete':"匿名用户不能删除或撤销删除帖子",
+ 'post recovered':"操作成功!该帖子已被恢复。",
+ 'post deleted':"操作成功!该帖子已删除。",
+ 'add comment':'添加评论',
+ 'community karma points':'社区积分',
+ 'to comment, need':'评论需要',
+ 'delete this comment':'删除此评论',
+ 'hide comments':"隐藏评论",
+ 'add a comment':"添加评论",
+ 'comments':"评论",
+ 'confirm delete comment':"真要删除此评论吗?",
+ 'characters':'字符',
+ 'can write':'还可写',
+ 'click to close':'点击消息框关闭',
+ 'loading...':'读取中...',
+ 'tags cannot be empty':'标签不能为空。',
+ 'tablimits info':"最多5个标签,每个标签长度小于20个字符。",
+ 'content cannot be empty':'内容不能为空。',
+ 'content minchars': '请输入至少 {0} 字符。',
+ 'please enter title':'请输入标题。',
+ 'title minchars':"请输入至少 {0} 字符。",
+ 'delete':'删除',
+ 'undelete': '取消',
+ 'bold':'粗体',
+ 'italic':'斜体',
+ 'link':'超链接',
+ 'quote':'引用',
+ 'preformatted text':'代码',
+ 'image':'图片',
+ 'numbered list':'数字编号列表',
+ 'bulleted list':'项目符号列表',
+ 'heading':'标题',
+ 'horizontal bar':'水平线',
+ 'undo':'撤销',
+ 'redo':'重做',
+ 'enter image url':'<b>输入图片地址</b></p><p>示例:<br />http://www.example.com/image.jpg \"我的截图\"',
+ 'enter url':'<b>输入Web地址</b></p><p>示例:<br />http://www.cnprog.com/ \"我的网站\"</p>"',
+ 'upload image':'或者上传本地图片:'
+};
+
+var i18nEn = {
+ 'need >15 points to report spam':'need >15 points to report spam ',
+ '>15 points requried to upvote':'>15 points required to upvote ',
+ 'tags cannot be empty':'please enter at least one tag',
+ 'anonymous users cannot vote':'sorry, anonymous users cannot vote ',
+ 'anonymous users cannot select favorite questions':'sorry, anonymous users cannot select favorite questions ',
+ 'to comment, need': '(to comment other people\'s posts, karma ',
+ 'please see':'please see ',
+ 'community karma points':' or more is necessary) - ',
+ 'upload image':'Upload image:',
+ 'enter image url':'enter URL of the image, e.g. http://www.example.com/image.jpg \"image title\"',
+ 'enter url':'enter Web address, e.g. http://www.example.com \"page title\"',
+ 'daily vote cap exhausted':'sorry, you\'ve used up todays vote cap',
+ 'cannot pick own answer as best':'sorry, you cannot accept your own answer',
+ 'cannot revoke old vote':'sorry, older votes cannot be revoked',
+ 'please confirm offensive':'are you sure this post is offensive, contains spam, advertising, malicious remarks, etc.?',
+ 'flag offensive cap exhausted':'sorry, you\'ve used up todays cap of flagging offensive messages ',
+ 'confirm delete':'are you sure you want to delete this?',
+ 'anonymous users cannot delete/undelete':'sorry, anonymous users cannot delete or undelete posts',
+ 'post recovered':'your post is now restored!',
+ 'post deleted':'your post has been deleted',
+ 'confirm delete comment':'do you really want to delete this comment?',
+ 'can write':'have ',
+ 'tablimits info':'up to 5 tags, no more than 20 characters each',
+ 'content minchars': 'please enter more than {0} characters',
+ 'title minchars':"please enter at least {0} characters",
+ 'characters':'characters left',
+ 'cannot vote for own posts':'sorry, you cannot vote for your own posts',
+ 'cannot flag message as offensive twice':'cannot flag message as offensive twice ',
+ '>100 points required to downvote':'>100 points required to downvote '
+};
+
+var i18nTr = {
+ 'insufficient privilege':'buna yetkiniz yoktur',
+ 'cannot pick own answer as best':'en cevap olarak kendi cevabınızı seçemezsiniz',
+ 'anonymous users cannot select favorite questions':'üye girişi yapmadan favori seçemezsiniz',
+ 'please login':'lütfen üye girişi yapınız',
+ 'anonymous users cannot vote':'üye girişi yapmadan oy kullanamazsınız',
+ '>15 points requried to upvote': 'beğeninizi göstermek için en az 15 puan toplamalısınız',
+ '>100 points required to downvote':'beğenmediğinizi göstermek için en az 100 puan toplamalısınız',
+ 'please see': 'lütfen bakın',
+ 'cannot vote for own posts':'kendi yazılarınıza oy veremezsiniz',
+ 'daily vote cap exhausted':'bugünlük oy verme kotanız doldu',
+ 'cannot revoke old vote':'verilen bir oyu iptal edemezsiniz',
+ 'please confirm offensive':"şikayetinizi onaylayın",
+ 'anonymous users cannot flag offensive posts':'üye girişi yapmadan şikayet gönderemezsiniz',
+ 'cannot flag message as offensive twice':'şikayet mesajı olarak iki kez işaretlemelisiniz',
+ 'flag offensive cap exhausted':'şikayet kotası aşıldı',
+ 'need >15 points to report spam':"spam olarak bildirmek için an az 15 puanınız olmalı",
+ 'confirm delete':"Bunu silmek istediğinizden emin misiniz?",
+ 'anonymous users cannot delete/undelete':"üye girişi yapmadan yazı silemez yada geri alamazsınız",
+ 'post recovered':"yazı geri alındı",
+ 'post deleted':"yazı silindi",
+ 'add comment':'yorum ekle',
+ 'community karma points':'site itibar puanları',
+ 'to comment, need':'Yorum için itibar puanınız olmalı',
+ 'delete this comment':'bu yorumu sil',
+ 'hide comments':"yorumları gizle",
+ 'add a comment':"yorum ekle",
+ 'comments':"yorumlar",
+ 'confirm delete comment':"yorumu silmek istediğinizden emin misiniz?",
+ 'characters':'karakter eksik',
+ 'can write':'yazılabilir ',
+ 'click to close':'kapatmak için tıklayın',
+ 'loading...':'yükleniyor...',
+ 'tags cannot be empty':'etiketler boş olamaz',
+ 'tablimits info':"En fazla 5 etiket ve her biri en fazla 20 karakter",
+ 'content cannot be empty':'içerik boş olamaz',
+ 'content minchars': 'Lütfen en az (0) karakter girin',
+ 'please enter title':'lütfen bir başlık yazın',
+ 'title minchars':"Lütfen en az (0) karakter girin",
+ 'delete':'sil',
+ 'undelete': 'geri al',
+ 'bold': 'kalın',
+ 'italic':'italik',
+ 'link':'link',
+ 'quote':'alıntı',
+ 'preformatted text':'hazır metin',
+ 'image':'resimler',
+ 'numbered list':'numaralı liste',
+ 'bulleted list':'işaretli liste',
+ 'heading':'Başlık',
+ 'horizontal bar':'yatay bar',
+ 'undo':'geri',
+ 'redo':'yeniden',
+ 'enter image url':'örnek resmin URLsini girin: <br />http://www.example.com/image.jpg \"resim başlığı\"',
+ 'enter url':'web adresini girin: <br />http://www.cnprog.com/ \"başlık bağlantısı\"</p>"',
+ 'upload image':'resim yükle:',
+ 'questions/' : 'sorular/',
+ 'answers/' : 'cevaplar/',
+ 'comments/' : 'yorumlar/',
+ 'vote/' : 'oy/',
+ 'delete/' : 'sil/'
+};
+
+var i18nEs = {
+ 'insufficient privilege':'privilegio insuficiente',
+ 'cannot pick own answer as best':'no puede escoger su propia respuesta como la mejor',
+ 'anonymous users cannot select favorite questions':'usuarios anonimos no pueden seleccionar',
+ 'please login':'por favor inicie sesión',
+ 'anonymous users cannot vote':'usuarios anónimos no pueden votar',
+ '>15 points requried to upvote': '>15 puntos requeridos para votar positivamente',
+ '>100 points required to downvote':'>100 puntos requeridos para votar negativamente',
+ 'please see': 'por favor vea',
+ 'cannot vote for own posts':'no se puede votar por sus propias publicaciones',
+ 'daily vote cap exhausted':'cuota de votos diarios excedida',
+ 'cannot revoke old vote':'no puede revocar un voto viejo',
+ 'please confirm offensive':"por favor confirme ofensiva",
+ 'anonymous users cannot flag offensive posts':'usuarios anónimos no pueden marcar publicaciones como ofensivas',
+ 'cannot flag message as offensive twice':'no puede marcar mensaje como ofensivo dos veces',
+ 'flag offensive cap exhausted':'cuota para marcar ofensivas ha sido excedida',
+ 'need >15 points to report spam':"necesita >15 puntos para reportar spam",
+ 'confirm delete':"¿Está seguro que desea borrar esto?",
+ 'anonymous users cannot delete/undelete':"usuarios anónimos no pueden borrar o recuperar publicaciones",
+ 'post recovered':"publicación recuperada",
+ 'post deleted':"publicación borrada。",
+ 'add comment':'agregar comentario',
+ 'community karma points':'reputación comunitaria',
+ 'to comment, need':'para comentar, necesita reputación',
+ 'delete this comment':'borrar este comentario',
+ 'hide comments':"ocultar comentarios",
+ 'add a comment':"agregar comentarios",
+ 'comments':"comentarios",
+ 'confirm delete comment':"¿Realmente desea borrar este comentario?",
+ 'characters':'caracteres faltantes',
+ 'can write':'tiene ',
+ 'click to close':'haga click para cerrar',
+ 'loading...':'cargando...',
+ 'tags cannot be empty':'las etiquetas no pueden estar vacías',
+ 'tablimits info':"hasta 5 etiquetas de no mas de 20 caracteres cada una",
+ 'content cannot be empty':'el contenido no puede estar vacío',
+ 'content minchars': 'por favor introduzca mas de {0} caracteres',
+ 'please enter title':'por favor ingrese un título',
+ 'title minchars':"por favor introduzca al menos {0} caracteres",
+ 'delete':'borrar',
+ 'undelete': 'recuperar',
+ 'bold': 'negrita',
+ 'italic':'cursiva',
+ 'link':'enlace',
+ 'quote':'citar',
+ 'preformatted text':'texto preformateado',
+ 'image':'imagen',
+ 'numbered list':'lista numerada',
+ 'bulleted list':'lista no numerada',
+ 'heading':'标题',
+ 'horizontal bar':'barra horizontal',
+ 'undo':'deshacer',
+ 'redo':'rehacer',
+ 'enter image url':'introduzca la URL de la imagen, por ejemplo:<br />http://www.example.com/image.jpg \"titulo de imagen\"',
+ 'enter url':'introduzca direcciones web, ejemplo:<br />http://www.cnprog.com/ \"titulo del enlace\"</p>"',
+ 'upload image':'cargar imagen:',
+ 'questions/' : 'preguntas/',
+ 'answers/' : 'respuestas/',
+ 'comments/' : 'comentarios/',
+ 'vote/' : 'votar/',
+ 'delete/' : 'eliminar/'
+};
+
+var i18n = {
+ 'en':i18nEn,
+ 'zh-cn':i18nZh,
+ 'es':i18nEs,
+ 'tr':i18nTr
+};
+
+var i18n_dict = i18n[i18nLang];
diff --git a/forum/skins/default/media/style/style.css b/forum/skins/default/media/style/style.css
index 3f51e619..855dc75d 100755
--- a/forum/skins/default/media/style/style.css
+++ b/forum/skins/default/media/style/style.css
@@ -796,6 +796,8 @@ blockquote {
}
/*标签*/
+/* todo: probably needs to be removed
+conflicts with WMD!
.tag {
font-size: 13px;
font-weight: normal;
@@ -808,6 +810,7 @@ blockquote {
border-right: 1px solid #CCC;
padding: 1px 8px 1px 8px;
}
+*/
.tags {
font-family: sans-serif;
diff --git a/forum/skins/default/templates/badge.html b/forum/skins/default/templates/badge.html
index af6aa2a2..99d74e1b 100644
--- a/forum/skins/default/templates/badge.html
+++ b/forum/skins/default/templates/badge.html
@@ -1,9 +1,9 @@
-{% extends "base_content.html" %}
+{% extends "base.html" %}
<!-- template badge.html -->
{% load i18n %}
{% load extra_tags %}
{% load humanize %}
-{% block title %}{% spaceless %}{{ badge.name }} - {% trans "Badge" %}{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans badge.name %} - {% trans "Badge" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -18,12 +18,12 @@
</div>
<div id="main-body" style="width:100%;margin-bottom:20px">
<p>
- <a href="{{badge.get_absolute_url}}" title="{{ badge.get_type_display }} : {{ badge.description }}" class="medal"><span class="badge{{ badge.type }}">&#9679;</span>&nbsp;{{ badge.name }}</a> {{ badge.description }}
+ <a href="{{badge.get_absolute_url}}" title="{{ badge.get_type_display }} : {% trans badge.description %}" class="medal"><span class="badge{{ badge.type }}">&#9679;</span>&nbsp;{% trans badge.name %}</a> {% trans badge.description %}
</p>
<div>
{% if badge.awarded_count %}
<p style="float:left"><span class="count">{{ awards|length|intcomma }}</span>
- <strong>{% trans "The users have been awarded with badges:" %}</strong></p>
+ <strong>{% blocktrans count awards|length as num_awardees %}user received this badge:{% plural %}users received this badge:{% endblocktrans %}</strong></p>
{% endif %}
</div>
<div id="award-list" style="clear:both;margin-left:20px;line-height:25px;">
diff --git a/forum/skins/default/templates/badges.html b/forum/skins/default/templates/badges.html
index 8de93df5..9fbd6395 100644
--- a/forum/skins/default/templates/badges.html
+++ b/forum/skins/default/templates/badges.html
@@ -34,11 +34,12 @@
{% endfor %}
</div>
<div style="float:left;width:230px;">
- <a href="{{badge.get_absolute_url}}" title="{{ badge.get_type_display }} : {{ badge.description }}" class="medal"><span class="badge{{ badge.type }}">&#9679;</span>&nbsp;{{ badge.name }}</a><strong> &#215; {{ badge.awarded_count|intcomma }}</strong>
+ <a href="{{badge.get_absolute_url}}"
+ title="{% trans badge.get_type_display %} : {% trans badge.description %}"
+ class="medal"><span class="badge{{ badge.type }}">&#9679;</span>&nbsp;{% trans badge.name %}</a><strong>
+ &#215; {{ badge.awarded_count|intcomma }}</strong>
</div>
- <p style="float:left;margin-top:8px;">
- {{ badge.description }}
- </p>
+ <p style="float:left;margin-top:8px;">{% trans badge.description %}</p>
</div>
{% endfor %}
</div>
diff --git a/forum/skins/default/templates/base.html b/forum/skins/default/templates/base.html
index ed674fef..a4e4ceed 100644
--- a/forum/skins/default/templates/base.html
+++ b/forum/skins/default/templates/base.html
@@ -38,6 +38,7 @@
</script>
{% endif %}
{% if active_tab != "tags" and active_tab != "users" %}
+ {% comment %}start asking question with title from search query{% endcomment %}
<script type="text/javascript">
$(document).ready(function(){
$('#nav_ask').click(
@@ -50,6 +51,7 @@
);
});
</script>
+ {% comment %}focus input on the search bar{% endcomment %}
<script type="text/javascript">
$(document).ready(function() {
{% if active_tab != "ask" %}
@@ -59,7 +61,6 @@
{% endif %}
});
</script>
-
{% endif %}
{% block forejs %}
{% endblock %}
diff --git a/forum/skins/default/templates/post_contributor_info.html b/forum/skins/default/templates/post_contributor_info.html
index 9997be5f..3fc3f400 100644
--- a/forum/skins/default/templates/post_contributor_info.html
+++ b/forum/skins/default/templates/post_contributor_info.html
@@ -6,11 +6,7 @@
{% if wiki %}
<p>{% trans "community wiki" %}</p>
<p>
- {% blocktrans count post.revisions.all|length as rev_count %}
- one revision
- {% plural %}
- {{rev_count}} revisions
- {% endblocktrans %}
+ {% blocktrans count post.revisions.all|length as rev_count %}one revision{% plural %}{{rev_count}} revisions{% endblocktrans %}
</p>
<p>{{post.author.get_profile_link}}</p>
{% else %}
diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html
index 79ff9a5b..48b6d719 100644
--- a/forum/skins/default/templates/question.html
+++ b/forum/skins/default/templates/question.html
@@ -195,16 +195,9 @@
{% endif %}
{% if question.comment_count > 5 %}
{% if request.user|can_add_comments:question %}/
- {% blocktrans count question.get_comments|slice:"5:"|length as counter %}
- see <strong>one</strong> more
- {% plural %}
- see <strong>{{counter}}</strong> more
- {% endblocktrans %}
+ {% blocktrans count question.get_comments|slice:"5:"|length as counter %}see <strong>one</strong> more{% plural %}see <strong>{{counter}}</strong> more{% endblocktrans %}
{% else %}
- {% blocktrans count question.get_comments|slice:"5:"|length as counter %}
- see <strong>one</strong> more comment
- {% plural %}
- see <strong>{{counter}}</strong> more comments
+ {% blocktrans count question.get_comments|slice:"5:"|length as counter %}see <strong>one</strong> more comment{% plural %}see <strong>{{counter}}</strong> more comments
{% endblocktrans %}
{% endif %}
{% endif %}</a>
@@ -344,17 +337,9 @@
{% endif %}
{% if answer.comment_count > 5 %}
{% if request.user|can_add_comments:answer %}/
- {% blocktrans count answer.get_comments|slice:"5:"|length as counter %}
- see <strong>one</strong> more
- {% plural %}
- see <strong>{{counter}}</strong> more
- {% endblocktrans %}
+ {% blocktrans count answer.get_comments|slice:"5:"|length as counter %}see <strong>one</strong> more{% plural %}see <strong>{{counter}}</strong> more{% endblocktrans %}
{% else %}
- {% blocktrans count answer.get_comments|slice:"5:"|length as counter %}
- see <strong>one</strong> more comment
- {% plural %}
- see <strong>{{counter}}</strong> more comments
- {% endblocktrans %}
+ {% blocktrans count answer.get_comments|slice:"5:"|length as counter %}see <strong>one</strong> more comment{% plural %} see <strong>{{counter}}</strong> more comments{% endblocktrans %}
{% endif %}
{% endif %}</a>
{% endif %}
diff --git a/forum/skins/default/templates/user.html b/forum/skins/default/templates/user.html
index 8fd9e267..833c2058 100644
--- a/forum/skins/default/templates/user.html
+++ b/forum/skins/default/templates/user.html
@@ -18,11 +18,7 @@
<script type="text/javascript">
var viewUserID = {{view_user.id}};
$().ready(function(){
- {% ifequal view_user request.user%}
- $("#nav_profile").attr('className',"on");
- {% else %}
- $("#nav_users").attr('className',"on");
- {% endifequal %}
+ $("#nav_users").attr('className',"on");
});
</script>
{% block userjs %}
diff --git a/forum/skins/default/templates/user_recent.html b/forum/skins/default/templates/user_recent.html
index b704ab25..78347993 100644
--- a/forum/skins/default/templates/user_recent.html
+++ b/forum/skins/default/templates/user_recent.html
@@ -2,6 +2,7 @@
<!-- user_recent.html -->
{% load extra_tags %}
{% load humanize %}
+{% load i18n %}
{% block usercontent %}
<div style="padding-top:5px;font-size:13px;">
{% for act in activities %}
@@ -12,7 +13,7 @@
</div>
<div style="float:left;overflow:hidden;">
{% ifequal act.type_id 7 %}
- <a href="{{act.badge.get_absolute_url}}" title="{{ act.badge.get_type_display }} : {{ act.badge.description }}" class="medal"><span class="badge{{ act.badge.type }}">&#9679;</span>&nbsp;{{ act.badge.name }}</a>
+ <a href="{{act.badge.get_absolute_url}}" title="{{ act.badge.get_type_display }} : {% trans act.badge.description %}" class="medal"><span class="badge{{ act.badge.type }}">&#9679;</span>&nbsp;{% trans act.badge.name %}</a>
{% else %}
<span class="post-type-{{ act.type_id }}"><a href="{{ act.title_link }}">{{ act.title }}</a></span>
{% if act.summary %}<span class="revision-summary">{{ act.summary }}</span>{% endif %}
diff --git a/forum/skins/default/templates/user_stats.html b/forum/skins/default/templates/user_stats.html
index 482b1228..ae24a374 100644
--- a/forum/skins/default/templates/user_stats.html
+++ b/forum/skins/default/templates/user_stats.html
@@ -8,24 +8,12 @@
<a name="questions"></a>
{% spaceless %}
- <h2>
- {% blocktrans count questions|length as counter %}
- <span class="count">1</span> Question
- {% plural %}
- <span class="count">{{counter}}</span> Questions
- {% endblocktrans %}
- </h2>
+ <h2>{% blocktrans count questions|length as counter %}<span class="count">1</span> Question{% plural %}<span class="count">{{counter}}</span> Questions{% endblocktrans %}</h2>
{% endspaceless %}
{% include "users_questions.html" %}
<a name="answers"></a>
{% spaceless %}
- <h2>
- {% blocktrans count answered_questions|length as counter %}
- <span class="count">1</span> Answer
- {% plural %}
- <span class="count">{{counter}}</span> Answers
- {% endblocktrans %}
- </h2>
+ <h2>{% blocktrans count answered_questions|length as counter %}<span class="count">1</span> Answer{% plural %}<span class="count">{{counter}}</span> Answers{% endblocktrans %}</h2>
{% endspaceless %}
<div class="user-stats-table">
{% for answered_question in answered_questions %}
@@ -43,11 +31,7 @@
{% endspaceless %}
{% if answered_question.comment_count %}
<span>
- {% blocktrans count answered_question.comment_count as comment_count %}
- (one comment)
- {% plural %}
- the answer has been commented {{comment_count}} times
- {% endblocktrans %}
+ {% blocktrans count answered_question.comment_count as comment_count %}(one comment){% plural %}the answer has been commented {{comment_count}} times{% endblocktrans %}
</span>
{% endif %}
</div>
@@ -57,13 +41,7 @@
<br/>
<a name="votes"></a>
{% spaceless %}
- <h2>
- {% blocktrans count total_votes as cnt %}
- <span class="count">1</span> Vote
- {% plural %}
- <span class="count">{{cnt}}</span> Votes
- {% endblocktrans %}
- </h2>
+ <h2>{% blocktrans count total_votes as cnt %}<span class="count">1</span> Vote{% plural %}<span class="count">{{cnt}}</span> Votes {% endblocktrans %}</h2>
{% endspaceless %}
<div class="user-stats-table">
<table>
@@ -83,13 +61,7 @@
</div>
<a name="tags"></a>
{% spaceless %}
- <h2>
- {% blocktrans count user_tags|length as counter %}
- <span class="count">1</span> Tag
- {% plural %}
- <span class="count">{{counter}}</span> Tags
- {% endblocktrans %}
- </h2>
+ <h2>{% blocktrans count user_tags|length as counter %}<span class="count">1</span> Tag{% plural %}<span class="count">{{counter}}</span> Tags{% endblocktrans %}</h2>
{% endspaceless %}
<div class="user-stats-table">
<table class="tags">
@@ -97,8 +69,8 @@
<td width="180" valign="top">
{% for tag in user_tags%}
<a rel="tag"
- title="{% blocktrans with tag.name as tag_name %}see other questions with {{view_user}}'s contributions tagged '{{ tag_name }}' {% endblocktrans %}"
- href="{% url questions %}?tags={{tag|urlencode}}&author={{view_user.id}}&start_over=true">{{tag.name}}</a>
+ title="{% blocktrans with tag.name as tag_name %}see other questions with {{view_user}}'s contributions tagged '{{ tag_name }}' {% endblocktrans %}"
+ href="{% url questions %}?tags={{tag|urlencode}}&author={{view_user.id}}&start_over=true">{{tag.name}}</a>
<span class="tag-number">&#215; {{ tag.user_tag_usage_count|intcomma }}</span><br/>
{% if forloop.counter|divisibleby:"10" %}
</td>
@@ -111,20 +83,14 @@
</div>
<a name="badges"></a>
{% spaceless %}
- <h2>
- {% blocktrans count total_awards as counter %}
- <span class="count">1</span> Badge
- {% plural %}
- <span class="count">{{counter}}</span> Badges
- {% endblocktrans %}
- </h2>
+ <h2>{% blocktrans count total_awards as counter %}<span class="count">1</span> Badge{% plural %}<span class="count">{{counter}}</span> Badges{% endblocktrans %}</h2>
{% endspaceless %}
<div class="user-stats-table">
<table>
<tr>
<td width="180" style="line-height:35px">
- {% for award in awards %}
- <a href="{% url badges %}{{award.id}}/{{award.name}}" title="{{ award.description }}" class="medal"><span class="badge{{ award.type }}">&#9679;</span>&nbsp;{{ award.name }}</a><span class="tag-number"> &#215; {{ award.count|intcomma }}</span><br/>
+ {% for award in awards %}{% comment %}todo: translate badge name properly{% endcomment %}
+ <a href="{% url badge award.id %}{{award.name}}" title="{% trans award.description %}" class="medal"><span class="badge{{ award.type }}">&#9679;</span>&nbsp;{% trans award.name %}</a><span class="tag-number"> &#215; {{ award.count|intcomma }}</span><br/>
{% if forloop.counter|divisibleby:"6" %}
</td>
<td width="180" style="line-height:35px">
diff --git a/forum/templatetags/extra_filters.py b/forum/templatetags/extra_filters.py
index b687889f..d600c23e 100644
--- a/forum/templatetags/extra_filters.py
+++ b/forum/templatetags/extra_filters.py
@@ -1,6 +1,7 @@
from django import template
from forum import auth
from forum_modules.grapefruit import Color
+from django.utils.translation import ugettext as _
import logging
register = template.Library()
@@ -96,7 +97,7 @@ def cnprog_intword(number):
@register.filter
def humanize_counter(number):
if number == 0:
- return 'no'
+ return _('no items in counter')
elif number >= 1000:
number = number/1000
s = '%.1f' % number
diff --git a/forum/views/commands.py b/forum/views/commands.py
index ffe1c34f..b5dbec56 100644
--- a/forum/views/commands.py
+++ b/forum/views/commands.py
@@ -2,7 +2,7 @@ import datetime
from django.conf import settings
from django.utils import simplejson
from django.http import HttpResponse, HttpResponseRedirect
-from django.shortcuts import get_object_or_404
+from django.shortcuts import get_object_or_404, render_to_response
from django.utils.translation import ugettext as _
from django.template import RequestContext
from forum.models import *
diff --git a/forum/views/meta.py b/forum/views/meta.py
index 40f3d394..af5fe6df 100644
--- a/forum/views/meta.py
+++ b/forum/views/meta.py
@@ -14,6 +14,7 @@ def about(request):
def faq(request):
data = {
+ 'view_name':'faq',
'gravatar_faq_url': reverse('faq') + '#gravatar',
#'send_email_key_url': reverse('send_email_key'),
'ask_question_url': reverse('ask'),
@@ -21,7 +22,7 @@ def faq(request):
return render_to_response('faq.html', data, context_instance=RequestContext(request))
def feedback(request):
- data = {}
+ data = {'view_name':'feedback'}
form = None
if request.method == "POST":
form = FeedbackForm(request.POST)
@@ -43,7 +44,7 @@ def feedback(request):
feedback.CANCEL_MESSAGE=_('We look forward to hearing your feedback! Please, give it next time :)')
def privacy(request):
- return render_to_response('privacy.html', context_instance=RequestContext(request))
+ return render_to_response('privacy.html', {'view_name':'privacy'}, context_instance=RequestContext(request))
def logout(request):#refactor/change behavior?
#currently you click logout and you get
@@ -54,6 +55,7 @@ def logout(request):#refactor/change behavior?
#why not just show a message: you are logged out of askbot, but
#if you really want to log out -> go to your openid provider
return render_to_response('logout.html', {
+ 'view_name':'logout',
'next' : get_next_url(request),
}, context_instance=RequestContext(request))
@@ -66,6 +68,7 @@ def badges(request):#user status/reputation system
return render_to_response('badges.html', {
'badges' : badges,
+ 'view_name': 'badges',
'mybadges' : my_badges,
'feedback_faq_url' : reverse('feedback'),
}, context_instance=RequestContext(request))
@@ -85,6 +88,7 @@ def badge(request, id):
).distinct('id')
return render_to_response('badge.html', {
+ 'view_name': badge,
'awards' : awards,
'badge' : badge,
}, context_instance=RequestContext(request))
diff --git a/forum/views/readers.py b/forum/views/readers.py
index 677cbd67..338da62b 100644
--- a/forum/views/readers.py
+++ b/forum/views/readers.py
@@ -134,6 +134,8 @@ def questions(request):#a view generating listing of questions, used by 'unanswe
#todo: organize variables by type
return render_to_response('questions.html', {
+ 'view_name': 'questions',
+ 'active_tab': 'questions',
'questions' : questions,
'contributors' : contributors,
'author_name' : meta_data.get('author_name',None),
@@ -182,6 +184,8 @@ def search(request): #generates listing of questions matching a search query - i
else:
raise Http404
+#todo: eliminate this - need to go through templates to make sure
+#that there are no urls pointing here
def tag(request, tag):#stub generates listing of questions tagged with a single tag
return questions(request, tagname=tag)
@@ -210,6 +214,7 @@ def tags(request):#view showing a listing of available tags - plain list
tags = objects_list.page(objects_list.num_pages)
return render_to_response('tags.html', {
+ "view_name":"tags",
"active_tab": "tags",
"tags" : tags,
"stag" : stag,
@@ -341,17 +346,19 @@ def question(request, id):#refactor - long subroutine. display question body, an
question_view.save()
return render_to_response('question.html', {
- "question" : question,
- "question_vote" : question_vote,
- "question_comment_count":question.comments.count(),
- "answer" : answer_form,
- "answers" : page_objects.object_list,
- "user_answer_votes": user_answer_votes,
- "tags" : question.tags.all(),
- "tab_id" : view_id,
- "favorited" : favorited,
- "similar_questions" : Question.objects.get_similar_questions(question),
- "context" : {
+ 'view_name': 'question',
+ 'active_tab': 'questions',
+ 'question' : question,
+ 'question_vote' : question_vote,
+ 'question_comment_count':question.comments.count(),
+ 'answer' : answer_form,
+ 'answers' : page_objects.object_list,
+ 'user_answer_votes': user_answer_votes,
+ 'tags' : question.tags.all(),
+ 'tab_id' : view_id,
+ 'favorited' : favorited,
+ 'similar_questions' : Question.objects.get_similar_questions(question),
+ 'context' : {
'is_paginated' : True,
'pages': objects_list.num_pages,
'page': page,
@@ -389,6 +396,8 @@ def question_revisions(request, id):
}
revisions[i].summary = _('initial version')
return render_to_response('revisions_question.html', {
+ 'view_name':'question_revisions',
+ 'active_tab':'questions',
'post': post,
'revisions': revisions,
}, context_instance=RequestContext(request))
@@ -408,6 +417,8 @@ def answer_revisions(request, id):
revisions[i].diff = revisions[i].text
revisions[i].summary = _('initial version')
return render_to_response('revisions_answer.html', {
+ 'view_name':'answer_revisions',
+ 'active_tab':'questions',
'post': post,
'revisions': revisions,
}, context_instance=RequestContext(request))
diff --git a/forum/views/users.py b/forum/views/users.py
index 0cefc598..5fb97ef9 100644
--- a/forum/views/users.py
+++ b/forum/views/users.py
@@ -102,6 +102,7 @@ def moderate_user(request, id):
response = HttpResponseForbidden(mimetype="application/json")
return response
+#non-view function
def set_new_email(user, new_email, nomessage=False):
if new_email != user.email:
user.email = new_email
@@ -142,6 +143,7 @@ def edit_user(request, id):
else:
form = EditUserForm(user)
return render_to_response('user_edit.html', {
+ 'active_tab': 'users',
'form' : form,
'gravatar_faq_url' : reverse('faq') + '#gravatar',
}, context_instance=RequestContext(request))
@@ -268,6 +270,7 @@ def user_stats(request, user_id, user_view):
moderate_user_form = None
return render_to_response(user_view.template_file,{
+ 'active_tab':'users',
'moderate_user_form': moderate_user_form,
"tab_name" : user_view.id,
"tab_description" : user_view.tab_description,
@@ -533,6 +536,7 @@ def user_recent(request, user_id, user_view):
activities.sort(lambda x,y: cmp(y.time, x.time))
return render_to_response(user_view.template_file,{
+ 'active_tab':'users',
"tab_name" : user_view.id,
"tab_description" : user_view.tab_description,
"page_title" : user_view.page_title,
@@ -686,6 +690,7 @@ def user_responses(request, user_id, user_view):
responses.sort(lambda x,y: cmp(y.time, x.time))
return render_to_response(user_view.template_file,{
+ 'active_tab':'users',
"tab_name" : user_view.id,
"tab_description" : user_view.tab_description,
"page_title" : user_view.page_title,
@@ -748,6 +753,7 @@ def user_votes(request, user_id, user_view):
votes.extend(answer_votes)
votes.sort(lambda x,y: cmp(y['voted_at'], x['voted_at']))
return render_to_response(user_view.template_file,{
+ 'active_tab':'users',
"tab_name" : user_view.id,
"tab_description" : user_view.tab_description,
"page_title" : user_view.page_title,
@@ -788,6 +794,7 @@ def user_reputation(request, user_id, user_view):
reps = '[%s]' % reps
return render_to_response(user_view.template_file, {
+ 'active_tab':'users',
"tab_name": user_view.id,
"tab_description": user_view.tab_description,
"page_title": user_view.page_title,
@@ -839,6 +846,7 @@ def user_favorites(request, user_id, user_view):
'la_user_bronze',
'la_user_reputation')
return render_to_response(user_view.template_file,{
+ 'active_tab':'users',
"tab_name" : user_view.id,
"tab_description" : user_view.tab_description,
"page_title" : user_view.page_title,
@@ -873,6 +881,7 @@ def user_email_subscriptions(request, user_id, user_view):
tag_filter_form = TagFilterSelectionForm(instance=user)
action_status = None
return render_to_response(user_view.template_file,{
+ 'active_tab':'users',
'tab_name':user_view.id,
'tab_description':user_view.tab_description,
'page_title':user_view.page_title,
@@ -963,7 +972,7 @@ def user(request, id, slug=None):
return func(request, id, user_view)
@login_required
-def account_settings(request):
+def account_settings(request):#todo: is this actually used?
"""
index pages to changes some basic account settings :
- change password
@@ -980,6 +989,7 @@ def account_settings(request):
is_openid = False
return render_to_response('account_settings.html', {
+ 'active_tab':'users',
'msg': msg,
'is_openid': is_openid
}, context_instance=RequestContext(request))
diff --git a/forum/views/writers.py b/forum/views/writers.py
index 57c8e043..86831ba3 100644
--- a/forum/views/writers.py
+++ b/forum/views/writers.py
@@ -7,7 +7,7 @@ from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseForbidden, Http404
from django.template import RequestContext
-from django.utils.html import *
+from django.utils.html import * #todo: remove import * in favor of explicit imports
from django.utils import simplejson
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
@@ -91,7 +91,7 @@ def ask(request):#view used to ask a new question
added_at = datetime.datetime.now()
#todo: move this to clean_title
- title = strip_tags(form.cleaned_data['title'].strip())
+ title = form.cleaned_data['title'].strip()
wiki = form.cleaned_data['wiki']
#todo: move this to clean_tagnames
tagnames = form.cleaned_data['tags'].strip()
@@ -131,11 +131,14 @@ def ask(request):#view used to ask a new question
question.save()
return HttpResponseRedirect(reverse('user_signin_new_question'))
else:
+ #this branch is for the initial load of ask form
form = AskForm()
if 'title' in request.GET:
- raw_title = request.GET['title']
- form.initial['title'] = strip_tags(strip_entities(raw_title))
+ #normally this title is inherited from search query
+ #but it is possible to ask with a parameter title in the url query
+ form.initial['title'] = request.GET['title']
else:
+ #attempt to extract title from previous search query
search_state = request.session.get('search_state',None)
if search_state:
query = search_state.query
@@ -180,6 +183,7 @@ def _retag_question(request, question):#non-url subview of edit question - just
else:
form = RetagQuestionForm(question)
return render_to_response('question_retag.html', {
+ 'active_tab': 'questions',
'question': question,
'form' : form,
'tags' : _get_tags_cache_json(),
@@ -222,6 +226,7 @@ def _edit_question(request, question):#non-url subview of edit_question - just e
revision_form = RevisionForm(question, latest_revision)
form = EditQuestionForm(question, latest_revision)
return render_to_response('question_edit.html', {
+ 'active_tab': 'questions',
'question': question,
'revision_form': revision_form,
'form' : form,
@@ -265,6 +270,7 @@ def edit_answer(request, id):
revision_form = RevisionForm(answer, latest_revision)
form = EditAnswerForm(answer, latest_revision)
return render_to_response('answer_edit.html', {
+ 'active_tab': 'questions',
'answer': answer,
'revision_form': revision_form,
'form': form,