From 818d0b99a9ed70a2f92c59a835a2a51bc66dc7d1 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 28 Nov 2009 00:10:25 -0500 Subject: configuration of javascript base url is no longer needed --- INSTALL | 3 --- settings_local.py.dist | 3 --- templates/base.html | 3 ++- templates/base_content.html | 5 +++- templates/content/js/com.cnprog.post.js | 42 +++++++++++++++++++------------- templates/content/js/com.cnprog.utils.js | 2 +- templates/content/js/wmd/wmd.js | 2 +- templates/content/style/style.css | 2 +- 8 files changed, 34 insertions(+), 28 deletions(-) diff --git a/INSTALL b/INSTALL index 4b878f24..e071f9a7 100644 --- a/INSTALL +++ b/INSTALL @@ -249,9 +249,6 @@ APP_COPYRIGHT = '' #copyright message #then CNPROG will run at url http://example.com/forum #FORUM_SCRIPT_ALIAS cannot have leading slash, otherwise it can be set to anything FORUM_SCRIPT_ALIAS = '' #no leading slash, default = '' empty string -#also remember to set '/':'/forum' in file templates/content/js/com.cnprog.i18n.js -#this is because javascript also needs to know the correct url prefix -#nothing needs to be changed in .css files, as all urls there are relative LANGUAGE_CODE = 'en' #forum language (see language instructions on the wiki) EMAIL_VALIDATION = 'off' #string - on|off diff --git a/settings_local.py.dist b/settings_local.py.dist index 3c37c14e..5447e517 100644 --- a/settings_local.py.dist +++ b/settings_local.py.dist @@ -44,9 +44,6 @@ TIME_ZONE = 'America/Tijuana' # # FORUM_SCRIPT_ALIAS = 'forum/' # -# also make sure to set '/':'/forum' in file templates/content/js/com.cnprog.i18n.js -# this is necessary to make client scripts work in this configuration -# FORUM_SCRIPT_ALIAS = '' #no leading slash, default = '' empty string diff --git a/templates/base.html b/templates/base.html index 2b933c4a..ec0a53d7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -18,7 +18,8 @@ diff --git a/templates/base_content.html b/templates/base_content.html index 52cc6134..78e5fe38 100644 --- a/templates/base_content.html +++ b/templates/base_content.html @@ -6,7 +6,9 @@ {% block title %}{% endblock %} - {{ settings.APP_TITLE }} + {% if settings.GOOGLE_SITEMAP_CODE %} + {% endif %} {% spaceless %} @@ -15,7 +17,8 @@ diff --git a/templates/content/js/com.cnprog.post.js b/templates/content/js/com.cnprog.post.js index 0e604b8f..0ddc8f74 100644 --- a/templates/content/js/com.cnprog.post.js +++ b/templates/content/js/com.cnprog.post.js @@ -53,11 +53,11 @@ var Vote = function(){ var acceptAnonymousMessage = $.i18n._('insufficient privilege'); var acceptOwnAnswerMessage = $.i18n._('cannot pick own answer as best'); - var pleaseLogin = "" + var pleaseLogin = "" + $.i18n._('please login') + ""; - var pleaseSeeFAQ = $.i18n._('please see') + "faq"; + var pleaseSeeFAQ = $.i18n._('please see') + "faq"; var favoriteAnonymousMessage = $.i18n._('anonymous users cannot select favorite questions') var voteAnonymousMessage = $.i18n._('anonymous users cannot vote') + pleaseLogin; @@ -151,17 +151,17 @@ var Vote = function(){ var setVoteImage = function(voteType, undo, object){ var flag = undo ? "" : "-on"; var arrow = (voteType == VoteType.questionUpVote || voteType == VoteType.answerUpVote) ? "up" : "down"; - object.attr("src", $.i18n._("/") + "content/images/vote-arrow-"+ arrow + flag +".png"); + object.attr("src", scriptUrl + "content/images/vote-arrow-"+ arrow + flag +".png"); // if undo voting, then undo the pair of arrows. if(undo){ if(voteType == VoteType.questionUpVote || voteType == VoteType.questionDownVote){ - $(getQuestionVoteUpButton()).attr("src", $.i18n._("/") + "content/images/vote-arrow-up.png"); - $(getQuestionVoteDownButton()).attr("src", $.i18n._("/") + "content/images/vote-arrow-down.png"); + $(getQuestionVoteUpButton()).attr("src", scriptUrl + "content/images/vote-arrow-up.png"); + $(getQuestionVoteDownButton()).attr("src", scriptUrl + "content/images/vote-arrow-down.png"); } else{ - $(getAnswerVoteUpButton(postId)).attr("src", $.i18n._("/") + "content/images/vote-arrow-up.png"); - $(getAnswerVoteDownButton(postId)).attr("src", $.i18n._("/") + "content/images/vote-arrow-down.png"); + $(getAnswerVoteUpButton(postId)).attr("src", scriptUrl + "content/images/vote-arrow-up.png"); + $(getAnswerVoteDownButton(postId)).attr("src", scriptUrl + "content/images/vote-arrow-down.png"); } } }; @@ -237,7 +237,7 @@ var Vote = function(){ type: "POST", cache: false, dataType: "json", - url: $.i18n._("/") + $.i18n._("questions/") + questionId + "/" + $.i18n._("vote/"), + url: scriptUrl + $.i18n._("questions/") + questionId + "/" + $.i18n._("vote/"), data: { "type": voteType, "postId": postId }, error: handleFail, success: function(data){callback(object, voteType, data)}}); @@ -256,19 +256,23 @@ var Vote = function(){ showMessage(object, acceptOwnAnswerMessage); } else if(data.status == "1"){ +<<<<<<< HEAD:templates/content/js/com.cnprog.post.js object.attr("src", $.i18n._("/") + "content/images/vote-accepted.png"); +======= + object.attr("src", scriptUrl + "content/images/vote-accepted.png"); +>>>>>>> private:templates/content/js/com.cnprog.post.js $("#"+answerContainerIdPrefix+postId).removeClass("accepted-answer"); $("#"+commentLinkIdPrefix+postId).removeClass("comment-link-accepted"); } else if(data.success == "1"){ var acceptedButtons = 'div.'+ voteContainerId +' img[id^='+ imgIdPrefixAccept +']'; - $(acceptedButtons).attr("src", $.i18n._("/") + "content/images/vote-accepted.png"); + $(acceptedButtons).attr("src", scriptUrl + "content/images/vote-accepted.png"); var answers = ("div[id^="+answerContainerIdPrefix +"]"); $(answers).removeClass("accepted-answer"); var commentLinks = ("div[id^="+answerContainerIdPrefix +"] div[id^="+ commentLinkIdPrefix +"]"); $(commentLinks).removeClass("comment-link-accepted"); - object.attr("src", $.i18n._("/") + "content/images/vote-accepted-on.png"); + object.attr("src", scriptUrl + "content/images/vote-accepted-on.png"); $("#"+answerContainerIdPrefix+postId).addClass("accepted-answer"); $("#"+commentLinkIdPrefix+postId).addClass("comment-link-accepted"); } @@ -282,7 +286,7 @@ var Vote = function(){ showMessage(object, favoriteAnonymousMessage.replace("{{QuestionID}}", questionId)); } else if(data.status == "1"){ - object.attr("src", $.i18n._("/") + "content/images/vote-favorite-off.png"); + object.attr("src", scriptUrl + "content/images/vote-favorite-off.png"); var fav = getFavoriteNumber(); fav.removeClass("my-favorite-number"); if(data.count == 0) @@ -290,7 +294,7 @@ var Vote = function(){ fav.text(data.count); } else if(data.success == "1"){ - object.attr("src", $.i18n._("/") + "content/images/vote-favorite-on.png"); + object.attr("src", scriptUrl + "content/images/vote-favorite-on.png"); var fav = getFavoriteNumber(); fav.text(data.count); fav.addClass("my-favorite-number"); @@ -359,7 +363,7 @@ var Vote = function(){ } else if (data.success == "1"){ if (voteType == VoteType.removeQuestion){ - window.location.href = $.i18n._("/") + $.i18n._("questions/"); + window.location.href = scriptUrl + $.i18n._("questions/"); } else { if (removeActionType == 'delete'){ @@ -508,7 +512,7 @@ function createComments(type) { var getComments = function(id, jDiv) { //appendLoaderImg(id); - $.getJSON($.i18n._("/") + objectType + "s/" + id + "/" + $.i18n._("comments/") + $.getJSON(scriptUrl + objectType + "s/" + id + "/" + $.i18n._("comments/") , function(json) { showComments(id, json); }); }; @@ -529,8 +533,8 @@ function createComments(type) { var renderDeleteCommentIcon = function(post_id, delete_url){ if (canPostComments(post_id)){ var html = ''; - var img = $.i18n._("/") + "content/images/close-small.png"; - var imgHover = $.i18n._("/") + "content/images/close-small-hover.png"; + var img = scriptUrl + "content/images/close-small.png"; + var imgHover = scriptUrl + "content/images/close-small-hover.png"; html += ''; @@ -569,7 +573,11 @@ function createComments(type) { //todo fix url translations!!! $.ajax({ type: "POST", +<<<<<<< HEAD:templates/content/js/com.cnprog.post.js url: $.i18n._("/") + objectType + "s/" + id + "/" + $.i18n._("comments/"), +======= + url: scriptUrl + objectType + "s/" + id + "/" + $.i18n._("comments/"), +>>>>>>> private:templates/content/js/com.cnprog.post.js dataType: "json", data: { comment: textarea.val() }, success: function(json) { diff --git a/templates/content/js/com.cnprog.utils.js b/templates/content/js/com.cnprog.utils.js index fff61759..cf27c8a1 100644 --- a/templates/content/js/com.cnprog.utils.js +++ b/templates/content/js/com.cnprog.utils.js @@ -23,7 +23,7 @@ var notify = function() { }, close: function(doPostback) { if (doPostback) { - $.post($.i18n._("/") + $.i18n._("messages/") + + $.post(scriptUrl + $.i18n._("messages/") + $.i18n._("markread/"), { formdata: "required" }); } $(".notify").fadeOut("fast"); diff --git a/templates/content/js/wmd/wmd.js b/templates/content/js/wmd/wmd.js index 0bdc55b6..e396d3cb 100644 --- a/templates/content/js/wmd/wmd.js +++ b/templates/content/js/wmd/wmd.js @@ -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. diff --git a/templates/content/style/style.css b/templates/content/style/style.css index 13494721..ffa72676 100644 --- a/templates/content/style/style.css +++ b/templates/content/style/style.css @@ -258,7 +258,7 @@ blockquote border:1px solid #fff; background-color:#fff; color:#777; - padding:.3em; + padding:2px 4px 3px 4px; font:bold 100% sans-serif; } -- cgit v1.2.3-1-g7c22