From aa15395a7bba6529c2116e354bda97de2afa5e6f Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Mon, 22 Feb 2010 20:58:30 -0500 Subject: cleaning up small errors, commit in the middle of linting wmd.js --- forum/skins/README | 13 ++++----- forum/skins/default/media/js/wmd/wmd.js | 52 ++++++++++++++++----------------- forum/views/users.py | 2 ++ forum/views/writers.py | 2 +- sql_scripts/update_2010_02_22.sql | 1 + 5 files changed, 36 insertions(+), 34 deletions(-) create mode 100644 sql_scripts/update_2010_02_22.sql diff --git a/forum/skins/README b/forum/skins/README index b2f32b77..5565fa83 100644 --- a/forum/skins/README +++ b/forum/skins/README @@ -4,14 +4,10 @@ this directory contains available skins 2) common - this directory is to media directory common to all or many templates to create a new skin just create another directory under skins/ -and start populating it with templates named the same way as in -default/templates +and start populating it with the directory structure as in +default/templates - templates must be named the same way -all paths must be the same except they will be under -yourtemplate/templates - -media does not have to be composed of files named the same way as in default skin -whatever media you link to from your templates - will be in operation +NO NEED TO CREATE ALL TEMPLATES/MEDIA FILES AT ONCE templates are resolved in the following way: * check in skin named as in settings.OSQA_DEFAULT_SKIN @@ -21,3 +17,6 @@ media is resolved with one extra option * settings.OSQA_DEFAULT_SKIN * 'default' * 'common' + +media does not have to be composed of files named the same way as in default skin +whatever media you link to from your templates - will be in operation diff --git a/forum/skins/default/media/js/wmd/wmd.js b/forum/skins/default/media/js/wmd/wmd.js index b5f1c9e0..e81a8046 100644 --- a/forum/skins/default/media/js/wmd/wmd.js +++ b/forum/skins/default/media/js/wmd/wmd.js @@ -21,11 +21,11 @@ Attacklab.wmdBase = function(){ // Used to work around some browser bugs where we can't use feature testing. - 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; - global.isOpera = /opera/.test(nav.userAgent.toLowerCase()); - global.isKonqueror = /konqueror/.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; + global.isOpera = /opera/.test(nav.userAgent.toLowerCase()); + global.isKonqueror = /konqueror/.test(nav.userAgent.toLowerCase()); var toolbar_strong_label = $.i18n._('bold') + " Ctrl-B"; var toolbar_emphasis_label = $.i18n._('italic') + " Ctrl-I"; @@ -54,7 +54,7 @@ Attacklab.wmdBase = function(){ var uploadImageHTML ="
" + $.i18n._('upload image') + "
" + '
' + - ''; + ''; // The default text that appears in the dialog input box when entering // links. @@ -115,7 +115,7 @@ Attacklab.wmdBase = function(){ } else if (elem.currentStyle) { // IE - return elem.currentStyle["display"] !== "none"; + return elem.currentStyle.display !== "none"; } }; @@ -185,7 +185,7 @@ Attacklab.wmdBase = function(){ pattern = pre + pattern + post; return new re(pattern, flags); - } + }; // Sets the image for a button passed to the WMD editor. @@ -218,8 +218,9 @@ Attacklab.wmdBase = function(){ var input; // The text box where you enter the hyperlink. var type = 0; // The dialog box type(0: Link, 1: Image) - if(arguments.length == 4) + if(arguments.length == 4){ type = arguments[3]; + } if (defaultInputText === undefined) { defaultInputText = ""; @@ -334,8 +335,9 @@ Attacklab.wmdBase = function(){ // The input text box input = doc.createElement("input"); - if(type == 1) + if(type == 1){ input.id = "image-url"; + } input.type = "text"; input.value = defaultInputText; style = input.style; @@ -347,9 +349,9 @@ Attacklab.wmdBase = function(){ // The upload file input if(type == 1){ var upload = doc.createElement("div"); - upload.innerHTML = uploadImageHTML; - upload.style.padding = "5px"; - form.appendChild(upload); + upload.innerHTML = uploadImageHTML; + upload.style.padding = "5px"; + form.appendChild(upload); } // The ok button @@ -433,9 +435,10 @@ Attacklab.wmdBase = function(){ position.getTop = function(elem, isInner){ var result = elem.offsetTop; if (!isInner) { - while (elem = elem.offsetParent) { - result += elem.offsetTop; - } + while (elem.offsetParent) { + elem = elem.offsetParent; + result += elem.offsetTop; + } } return result; }; @@ -762,7 +765,7 @@ Attacklab.wmdBase = function(){ var handlePaste = function(){ if (global.isIE || (inputStateObj && inputStateObj.text != wmd.panels.input.value)) { - if (timer == undefined) { + if (timer === undefined) { mode = "paste"; saveState(); refreshState(); @@ -923,17 +926,16 @@ Attacklab.wmdBase = function(){ } doClick(this); return false; - } + }; } } else { button.style.backgroundPosition = button.XShift + " " + disabledYShift; button.onmouseover = button.onmouseout = button.onclick = function(){}; } - } - + }; + var makeSpritedButtonRow = function(){ - var buttonBar = document.getElementById("wmd-button-bar"); var normalYShift = "0px"; var disabledYShift = "-20px"; @@ -1102,7 +1104,7 @@ Attacklab.wmdBase = function(){ buttonRow.appendChild(helpButton); */ setUndoRedoButtonStates(); - } + }; var setupEditor = function(){ @@ -1298,7 +1300,7 @@ Attacklab.wmdBase = function(){ this.text = inputArea.value; } - } + }; // Sets the selected text in the input box after we've performed an // operation. @@ -1384,7 +1386,7 @@ Attacklab.wmdBase = function(){ // Restore this state into the input area. this.restore = function(){ - if (stateObj.text != undefined && stateObj.text != inputArea.value) { + if (stateObj.text !== undefined && stateObj.text != inputArea.value) { inputArea.value = stateObj.text; } this.setInputAreaSelection(); @@ -1903,12 +1905,10 @@ Attacklab.wmdBase = function(){ if (wmd.panels.preview) { wmd.panels.preview.scrollTop = (wmd.panels.preview.scrollHeight - wmd.panels.preview.clientHeight) * getScaleFactor(wmd.panels.preview); - ; } if (wmd.panels.output) { wmd.panels.output.scrollTop = (wmd.panels.output.scrollHeight - wmd.panels.output.clientHeight) * getScaleFactor(wmd.panels.output); - ; } }; diff --git a/forum/views/users.py b/forum/views/users.py index 04ffb690..cc05c19e 100644 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -8,9 +8,11 @@ from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.http import HttpResponse, HttpResponseForbidden from django.utils.translation import ugettext as _ +from django.utils.html import strip_tags from django.core.urlresolvers import reverse from forum.forms import *#incomplete list is EditUserForm, ModerateUserForm, TagFilterSelectionForm, from forum import auth +import calendar from django.contrib.contenttypes.models import ContentType question_type = ContentType.objects.get_for_model(Question) diff --git a/forum/views/writers.py b/forum/views/writers.py index 666b936a..a8f07334 100644 --- a/forum/views/writers.py +++ b/forum/views/writers.py @@ -380,7 +380,7 @@ def __generate_comments_json(obj, type, user):#non-view generates json data for if user != None and auth.can_delete_comment(user, comment): #/posts/392845/comments/219852/delete #todo translate this url - delete_url = reverse(index) + type + "s/%s/comments/%s/delete/" % (obj.id, comment.id) + delete_url = reverse('index') + type + "s/%s/comments/%s/delete/" % (obj.id, comment.id) json_comments.append({"id" : comment.id, "object_id" : obj.id, "comment_age" : diff_date(comment.added_at), diff --git a/sql_scripts/update_2010_02_22.sql b/sql_scripts/update_2010_02_22.sql new file mode 100644 index 00000000..2778885a --- /dev/null +++ b/sql_scripts/update_2010_02_22.sql @@ -0,0 +1 @@ +alter table answer add column deleted_at datetime; -- cgit v1.2.3-1-g7c22