summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-04-16 10:58:44 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-04-16 10:58:44 -0600
commit7f7e3f04405a669b4d3fb775ba68b9cce91f9a7a (patch)
treeb81f7454e934fc164330e571d94a553b5efc0961
parent15cb75c3bddec29649f2a5de77ffcf786117ed57 (diff)
parentca5efbe3667058e2bfd36403c1236819f954ee40 (diff)
downloadaskbot-7f7e3f04405a669b4d3fb775ba68b9cce91f9a7a.tar.gz
askbot-7f7e3f04405a669b4d3fb775ba68b9cce91f9a7a.tar.bz2
askbot-7f7e3f04405a669b4d3fb775ba68b9cce91f9a7a.zip
Merge branch 'master' of github.com:ASKBOT/askbot-devel
-rw-r--r--askbot/auth.py42
-rw-r--r--askbot/search/state_manager.py5
-rw-r--r--askbot/setup_templates/settings.py2
-rw-r--r--askbot/setup_templates/settings.py.mustache2
-rw-r--r--askbot/skins/common/media/jquery-openid/openid.css3
-rw-r--r--askbot/skins/common/templates/authopenid/authopenid_macros.html77
-rw-r--r--askbot/skins/common/templates/authopenid/signin.html17
-rw-r--r--askbot/skins/common/templates/widgets/related_tags.html8
-rw-r--r--askbot/skins/default/templates/macros.html8
-rw-r--r--askbot/skins/default/templates/revisions.html2
-rw-r--r--askbot/skins/default/templates/tags.html2
-rw-r--r--askbot/startup_procedures.py4
-rw-r--r--askbot/views/meta.py9
-rw-r--r--askbot/views/readers.py3
14 files changed, 122 insertions, 62 deletions
diff --git a/askbot/auth.py b/askbot/auth.py
index 5c0f7bd9..eba24c80 100644
--- a/askbot/auth.py
+++ b/askbot/auth.py
@@ -199,6 +199,11 @@ def onAnswerAccept(answer, user, timestamp=None):
reputation=answer.author.reputation)
reputation.save()
+ if answer.author == question.author and user == question.author:
+ #a plug to prevent reputation gaming by posting a question
+ #then answering and accepting as best all by the same person
+ return
+
user.receive_reputation(askbot_settings.REP_GAIN_FOR_ACCEPTING_ANSWER)
user.save()
reputation = Repute(user=user,
@@ -214,24 +219,29 @@ def onAnswerAcceptCanceled(answer, user, timestamp=None):
if timestamp is None:
timestamp = datetime.datetime.now()
answer.thread.set_accepted_answer(answer=None, timestamp=None)
-
- answer.author.receive_reputation(
- askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE
- )
- answer.author.save()
-
question = answer.thread._question_post()
- reputation = Repute(
- user=answer.author,
- negative=\
- askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE,
- question=question,
- reputed_at=timestamp,
- reputation_type=-2,
- reputation=answer.author.reputation
- )
- reputation.save()
+ if user != answer.author:
+ answer.author.receive_reputation(
+ askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE
+ )
+ answer.author.save()
+ reputation = Repute(
+ user=answer.author,
+ negative=\
+ askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE,
+ question=question,
+ reputed_at=timestamp,
+ reputation_type=-2,
+ reputation=answer.author.reputation
+ )
+ reputation.save()
+
+ if answer.author == question.author and user == question.author:
+ #a symmettric measure for the reputation gaming plug
+ #as in the onAnswerAccept function
+ #here it protects the user from uwanted reputation loss
+ return
user.receive_reputation(
askbot_settings.REP_LOSS_FOR_CANCELING_ANSWER_ACCEPTANCE
diff --git a/askbot/search/state_manager.py b/askbot/search/state_manager.py
index ee46501e..8096cbdd 100644
--- a/askbot/search/state_manager.py
+++ b/askbot/search/state_manager.py
@@ -241,8 +241,13 @@ class SearchState(object):
class DummySearchState(object): # Used for caching question/thread summaries
+
def add_tag(self, tag):
self.tag = tag
return self
+
+ def change_scope(self, new_scope):
+ return self
+
def full_url(self):
return '<<<%s>>>' % self.tag
diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py
index 0aabcbe0..3ec209df 100644
--- a/askbot/setup_templates/settings.py
+++ b/askbot/setup_templates/settings.py
@@ -227,3 +227,5 @@ CSRF_COOKIE_NAME = 'askbot_csrf'
#CSRF_COOKIE_DOMAIN = ''
STATICFILES_DIRS = ( os.path.join(ASKBOT_ROOT, 'skins'),)
+
+RECAPTCHA_USE_SSL = True
diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache
index 99023524..43f2f47b 100644
--- a/askbot/setup_templates/settings.py.mustache
+++ b/askbot/setup_templates/settings.py.mustache
@@ -228,3 +228,5 @@ CSRF_COOKIE_NAME = '{{domain_name}}_csrf'
STATIC_ROOT = os.path.join(PROJECT_ROOT, "static")
STATICFILES_DIRS = (os.path.join(ASKBOT_ROOT, 'skins'),)
+
+RECAPTCHA_USE_SSL = True
diff --git a/askbot/skins/common/media/jquery-openid/openid.css b/askbot/skins/common/media/jquery-openid/openid.css
index 00287224..f9430108 100644
--- a/askbot/skins/common/media/jquery-openid/openid.css
+++ b/askbot/skins/common/media/jquery-openid/openid.css
@@ -1,7 +1,8 @@
-div#login-icons {margin:10px 0 0 0;padding:10px;border:#eee 1px solid;}
+div#login-icons {padding:20px 0 0 0;}
ul.login-icons {width: 450px; margin:0;padding:0;text-align:left; list-style-type:none; display:block;}
ul.login-icons li {display:inline;}
ul.large input {height: 40px; width: 90px;border:1px solid #ccc;margin:0 5px 5px 0;}
+.openid-signin h1 {margin-top: -15px; padding-bottom: 10px;}
.openid-signin h2 {margin-top:15px;}
.openid-signin h2#account-recovery-heading {margin-bottom:2px;}
#account-recovery-form p.hint a {color:#1b79bd; text-decoration: none;}
diff --git a/askbot/skins/common/templates/authopenid/authopenid_macros.html b/askbot/skins/common/templates/authopenid/authopenid_macros.html
index 477d277c..9d35ac6f 100644
--- a/askbot/skins/common/templates/authopenid/authopenid_macros.html
+++ b/askbot/skins/common/templates/authopenid/authopenid_macros.html
@@ -15,44 +15,55 @@
minor_login_providers = None,
hide_local_login = False,
settings = None,
- logged_in = False
+ logged_in = False,
+ show_buttons = True
)
%}
- <div id="login-icons">
- <ul class="login-icons large">
- {% for login_provider in major_login_providers %}
- {% if login_provider.name == 'local' and hide_local_login == True %}
- {# do nothing here, left if statement this way for simplicity #}
- {% else %}
- {% if logged_in == True and login_provider.type == 'password' and login_provider.password_changeable == False %}
+ {% if show_buttons == True %}{# a hack #}
+ <div id="login-icons">
+ {% if major_login_providers %}
+ <ul class="login-icons large">
+ {% for login_provider in major_login_providers %}
+ {% if login_provider.name == 'local' and hide_local_login == True %}
+ {# do nothing here, left if statement this way for simplicity #}
+ {% else %}
+ {% if logged_in == True and login_provider.type == 'password'
+ and login_provider.password_changeable == False
+ %}
+ {% else %}
+ <li>
+ {{ login_provider_input(login_provider) }}
+ </li>
+ {% endif %}
+ {% endif %}
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% if minor_login_providers %}
+ <ul class="login-icons small">
+ {% for login_provider in minor_login_providers %}
+ {% if logged_in == True and login_provider.type == 'password'
+ and login_provider.password_changeable == False
+ %}
{% else %}
<li>
{{ login_provider_input(login_provider) }}
</li>
{% endif %}
- {% endif %}
- {% endfor %}
- </ul>
- <ul class="login-icons small">
- {% for login_provider in minor_login_providers %}
- {% if logged_in == True and login_provider.type == 'password' and login_provider.password_changeable == False %}
- {% else %}
- <li>
- {{ login_provider_input(login_provider) }}
- </li>
- {% endif %}
- {% endfor %}
- </ul>
- </div>
- <fieldset
- id="openid-fs"
- {% if not login_form.openid_login_token.errors %}
- style="display:none;"
- {% endif %}
- >
- <h2 id="openid-heading">{% trans %}Please enter your <span>user name</span>, then sign in{% endtrans %}</h2>
- <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
- <input type="text" name="openid_login_token" />
- <input class="submit-b" type="submit" name="openid_login_with_extra_token" value="{% trans %}Sign in{% endtrans %}"/>
- </fieldset>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ </div>
+ <fieldset
+ id="openid-fs"
+ {% if not login_form.openid_login_token.errors %}
+ style="display:none;"
+ {% endif %}
+ >
+ <h2 id="openid-heading">{% trans %}Please enter your <span>user name</span>, then sign in{% endtrans %}</h2>
+ <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
+ <input type="text" name="openid_login_token" />
+ <input class="submit-b" type="submit" name="openid_login_with_extra_token" value="{% trans %}Sign in{% endtrans %}"/>
+ </fieldset>
+ {% endif %}
{% endmacro %}
diff --git a/askbot/skins/common/templates/authopenid/signin.html b/askbot/skins/common/templates/authopenid/signin.html
index f4bf82c9..e849db20 100644
--- a/askbot/skins/common/templates/authopenid/signin.html
+++ b/askbot/skins/common/templates/authopenid/signin.html
@@ -25,7 +25,7 @@
{% endif %}
<p id='login-intro'>
{% if view_subtype == 'default' and have_buttons %}
- {% trans %}Take a pick of your favorite service below to sign in using secure OpenID or similar technology. Your external service password always stays confidential and you don't have to rememeber or create another one.{% endtrans %}
+ {% trans %}Choose your favorite service below to sign in using secure OpenID or similar technology. Your external service password always stays confidential and you don't have to rememeber or create another one.{% endtrans %}
{% elif view_subtype == 'add_openid' and have_buttons %}
{% if existing_login_methods %}
{% trans %}It's a good idea to make sure that your existing login methods still work, or add a new one. Please click any of the icons below to check/change or add new login methods.{% endtrans %}
@@ -61,7 +61,8 @@
minor_login_providers = minor_login_providers,
hide_local_login = settings.SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN,
settings = settings,
- logged_in = user.is_authenticated()
+ logged_in = user.is_authenticated(),
+ show_buttons = have_buttons
)
}}
{% if use_password_login == True %}
@@ -83,9 +84,15 @@
>
{{login_form.password_action}}
{% if user.is_anonymous() %}
- <h2 id="password-heading">
- {% trans %}Please enter your <span>user name and password</span>, then sign in{% endtrans %}
- </h2>
+ {% if have_buttons %}
+ <h2 id="password-heading">
+ {% trans %}or enter your <span>user name and password</span>, then sign in{% endtrans %}
+ </h2>
+ {% else %}
+ <h1 class="section-title">
+ {% trans %}Please, sign in{% endtrans %}
+ </h1>
+ {% endif %}
{% if have_buttons %}
<p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
{% endif %}
diff --git a/askbot/skins/common/templates/widgets/related_tags.html b/askbot/skins/common/templates/widgets/related_tags.html
index 39873437..05520998 100644
--- a/askbot/skins/common/templates/widgets/related_tags.html
+++ b/askbot/skins/common/templates/widgets/related_tags.html
@@ -16,7 +16,13 @@
{% endfor %}
</ul>
{% else %}
- {{ macros.tag_cloud(tags = tags, font_sizes = font_size) }}
+ {{
+ macros.tag_cloud(
+ tags = tags,
+ font_sizes = font_size,
+ search_state = search_state
+ )
+ }}
{% endif %}
</div>
{% endcache %}
diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html
index 20e2055c..1c6b925c 100644
--- a/askbot/skins/default/templates/macros.html
+++ b/askbot/skins/default/templates/macros.html
@@ -137,10 +137,14 @@ poor design of the data or methods on data objects #}
{%- endif -%}
{%- endmacro -%}
-{%- macro tag_cloud(tags = None, font_sizes = None) -%}
+{%- macro tag_cloud(tags = None, font_sizes = None, search_state = None) -%}
{% for tag in tags %}
<span class="tag-size-{{ font_sizes[tag.name] }}">
- <a class="link-typeA" title="Number of entries: {{ tag.used_count }}" href="{% url questions %}?tags={{ tag.name }}">{{ tag.name }}</a>
+ <a
+ class="link-typeA"
+ title="Number of entries: {{ tag.used_count }}"
+ href="{{ search_state.add_tag(tag.name).full_url() }}"
+ >{{ tag.name }}</a>
</span>
{% endfor %}
{%- endmacro -%}
diff --git a/askbot/skins/default/templates/revisions.html b/askbot/skins/default/templates/revisions.html
index 07b98b5b..fd7dbf0c 100644
--- a/askbot/skins/default/templates/revisions.html
+++ b/askbot/skins/default/templates/revisions.html
@@ -19,7 +19,7 @@
<td width="20" style="vertical-align:middle">
<img
id="rev-arrow-{{ revision.revision }}"
- src="{{"/images/expander-arrow-show.gif"|media}}"
+ src="{{"/images/expander-arrow-hide.gif"|media}}"
alt="{% trans %}click to hide/show revision{% endtrans %}"
/>
</td>
diff --git a/askbot/skins/default/templates/tags.html b/askbot/skins/default/templates/tags.html
index 0f0c1fc6..2bd4b2ec 100644
--- a/askbot/skins/default/templates/tags.html
+++ b/askbot/skins/default/templates/tags.html
@@ -55,7 +55,7 @@
{% if not tags %}
<span>{% trans %}Nothing found{% endtrans %}</span>
{% endif %}
- {{ macros.tag_cloud(tags = tags, font_sizes = font_size) }}
+ {{ macros.tag_cloud(tags = tags, font_sizes = font_size, search_state = search_state) }}
{% endif %}
{% endblock %}
diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py
index 86a33a6e..82eae060 100644
--- a/askbot/startup_procedures.py
+++ b/askbot/startup_procedures.py
@@ -529,6 +529,10 @@ def run_startup_tests():
'test_for_absence': True,
'message': 'Please replace setting ASKBOT_UPLOADED_FILES_URL ',
'replace_hint': "with MEDIA_URL = '/%s'"
+ },
+ 'RECAPTCHA_USE_SSL': {
+ 'value': True,
+ 'message': 'Please add: RECAPTCHA_USE_SSL = True'
}
})
settings_tester.run()
diff --git a/askbot/views/meta.py b/askbot/views/meta.py
index b2f09cf4..73cb494f 100644
--- a/askbot/views/meta.py
+++ b/askbot/views/meta.py
@@ -37,6 +37,7 @@ def about(request, template='about.html'):
title = _('About %(site)s') % {'site': askbot_settings.APP_SHORT_NAME}
data = {
'title': title,
+ 'page_class': 'meta',
'content': askbot_settings.FORUM_ABOUT
}
return render_into_skin('static_page.html', data, request)
@@ -56,9 +57,14 @@ def help(request):
def faq(request):
if askbot_settings.FORUM_FAQ.strip() != '':
+ data = {
+ 'title': _('FAQ'),
+ 'content': askbot_settings.FORUM_FAQ,
+ 'page_class': 'meta',
+ }
return render_into_skin(
'static_page.html',
- {'title': _('FAQ'), 'content': askbot_settings.FORUM_FAQ},
+ data,
request
)
else:
@@ -98,6 +104,7 @@ feedback.CANCEL_MESSAGE=_('We look forward to hearing your feedback! Please, giv
def privacy(request):
data = {
'title': _('Privacy policy'),
+ 'page_class': 'meta',
'content': askbot_settings.FORUM_PRIVACY
}
return render_into_skin('static_page.html', data, request)
diff --git a/askbot/views/readers.py b/askbot/views/readers.py
index 7886439c..2a81f5c2 100644
--- a/askbot/views/readers.py
+++ b/askbot/views/readers.py
@@ -34,7 +34,7 @@ from askbot.models.tag import Tag
from askbot import const
from askbot.utils import functions
from askbot.utils.decorators import anonymous_forbidden, ajax_only, get_only
-from askbot.search.state_manager import SearchState
+from askbot.search.state_manager import SearchState, DummySearchState
from askbot.templatetags import extra_tags
import askbot.conf
from askbot.conf import settings as askbot_settings
@@ -295,6 +295,7 @@ def tags(request):#view showing a listing of available tags - plain list
'stag' : stag,
'tab_id' : sortby,
'keywords' : stag,
+ 'search_state': SearchState(*[None for x in range(7)])
}
return render_into_skin('tags.html', data, request)