From a2d1de600828ca6017b65ce36498e824cadca87f Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Thu, 23 Aug 2012 08:14:50 -0400 Subject: applied the blockquote bug in Chrome as suggested by dajafa --- askbot/setup_templates/tinymce_sample_config.py | 26 +++++++++++++++++++++++++ askbot/skins/common/media/js/wmd/wmd.js | 5 +++++ askbot/tests/utils_tests.py | 17 ++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 askbot/setup_templates/tinymce_sample_config.py create mode 100644 askbot/tests/utils_tests.py diff --git a/askbot/setup_templates/tinymce_sample_config.py b/askbot/setup_templates/tinymce_sample_config.py new file mode 100644 index 00000000..c75170b0 --- /dev/null +++ b/askbot/setup_templates/tinymce_sample_config.py @@ -0,0 +1,26 @@ +TINYMCE_COMPRESSOR = True +TINYMCE_SPELLCHECKER = False +TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, 'common/media/js/tinymce/') +TINYMCE_URL = STATIC_URL + 'common/media/js/tinymce/' +TINYMCE_DEFAULT_CONFIG = { + 'plugins': 'askbot_imageuploader,askbot_attachment', + 'theme': 'advanced', + 'content_css': STATIC_URL + 'default/media/style/tinymce/content.css', + 'force_br_newlines': True, + 'force_p_newlines': False, + 'forced_root_block': '', + 'mode' : 'textareas', + 'oninit': "function(){ tinyMCE.activeEditor.setContent(askbot['data']['editorContent'] || ''); }", + 'plugins': 'askbot_imageuploader,askbot_attachment', + 'theme_advanced_toolbar_location' : 'top', + 'theme_advanced_toolbar_align': 'left', + 'theme_advanced_buttons1': 'bold,italic,underline,|,bullist,numlist,|,undo,redo,|,link,unlink,askbot_imageuploader,askbot_attachment', + 'theme_advanced_buttons2': '', + 'theme_advanced_buttons3' : '', + 'theme_advanced_path': False, + 'theme_advanced_resizing': True, + 'theme_advanced_resize_horizontal': False, + 'theme_advanced_statusbar_location': 'bottom', + 'width': '723', + 'height': '250' +} diff --git a/askbot/skins/common/media/js/wmd/wmd.js b/askbot/skins/common/media/js/wmd/wmd.js index 98af264f..c30fe11d 100644 --- a/askbot/skins/common/media/js/wmd/wmd.js +++ b/askbot/skins/common/media/js/wmd/wmd.js @@ -21,6 +21,7 @@ Attacklab.wmdBase = function(){ // Used to work around some browser bugs where we can't use feature testing. + global.isChrome = /chrome/.test(nav.userAgent.toLowerCase()); global.isIE = /msie/.test(nav.userAgent.toLowerCase()); global.isIE_5or6 = /msie 6/.test(nav.userAgent.toLowerCase()) || /msie 5/.test(nav.userAgent.toLowerCase()); global.isIE_7plus = global.isIE && !global.isIE_5or6; @@ -1598,6 +1599,10 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){ var regexText; var replacementText; + + if (global.isChrome) {//Chrome bug workaround + 'X'.match(/()./); + } this.selection = this.selection.replace(/(^\n*)/, ""); this.startTag = this.startTag + re.$1; diff --git a/askbot/tests/utils_tests.py b/askbot/tests/utils_tests.py new file mode 100644 index 00000000..7f252b69 --- /dev/null +++ b/askbot/tests/utils_tests.py @@ -0,0 +1,17 @@ +from django.test import TestCase +from askbot.utils.url_utils import urls_equal + +class UrlUtilsTests(TestCase): + + def tests_urls_equal(self): + e = urls_equal + self.assertTrue(e('', '')) + self.assertTrue(e('', '/', True)) + self.assertTrue(e('http://cnn.com', 'http://cnn.com/', True)) + + self.assertFalse(e('https://cnn.com', 'http://cnn.com')) + self.assertFalse(e('http://cnn.com:80', 'http://cnn.com:8000')) + + self.assertTrue(e('http://cnn.com/path', 'http://cnn.com/path/', True)) + self.assertFalse(e('http://cnn.com/path', 'http://cnn.com/path/')) + -- cgit v1.2.3-1-g7c22 From 43745b50d82ca8598791f05668d253aac0c8aa6c Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Thu, 23 Aug 2012 18:06:56 -0400 Subject: allowed user names > 30 chars --- askbot/__init__.py | 1 + askbot/doc/source/changelog.rst | 1 + askbot/setup_templates/settings.py | 1 + askbot/setup_templates/settings.py.mustache | 1 + .../default/templates/widgets/user_navigation.html | 2 +- askbot/startup_procedures.py | 19 +++++++++++++++++++ askbot/utils/forms.py | 5 ++++- askbot_requirements.txt | 1 + 8 files changed, 29 insertions(+), 2 deletions(-) diff --git a/askbot/__init__.py b/askbot/__init__.py index 8e4f20ab..59693a5a 100644 --- a/askbot/__init__.py +++ b/askbot/__init__.py @@ -32,6 +32,7 @@ REQUIREMENTS = { 'pystache': 'pystache==0.3.1', 'lamson': 'Lamson', 'pytz': 'pytz', + 'longerusername': 'longerusername', } #necessary for interoperability of django and coffin diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index d88cd734..9d28dd5f 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -3,6 +3,7 @@ Changes in Askbot Development version ------------------- +* Allow user names longer than 30 characters (Evgeny) * Option to disable feedback form for the anonymos users (Evgeny) * Optional restriction to have confirmed email address to join forum (Evgeny) * Optional list of allowed email addresses and email domain name for the new users (Evgeny) diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 632c4e70..3b1f6bf5 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -150,6 +150,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( INSTALLED_APPS = ( + 'longerusername', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index 18ac214d..69b030ed 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -149,6 +149,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( INSTALLED_APPS = ( + 'longerusername', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', diff --git a/askbot/skins/default/templates/widgets/user_navigation.html b/askbot/skins/default/templates/widgets/user_navigation.html index 717cd7ee..227053b0 100644 --- a/askbot/skins/default/templates/widgets/user_navigation.html +++ b/askbot/skins/default/templates/widgets/user_navigation.html @@ -17,7 +17,7 @@ {% trans %}sign out{% endtrans %} {% endif %} {% elif settings.USE_ASKBOT_LOGIN_SYSTEM %} - {% trans %}Hi, there! Please sign in{% endtrans %} + {% trans %}Hi there! Please sign in{% endtrans %} {% endif %} {% if request.user.is_authenticated() and request.user.is_administrator() %} {% trans %}settings{% endtrans %} diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 0fec6d5f..4b4575cf 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -512,6 +512,24 @@ def test_custom_user_profile_tab(): footer = 'Please carefully read about adding a custom user profile tab.' print_errors(errors, header = header, footer = footer) +def test_longerusername(): + """tests proper installation of the "longerusername" app + """ + errors = list() + if 'longerusername' not in django_settings.INSTALLED_APPS: + errors.append( + "add 'longerusername', as the first item in the INSTALLED_APPS" + ) + else: + index = django_settings.INSTALLED_APPS.index('longerusername') + if index != 0: + message = "move 'longerusername', to the beginning of INSTALLED_APPS" + raise AskbotConfigError(message) + + if errors: + errors.append('run "python manage.py migrate longerusername"') + print_errors(errors) + def run_startup_tests(): """function that runs all startup tests, mainly checking settings config so far @@ -527,6 +545,7 @@ def run_startup_tests(): test_celery() #test_csrf_cookie_domain() test_staticfiles() + test_longerusername() test_avatar() settings_tester = SettingsTester({ 'CACHE_MIDDLEWARE_ANONYMOUS_ONLY': { diff --git a/askbot/utils/forms.py b/askbot/utils/forms.py index 319e9b9d..4375ca17 100644 --- a/askbot/utils/forms.py +++ b/askbot/utils/forms.py @@ -9,6 +9,7 @@ from askbot.conf import settings as askbot_settings from askbot.utils.slug import slugify from askbot.utils.functions import split_list from askbot import const +from longerusername import MAX_USERNAME_LENGTH import logging import urllib @@ -78,7 +79,9 @@ class UserNameField(StrippedNonEmptyCharField): if 'error_messages' in kw: error_messages.update(kw['error_messages']) del kw['error_messages'] - super(UserNameField,self).__init__(max_length=30, + + max_length = MAX_USERNAME_LENGTH + super(UserNameField,self).__init__(max_length=max_length, widget=forms.TextInput(attrs=login_form_widget_attrs), label=label, error_messages=error_messages, diff --git a/askbot_requirements.txt b/askbot_requirements.txt index 7b619c36..885a21e3 100644 --- a/askbot_requirements.txt +++ b/askbot_requirements.txt @@ -19,3 +19,4 @@ django-recaptcha-works python-openid pystache==0.3.1 pytz +longerusername -- cgit v1.2.3-1-g7c22 From 1c16316b721117bef9387ba181b49557777a5bc9 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Thu, 23 Aug 2012 18:06:56 -0400 Subject: added js patch for the noscript tag to hide red margin on IE and disabled Lamson on Windows --- askbot/__init__.py | 6 +++++- askbot/doc/source/changelog.rst | 1 + askbot/doc/source/optional-modules.rst | 5 +++++ askbot/setup_templates/settings.py | 1 + askbot/setup_templates/settings.py.mustache | 1 + .../skins/default/templates/meta/bottom_scripts.html | 6 ++++++ .../default/templates/widgets/user_navigation.html | 2 +- askbot/startup_procedures.py | 19 +++++++++++++++++++ askbot/utils/forms.py | 5 ++++- askbot_requirements.txt | 1 + 10 files changed, 44 insertions(+), 3 deletions(-) diff --git a/askbot/__init__.py b/askbot/__init__.py index 8e4f20ab..51b7c24f 100644 --- a/askbot/__init__.py +++ b/askbot/__init__.py @@ -5,6 +5,7 @@ Functions in the askbot module perform various basic actions on behalf of the forum application """ import os +import platform VERSION = (0, 7, 43) @@ -30,10 +31,13 @@ REQUIREMENTS = { 'recaptcha_works': 'django-recaptcha-works', 'openid': 'python-openid', 'pystache': 'pystache==0.3.1', - 'lamson': 'Lamson', 'pytz': 'pytz', + 'longerusername': 'longerusername', } +if platform.system() != 'Windows': + REQUIREMENTS['lamson'] = 'Lamson' + #necessary for interoperability of django and coffin try: from askbot import patches diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index d88cd734..9d28dd5f 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -3,6 +3,7 @@ Changes in Askbot Development version ------------------- +* Allow user names longer than 30 characters (Evgeny) * Option to disable feedback form for the anonymos users (Evgeny) * Optional restriction to have confirmed email address to join forum (Evgeny) * Optional list of allowed email addresses and email domain name for the new users (Evgeny) diff --git a/askbot/doc/source/optional-modules.rst b/askbot/doc/source/optional-modules.rst index 25bb5cc8..3dc2b5ae 100644 --- a/askbot/doc/source/optional-modules.rst +++ b/askbot/doc/source/optional-modules.rst @@ -216,6 +216,11 @@ Askbot supports posting replies by email. For this feature to work ``Lamson`` a pip install django-lamson +.. note:: + On Windows installation of the Lamson module may require + additional work. Askbot does not support this feature + on Windows automatically. + The lamson daemon needs a folder to store it's mail queue files and a folder to store log files, create the folders folder named ``run`` and ``logs`` within your project folder by executing the following commands: mkdir run diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 632c4e70..3b1f6bf5 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -150,6 +150,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( INSTALLED_APPS = ( + 'longerusername', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index 18ac214d..69b030ed 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -149,6 +149,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( INSTALLED_APPS = ( + 'longerusername', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', diff --git a/askbot/skins/default/templates/meta/bottom_scripts.html b/askbot/skins/default/templates/meta/bottom_scripts.html index 6c132203..1bcdca1f 100644 --- a/askbot/skins/default/templates/meta/bottom_scripts.html +++ b/askbot/skins/default/templates/meta/bottom_scripts.html @@ -6,6 +6,12 @@ + {% endblock %} diff --git a/askbot/skins/default/templates/question/javascript.html b/askbot/skins/default/templates/question/javascript.html index 5b73854e..51555bc1 100644 --- a/askbot/skins/default/templates/question/javascript.html +++ b/askbot/skins/default/templates/question/javascript.html @@ -53,6 +53,7 @@ $("#fmanswer_button").hide(); }); {%endif%} + askbot['functions']['hideConvertLinks'](); }); $(window).bind('hashchange', animate_hashes); diff --git a/askbot/views/writers.py b/askbot/views/writers.py index c2521b92..4640a66d 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -671,10 +671,14 @@ def delete_comment(request): @decorators.admins_only @decorators.post_only def comment_to_answer(request): - comment_id = int(request.POST['comment_id']) - comment = get_object_or_404(models.Post, post_type = 'comment', id=comment_id) - comment.post_type = 'answer' - comment.save() - comment.thread.invalidate_cached_data() - - return HttpResponseRedirect(comment.get_absolute_url()) + comment_id = request.POST.get('comment_id') + if comment_id: + comment_id = int(comment_id) + comment = get_object_or_404(models.Post, post_type = 'comment', id=comment_id) + comment.post_type = 'answer' + comment.save() + comment.thread.invalidate_cached_data() + + return HttpResponseRedirect(comment.get_absolute_url()) + else: + raise Http404 -- cgit v1.2.3-1-g7c22