summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/404.html12
-rw-r--r--templates/500.html8
-rw-r--r--templates/about.html22
-rw-r--r--templates/answer_edit.html25
-rw-r--r--templates/answer_edit_tips.html10
-rw-r--r--templates/ask.html36
-rw-r--r--templates/authopenid/changeemail.html45
-rw-r--r--templates/authopenid/changeopenid.html2
-rw-r--r--templates/authopenid/changepw.html33
-rw-r--r--templates/authopenid/complete.html100
-rw-r--r--templates/authopenid/confirm_email.txt2
-rw-r--r--templates/authopenid/delete.html3
-rw-r--r--templates/authopenid/external_legacy_login_info.html15
-rw-r--r--templates/authopenid/sendpw.html30
-rw-r--r--templates/authopenid/sendpw_email.txt11
-rw-r--r--templates/authopenid/settings.html4
-rw-r--r--templates/authopenid/signin.html112
-rw-r--r--templates/authopenid/signup.html61
-rw-r--r--templates/badge.html2
-rw-r--r--templates/badges.html9
-rw-r--r--templates/base.html28
-rw-r--r--templates/base_content.html32
-rw-r--r--templates/book.html10
-rw-r--r--templates/content/images/blue-up-arrow-h18px.pngbin0 -> 593 bytes
-rw-r--r--templates/content/images/gray-up-arrow-h18px.pngbin0 -> 383 bytes
-rw-r--r--templates/content/images/logo.gif (renamed from templates/content/images/cnprog_logo_200_56.gif)bin2114 -> 2114 bytes
-rw-r--r--templates/content/images/logo.pngbin3631 -> 1902 bytes
-rw-r--r--templates/content/jquery-openid/images/blogger-1.pngbin0 -> 432 bytes
-rw-r--r--templates/content/jquery-openid/images/claimid-0.pngbin0 -> 629 bytes
-rw-r--r--templates/content/jquery-openid/images/flickr.pngbin0 -> 426 bytes
-rw-r--r--templates/content/jquery-openid/images/livejournal-1.pngbin0 -> 713 bytes
-rw-r--r--templates/content/jquery-openid/images/local-login.pngbin0 -> 2522 bytes
-rw-r--r--templates/content/jquery-openid/images/myopenid-2.pngbin0 -> 511 bytes
-rw-r--r--templates/content/jquery-openid/images/openidico16.pngbin0 -> 554 bytes
-rw-r--r--templates/content/jquery-openid/images/technorati-1.pngbin0 -> 606 bytes
-rw-r--r--templates/content/jquery-openid/images/verisign-2.pngbin0 -> 859 bytes
-rw-r--r--templates/content/jquery-openid/images/vidoop.pngbin0 -> 499 bytes
-rw-r--r--templates/content/jquery-openid/images/wordpress.pngbin0 -> 566 bytes
-rw-r--r--templates/content/jquery-openid/jquery.openid.js25
-rw-r--r--templates/content/jquery-openid/openid.css50
-rw-r--r--templates/content/js/com.cnprog.admin.js13
-rw-r--r--templates/content/js/com.cnprog.i18n.js89
-rw-r--r--templates/content/js/com.cnprog.post.js314
-rw-r--r--templates/content/js/com.cnprog.utils.js7
-rw-r--r--templates/content/js/jquery.form.js654
-rw-r--r--templates/content/js/wmd/wmd.js2
-rw-r--r--templates/content/style/default.css27
-rw-r--r--templates/content/style/jquery.autocomplete.css2
-rw-r--r--templates/content/style/style.css477
-rw-r--r--templates/edit_user_email_feeds_form.html4
-rw-r--r--templates/faq.html22
-rw-r--r--templates/feedback.html55
-rw-r--r--templates/feedback_email.txt19
-rw-r--r--templates/footer.html48
-rw-r--r--templates/header.html55
-rw-r--r--templates/index.html86
-rw-r--r--templates/logout.html2
-rw-r--r--templates/post_contributor_info.html55
-rw-r--r--templates/privacy.html1
-rw-r--r--templates/question.html629
-rw-r--r--templates/question_edit.html33
-rw-r--r--templates/question_edit_tips.html10
-rw-r--r--templates/question_retag.html20
-rw-r--r--templates/question_summary_list_roll.html55
-rw-r--r--templates/questions.html108
-rw-r--r--templates/revisions_answer.html41
-rw-r--r--templates/revisions_question.html41
-rw-r--r--templates/tags.html13
-rw-r--r--templates/unanswered.html74
-rwxr-xr-xtemplates/upfiles/1245715031297631.pngbin3863 -> 0 bytes
-rwxr-xr-xtemplates/upfiles/12457157052552259.pngbin3863 -> 0 bytes
-rw-r--r--templates/user.html30
-rw-r--r--templates/user_edit.html8
-rw-r--r--templates/user_email_subscriptions.html23
-rw-r--r--templates/user_favorites.html1
-rw-r--r--templates/user_info.html42
-rw-r--r--templates/user_preferences.html23
-rw-r--r--templates/user_recent.html1
-rw-r--r--templates/user_reputation.html7
-rw-r--r--templates/user_responses.html2
-rw-r--r--templates/user_stats.html140
-rw-r--r--templates/user_tabs.html20
-rw-r--r--templates/user_votes.html9
-rw-r--r--templates/users.html8
-rw-r--r--templates/users_questions.html30
85 files changed, 2730 insertions, 1257 deletions
diff --git a/templates/404.html b/templates/404.html
index cd23a36b..227de3ae 100644
--- a/templates/404.html
+++ b/templates/404.html
@@ -23,24 +23,24 @@
<div style="padding:5px 0px 10px 0;line-height:25px;">
<h3>{% trans "Sorry, could not find the page you requested." %}</h3>
<div style="margin-top:5px">
- {% trans "This might have happened for the following reasons:" %}<br>
+ {% trans "This might have happened for the following reasons:" %}<br/>
<ul>
<li>{% trans "this question or answer has been deleted;" %}</li>
<li>{% trans "url has error - please check it;" %}</li>
- <li>{% trans "the page you tried to visit is protected or you don't have sufficient points, see" %} <a href="/faq"> faq</a>;</li>
+ <li>{% trans "the page you tried to visit is protected or you don't have sufficient points, see" %} <a href="{% url faq %}"> faq</a>;</li>
<li>{% trans "if you believe this error 404 should not have occured, please" %}
<a href="{{feedback_site_url}}" target="_blank">{% trans "report this problem" %}</a></li>
</u>
</div>
<script type="text/javascript">
- var GOOG_FIXURL_LANG = 'zh-cn';
+ var GOOG_FIXURL_LANG = '{{settings.LANGUAGE_CODE}}';
var GOOG_FIXURL_SITE = '{{site_url}}';
</script>
<script type="text/javascript" src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
<ul>
- <li><a href="#" id="linkPrevious">{% trans "back to previous page" %} » </li>
- <li><a href="/questions">{% trans "see all questions" %} » </a></li>
- <li><a href="/tags/">{% trans "see all tags" %} » </a></li>
+ <li><a href="#" id="linkPrevious">{% trans "back to previous page" %} »</li>
+ <li><a href="{% url questions %}">{% trans "see all questions" %} »</a></li>
+ <li><a href="{% url tags %}">{% trans "see all tags" %} »</a></li>
</u>
</div>
diff --git a/templates/500.html b/templates/500.html
index 52dcafae..51e73178 100644
--- a/templates/500.html
+++ b/templates/500.html
@@ -20,13 +20,13 @@
<div id="main-body" class="headNormal">
<div style="padding:5px 0px 10px 0;line-height:25px">
<h3>{% trans "sorry, system error" %}</h3>
- <br>
- {% trans "system error log is recorded, error will be fixed as soon as possible" %}<br>
+ <br/>
+ {% trans "system error log is recorded, error will be fixed as soon as possible" %}<br/>
{% trans "please report the error to the site administrators if you wish" %}
<ul>
<li><a href="#" id="linkPrevious">{% trans "back to previous page" %}</li>
- <li><a href="/questions">{% trans "see latest questions" %}</a></li>
- <li><a href="/tags/">{% trans "see tags" %}</a></li>
+ <li><a href="{% url questions %}">{% trans "see latest questions" %}</a></li>
+ <li><a href="{% url tags %}">{% trans "see tags" %}</a></li>
</u>
</div>
diff --git a/templates/about.html b/templates/about.html
index eaf0d591..671964cc 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -12,10 +12,32 @@
</div>
<div class="content">
+ <!-- default text
<p>edit file templates/about.html. Below are just suggestions of what can go here</p>
<p>what is your site for?</p>
<p>how does it work? what are roles of members?</p>
<p>is there a place to find out more about this website?</p>
+ -->
+ <p>{% blocktrans %}<strong>CNPROG <span class="orange">Q&amp;A</span></strong> is a collaboratively edited question
+ and answer site created for the <strong>CNPROG</strong> community.
+ {% endblocktrans %}
+ </p>
+ <p>{% blocktrans %}Here you can <strong>ask</strong> and <strong>answer</strong> questions, <strong>comment</strong>
+ and <strong>vote</strong> for the questions of others and their answers. Both questions and answers
+ <strong>can be revised</strong> and improved. Questions can be <strong>tagged</strong> with
+ the relevant keywords to simplify future access and organize the accumulated material.{% endblocktrans %}
+ </p>
+
+ <p>{% blocktrans %}This <span class="orange">Q&amp;A</span> site is moderated by its members, hopefully - including yourself!
+ Moderation rights are gradually assigned to the site users based on the accumulated <strong>"reputation"</strong>
+ points. These points are added to the users account when others vote for his/her questions or answers.
+ These points (very) roughly reflect the level of trust of the community.{% endblocktrans %}
+ </p>
+ <p>No points are necessary to ask or answer the questions - so please -
+ <strong><a href="{% url user_signin %}">join us!</a></strong>
+ </p>
+ <p>If you would like to find out more about this site - please see <strong><a href="{% url faq %}">frequently asked questions</a></strong>.
+ </p>
</div>
{% endblock %}
<!-- end template about.html -->
diff --git a/templates/answer_edit.html b/templates/answer_edit.html
index 9f0f1bec..cd247a3c 100644
--- a/templates/answer_edit.html
+++ b/templates/answer_edit.html
@@ -1,14 +1,15 @@
{% extends "base.html" %}
<!-- template answer_edit.html -->
{% load i18n %}
+{% load extra_tags %}
{% block title %}{% spaceless %}{% trans "Edit answer" %}{% endspaceless %}{% endblock %}
{% block forejs %}
- <script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
- <script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
- <script type='text/javascript' src='/content/js/wmd/showdown.js'></script>
- <script type='text/javascript' src='/content/js/wmd/wmd.js'></script>
- <link rel="stylesheet" type="text/css" href="/content/js/wmd/wmd.css" />
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.editor.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.post.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.validate.pack.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/wmd/showdown.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/wmd/wmd.js" %}'></script>
+ <link rel="stylesheet" type="text/css" href="{% href "/content/js/wmd/wmd.css" %}" />
<script type="text/javascript">
$().ready(function(){
@@ -49,31 +50,27 @@
<div id="main-body" class="ask-body">
<div id="askform">
<form id="fmedit" action="{% url edit_answer answer.id %}" method="post" >
- <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br>
+ <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/>
{% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
<div style="vertical-align:middle">
{{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans "select revision" %}">
- </div><br>
+ </div>
<div class="form-item">
<div id="wmd-button-bar" class="wmd-panel"></div>
{{ form.text }}
<span class="form-error"></span>
<div class="preview-toggle"><span id="pre-collapse"
- title="{% trans "Toggle the real time Markdown editor preview" %}打">{% trans "toggle preview" %}</span></div>
+ title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span></div>
<div id="previewer" class="wmd-preview"></div>
- <br>
</div>
- <strong>{{ form.summary.label_tag }}</strong> <br>
+ <strong>{{ form.summary.label_tag }}</strong> <br/>
{{ form.summary }} {{ form.summary.errors }}
<div class="title-desc">
{{ form.summary.help_text }}
</div>
- <br>
<input type="submit" value="{% trans "Save edit" %}" class="submit" />
<input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" />
- <br>
- <br>
</form>
</div>
</div>
diff --git a/templates/answer_edit_tips.html b/templates/answer_edit_tips.html
index 31f71e34..c390da06 100644
--- a/templates/answer_edit_tips.html
+++ b/templates/answer_edit_tips.html
@@ -16,8 +16,9 @@
{% trans "be clear and concise" %}
</li>
</ul>
- <a href="/faq/" target="_blank" title="{% trans "see frequently asked questions" %}" style="float:right;position:relative">faq »</a>
- <br>
+ <p class='info-box-follow-up-links'>
+ <a href="{% url faq %}" target="_blank" title="{% trans "see frequently asked questions" %}">faq »</a>
+ </p>
</div>
</div>
@@ -47,7 +48,8 @@
{% trans "basic HTML tags are also supported" %}
</li>
</ul>
- <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank" style="float:right;position:relative">{% trans "learn more about Markdown" %} »</a>
- <br>
+ <p class='info-box-follow-up-links'>
+ <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans "learn more about Markdown" %} »</a>
+ </p>
</div>
<!-- end template answer_edit_tips.html -->
diff --git a/templates/ask.html b/templates/ask.html
index 4aa18dd5..30d43ee0 100644
--- a/templates/ask.html
+++ b/templates/ask.html
@@ -1,14 +1,15 @@
{% extends "base.html" %}
<!-- template ask.html -->
{% load i18n %}
+{% load extra_tags %}
{% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %}
{% block forejs %}
- <script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
- <script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
- <script type='text/javascript' src='/content/js/wmd/showdown.js'></script>
- <script type='text/javascript' src='/content/js/wmd/wmd.js'></script>
- <link rel="stylesheet" type="text/css" href="/content/js/wmd/wmd.css" />
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.editor.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.post.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.validate.pack.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/wmd/showdown.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/wmd/wmd.js" %}'></script>
+ <link rel="stylesheet" type="text/css" href="{% href "/content/js/wmd/wmd.css" %}" />
<script type="text/javascript">
$().ready(function(){
//set current module button style
@@ -70,20 +71,22 @@
{% ifequal settings.EMAIL_VALIDATION 'on' %}
{% if not request.user.email_isvalid %}
<div class="message">
- {% blocktrans with request.user.email as email %}must have valid {{email}} to post{% endblocktrans %}
+ {% blocktrans with request.user.email as email %}must have valid {{email}} to post,
+ see {{email_validation_faq_url}}
+ {% endblocktrans %}
</div>
{% endif %}
{% endifequal %}
{% endif %}
- <p class="form-item">
- <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br>
+ <div class="form-item">
+ <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
{{ form.title }} {{ form.title.errors }}
<div class="title-desc">
{{ form.title.help_text }}
</div>
- </p>
+ </div>
- <p class="form-item">
+ <div class="form-item">
<div id="wmd-button-bar" class="wmd-panel"></div>
{{ form.text }}
@@ -93,21 +96,22 @@
<td>
<span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
</td>
+ {% if settings.WIKI_ON %}
<td style="text-align:right;">
{{ form.wiki }} <span style="font-weight:normal;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
</td>
+ {% endif %}
</tr>
</table>
</div>
<div id="previewer" class="wmd-preview"></div>
<span class="form-error"></span>
- <br>
- </p>
- <p class="form-item">
- <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <span class="form-error"></span><br>
+ </div>
+ <div class="form-item">
+ <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <span class="form-error"></span><br/>
{{ form.tags }} {{ form.tags.errors }}
- </p>
+ </div>
<p class="title-desc">
{{ form.tags.help_text }}
</p>
diff --git a/templates/authopenid/changeemail.html b/templates/authopenid/changeemail.html
index d5acb6c9..94d1881c 100644
--- a/templates/authopenid/changeemail.html
+++ b/templates/authopenid/changeemail.html
@@ -1,37 +1,44 @@
{% extends "base_content.html" %}
{% load i18n %}
+{% block title %}{% spaceless %}{% trans "Change email" %}{% endspaceless %}{% endblock %}
{% block content %}
<!-- changeemail.html action_type={{action_type}}-->
{% ifequal action_type "change" %}
<div id="main-bar" class="headNormal">
- {% trans "Change email" %}
+ {% if user.email %}
+ {% trans "Change email" %}
+ {% else %}
+ {% trans "Save your email address" %}
+ {% endif %}
</div>
<p class="message">
- {% blocktrans %}change {{email}} info{% endblocktrans %}
- </p>
- {% if form.errors %}
- <p class="errors">{% trans "Please correct errors below:" %}<br />
- {% if form.email.errors %}
- <span class="error">{{ form.email.errors|join:", " }}</span>
- {% endif %}
- {% if form.password.errors %}
- <span class="error">{{ form.password.errors|join:", " }}</span>
+ {% if user.email %}
+ {% blocktrans %}change {{email}} info{% endblocktrans %}
+ {% else %}
+ {% blocktrans %}here is why email is required, see {{gravatar_faq_url}}{% endblocktrans %}
{% endif %}
</p>
- {% endif %}
-
{% if msg %}
- <p class="errors">{{ msg }}</p>
+ <p class="error">{{ msg }}</p>
{% endif %}
<div class="aligned">
<form action="." method="post" accept-charset="utf-8">
-
- <div class="form-row"><label for="id_email">{% trans "Your new Email" %}</label><br>{{ form.email }}</div>
- <!--<div class="form-row"><label for="id_password">{% trans "Password" %}</label>{{ form.password }}</div>-->
+ {% if next %}
+ <input type="hidden" name="next" value="{{next}}"/>
+ {% endif %}
+ <div class="form-row-vertical">
+ <label for="id_email">{% if user.email %}{% trans "Your new Email" %}{% else %}{% trans "Your Email" %}{% endif %}</label>
+ {% if form.email.errors %}
+ <p class="error">{{form.email.errors|join:", "}}</p>
+ {% endif %}
+ {{ form.email }}
+ </div>
<div class="submit-row">
- <input class="submit" type="submit" name="change_email" value="{% trans "Change email" %}">
+ <input class="submit" type="submit" name="change_email" value="{% if user.email %}{% trans "Change email" %}{% else %}{% trans "Save Email" %}{% endif %}">
+ {% if user.email %}
<input class="submit" type="submit" name="cancel" value="{% trans "Cancel" %}">
+ {% endif %}
</div>
</form>
@@ -42,7 +49,7 @@
{% trans "Validate email" %}
</div>
<p class="message">
- {% blocktrans %}validate {{email}} info{% endblocktrans %}
+ {% blocktrans %}validate {{email}} info or go to {{change_email_url}}{% endblocktrans %}
</p>
{% endifequal %}
{% ifequal action_type "keep" %}
@@ -50,7 +57,7 @@
{% trans "Email not changed" %}
</div>
<p class="message">
- {% blocktrans %}old {{email}} kept{% endblocktrans %}
+ {% blocktrans %}old {{email}} kept, if you like go to {{change_email_url}}{% endblocktrans %}
</p>
{% endifequal %}
{% ifequal action_type "done_novalidate" %}
diff --git a/templates/authopenid/changeopenid.html b/templates/authopenid/changeopenid.html
index 9b5a196a..d01788fb 100644
--- a/templates/authopenid/changeopenid.html
+++ b/templates/authopenid/changeopenid.html
@@ -1,7 +1,7 @@
{% extends "base.html" %}
<!-- changeopenid.html -->
{% load i18n %}
-
+{% block title %}{% spaceless %}{% trans "Change OpenID" %}{% endspaceless %}{% endblock %}
{% block content %}
<div id="main-bar" class="">
<h3>
diff --git a/templates/authopenid/changepw.html b/templates/authopenid/changepw.html
index 0e90b172..8b059544 100644
--- a/templates/authopenid/changepw.html
+++ b/templates/authopenid/changepw.html
@@ -1,34 +1,17 @@
{% extends "base.html" %}
<!-- changepw.html -->
{% load i18n %}
-
-{% block head %}
-
-{% endblock %}
-
-
-
+{% block head %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Change password" %}{% endspaceless %}{% endblock %}
{% block content %}
-<div id="main-bar" class="">
- <h3>
- {% trans "Account: change password" %}
- </h3>
-</div>
-<p>{% blocktrans %}This is where you can change your password. Make sure you remember it!{% endblocktrans %}</p>
-{% if form.errors %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-{{ form.errors }}
-</p>
-{% endif %}
-
+<div class="headNormal">{% trans "Account: change password" %}</div>
+<p class="message">{% blocktrans %}This is where you can change your password. Make sure you remember it!{% endblocktrans %}</p>
<div class="aligned">
<form action="." method="post" accept-charset="utf-8">
-
- <div id="form-row"><label for="id_oldpw">{% trans "Current password" %}</label>{{ form.oldpw }}</div>
- <div id="form-row"><label for="id_password1">{% trans "New password" %}</label>{{ form.password1 }}</div>
- <div id="form-row"><label for="id_password2">{% trans "New password again" %}</label>{{ form.password2 }}</div>
- <p><input type="submit" value="{% trans "Change password" %}"></p>
-
+ <ul id="changepw-form" class="form-horizontal-rows">
+ {{form.as_ul}}
+ </ul>
+ <div class="submit-row"><input type="submit" class="submit" value="{% trans "Change password" %}" /></div>
</form>
</div>
{% endblock %}
diff --git a/templates/authopenid/complete.html b/templates/authopenid/complete.html
index b9a14e16..9a94c3c4 100644
--- a/templates/authopenid/complete.html
+++ b/templates/authopenid/complete.html
@@ -1,5 +1,19 @@
{% extends "base_content.html" %}
<!-- complete.html -->
+{% comment %}
+views calling this template:
+* django_authopenid.views.register with login_type='openid'
+* django_authopenid.views.signin - with login_type='legacy'
+
+parameters:
+* provider
+* login_type openid|legacy
+* username (same as screen name or username in the models, and nickname in openid sreg)
+* form1 - OpenidRegisterForm
+* form2 - OpenidVerifyForm not clear what this form is supposed to do, not used for legacy
+* email_feeds_form forum.forms.EditUserEmailFeedsForm
+* openid_username_exists
+{% endcomment %}
{% load i18n %}
{% block head %}{% endblock %}
{% block title %}{% spaceless %}{% trans "Connect your OpenID with this site" %}{% endspaceless %}{% endblock %}
@@ -7,29 +21,38 @@
<div id="main-bar" class="headNormal">
{% trans "Connect your OpenID with your account on this site" %}
</div>
- <p id="completetxt" >
+ <div id="completetxt" >
<div class="message">
- {% blocktrans %}register new {{provider}} account info{% endblocktrans %}
+ {% ifequal login_type 'openid' %}
+ {% blocktrans %}register new {{provider}} account info, see {{gravatar_faq_url}}{% endblocktrans %}
+ {% else %}
+ {% ifequal login_type 'legacy' %}
+ {% if external_login_name_is_taken %}
+ {% blocktrans %}{{username}} already exists, choose another name for
+ {{provider}}. Email is required too, see {{gravatar_faq_url}}
+ {% endblocktrans %}
+ {% else %}
+ {% blocktrans %}register new external {{provider}} account info, see {{gravatar_faq_url}}{% endblocktrans %}
+ {% endif %}
+ {% endifequal %}
+ {% endifequal %}
</div>
<p style="display:none">{% trans "This account already exists, please use another." %}</p>
- </p>
+ </div>
{% if form1.errors %}
- <p class="errors">
- <span class="big">{% trans "Sorry, looks like we have some errors:" %}</span><br>
- <ul class="error-list">
- {% if form1.username.errors %}
- <li><span class="error">{{ form1.username.errors|join:", " }}</span></li>
- {% endif %}
- {% if form1.email.errors %}
- <li><span class="error">{{ form1.email.errors|join:", " }}</span></li>
- {% endif %}
+ <ul class="errorlist">
+ {% if form1.non_field_errors %}
+ {% for error in form1.non_field_errors %}
+ <li>{{error}}</li>
+ {% endfor %}
+ {% endif %}
</ul>
- </p>
{% endif %}
- {% if form2.errors %}
- <p class="errors">
- <span class="big">{% trans "Sorry, looks like we have some errors:" %}</span><br>
+ {% comment %}
+ {% if form2.errors %}<!--form2 is dysfunctional so commented out -->
+ <div class="errors">
+ <span class="big">{% trans "Sorry, looks like we have some errors:" %}</span><br/>
<ul class="error-list">
{% if form2.username.errors %}
<li><span class="error">{{ form2.username.errors|join:", " }}</span></li>
@@ -38,31 +61,56 @@
<li><span class="error">{{ form2.password.errors|join:", " }}</span></li>
{% endif %}
</ul>
- </p>
+ </div>
{% endif %}
+ {% endcomment %}
<div class="login">
+ {% ifequal login_type 'openid' %}
<form name="fregister" action="{% url user_register %}" method="POST">
- {{ form.next }}
- <div class="form-row"><label for="id_username">{% trans "Screen name label" %}</label><br />{{ form1.username }}</div>
- <div class="form-row"><label for="id_email">{% trans "Email address label" %}</label><br />{{ form1.email }}</div>
- <div class="submit-row"><input type="submit" class="submit" name="bnewaccount" value="{% trans "create account" %}"></div>
+ {% else %}
+ <form name="fregister" action="{% url user_signin %}" method="POST">
+ {% endifequal %}
+ {{ form1.next }}
+ <div class="form-row-vertical">
+ <label for="id_username">{% trans "Screen name label" %}</label>
+ {% if form1.username.errors %}
+ <p class="error">{{ form1.username.errors|join:", " }}</p>
+ {% endif %}
+ {{ form1.username }}
+ </div>
+ <div class="form-row-vertical margin-bottom">
+ <label for="id_email">{% trans "Email address label" %}</label>
+ {% if form1.email.errors %}
+ <p class="error">{{ form1.email.errors|join:", " }}</p>
+ {% endif %}
+ {{ form1.email }}
+ </div>
+ <p class='nomargin'>{% trans "receive updates motivational blurb" %}</p>
+ {% include "edit_user_email_feeds_form.html" %}
+ <div class="submit-row"><input type="submit" class="submit" name="bnewaccount" value="{% trans "create account" %}"/></div>
</form>
</div>
+ {% comment %}<!-- this form associates openID with an existing password-protected account, not yet functional -->
+ {% if form2 %}
<div class="login" style="display:none">
<form name="fverify" action="{% url user_register %}" method="POST">
- {{ form.next }}
+ {{ form2.next }}
<fieldset style="padding:10px">
<legend class="big">{% trans "Existing account" %}</legend>
- <div class="form-row"><label for="id_username">{% trans "user name" %}</label><br />{{ form2.username }}</div>
- <div class="form-row"><label for="id_passwordl">{% trans "password" %}</label><br />{{ form2.password }}</div>
+ <div class="form-row"><label for="id_username">{% trans "user name" %}</label><br/>{{ form2.username }}</div>
+ <div class="form-row"><label for="id_passwordl">{% trans "password" %}</label><br/>{{ form2.password }}</div>
+ <p><span class='big strong'>(Optional) receive updates by email</span> - only sent when there are any.</p>
+ {% include "edit_user_email_feeds_form.html" %}
<!--todo double check translation from chinese 确认 = "Register" -->
<div class="submit-row">
- <input type="submit" class="submit" name="bverify" value="{% trans "Register" %}">
- <a href="">{% trans "Forgot your password?" %}</a>
+ <input type="submit" class="submit" name="bverify" value="{% trans "Register" %}"/>
+ <a href="{% url user_sendpw %}">{% trans "Forgot your password?" %}</a>
</div>
</fieldset>
</form>
</div>
+ {% endif %}
+ {% endcomment %}
{% endblock %}
<!-- end complete.html -->
diff --git a/templates/authopenid/confirm_email.txt b/templates/authopenid/confirm_email.txt
index 202db0fc..3a01f146 100644
--- a/templates/authopenid/confirm_email.txt
+++ b/templates/authopenid/confirm_email.txt
@@ -7,7 +7,7 @@
{% trans "Password:" %} {{ password }}
{% trans "Please sign in here:" %}
-{{ site_url }}{% trans "signin/" %}
+{{signup_url}}
{% blocktrans %}Sincerely,
Forum Administrator{% endblocktrans %}
diff --git a/templates/authopenid/delete.html b/templates/authopenid/delete.html
index d39bc962..0f9f1c60 100644
--- a/templates/authopenid/delete.html
+++ b/templates/authopenid/delete.html
@@ -1,8 +1,7 @@
{% extends "base.html" %}
<!-- delete.html -->
{% load i18n %}
-
-
+{% block title %}{% spaceless %}{% trans "Delete account" %}{% endspaceless %}{% endblock %}
{% block content %}
<div id="main-bar" class="">
<h3>
diff --git a/templates/authopenid/external_legacy_login_info.html b/templates/authopenid/external_legacy_login_info.html
new file mode 100644
index 00000000..c200b29d
--- /dev/null
+++ b/templates/authopenid/external_legacy_login_info.html
@@ -0,0 +1,15 @@
+{% extends "base_content.html" %}
+<!--customize this template-->
+{% load i18n %}
+{% block title %}{% spaceless %}{% trans "Traditional login information" %}{% endspaceless %}{% endblock %}
+{% block content %}
+<div class="headNormal">
+ {% trans "Traditional login information" %}
+</div>
+{% spaceless %}
+<div class="message">
+<!--add info about your external login site here-->
+{% trans "how to login with password through external login website" %}
+</div>
+{% endspaceless %}
+{% endblock %}
diff --git a/templates/authopenid/sendpw.html b/templates/authopenid/sendpw.html
index ba81dba4..6241c811 100644
--- a/templates/authopenid/sendpw.html
+++ b/templates/authopenid/sendpw.html
@@ -2,35 +2,25 @@
<!-- sendpw.html -->
{% load i18n %}
{% block title %}{% spaceless %}{% trans "Send new password" %}{% endspaceless %}{% endblock %}
-
{% block content %}
-<div id="main-bar" class="">
- <h3>{% trans "Send new password" %}</h3>
-
-</div>
-<div class="paragraph">
-{% trans "Lost your password? No problem - here you can reset it." %}<br>
-{% trans "Please enter your username below and new password will be sent to your registered e-mail" %}
+<div class="headNormal">
+ {% trans "Send new password" %}
</div>
-{% if form.errors %}
-<p class="errors"><span class="big">{% "Sorry, looks like we have some errors:" %}</span><br>
- {% if form.username.errors %}
- <span class="error">{{ form.username.errors|join:", " }}</span>
- {% endif %}
+<p class="message">
+{% trans "password recovery information" %}
</p>
-{% endif %}
{% if msg %}
- <div class="paragraph error">{{ msg }}</div>
+ <p class="action-status"><span>{{msg}}</span><p>
{% endif %}
<div class="aligned">
<form action="." method="post" accept-charset="utf-8">
- <div id="form-row"><label for="id_username">{% trans "User name" %}:</label>{{ form.username }}</div>
-
- <p style="padding-top:10px"><input type="submit" value="{% trans "Reset password" %}"> <a href="{% url user_signin %}">{% trans "return to login" %}</a></p>
-
+ <ul id="emailpw-form" class="form-horizontal-rows">
+ {{form.as_ul}}
+ </ul>
+ <p style="padding-top:10px"><input type="submit" class="submit" value="{% trans "Reset password" %}" />
+ <a href="{% url user_signin %}"><span class="strong">{% trans "return to login" %}</span></a></p>
</form>
- <span class="darkred">{% trans "Note: your new password will be activated only after you click the activation link in the email message" %}</span>
</div>
{% endblock %}
<!-- end sendpw.html -->
diff --git a/templates/authopenid/sendpw_email.txt b/templates/authopenid/sendpw_email.txt
index 2024061c..f044ca45 100644
--- a/templates/authopenid/sendpw_email.txt
+++ b/templates/authopenid/sendpw_email.txt
@@ -1,14 +1,9 @@
{% load i18n %}
-{% blocktrans %}Someone has requested to reset your password on {{ site_url }}.
+{% blocktrans%}Someone has requested to reset your password on {{site_url}}.
If it were not you, it is safe to ignore this email.{% endblocktrans %}
-{% trans "Your new account details are:" %}
-
-{% trans "Username:" %} {{ username }}
-{% trans "New password:" %} {{ password }}
-
-{% trans "To confirm that you wanted to reset your password please visit:" %}
-{{ site_url }}{{ url_confirm }}?key={{ confirm_key }}
+{% blocktrans %}email explanation how to use new {{password}} for {{username}}
+with the {{key_link}}{% endblocktrans %}
{% blocktrans %}Sincerely,
Forum Administrator{% endblocktrans %}
diff --git a/templates/authopenid/settings.html b/templates/authopenid/settings.html
index a373324e..66ea5953 100644
--- a/templates/authopenid/settings.html
+++ b/templates/authopenid/settings.html
@@ -1,7 +1,7 @@
{% extends "base_content.html" %}
<!-- settings.html -->
{% load i18n %}
-
+{% block title %}{% spaceless %}{% trans "Account functions" %}{% endspaceless %}{% endblock %}
{% block head %}
<style type="text/css" media="screen">
h4 {font-size:12pt;}
@@ -31,7 +31,7 @@
<dt>» <a href="{% url user_changeemail %}">{% trans "Change email " %}</a></dt>
<dd>{% trans "Add or update the email address associated with your account." %}</dd>
{% if is_openid %}
- <dt>» <a href="{% url user_changeopenid %}">{% trans "Change OpenID %}</a></dt>
+ <dt>» <a href="{% url user_changeopenid %}">{% trans "Change OpenID" %}</a></dt>
<dd>{% trans "Change openid associated to your account" %}</dd>
{% endif %}
diff --git a/templates/authopenid/signin.html b/templates/authopenid/signin.html
index 9a1a6780..1363661e 100644
--- a/templates/authopenid/signin.html
+++ b/templates/authopenid/signin.html
@@ -1,13 +1,13 @@
{% extends "base.html" %}
<!-- signin.html -->
{% load i18n %}
+{% load extra_tags %}
{% block title %}{% spaceless %}{% trans "User login" %}{% endspaceless %}{% endblock %}
{% block forejs %}
- <!--<script type="text/javascript" src="/content/js/jquery.openid.js?"></script>-->
- <script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.validate.pack.js" %}'></script>
- <link rel="stylesheet" type="text/css" media="screen" href="/content/jquery-openid/openid.css"/>
- <script type="text/javascript" src="/content/jquery-openid/jquery.openid.js"></script>
+ <link rel="stylesheet" type="text/css" media="screen" href="{% href "/content/jquery-openid/openid.css" %}"/>
+ <script type="text/javascript" src="{% href "/content/jquery-openid/jquery.openid.js" %}"></script>
<script type="text/javascript"> $().ready( function() { $("form.openid:eq(0)").openid(); })</script>
<!--<script type="text/javascript">
$().ready(function(){
@@ -37,64 +37,78 @@
{% endblocktrans %}
</div>
{% endif %}
- <div style="width:600px;float:left;margin-bottom:5px;">{% trans "Click to sign in through any of these services." %}</div>
<form id="openid_form" name="openid_form" class="openid" method="post" action="{% url user_signin %}">
+ <div style="width:600px;float:left;margin-bottom:5px;">
+ {% trans "Click to sign in through any of these services." %}
+ </div>
<ul class="providers">
- <li class="openid" title="OpenID">
- <div class="logo_box openid_box">
- <img src="/content/jquery-openid/images/openid.gif" alt="icon" />
+ <li class="local" title="Local login">
+ <div class="logo_box local_login_box">
+ <img src="{% href "/content/jquery-openid/images/local-login.png" %}" alt="your icon here" />
</div>
- <span><strong>http://{your-openid-url}</strong></span>
+ <span></span>
</li>
<li class="direct" title="Google">
<div class="logo_box google_box">
- <img src="/content/jquery-openid/images/google.gif" alt="icon" /><span>https://www.google.com/accounts/o8/id</span>
+ <img src="{% href "/content/jquery-openid/images/google.gif" %}" alt="icon" /><span>https://www.google.com/accounts/o8/id</span>
</div>
</li>
<li class="direct" title="Yahoo">
<div class="logo_box yahoo_box">
- <img src="/content/jquery-openid/images/yahoo.gif" alt="icon" /><span>http://yahoo.com/</span>
+ <img src="{% href "/content/jquery-openid/images/yahoo.gif" %}" alt="icon" /><span>http://yahoo.com/</span>
</div>
</li>
<li class="username" title="AOL screen name">
<div class="logo_box aol_box">
- <img src="/content/jquery-openid/images/aol.gif" alt="icon" /><span>http://openid.aol.com/<strong>username</strong></span>
+ <img src="{% href "/content/jquery-openid/images/aol.gif" %}" alt="icon" /><span>http://openid.aol.com/<strong>username</strong></span>
</div>
</li>
- <li class="username first_tiny_li" title="MyOpenID user name">
- <img src="/content/jquery-openid/images/myopenid.ico" alt="icon" />
+ </ul>
+ <ul class="providers">
+ <!--<li class="openid" title="OpenID">
+ <div class="logo_box openid_box">
+ <img src="/content/jquery-openid/images/openid.gif" alt="icon" />
+ </div>
+ <span><strong>http://{your-openid-url}</strong></span>
+ </li>-->
+ <li class="openid first_tiny_li" title="OpenID URL">
+ <img src="{% href "/content/jquery-openid/images/openidico16.png" %}" alt="icon" />
+ <span>http://{your-openid-url}</span>
+ </li>
+ <li class="username" title="MyOpenID user name">
+ <img src="{% href "/content/jquery-openid/images/myopenid-2.png" %}" alt="icon" />
<span>http://<strong>username</strong>.myopenid.com/</span>
</li>
<li class="username" title="Flickr user name">
- <img src="/content/jquery-openid/images/flickr.ico" alt="icon" />
+ <img src="{% href "/content/jquery-openid/images/flickr.png" %}" alt="icon" />
<span>http://flickr.com/<strong>username</strong>/</span>
</li>
<li class="username" title="Technorati user name">
- <img src="/content/jquery-openid/images/technorati.ico" alt="icon" />
+ <img src="{% href "/content/jquery-openid/images/technorati-1.png" %}" alt="icon" />
<span>http://technorati.com/people/technorati/<strong>username</strong>/</span>
</li>
<li class="username" title="Wordpress blog name">
- <img src="/content/jquery-openid/images/wordpress.ico" alt="icon" />
+ <img src="{% href "/content/jquery-openid/images/wordpress.png" %}" alt="icon" />
<span>http://<strong>username</strong>.wordpress.com</span>
</li>
<li class="username" title="Blogger blog name">
- <img src="/content/jquery-openid/images/blogger.ico" alt="icon" />
+ <img src="{% href "/content/jquery-openid/images/blogger-1.png" %}" alt="icon" />
<span>http://<strong>username</strong>.blogspot.com/</span>
</li>
<li class="username" title="LiveJournal blog name">
- <img src="/content/jquery-openid/images/livejournal.ico" alt="icon" />
+ <img src="{% href "/content/jquery-openid/images/livejournal-1.png" %}" alt="icon" />
<span>http://<strong>username</strong>.livejournal.com</span>
</li>
<li class="username" title="ClaimID user name">
- <img src="/content/jquery-openid/images/claimid.ico" alt="icon" />
+ <img src="{% href "/content/jquery-openid/images/claimid-0.png" %}" alt="icon" />
<span>http://claimid.com/<strong>username</strong></span>
</li>
<li class="username" title="Vidoop user name">
- <img src="/content/jquery-openid/images/vidoop.ico" alt="icon" />
+ <img src="{% href "/content/jquery-openid/images/vidoop.png" %}" alt="icon" />
<span>http://<strong>username</strong>.myvidoop.com/</span>
</li>
<li class="username" title="Verisign user name">
- <img src="/content/jquery-openid/images/verisign.ico" alt="icon" />
+ <img src="{% href "/content/jquery-openid/images/verisign-2.png" %}" alt="icon" />
<span>http://<strong>username</strong>.pip.verisignlabs.com/</span>
</li>
</ul>
@@ -111,44 +125,28 @@
<div><p><input id="openid_url" type="text" value="http://" name="openid_url" />
<input id="bsignin" name="bsignin" type="submit" value="{% trans "Login" %}" /></p></div>
</fieldset>
+ <fieldset id='local_login_fs'>
+ <p>{% trans 'Enter your login name and password' %}</p>
+ {% if form1.errors %}
+ {{form1.non_field_errors.as_ul}}
+ {% endif %}
+ <div><p class="login"><label for="id_username">{% trans "Login name" %}</label>
+ {{form1.username}}</p>
+ <p class="login"><label for="id_password">{% trans "Password" %}</label>
+ {{form1.password}}</p>
+ <p id="local_login_buttons">
+ <input id="blogin" name="blogin" type="submit" value="{% trans "Login" %}" />
+ <a href="{% url user_signup %}">{% trans "Create account" %}</a><br/>
+ <a href="{% url user_sendpw %}">{% trans "Forgot your password?" %}</a>
+ </p>
+ </div>
+ </fieldset>
</form>
-<div class="login">
- <p style="display:none">{% trans "we support two login modes" %}</p>
- <div style="display:none">
- <br>
- {% if form1.errors %}
- <p class="errors">
- <span class="big">{% trans "Sorry, looks like we have some errors:" %}</span><br>
- <ul class="error-list">
- {% if form1.username.errors %}
- <li><span class="error">{{ form1.username.errors|join:", " }}</span></li>
- {% endif %}
- {% if form1.password.errors %}
- <li><span class="error">{{ form1.password.errors|join:", " }}</span></li>
- {% endif %}
- </ul>
- </p>
- {% endif %}
- <br>
- <form name="fauth" action="{% url user_signin %}" method="post">
- {{ form1.next }}
- <fieldset class="fieldset" >
- <legend class="big">{% trans "Use login name and password" %}</legend>
- <div class="form-row"><label for="id_username">{% trans "Login name" %}:</label><br />{{ form1.username }}</div>
- <div class="form-row"><label for="id_password">{% trans "Password" %}:</label><br />{{ form1.password }}</div>
- <div class="submit-row"><input type="submit" class="submit" name="blogin" value="{% trans "Login" %}">
- <a href="">{% trans "Forgot your password?" %}</a>
- <a href="">{% trans "Create new account" %}</a></div>
- </fieldset>
- </form>
- </div>
-</div>
{% endblock %}
{% block sidebar %}
<div class="boxC">
<h3 class="subtitle">{% trans "Why use OpenID?" %}</h3>
- <p>
<ul class="list-item">
<li>
{% trans "with openid it is easier" %}
@@ -164,10 +162,10 @@
</li>
</ul>
- <a href="http://openid.net/what/" target="_blank" style="float:right;position:relative">{% trans "Find out more" %} »</a><br>
- <a href="http://openid.net/get/" target="_blank" style="float:right;position:relative">{% trans "Get OpenID" %} »</a>
+ <p class="info-box-follow-up-links">
+ <a href="http://openid.net/what/" target="_blank">{% trans "Find out more" %} »</a><br/>
+ <a href="http://openid.net/get/" target="_blank">{% trans "Get OpenID" %} »</a>
</p>
- <br>
</div>
{% endblock%}
diff --git a/templates/authopenid/signup.html b/templates/authopenid/signup.html
index a65dafdc..45dfb51b 100644
--- a/templates/authopenid/signup.html
+++ b/templates/authopenid/signup.html
@@ -1,55 +1,22 @@
-{% extends "base.html" %}
+{% extends "base_content.html" %}
<!--signup.html-->
{% load i18n %}
{% block title %}{% spaceless %}{% trans "Signup" %}{% endspaceless %}{% endblock %}
{% block content %}
-<div id="main-bar" class="">
- <h3 >{% trans "Signup" %}</h3>
-
-</div>
-<div class="jointxt">
- <p>{% trans "We support two types of user registration: conventional username/password, and" %} <a href="{% url user_signin %}">{% trans "the OpenID method" %}</a>.</p>
-
- {% if form.errors %}
-
- <p class="errors">
- <span class="big">{% trans "Sorry, looks like we have some errors" %}</span><br>
- <ul class="error-list">
- {% if form.username.errors %}
- <li><span class="error">{{ form.username.errors|join:", " }}</span></li>
- {% endif %}
- {% if form.email.errors %}
- <li><span class="error">{{ form.email.errors|join:", " }}</span></li>
- {% endif %}
- {% if form.password2.errors %}
- <li><span class="error">{{ form.password2.errors|join:", " }}
- </span></li>
- {% endif %}
- </ul>
- </p>
- {% endif %}
+<div class="headNormal">
+ {% trans "Create login name and password" %}
</div>
- <form action="{% url user_signup %}" method="post" accept-charset="utf-8">
- <fieldset class="fieldset">
- <legend class="big">{% trans "Conventional registration" %}</legend>
- <div class="form-row"><label for="id_username">{% trans "choose a user name" %}:</label><br>{{ form.username }}</div>
-
- <div class="form-row"><label for="id_email">{% trans "your email address" %}:</label><br>{{ form.email }}</div>
- <div class="form-row"><label for="id_password1">{% trans "choose password" %}:</label><br />{{ form.password1 }}</div>
- <div class="form-row"><label for="id_password2">{% trans "retype password" %}:</label><br>{{ form.password2 }}</div>
- <div class="submit-row"><input type="submit" class="submit" value="{% trans "login" %}" >
- <a href="{% url user_signin %}">{% trans "back to login" %}</a></div>
- </fieldset>
- <br >
- </form>
- <br >
- <div style="display:none">
- <h2 class="signup">{% trans "Register with your OpenID" %}</h2>
- <form name="fopenid" action="{% url user_signin %}" method="post">
- <div class="form-row">{{ form2.openid_url }}</div>
- <div class="submit-row "><input name="bsignin" class="submit" type="submit" value="{% trans "Login with your OpenID" %}"></div>
- </form>
- </div>
+<p class="message">{% trans "Traditional signup info" %}</p>
+<form action="{% url user_signup %}" method="post" accept-charset="utf-8">
+ <ul class="form-horizontal-rows">
+ {{form.as_ul}}
+ </ul>
+ <p style="margin:10px 0px 0px 3px;">{% trans "receive updates motivational blurb" %}</p>
+ {% include "edit_user_email_feeds_form.html" %}
+ <div class="submit-row"><input type="submit" class="submit" value="{% trans "Create Account" %}" />
+ <strong>{% trans "or" %}
+ <a href="{% url user_signin %}">{% trans "return to OpenID login" %}</a></strong></div>
+</form>
{% endblock %}
<!--end signup.html-->
diff --git a/templates/badge.html b/templates/badge.html
index 029ba0d9..73cba4ba 100644
--- a/templates/badge.html
+++ b/templates/badge.html
@@ -28,7 +28,7 @@
</div>
<div id="award-list" style="clear:both;margin-left:20px;line-height:25px;">
{% for award in awards %}
- <p style="width:185px;float:left"><a href="/users/{{ award.id }}/{{ award.name }}">{{ award.name }}</a> {% get_score_badge_by_details award.rep award.gold award.silver award.bronze %}</p>
+ <p style="width:185px;float:left"><a href="{% url users %}{{ award.id }}/{{ award.name }}">{{ award.name }}</a> {% get_score_badge_by_details award.rep award.gold award.silver award.bronze %}</p>
{% endfor %}
</div>
diff --git a/templates/badges.html b/templates/badges.html
index 69ddc39f..1902a3b0 100644
--- a/templates/badges.html
+++ b/templates/badges.html
@@ -18,10 +18,11 @@
</div>
<div class="badges" id="main-body" style="width:100%">
<p>
- {% trans "Community gives you awards for your questions, answers and votes." %}<br>
- {% trans "Below is the list of available badges and number of times each type of badge has been awarded." %}
+ {% trans "Community gives you awards for your questions, answers and votes." %}<br/>
+ {% blocktrans %}Below is the list of available badges and number
+ of times each type of badge has been awarded. Give us feedback at {{feedback_faq_url}}.
+ {% endblocktrans %}
</p>
- <br>
<div id="medalList">
{% for badge in badges %}
<div style="clear:both;line-height:30px">
@@ -33,7 +34,7 @@
{% endfor %}
</div>
<div style="float:left;width:180px;">
- <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> × {{ badge.awarded_count|intcomma }}</strong>
+ <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>
</div>
<p style="float:left;width:350px;">
{{ badge.description }}
diff --git a/templates/base.html b/templates/base.html
index ae389255..ec0a53d7 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,6 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- template base.html -->
{% load extra_filters %}
+{% load extra_tags %}
{% load i18n %}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@@ -8,18 +9,21 @@
{% spaceless %}
{% block meta %}{% endblock %}
{% endspaceless %}
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ {% if settings.GOOGLE_SITEMAP_CODE %}
<meta name="verify-v1" content="{{settings.GOOGLE_SITEMAP_CODE}}" />
- <link rel="shortcut icon" href="/content/images/favicon.ico" >
- <link href="/content/style/style.css" rel="stylesheet" type="text/css" />
- <script src="http://www.google.com/jsapi"></script>
- <script>google.load("jquery", "1.2.6");</script>
+ {% endif %}
+ <link rel="shortcut icon" href="{% href "/content/images/favicon.ico" %}" />
+ <link href="{% href "/content/style/style.css" %}" rel="stylesheet" type="text/css" />
+ <script src="http://www.google.com/jsapi" type="text/javascript"></script>
+ <script type="text/javascript">google.load("jquery", "1.2.6");</script>
<script type="text/javascript">
- var i18nLang = '{{settings.LANGUAGE_CODE}}';
+ var i18nLang = '{{settings.LANGUAGE_CODE}}';
+ var scriptUrl = '/{{settings.FORUM_SCRIPT_ALIAS}}'
</script>
- <script type='text/javascript' src='/content/js/com.cnprog.i18n.js'></script>
- <script type='text/javascript' src='/content/js/jquery.i18n.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.utils.js'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.i18n.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.i18n.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.utils.js" %}'></script>
<!--<script type="text/javascript">
var uservoiceJsHost = ("https:" == document.location.protocol) ? "https://uservoice.com" : "http://cdn.uservoice.com";
document.write(unescape("%3Cscript src='" + uservoiceJsHost + "/javascripts/widgets/tab.js' type='text/javascript'%3E%3C/script%3E"))
@@ -37,7 +41,7 @@
})
</script>-->
<!-- todo move this to settings -->
- {% if messages %}
+ {% if user_messages %}
<style type="text/css">
body { margin-top:2.4em; }
</style>
@@ -55,8 +59,8 @@
<body>
<div class="notify" style="display:none">
{% autoescape off %}
- {% if messages %}
- {% for message in messages %}
+ {% if user_messages %}
+ {% for message in user_messages %}
<p class="darkred">{{ message }}<p>
{% endfor %}
{% endif %}
diff --git a/templates/base_content.html b/templates/base_content.html
index 4ee9675f..78e5fe38 100644
--- a/templates/base_content.html
+++ b/templates/base_content.html
@@ -1,24 +1,28 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- base_content.html -->
{% load i18n %}
-<html>
+{% load extra_tags %}
+<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{% block title %}{% endblock %} - {{ settings.APP_TITLE }}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ {% if settings.GOOGLE_SITEMAP_CODE %}
<meta name="verify-v1" content="{{ settings.GOOGLE_SITEMAP_CODE }}" />
- <link rel="shortcut icon" href="/content/images/favicon.ico" >
- <link href="/content/style/style.css" rel="stylesheet" type="text/css" />
+ {% endif %}
+ <link rel="shortcut icon" href="{% href "/content/images/favicon.ico" %}" />
+ <link href="{% href "/content/style/style.css" %}" rel="stylesheet" type="text/css" />
{% spaceless %}
{% block forestyle %}{% endblock %}
{% endspaceless %}
- <script src="http://www.google.com/jsapi"></script>
- <script>google.load("jquery", "1.2.6");</script>
+ <script src="http://www.google.com/jsapi" type="text/javascript"></script>
+ <script type="text/javascript">google.load("jquery", "1.2.6");</script>
<script type="text/javascript">
- var i18nLang = '{{ settings.LANGUAGE_CODE }}';
+ var i18nLang = '{{ settings.LANGUAGE_CODE }}';
+ var scriptUrl = '/{{settings.FORUM_SCRIPT_ALIAS}}'
</script>
- <script type='text/javascript' src='/content/js/com.cnprog.i18n.js'></script>
- <script type='text/javascript' src='/content/js/jquery.i18n.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.utils.js'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.i18n.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.i18n.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.utils.js" %}'></script>
<!-- <script type="text/javascript">
var uservoiceJsHost = ("https:" == document.location.protocol) ? "https://uservoice.com" : "http://cdn.uservoice.com";
@@ -39,7 +43,7 @@
</script>-->
<!-- todo move this to settings-->
- {% if messages %}
+ {% if user_messages %}
<style type="text/css">
body { margin-top:2.4em; }
</style>
@@ -58,8 +62,8 @@
<body>
<div class="notify" style="display:none">
{% autoescape off %}
- {% if messages %}
- {% for message in messages %}
+ {% if user_messages %}
+ {% for message in user_messages %}
<p class="darkred">{{ message }}<p>
{% endfor %}
{% endif %}
diff --git a/templates/book.html b/templates/book.html
index dddd13e6..e83268e4 100644
--- a/templates/book.html
+++ b/templates/book.html
@@ -85,12 +85,12 @@
{% if question.favourite_count %}
{% if question.favorited_myself %}
<div class="favorites-count">
- <img title="{% trans "this question was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}" src="/content/images/vote-favorite-on.png">
+ <img title="{% trans "this question was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}" src="{% href "/content/images/vote-favorite-on.png" %}">
<div><b>{{question.favourite_count|intcomma}}</b></div>
</div>
{% else %}
<div class="favorites-count-off">
- <img title="{% trans "this question was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}" src="/content/images/vote-favorite-off.png">
+ <img title="{% trans "this question was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}" src="{% href "/content/images/vote-favorite-off.png" %}">
<div><b>{{question.favourite_count|intcomma}}</b></div>
</div>
{% endif %}
@@ -98,7 +98,7 @@
<div class="favorites-empty"> </div>
{% endif %}
<div id="question-summary-{{question.id}}" class="question-summary narrow">
- <a style="text-decoration: none;" href="/questions/{{question.id}}/{{question.get_question_title}}">
+ <a style="text-decoration: none;" href="{% url questions %}{{question.id}}/{{question.get_question_title}}">
<div class="stats">
<div class="votes">
<div class="vote-count-post">{{question.score|intcomma}}</div>
@@ -118,7 +118,7 @@
</a>
<div class="bookQuestionItem">
<h3>
- <a title="{{question.summary}}" href="/questions/{{question.id}}/{{question.title}}">{{question.title}}</a>
+ <a title="{{question.summary|collapse}}" href="{% url questions %}{{question.id}}/{{question.title}}">{{question.title}}</a>
</h3>
<div class="tags">
{% for tag in question.tagname_list %}
@@ -144,7 +144,7 @@
</div>
<div class="bookFeed">
<div id="feeds">
- <a href="/feeds/rss" title="{% trans "subscribe to book RSS feed" %}">{% trans "subscribe to the questions feed" %}</a>
+ <a href="{% href "/feeds/rss" %} " title="{% trans "subscribe to book RSS feed" %}">{% trans "subscribe to the questions feed" %}</a>
</div>
</div>
diff --git a/templates/content/images/blue-up-arrow-h18px.png b/templates/content/images/blue-up-arrow-h18px.png
new file mode 100644
index 00000000..e1f29e86
--- /dev/null
+++ b/templates/content/images/blue-up-arrow-h18px.png
Binary files differ
diff --git a/templates/content/images/gray-up-arrow-h18px.png b/templates/content/images/gray-up-arrow-h18px.png
new file mode 100644
index 00000000..78767445
--- /dev/null
+++ b/templates/content/images/gray-up-arrow-h18px.png
Binary files differ
diff --git a/templates/content/images/cnprog_logo_200_56.gif b/templates/content/images/logo.gif
index ab690de2..ab690de2 100644
--- a/templates/content/images/cnprog_logo_200_56.gif
+++ b/templates/content/images/logo.gif
Binary files differ
diff --git a/templates/content/images/logo.png b/templates/content/images/logo.png
index 640eb1da..b53732e3 100644
--- a/templates/content/images/logo.png
+++ b/templates/content/images/logo.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/blogger-1.png b/templates/content/jquery-openid/images/blogger-1.png
new file mode 100644
index 00000000..8b360ea5
--- /dev/null
+++ b/templates/content/jquery-openid/images/blogger-1.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/claimid-0.png b/templates/content/jquery-openid/images/claimid-0.png
new file mode 100644
index 00000000..4a0ea1b3
--- /dev/null
+++ b/templates/content/jquery-openid/images/claimid-0.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/flickr.png b/templates/content/jquery-openid/images/flickr.png
new file mode 100644
index 00000000..142405a6
--- /dev/null
+++ b/templates/content/jquery-openid/images/flickr.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/livejournal-1.png b/templates/content/jquery-openid/images/livejournal-1.png
new file mode 100644
index 00000000..e6436081
--- /dev/null
+++ b/templates/content/jquery-openid/images/livejournal-1.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/local-login.png b/templates/content/jquery-openid/images/local-login.png
new file mode 100644
index 00000000..258cedac
--- /dev/null
+++ b/templates/content/jquery-openid/images/local-login.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/myopenid-2.png b/templates/content/jquery-openid/images/myopenid-2.png
new file mode 100644
index 00000000..f64fb8e8
--- /dev/null
+++ b/templates/content/jquery-openid/images/myopenid-2.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/openidico16.png b/templates/content/jquery-openid/images/openidico16.png
new file mode 100644
index 00000000..ad718ac5
--- /dev/null
+++ b/templates/content/jquery-openid/images/openidico16.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/technorati-1.png b/templates/content/jquery-openid/images/technorati-1.png
new file mode 100644
index 00000000..f7195240
--- /dev/null
+++ b/templates/content/jquery-openid/images/technorati-1.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/verisign-2.png b/templates/content/jquery-openid/images/verisign-2.png
new file mode 100644
index 00000000..c1467008
--- /dev/null
+++ b/templates/content/jquery-openid/images/verisign-2.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/vidoop.png b/templates/content/jquery-openid/images/vidoop.png
new file mode 100644
index 00000000..032c9e98
--- /dev/null
+++ b/templates/content/jquery-openid/images/vidoop.png
Binary files differ
diff --git a/templates/content/jquery-openid/images/wordpress.png b/templates/content/jquery-openid/images/wordpress.png
new file mode 100644
index 00000000..ee29f0cf
--- /dev/null
+++ b/templates/content/jquery-openid/images/wordpress.png
Binary files differ
diff --git a/templates/content/jquery-openid/jquery.openid.js b/templates/content/jquery-openid/jquery.openid.js
index eec29ab2..763af2c6 100644
--- a/templates/content/jquery-openid/jquery.openid.js
+++ b/templates/content/jquery-openid/jquery.openid.js
@@ -13,6 +13,7 @@ $.fn.openid = function() {
var $end = $this.find('p:has(input[name=openid_username])>span:eq(1)');
//needed for special effects only
+ var $localfs = $this.find('fieldset:has(input[name=username])');
var $usrfs = $this.find('fieldset:has(input[name=openid_username])');
var $idfs = $this.find('fieldset:has(input[name=openid_url])');
@@ -33,11 +34,23 @@ $.fn.openid = function() {
return true;
};
+ var local = function() {
+ var $li = $(this);
+ $('#openid_form .providers li').removeClass('highlight');
+ $li.addClass('highlight');
+ $usrfs.hide();
+ $idfs.hide();
+ $localfs.show();
+ $this.unbind('submit').submit(submitid);
+ return false;
+ };
+
var direct = function() {
var $li = $(this);
- $li.parent().find('li').removeClass('highlight');
+ $('#openid_form .providers li').removeClass('highlight');
$li.addClass('highlight');
$usrfs.fadeOut('slow');
+ $localfs.fadeOut('slow');
$idfs.fadeOut('slow');
$id.val($this.find("li.highlight span").text());
setTimeout(function(){$('#bsignin').click()},1000);
@@ -46,9 +59,10 @@ $.fn.openid = function() {
var openid = function() {
var $li = $(this);
- $li.parent().find('li').removeClass('highlight');
+ $('#openid_form .providers li').removeClass('highlight');
$li.addClass('highlight');
$usrfs.hide();
+ $localfs.hide();
$idfs.show();
$id.focus();
$this.unbind('submit').submit(submitid);
@@ -57,9 +71,10 @@ $.fn.openid = function() {
var username = function() {
var $li = $(this);
- $li.parent().find('li').removeClass('highlight');
+ $('#openid_form .providers li').removeClass('highlight');
$li.addClass('highlight');
$idfs.hide();
+ $localfs.hide();
$usrfs.show();
$this.find('#enter_your_what').text($li.attr("title"));
$front.text($li.find("span").text().split("username")[0]);
@@ -69,6 +84,7 @@ $.fn.openid = function() {
return false;
};
+ $this.find('li.local').click(local);
$this.find('li.direct').click(direct);
$this.find('li.openid').click(openid);
$this.find('li.username').click(username);
@@ -84,6 +100,9 @@ $.fn.openid = function() {
});
$this.find('li span').hide();
$this.find('li').css('line-height', 0).css('cursor', 'pointer');
+ $usrfs.hide();
+ $idfs.hide();
+ $localfs.hide();
$this.find('li:eq(0)').click();
return this;
diff --git a/templates/content/jquery-openid/openid.css b/templates/content/jquery-openid/openid.css
index e53c1823..88960b56 100644
--- a/templates/content/jquery-openid/openid.css
+++ b/templates/content/jquery-openid/openid.css
@@ -1,26 +1,49 @@
-fieldset {border-style:none;}
+fieldset { border-style:none; }
img {border-style:none;}
-.logo_box {width:90px;height:40px;background:white;border:1px solid #dddddd;}
+.logo_box {display:inline-block;float:left;width:90px;height:40px;background:white;border:1px solid #dddddd;}
.openid_box img {margin-top:6px;}
.aol_box img {margin-top:6px;}
.yahoo_box img {margin-top:13px;}
.google_box img {margin-top:6px;}
+.local_login_box img {margin-top:2px;margin-left:-3px;}
form.openid ul{ margin:0;padding:0;text-align:center; list-style-type:none; display:block;}
-form.openid ul li {float:left; padding:4px;}
+form.openid ul li {float:left; padding:4px;display:inline-block;}
+form.openid ul li div {display:inline-block;}
form.openid ul li span {padding:0 1em 0 3px}
form.openid ul li.first_tiny_li {clear:left;}
form.openid fieldset {clear:both;padding:10px 0px 0px 0px;}
form.openid div+fieldset {display:none}
-form.openid label {display:block; font-weight:bold; margin-bottom:.5em}
+form.openid label {display:block; font-weight:bold;}
input[name=openid_username] {width:8em}
input[name=openid_identifier] {width:18em}
form.openid ul li.highlight { -moz-border-radius:4px; -webkit-border-radius:4px; background-color: #FD6}
-form.openid fieldset div {-moz-border-radius:4px; -webkit-border-radius:4px;
- background: #DCDCDC;
- padding:10px;display:inline-block}
+form.openid fieldset div {
+ -moz-border-radius:4px;
+ -webkit-border-radius:4px;
+ background: #DCDCDC;
+ padding:10px;
+ display:inline-block;
+ float:left;
+}
+form.openid p {margin-bottom:4px;}
form.openid fieldset div p {padding:0px;margin:0px;}
+form.openid fieldset div p.login {padding:0px;margin:0 0 10px 0;}
+form.openid label {
+ display:inline-block;
+ font-weight:normal;
+ width:6em;
+ text-align:right;
+}
+#local_login_fs div {
+ padding-bottom:4px;
+}
+#local_login_buttons {
+ text-align:center;
+ line-height:1.8em;
+ margin-top:3px;
+}
/*form.openid input[type='submit'] {margin-left:1em;}*/
#openid_username {background:#ffffa0;}
#openid_url {background:#ffffa0;}
@@ -31,3 +54,16 @@ background: url(images/openidico.png) no-repeat;
#openid_login {float:left; width:30%; margin:2em 1em; text-align:center}
#openid_login div{margin-top:0.5em}
+
+form.openid ul.errorlist {
+ border: none;
+ list-style-position:inside;
+ list-style-type: disc;
+ margin-bottom:5px;
+}
+form.openid ul.errorlist li {
+ text-align: left;
+ margin: 5px;
+ float: none;
+ color:blue;
+}
diff --git a/templates/content/js/com.cnprog.admin.js b/templates/content/js/com.cnprog.admin.js
new file mode 100644
index 00000000..73b5768f
--- /dev/null
+++ b/templates/content/js/com.cnprog.admin.js
@@ -0,0 +1,13 @@
+$().ready( function(){
+ var options = {
+ success: function(a,b){$('.admin #action_status').html($.i18n._('changes saved'));},
+ dataType:'json',
+ timeout:5000,
+ url: $.i18n._('/') + $.i18n._('moderate-user/') + viewUserID + '/'
+ };
+ var form = $('.admin #moderate_user_form').ajaxForm(options);
+ var box = $('.admin input#id_is_approved').click(function(){
+ $('.admin #action_status').html($.i18n._('sending data...'));
+ form.ajaxSubmit(options);
+ });
+});
diff --git a/templates/content/js/com.cnprog.i18n.js b/templates/content/js/com.cnprog.i18n.js
index 90166eec..7562628b 100644
--- a/templates/content/js/com.cnprog.i18n.js
+++ b/templates/content/js/com.cnprog.i18n.js
@@ -20,7 +20,7 @@ var i18nZh = {
'post recovered':"操作成功!该帖子已被恢复。",
'post deleted':"操作成功!该帖子已删除。",
'add comment':'添加评论',
- 'community reputation points':'社区积分',
+ 'community karma points':'社区积分',
'to comment, need':'评论需要',
'delete this comment':'删除此评论',
'hide comments':"隐藏评论",
@@ -53,27 +53,28 @@ var i18nZh = {
'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':'或者上传本地图片:',
+ 'upload image':'或者上传本地图片:'
};
var i18nEn = {
- '>15 points requried to upvote':'>15 points requried to upvote ',
+ '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':'anonymous users cannot vote ',
- 'anonymous users cannot select favorite questions':'anonymous users cannot select favorite questions ',
- 'to comment, need': 'to comment, need reputation ',
+ '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 reputation points':' ',
+ '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':'cannot accept own answer',
- 'cannot revoke old vote':'older votes cannot be revoked',
+ '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',
+ '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':'anonymous users cannot delete or undelete posts',
+ '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?',
@@ -82,11 +83,75 @@ var i18nEn = {
'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/',
+ 'vote/' : 'votar/'
};
var i18n = {
'en':i18nEn,
- 'zh_CN':i18nZh
+ 'zh_CN':i18nZh,
+ 'es':i18nEs
};
var i18n_dict = i18n[i18nLang];
diff --git a/templates/content/js/com.cnprog.post.js b/templates/content/js/com.cnprog.post.js
index 546cf101..5d58ff21 100644
--- a/templates/content/js/com.cnprog.post.js
+++ b/templates/content/js/com.cnprog.post.js
@@ -52,31 +52,25 @@ var Vote = function(){
var acceptAnonymousMessage = $.i18n._('insufficient privilege');
var acceptOwnAnswerMessage = $.i18n._('cannot pick own answer as best');
- var favoriteAnonymousMessage = $.i18n._('anonymous users cannot select favorite questions')
- + "<a href='/account/signin/?next=/questions/{{QuestionID}}'>"
- + $.i18n._('please login') + "</a>";
- var voteAnonymousMessage = $.i18n._('anonymous users cannot vote')
- + "<a href='/account/signin/?next=/questions/{{QuestionID}}'>"
+
+ var pleaseLogin = "<a href='" + scriptUrl + $.i18n._("account/") + $.i18n._("signin/")
+ + "?next=" + scriptUrl + $.i18n._("questions/") + "{{QuestionID}}'>"
+ $.i18n._('please login') + "</a>";
- var upVoteRequiredScoreMessage = $.i18n._('>15 points requried to upvote')
- + $.i18n._('please see') + "<a href='/faq'>faq</a>";
- var downVoteRequiredScoreMessage = $.i18n._('>100 points requried to downvote')
- + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+
+ var pleaseSeeFAQ = $.i18n._('please see') + "<a href='" + scriptUrl + $.i18n._("faq/") + "'>faq</a>";
+
+ var favoriteAnonymousMessage = $.i18n._('anonymous users cannot select favorite questions')
+ var voteAnonymousMessage = $.i18n._('anonymous users cannot vote') + pleaseLogin;
+ var upVoteRequiredScoreMessage = $.i18n._('>15 points requried to upvote') + pleaseSeeFAQ;
+ var downVoteRequiredScoreMessage = $.i18n._('>100 points required to downvote') + pleaseSeeFAQ;
var voteOwnDeniedMessage = $.i18n._('cannot vote for own posts');
- var voteRequiredMoreVotes = $.i18n._('daily vote cap exhausted')
- + $.i18n._('please see') + "<a href='/faq'>faq</a>";
- var voteDenyCancelMessage = $.i18n._('cannot revoke old vote')
- + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var voteRequiredMoreVotes = $.i18n._('daily vote cap exhausted') + pleaseSeeFAQ;
+ var voteDenyCancelMessage = $.i18n._('cannot revoke old vote') + pleaseSeeFAQ;
var offensiveConfirmation = $.i18n._('please confirm offensive');
- var offensiveAnonymousMessage = $.i18n._('anonymous users cannot flag offensive posts')
- + "<a href='/account/signin/?next=/questions/{{QuestionID}}'>"
- + $.i18n._('please login') + "</a>";
- var offensiveTwiceMessage = $.i18n._('cannot flag message as offensive twice')
- + $.i18n._('please see') + "<a href='/faq'>faq</a>";
- var offensiveNoFlagsLeftMessage = $.i18n._('flag offensive cap exhausted')
- + $.i18n._('please see') + "<a href='/faq'>faq</a>";
- var offensiveNoPermissionMessage = $.i18n._('need >15 points to report spam')
- + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var offensiveAnonymousMessage = $.i18n._('anonymous users cannot flag offensive posts') + pleaseLogin;
+ var offensiveTwiceMessage = $.i18n._('cannot flag message as offensive twice') + pleaseSeeFAQ;
+ var offensiveNoFlagsLeftMessage = $.i18n._('flag offensive cap exhausted') + pleaseSeeFAQ;
+ var offensiveNoPermissionMessage = $.i18n._('need >15 points to report spam') + pleaseSeeFAQ;
var removeConfirmation = $.i18n._('confirm delete');
var removeAnonymousMessage = $.i18n._('anonymous users cannot delete/undelete');
var recoveredMessage = $.i18n._('post recovered');
@@ -94,7 +88,7 @@ var Vote = function(){
removeQuestion: 9,
removeAnswer:10,
questionSubscribeUpdates:11,
- questionUnsubscribeUpdates:12,
+ questionUnsubscribeUpdates:12
};
var getFavoriteButton = function(){
@@ -131,7 +125,7 @@ var Vote = function(){
};
var getOffensiveQuestionFlag = function(){
- var offensiveQuestionFlag = 'table[id=question-table] span[class='+ offensiveClassFlag +']';
+ var offensiveQuestionFlag = '#question-table span[class='+ offensiveClassFlag +']';
return $(offensiveQuestionFlag);
};
@@ -157,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", "/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", "/content/images/vote-arrow-up.png");
- $(getQuestionVoteDownButton()).attr("src", "/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", "/content/images/vote-arrow-up.png");
- $(getAnswerVoteDownButton(postId)).attr("src", "/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");
}
}
};
@@ -182,42 +176,42 @@ var Vote = function(){
if(questionAuthorId == currentUserId){
var acceptedButtons = 'div.'+ voteContainerId +' img[id^='+ imgIdPrefixAccept +']';
$(acceptedButtons).unbind('click').click(function(event){
- Vote.accept($(event.target))
+ Vote.accept($(event.target));
});
}
// set favorite question
var favoriteButton = getFavoriteButton();
favoriteButton.unbind('click').click(function(event){
- Vote.favorite($(event.target))
+ Vote.favorite($(event.target));
});
// question vote up
var questionVoteUpButton = getQuestionVoteUpButton();
questionVoteUpButton.unbind('click').click(function(event){
- Vote.vote($(event.target), VoteType.questionUpVote)
+ Vote.vote($(event.target), VoteType.questionUpVote);
});
var questionVoteDownButton = getQuestionVoteDownButton();
questionVoteDownButton.unbind('click').click(function(event){
- Vote.vote($(event.target), VoteType.questionDownVote)
+ Vote.vote($(event.target), VoteType.questionDownVote);
});
var answerVoteUpButton = getAnswerVoteUpButtons();
answerVoteUpButton.unbind('click').click(function(event){
- Vote.vote($(event.target), VoteType.answerUpVote)
+ Vote.vote($(event.target), VoteType.answerUpVote);
});
var answerVoteDownButton = getAnswerVoteDownButtons();
answerVoteDownButton.unbind('click').click(function(event){
- Vote.vote($(event.target), VoteType.answerDownVote)
+ Vote.vote($(event.target), VoteType.answerDownVote);
});
getOffensiveQuestionFlag().unbind('click').click(function(event){
- Vote.offensive(this, VoteType.offensiveQuestion)
+ Vote.offensive(this, VoteType.offensiveQuestion);
});
getOffensiveAnswerFlags().unbind('click').click(function(event){
- Vote.offensive(this, VoteType.offensiveAnswer)
+ Vote.offensive(this, VoteType.offensiveAnswer);
});
getremoveQuestionLink().unbind('click').click(function(event){
@@ -234,7 +228,7 @@ var Vote = function(){
});
getremoveAnswersLinks().unbind('click').click(function(event){
- Vote.remove(this, VoteType.removeAnswer)
+ Vote.remove(this, VoteType.removeAnswer);
});
};
@@ -243,14 +237,14 @@ var Vote = function(){
type: "POST",
cache: false,
dataType: "json",
- url: "/questions/" + questionId + "/vote/",
+ url: scriptUrl + $.i18n._("questions/") + questionId + "/" + $.i18n._("vote/"),
data: { "type": voteType, "postId": postId },
error: handleFail,
success: function(data){callback(object, voteType, data)}});
};
var handleFail = function(xhr, msg){
- alert("Callback invoke error: " + msg)
+ alert("Callback invoke error: " + msg);
};
// callback function for Accept Answer action
@@ -262,19 +256,19 @@ var Vote = function(){
showMessage(object, acceptOwnAnswerMessage);
}
else if(data.status == "1"){
- object.attr("src", "/content/images/vote-accepted.png");
+ object.attr("src", scriptUrl + "content/images/vote-accepted.png");
$("#"+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", "/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", "/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");
}
@@ -288,7 +282,7 @@ var Vote = function(){
showMessage(object, favoriteAnonymousMessage.replace("{{QuestionID}}", questionId));
}
else if(data.status == "1"){
- object.attr("src", "/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)
@@ -296,7 +290,7 @@ var Vote = function(){
fav.text(data.count);
}
else if(data.success == "1"){
- object.attr("src", "/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");
@@ -310,69 +304,75 @@ var Vote = function(){
if(data.allowed == "0" && data.success == "0"){
showMessage(object, voteAnonymousMessage.replace("{{QuestionID}}", questionId));
}
- else if(data.allowed == "-3"){
+ else if (data.allowed == "-3"){
showMessage(object, voteRequiredMoreVotes);
}
- else if(data.allowed == "-2"){
- if(voteType == VoteType.questionUpVote || voteType == VoteType.answerUpVote){
+ else if (data.allowed == "-2"){
+ if (voteType == VoteType.questionUpVote || voteType == VoteType.answerUpVote){
showMessage(object, upVoteRequiredScoreMessage);
}
- else if(voteType == VoteType.questionDownVote || voteType == VoteType.answerDownVote){
+ else if (voteType == VoteType.questionDownVote || voteType == VoteType.answerDownVote){
showMessage(object, downVoteRequiredScoreMessage);
}
}
- else if(data.allowed == "-1"){
+ else if (data.allowed == "-1"){
showMessage(object, voteOwnDeniedMessage);
}
- else if(data.status == "2"){
+ else if (data.status == "2"){
showMessage(object, voteDenyCancelMessage);
}
- else if(data.status == "1"){
+ else if (data.status == "1"){
setVoteImage(voteType, true, object);
setVoteNumber(object, data.count);
}
- else if(data.success == "1"){
+ else if (data.success == "1"){
setVoteImage(voteType, false, object);
setVoteNumber(object, data.count);
- if(data.message.length > 0)
+ if (data.message.length > 0){
showMessage(object, data.message);
+ }
}
};
var callback_offensive = function(object, voteType, data){
object = $(object);
- if(data.allowed == "0" && data.success == "0"){
+ if (data.allowed == "0" && data.success == "0"){
showMessage(object, offensiveAnonymousMessage.replace("{{QuestionID}}", questionId));
}
- else if(data.allowed == "-3"){
+ else if (data.allowed == "-3"){
showMessage(object, offensiveNoFlagsLeftMessage);
}
- else if(data.allowed == "-2"){
+ else if (data.allowed == "-2"){
showMessage(object, offensiveNoPermissionMessage);
}
- else if(data.status == "1"){
+ else if (data.status == "1"){
showMessage(object, offensiveTwiceMessage);
}
- else if(data.success == "1"){
+ else if (data.success == "1"){
$(object).children('span[class=darkred]').text("("+ data.count +")");
}
};
var callback_remove = function(object, voteType, data){
- if(data.allowed == "0" && data.success == "0"){
+ if (data.allowed == "0" && data.success == "0"){
showMessage(object, removeAnonymousMessage.replace("{{QuestionID}}", questionId));
}
else if (data.success == "1"){
- if (removeActionType == 'delete'){
- postNode.addClass('deleted');
- postRemoveLink.innerHTML = $.i18n._('undelete');
- showMessage(object, deletedMessage);
- }
- else if (removeActionType == 'undelete') {
- postNode.removeClass('deleted');
- postRemoveLink.innerHTML = $.i18n._('delete');
- showMessage(object, recoveredMessage);
- }
+ if (voteType == VoteType.removeQuestion){
+ window.location.href = scriptUrl + $.i18n._("questions/");
+ }
+ else {
+ if (removeActionType == 'delete'){
+ postNode.addClass('deleted');
+ postRemoveLink.innerHTML = $.i18n._('undelete');
+ showMessage(object, deletedMessage);
+ }
+ else if (removeActionType == 'undelete') {
+ postNode.removeClass('deleted');
+ postRemoveLink.innerHTML = $.i18n._('delete');
+ showMessage(object, recoveredMessage);
+ }
+ }
}
};
@@ -391,7 +391,7 @@ var Vote = function(){
},
favorite: function(object){
- if(!currentUserId || currentUserId.toUpperCase() == "NONE"){
+ if (!currentUserId || currentUserId.toUpperCase() == "NONE"){
showMessage(object, favoriteAnonymousMessage.replace("{{QuestionID}}", questionId));
return false;
}
@@ -399,14 +399,14 @@ var Vote = function(){
},
vote: function(object, voteType){
- if(!currentUserId || currentUserId.toUpperCase() == "NONE"){
+ if (!currentUserId || currentUserId.toUpperCase() == "NONE"){
showMessage(object, voteAnonymousMessage.replace("{{QuestionID}}", questionId));
return false;
}
- if(voteType == VoteType.answerUpVote){
+ if (voteType == VoteType.answerUpVote){
postId = object.attr("id").substring(imgIdPrefixAnswerVoteup.length);
}
- else if(voteType == VoteType.answerDownVote){
+ else if (voteType == VoteType.answerDownVote){
postId = object.attr("id").substring(imgIdPrefixAnswerVotedown.length);
}
@@ -414,39 +414,43 @@ var Vote = function(){
},
offensive: function(object, voteType){
- if(!currentUserId || currentUserId.toUpperCase() == "NONE"){
+ if (!currentUserId || currentUserId.toUpperCase() == "NONE"){
showMessage($(object), offensiveAnonymousMessage.replace("{{QuestionID}}", questionId));
return false;
}
- if(confirm(offensiveConfirmation)){
+ if (confirm(offensiveConfirmation)){
postId = object.id.substr(object.id.lastIndexOf('-') + 1);
submit(object, voteType, callback_offensive);
}
},
remove: function(object, voteType){
- if(!currentUserId || currentUserId.toUpperCase() == "NONE"){
+ if (!currentUserId || currentUserId.toUpperCase() == "NONE"){
showMessage($(object), removeAnonymousMessage.replace("{{QuestionID}}", questionId));
return false;
}
- if(confirm(removeConfirmation)){
- bits = object.id.split('-');
- postId = bits.pop();/* this seems to be used within submit! */
- postType = bits.shift();
-
- if (postType == 'answer'){
- postNode = $('#answer-container-' + postId);
- postRemoveLink = object;
- if (postNode.hasClass('deleted')){
- removeActionType = 'undelete';
- }
- else {
- removeActionType = 'delete';
- }
- }
+ bits = object.id.split('-');
+ postId = bits.pop();/* this seems to be used within submit! */
+ postType = bits.shift();
+
+ var do_proceed = false;
+ if (postType == 'answer'){
+ postNode = $('#answer-container-' + postId);
+ postRemoveLink = object;
+ if (postNode.hasClass('deleted')){
+ removeActionType = 'undelete';
+ do_proceed = true;
+ }
+ else {
+ removeActionType = 'delete';
+ do_proceed = confirm(removeConfirmation);
+ }
+ }
+ else {
+ do_proceed = confirm(removeConfirmation);
+ }
+ if (do_proceed) {
submit($(object), voteType, callback_remove);
-
-
}
}
}
@@ -457,21 +461,24 @@ var Vote = function(){
function createComments(type) {
var objectType = type;
var jDivInit = function(id) {
- return $("#comments-" + objectType + '-' + id);
+ return $("#comments-container-" + objectType + '-' + id);
};
var appendLoaderImg = function(id) {
- appendLoader("#comments-" + objectType + '-' + id + " div.comments");
+ appendLoader("#comments-container-" + objectType + '-' + id);
};
- var canPostComments = function(id, jDiv) {
- var jHidden = jDiv.siblings("#can-post-comments-" + objectType + '-' + id);
+ var canPostComments = function(id) {
+ var jHidden = $("#can-post-comments-" + objectType + '-' + id);
return jHidden.val().toLowerCase() == "true";
};
- var renderForm = function(id, jDiv) {
+ var renderForm = function(id) {
var formId = "form-comments-" + objectType + "-" + id;
- if (canPostComments(id, jDiv)) {
+ var jDiv = $('#comments-link-' + objectType + "-" + id).parent();
+ $(jDiv).css('background','none');
+ $(jDiv).css('padding-left',0);
+ if (canPostComments(id)) {
if (jDiv.find("#" + formId).length == 0) {
var form = '<form id="' + formId + '" class="post-comments"><div>';
form += '<textarea name="comment" cols="60" rows="5" maxlength="300" onblur="'+ objectType +'Comments.updateTextCounter(this)" ';
@@ -490,64 +497,79 @@ function createComments(type) {
else {
var divId = "comments-rep-needed-" + objectType + '-' + id;
if (jDiv.find("#" + divId).length == 0) {
- jDiv.append('<div id="' + divId + '" style="color:red">'
+ jDiv.append('<p id="' + divId + '" class="comment">'
+ $.i18n._('to comment, need') + ' ' +
- + repNeededForComments + ' ' + $.i18n._('community reputation points')
- + '<a href="/faq" class="comment-user">' + $.i18n._('please see') + 'faq</a></span>');
+ + repNeededForComments + ' ' + $.i18n._('community karma points')
+ + '<a href="' + $.i18n._('/') + $.i18n._('faq/') + '" class="comment-user">'
+ + $.i18n._('please see') + 'faq</a></span></p>');
}
}
};
var getComments = function(id, jDiv) {
- appendLoaderImg(id);
- $.getJSON("/" + objectType + "s/" + id + "/comments/", function(json) { showComments(id, json); });
+ //appendLoaderImg(id);
+ $.getJSON(scriptUrl + objectType + "s/" + id + "/" + $.i18n._("comments/")
+ , function(json) { showComments(id, json); });
};
var showComments = function(id, json) {
var jDiv = jDivInit(id);
- jDiv = jDiv.find("div.comments"); // this div should contain any fetched comments..
- jDiv.find("div[id^='comment-" + objectType + "-'" + "]").remove(); // clean previous calls..
-
+ //jDiv = jDiv.find("div.comments"); // this div should contain any fetched comments..
+ //jDiv.find("div[id^='comment-" + objectType + "-'" + "]").remove(); // clean previous calls..
+ jDiv.children().remove();
removeLoader();
-
if (json && json.length > 0) {
for (var i = 0; i < json.length; i++)
renderComment(jDiv, json[i]);
-
jDiv.children().show();
}
};
+ var renderDeleteCommentIcon = function(post_id, delete_url){
+ if (canPostComments(post_id)){
+ var html = '';
+ var img = scriptUrl + "content/images/close-small.png";
+ var imgHover = scriptUrl + "content/images/close-small-hover.png";
+ html += '<img class="delete-icon" onclick="' + objectType + 'Comments.deleteComment($(this), ' + post_id + ', \'' + delete_url + '\')" src="' + img;
+ html += '" onmouseover="$(this).attr(\'src\', \'' + imgHover + '\')" onmouseout="$(this).attr(\'src\', \'' + img
+ html += '\')" title="' + $.i18n._('delete this comment') + '" />';
+ return html;
+ }
+ else{
+ return '';
+ }
+ }
+
// {"Id":6,"PostId":38589,"CreationDate":"an hour ago","Text":"hello there!","UserDisplayName":"Jarrod Dixon","UserUrl":"/users/3/jarrod-dixon","DeleteUrl":null}
var renderComment = function(jDiv, json) {
- var html = '<div id="comment-' + objectType + "-" + json.id + '" style="display:none">' + json.text;
- html += json.user_url ? '&nbsp;&ndash;&nbsp;<a href="' + json.user_url + '"' : '<span';
+ var html = '<p id="comment-' + json.id + '" class="comment" style="display:none">' + json.text;
+ html += json.user_url ? ' - <a href="' + json.user_url + '"' : '<span';
html += ' class="comment-user">' + json.user_display_name + (json.user_url ? '</a>' : '</span>');
- html += ' <span class="comment-date">(' + json.add_date + ')</span>';
+ html += ' (' + json.comment_age + ')';
+
+ if (json.delete_url){
+ html += renderDeleteCommentIcon(json.object_id, json.delete_url);
+ }
if (json.delete_url) {
- var img = "/content/images/close-small.png";
- var imgHover = "/content/images/close-small-hover.png";
- html += '<img onclick="' + objectType + 'Comments.deleteComment($(this), ' + json.object_id + ', \'' + json.delete_url + '\')" src="' + img;
- html += '" onmouseover="$(this).attr(\'src\', \'' + imgHover + '\')" onmouseout="$(this).attr(\'src\', \'' + img
- html += '\')" title="' + $.i18n._('delete this comment') + '" />';
}
- html += '</div>';
+ html += '</p>';
jDiv.append(html);
};
var postComment = function(id, formId) {
- appendLoaderImg(id);
+ //appendLoaderImg(id);
var formSelector = "#" + formId;
var textarea = $(formSelector + " textarea");
+ //todo fix url translations!!!
$.ajax({
type: "POST",
- url: "/" + objectType + "s/" + id + "/comments/",
+ url: scriptUrl + objectType + "s/" + id + "/" + $.i18n._("comments/"),
dataType: "json",
data: { comment: textarea.val() },
success: function(json) {
@@ -569,18 +591,52 @@ function createComments(type) {
init: function() {
// Setup "show comments" clicks..
- $("a[id^='comments-link-" + objectType + "-" + "']").unbind("click").click(function() { commentsFactory[objectType].show($(this).attr("id").substr(("comments-link-" + objectType + "-").length)); });
+ $("a[id^='comments-link-" + objectType + "-" + "']").unbind("click").click(function() {
+ commentsFactory[objectType].show($(this).attr("id").substr(("comments-link-" + objectType + "-").length));
+ });
+
+ var cBox = $("[id^='comments-container-" + objectType + "']");
+ cBox.each( function(i){
+ var post_id = $(this).attr('id').replace('comments-container-' + objectType + '-', '');
+ $(this).children().each(
+ function(i){
+ var comment_id = $(this).attr('id').replace('comment-','');
+ var delete_url = $.i18n._('/') + objectType + 's/' + post_id + '/'
+ + $.i18n._('comments/') + comment_id + '/' + $.i18n._('delete/');
+ var html = $(this).html();
+ var CommentsClass;
+ if (objectType == 'question'){
+ CommentsClass = questionComments;
+ }
+ else if (objectType == 'answer') {
+ CommentsClass = answerComments;
+ }
+ var delete_icon = $(this).find('img.delete-icon');
+ delete_icon.click(function(){CommentsClass.deleteComment($(this),comment_id,delete_url);});
+ delete_icon.unbind('mouseover').bind('mouseover',
+ function(){
+ $(this).attr('src',$.i18n._('/') + 'content/images/close-small-hover.png');
+ }
+ );
+ delete_icon.unbind('mouseout').bind('mouseout',
+ function(){
+ $(this).attr('src',$.i18n._('/') + 'content/images/close-small.png');
+ }
+ );
+ }
+ );
+ });
},
show: function(id) {
var jDiv = jDivInit(id);
getComments(id, jDiv);
- renderForm(id, jDiv);
+ renderForm(id);
jDiv.show();
- if (canPostComments(id, jDiv)) jDiv.find("textarea").get(0).focus();
- jDiv.siblings("a").unbind("click").click(function(){
- commentsFactory[objectType].hide(id);
- }).text($.i18n._('hide comments'));
+
+ var link = $('#comments-link-' + objectType + '-' + id);
+ if (canPostComments(id)) link.parent().find("textarea").get(0).focus();
+ link.remove();
},
hide: function(id) {
@@ -596,9 +652,9 @@ function createComments(type) {
deleteComment: function(jImg, id, deleteUrl) {
if (confirm($.i18n._('confirm delete comment'))) {
jImg.hide();
- appendLoaderImg(id);
$.post(deleteUrl, { dataNeeded: "forIIS7" }, function(json) {
- showComments(id, json);
+ var par = jImg.parent();
+ par.remove();
}, "json");
}
},
diff --git a/templates/content/js/com.cnprog.utils.js b/templates/content/js/com.cnprog.utils.js
index e271ed78..cf27c8a1 100644
--- a/templates/content/js/com.cnprog.utils.js
+++ b/templates/content/js/com.cnprog.utils.js
@@ -23,7 +23,8 @@ var notify = function() {
},
close: function(doPostback) {
if (doPostback) {
- $.post("/messages/markread/", { formdata: "required" });
+ $.post(scriptUrl + $.i18n._("messages/") +
+ $.i18n._("markread/"), { formdata: "required" });
}
$(".notify").fadeOut("fast");
$("body").css("margin-top", "0");
@@ -35,7 +36,7 @@ var notify = function() {
function appendLoader(containerSelector) {
$(containerSelector).append('<img class="ajax-loader" '
- +'src="/content/images/indicator.gif" title="'
+ +'src="' + $.i18n._('/') + 'content/images/indicator.gif" title="'
+$.i18n._('loading...')
+'" alt="'
+$.i18n._('loading...')
@@ -103,7 +104,7 @@ var CPValidator = function(){
return {
tags: {
required: " " + $.i18n._('tags cannot be empty'),
- maxlength: " " + $.i18n._('tablimits info'),
+ maxlength: " " + $.i18n._('tablimits info')
},
text: {
required: " " + $.i18n._('content cannot be empty'),
diff --git a/templates/content/js/jquery.form.js b/templates/content/js/jquery.form.js
new file mode 100644
index 00000000..443114fd
--- /dev/null
+++ b/templates/content/js/jquery.form.js
@@ -0,0 +1,654 @@
+/*
+ * jQuery Form Plugin
+ * version: 2.33 (22-SEP-2009)
+ * @requires jQuery v1.2.6 or later
+ *
+ * Examples and documentation at: http://malsup.com/jquery/form/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ */
+;(function($) {
+
+/*
+ Usage Note:
+ -----------
+ Do not use both ajaxSubmit and ajaxForm on the same form. These
+ functions are intended to be exclusive. Use ajaxSubmit if you want
+ to bind your own submit handler to the form. For example,
+
+ $(document).ready(function() {
+ $('#myForm').bind('submit', function() {
+ $(this).ajaxSubmit({
+ target: '#output'
+ });
+ return false; // <-- important!
+ });
+ });
+
+ Use ajaxForm when you want the plugin to manage all the event binding
+ for you. For example,
+
+ $(document).ready(function() {
+ $('#myForm').ajaxForm({
+ target: '#output'
+ });
+ });
+
+ When using ajaxForm, the ajaxSubmit function will be invoked for you
+ at the appropriate time.
+*/
+
+/**
+ * ajaxSubmit() provides a mechanism for immediately submitting
+ * an HTML form using AJAX.
+ */
+$.fn.ajaxSubmit = function(options) {
+ // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
+ if (!this.length) {
+ log('ajaxSubmit: skipping submit process - no element selected');
+ return this;
+ }
+
+ if (typeof options == 'function')
+ options = { success: options };
+
+ var url = $.trim(this.attr('action'));
+ if (url) {
+ // clean url (don't include hash vaue)
+ url = (url.match(/^([^#]+)/)||[])[1];
+ }
+ url = url || window.location.href || '';
+
+ options = $.extend({
+ url: url,
+ type: this.attr('method') || 'GET'
+ }, options || {});
+
+ // hook for manipulating the form data before it is extracted;
+ // convenient for use with rich editors like tinyMCE or FCKEditor
+ var veto = {};
+ this.trigger('form-pre-serialize', [this, options, veto]);
+ if (veto.veto) {
+ log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
+ return this;
+ }
+
+ // provide opportunity to alter form data before it is serialized
+ if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
+ log('ajaxSubmit: submit aborted via beforeSerialize callback');
+ return this;
+ }
+
+ var a = this.formToArray(options.semantic);
+ if (options.data) {
+ options.extraData = options.data;
+ for (var n in options.data) {
+ if(options.data[n] instanceof Array) {
+ for (var k in options.data[n])
+ a.push( { name: n, value: options.data[n][k] } );
+ }
+ else
+ a.push( { name: n, value: options.data[n] } );
+ }
+ }
+
+ // give pre-submit callback an opportunity to abort the submit
+ if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
+ log('ajaxSubmit: submit aborted via beforeSubmit callback');
+ return this;
+ }
+
+ // fire vetoable 'validate' event
+ this.trigger('form-submit-validate', [a, this, options, veto]);
+ if (veto.veto) {
+ log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
+ return this;
+ }
+
+ var q = $.param(a);
+
+ if (options.type.toUpperCase() == 'GET') {
+ options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
+ options.data = null; // data is null for 'get'
+ }
+ else
+ options.data = q; // data is the query string for 'post'
+
+ var $form = this, callbacks = [];
+ if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
+ if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
+
+ // perform a load on the target only if dataType is not provided
+ if (!options.dataType && options.target) {
+ var oldSuccess = options.success || function(){};
+ callbacks.push(function(data) {
+ $(options.target).html(data).each(oldSuccess, arguments);
+ });
+ }
+ else if (options.success)
+ callbacks.push(options.success);
+
+ options.success = function(data, status) {
+ for (var i=0, max=callbacks.length; i < max; i++)
+ callbacks[i].apply(options, [data, status, $form]);
+ };
+
+ // are there files to upload?
+ var files = $('input:file', this).fieldValue();
+ var found = false;
+ for (var j=0; j < files.length; j++)
+ if (files[j])
+ found = true;
+
+ var multipart = false;
+// var mp = 'multipart/form-data';
+// multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
+
+ // options.iframe allows user to force iframe mode
+ if (options.iframe || found || multipart) {
+ // hack to fix Safari hang (thanks to Tim Molendijk for this)
+ // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
+ if (options.closeKeepAlive)
+ $.get(options.closeKeepAlive, fileUpload);
+ else
+ fileUpload();
+ }
+ else{
+ $.ajax(options);
+ }
+
+ // fire 'notify' event
+ this.trigger('form-submit-notify', [this, options]);
+ return this;
+
+
+ // private function for handling file uploads (hat tip to YAHOO!)
+ function fileUpload() {
+ var form = $form[0];
+
+ if ($(':input[name=submit]', form).length) {
+ alert('Error: Form elements must not be named "submit".');
+ return;
+ }
+
+ var opts = $.extend({}, $.ajaxSettings, options);
+ var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
+
+ var id = 'jqFormIO' + (new Date().getTime());
+ var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
+ var io = $io[0];
+
+ $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
+
+ var xhr = { // mock object
+ aborted: 0,
+ responseText: null,
+ responseXML: null,
+ status: 0,
+ statusText: 'n/a',
+ getAllResponseHeaders: function() {},
+ getResponseHeader: function() {},
+ setRequestHeader: function() {},
+ abort: function() {
+ this.aborted = 1;
+ $io.attr('src','about:blank'); // abort op in progress
+ }
+ };
+
+ var g = opts.global;
+ // trigger ajax global events so that activity/block indicators work like normal
+ if (g && ! $.active++) $.event.trigger("ajaxStart");
+ if (g) $.event.trigger("ajaxSend", [xhr, opts]);
+
+ if (s.beforeSend && s.beforeSend(xhr, s) === false) {
+ s.global && $.active--;
+ return;
+ }
+ if (xhr.aborted)
+ return;
+
+ var cbInvoked = 0;
+ var timedOut = 0;
+
+ // add submitting element to data if we know it
+ var sub = form.clk;
+ if (sub) {
+ var n = sub.name;
+ if (n && !sub.disabled) {
+ options.extraData = options.extraData || {};
+ options.extraData[n] = sub.value;
+ if (sub.type == "image") {
+ options.extraData[name+'.x'] = form.clk_x;
+ options.extraData[name+'.y'] = form.clk_y;
+ }
+ }
+ }
+
+ // take a breath so that pending repaints get some cpu time before the upload starts
+ setTimeout(function() {
+ // make sure form attrs are set
+ var t = $form.attr('target'), a = $form.attr('action');
+
+ // update form attrs in IE friendly way
+ form.setAttribute('target',id);
+ if (form.getAttribute('method') != 'POST')
+ form.setAttribute('method', 'POST');
+ if (form.getAttribute('action') != opts.url)
+ form.setAttribute('action', opts.url);
+
+ // ie borks in some cases when setting encoding
+ if (! options.skipEncodingOverride) {
+ $form.attr({
+ encoding: 'multipart/form-data',
+ enctype: 'multipart/form-data'
+ });
+ }
+
+ // support timout
+ if (opts.timeout)
+ setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
+
+ // add "extra" data to form if provided in options
+ var extraInputs = [];
+ try {
+ if (options.extraData)
+ for (var n in options.extraData)
+ extraInputs.push(
+ $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
+ .appendTo(form)[0]);
+
+ // add iframe to doc and submit the form
+ $io.appendTo('body');
+ io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
+ form.submit();
+ }
+ finally {
+ // reset attrs and remove "extra" input elements
+ form.setAttribute('action',a);
+ t ? form.setAttribute('target', t) : $form.removeAttr('target');
+ $(extraInputs).remove();
+ }
+ }, 10);
+
+ var domCheckCount = 50;
+
+ function cb() {
+ if (cbInvoked++) return;
+
+ io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
+
+ var ok = true;
+ try {
+ if (timedOut) throw 'timeout';
+ // extract the server response from the iframe
+ var data, doc;
+
+ doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
+
+ var isXml = opts.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
+ log('isXml='+isXml);
+ if (!isXml && (doc.body == null || doc.body.innerHTML == '')) {
+ if (--domCheckCount) {
+ // in some browsers (Opera) the iframe DOM is not always traversable when
+ // the onload callback fires, so we loop a bit to accommodate
+ cbInvoked = 0;
+ setTimeout(cb, 100);
+ return;
+ }
+ log('Could not access iframe DOM after 50 tries.');
+ return;
+ }
+
+ xhr.responseText = doc.body ? doc.body.innerHTML : null;
+ xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
+ xhr.getResponseHeader = function(header){
+ var headers = {'content-type': opts.dataType};
+ return headers[header];
+ };
+
+ if (opts.dataType == 'json' || opts.dataType == 'script') {
+ // see if user embedded response in textarea
+ var ta = doc.getElementsByTagName('textarea')[0];
+ if (ta)
+ xhr.responseText = ta.value;
+ else {
+ // account for browsers injecting pre around json response
+ var pre = doc.getElementsByTagName('pre')[0];
+ if (pre)
+ xhr.responseText = pre.innerHTML;
+ }
+ }
+ else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
+ xhr.responseXML = toXml(xhr.responseText);
+ }
+ data = $.httpData(xhr, opts.dataType);
+ }
+ catch(e){
+ ok = false;
+ $.handleError(opts, xhr, 'error', e);
+ }
+
+ // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
+ if (ok) {
+ opts.success(data, 'success');
+ if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
+ }
+ if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
+ if (g && ! --$.active) $.event.trigger("ajaxStop");
+ if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
+
+ // clean up
+ setTimeout(function() {
+ $io.remove();
+ xhr.responseXML = null;
+ }, 100);
+ };
+
+ function toXml(s, doc) {
+ if (window.ActiveXObject) {
+ doc = new ActiveXObject('Microsoft.XMLDOM');
+ doc.async = 'false';
+ doc.loadXML(s);
+ }
+ else
+ doc = (new DOMParser()).parseFromString(s, 'text/xml');
+ return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
+ };
+ };
+};
+
+/**
+ * ajaxForm() provides a mechanism for fully automating form submission.
+ *
+ * The advantages of using this method instead of ajaxSubmit() are:
+ *
+ * 1: This method will include coordinates for <input type="image" /> elements (if the element
+ * is used to submit the form).
+ * 2. This method will include the submit element's name/value data (for the element that was
+ * used to submit the form).
+ * 3. This method binds the submit() method to the form for you.
+ *
+ * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
+ * passes the options argument along after properly binding events for submit elements and
+ * the form itself.
+ */
+$.fn.ajaxForm = function(options) {
+ return this.ajaxFormUnbind().bind('submit.form-plugin', function() {
+ $(this).ajaxSubmit(options);
+ return false;
+ }).bind('click.form-plugin', function(e) {
+ var $el = $(e.target);
+ if (!($el.is(":submit,input:image"))) {
+ return;
+ }
+ var form = this;
+ form.clk = e.target;
+ if (e.target.type == 'image') {
+ if (e.offsetX != undefined) {
+ form.clk_x = e.offsetX;
+ form.clk_y = e.offsetY;
+ } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
+ var offset = $el.offset();
+ form.clk_x = e.pageX - offset.left;
+ form.clk_y = e.pageY - offset.top;
+ } else {
+ form.clk_x = e.pageX - e.target.offsetLeft;
+ form.clk_y = e.pageY - e.target.offsetTop;
+ }
+ }
+ // clear form vars
+ setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
+ });
+};
+
+// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
+$.fn.ajaxFormUnbind = function() {
+ return this.unbind('submit.form-plugin click.form-plugin');
+};
+
+/**
+ * formToArray() gathers form element data into an array of objects that can
+ * be passed to any of the following ajax functions: $.get, $.post, or load.
+ * Each object in the array has both a 'name' and 'value' property. An example of
+ * an array for a simple login form might be:
+ *
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
+ *
+ * It is this array that is passed to pre-submit callback functions provided to the
+ * ajaxSubmit() and ajaxForm() methods.
+ */
+$.fn.formToArray = function(semantic) {
+ var a = [];
+ if (this.length == 0) return a;
+
+ var form = this[0];
+ var els = semantic ? form.getElementsByTagName('*') : form.elements;
+ if (!els) return a;
+ for(var i=0, max=els.length; i < max; i++) {
+ var el = els[i];
+ var n = el.name;
+ if (!n) continue;
+
+ if (semantic && form.clk && el.type == "image") {
+ // handle image inputs on the fly when semantic == true
+ if(!el.disabled && form.clk == el) {
+ a.push({name: n, value: $(el).val()});
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+ }
+ continue;
+ }
+
+ var v = $.fieldValue(el, true);
+ if (v && v.constructor == Array) {
+ for(var j=0, jmax=v.length; j < jmax; j++)
+ a.push({name: n, value: v[j]});
+ }
+ else if (v !== null && typeof v != 'undefined')
+ a.push({name: n, value: v});
+ }
+
+ if (!semantic && form.clk) {
+ // input type=='image' are not found in elements array! handle it here
+ var $input = $(form.clk), input = $input[0], n = input.name;
+ if (n && !input.disabled && input.type == 'image') {
+ a.push({name: n, value: $input.val()});
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+ }
+ }
+ return a;
+};
+
+/**
+ * Serializes form data into a 'submittable' string. This method will return a string
+ * in the format: name1=value1&amp;name2=value2
+ */
+$.fn.formSerialize = function(semantic) {
+ //hand off to jQuery.param for proper encoding
+ return $.param(this.formToArray(semantic));
+};
+
+/**
+ * Serializes all field elements in the jQuery object into a query string.
+ * This method will return a string in the format: name1=value1&amp;name2=value2
+ */
+$.fn.fieldSerialize = function(successful) {
+ var a = [];
+ this.each(function() {
+ var n = this.name;
+ if (!n) return;
+ var v = $.fieldValue(this, successful);
+ if (v && v.constructor == Array) {
+ for (var i=0,max=v.length; i < max; i++)
+ a.push({name: n, value: v[i]});
+ }
+ else if (v !== null && typeof v != 'undefined')
+ a.push({name: this.name, value: v});
+ });
+ //hand off to jQuery.param for proper encoding
+ return $.param(a);
+};
+
+/**
+ * Returns the value(s) of the element in the matched set. For example, consider the following form:
+ *
+ * <form><fieldset>
+ * <input name="A" type="text" />
+ * <input name="A" type="text" />
+ * <input name="B" type="checkbox" value="B1" />
+ * <input name="B" type="checkbox" value="B2"/>
+ * <input name="C" type="radio" value="C1" />
+ * <input name="C" type="radio" value="C2" />
+ * </fieldset></form>
+ *
+ * var v = $(':text').fieldValue();
+ * // if no values are entered into the text inputs
+ * v == ['','']
+ * // if values entered into the text inputs are 'foo' and 'bar'
+ * v == ['foo','bar']
+ *
+ * var v = $(':checkbox').fieldValue();
+ * // if neither checkbox is checked
+ * v === undefined
+ * // if both checkboxes are checked
+ * v == ['B1', 'B2']
+ *
+ * var v = $(':radio').fieldValue();
+ * // if neither radio is checked
+ * v === undefined
+ * // if first radio is checked
+ * v == ['C1']
+ *
+ * The successful argument controls whether or not the field element must be 'successful'
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true. If this value is false the value(s)
+ * for each element is returned.
+ *
+ * Note: This method *always* returns an array. If no valid value can be determined the
+ * array will be empty, otherwise it will contain one or more values.
+ */
+$.fn.fieldValue = function(successful) {
+ for (var val=[], i=0, max=this.length; i < max; i++) {
+ var el = this[i];
+ var v = $.fieldValue(el, successful);
+ if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
+ continue;
+ v.constructor == Array ? $.merge(val, v) : val.push(v);
+ }
+ return val;
+};
+
+/**
+ * Returns the value of the field element.
+ */
+$.fieldValue = function(el, successful) {
+ var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
+ if (typeof successful == 'undefined') successful = true;
+
+ if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
+ (t == 'checkbox' || t == 'radio') && !el.checked ||
+ (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
+ tag == 'select' && el.selectedIndex == -1))
+ return null;
+
+ if (tag == 'select') {
+ var index = el.selectedIndex;
+ if (index < 0) return null;
+ var a = [], ops = el.options;
+ var one = (t == 'select-one');
+ var max = (one ? index+1 : ops.length);
+ for(var i=(one ? index : 0); i < max; i++) {
+ var op = ops[i];
+ if (op.selected) {
+ var v = op.value;
+ if (!v) // extra pain for IE...
+ v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
+ if (one) return v;
+ a.push(v);
+ }
+ }
+ return a;
+ }
+ return el.value;
+};
+
+/**
+ * Clears the form data. Takes the following actions on the form's input fields:
+ * - input text fields will have their 'value' property set to the empty string
+ * - select elements will have their 'selectedIndex' property set to -1
+ * - checkbox and radio inputs will have their 'checked' property set to false
+ * - inputs of type submit, button, reset, and hidden will *not* be effected
+ * - button elements will *not* be effected
+ */
+$.fn.clearForm = function() {
+ return this.each(function() {
+ $('input,select,textarea', this).clearFields();
+ });
+};
+
+/**
+ * Clears the selected form elements.
+ */
+$.fn.clearFields = $.fn.clearInputs = function() {
+ return this.each(function() {
+ var t = this.type, tag = this.tagName.toLowerCase();
+ if (t == 'text' || t == 'password' || tag == 'textarea')
+ this.value = '';
+ else if (t == 'checkbox' || t == 'radio')
+ this.checked = false;
+ else if (tag == 'select')
+ this.selectedIndex = -1;
+ });
+};
+
+/**
+ * Resets the form data. Causes all form elements to be reset to their original value.
+ */
+$.fn.resetForm = function() {
+ return this.each(function() {
+ // guard against an input with the name of 'reset'
+ // note that IE reports the reset function as an 'object'
+ if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
+ this.reset();
+ });
+};
+
+/**
+ * Enables or disables any matching elements.
+ */
+$.fn.enable = function(b) {
+ if (b == undefined) b = true;
+ return this.each(function() {
+ this.disabled = !b;
+ });
+};
+
+/**
+ * Checks/unchecks any matching checkboxes or radio buttons and
+ * selects/deselects and matching option elements.
+ */
+$.fn.selected = function(select) {
+ if (select == undefined) select = true;
+ return this.each(function() {
+ var t = this.type;
+ if (t == 'checkbox' || t == 'radio')
+ this.checked = select;
+ else if (this.tagName.toLowerCase() == 'option') {
+ var $sel = $(this).parent('select');
+ if (select && $sel[0] && $sel[0].type == 'select-one') {
+ // deselect all other options
+ $sel.find('option').selected(false);
+ }
+ this.selected = select;
+ }
+ });
+};
+
+// helper fn for console logging
+// set $.fn.ajaxSubmit.debug to true to enable debug logging
+function log() {
+ if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
+ window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
+};
+
+})(jQuery);
diff --git a/templates/content/js/wmd/wmd.js b/templates/content/js/wmd/wmd.js
index 7b611dba..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 ="<div>" + $.i18n._('upload image') + "</div>" +
"<input type=\"file\" name=\"file-upload\" id=\"file-upload\" size=\"26\" "+
"onchange=\"return ajaxFileUpload($('#image-url'));\"/><br>" +
- "<img id=\"loading\" src=\"/content/images/indicator.gif\" style=\"display:none;\"/>";
+ "<img id=\"loading\" src=\"" + scriptUrl + "content/images/indicator.gif\" style=\"display:none;\"/>";
// The default text that appears in the dialog input box when entering
// links.
diff --git a/templates/content/style/default.css b/templates/content/style/default.css
index 0221cc03..2bc185ad 100644
--- a/templates/content/style/default.css
+++ b/templates/content/style/default.css
@@ -7,9 +7,9 @@ Style sheet for cnprog.com
All rights reserved. 2008 CNPROG.COM
*/
-@import url(/content/style/jquery.autocomplete.css);
-@import url(/content/style/openid.css);
-@import url(/content/style/prettify.css);
+@import url(content/style/jquery.autocomplete.css);
+@import url(content/style/openid.css);
+@import url(content/style/prettify.css);
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, form, label, table, caption, tbody, tfoot, thead, tr, th, td
{
@@ -232,19 +232,19 @@ h4 {display:block;font-size:90%; font-family:Verdana;color:#ccc;}
}
#main-bar .golden{
- background:url(/content/images/bg_title_golden.gif) no-repeat;
+ background:url(../../images/bg_title_golden.gif) no-repeat;
}
#main-bar .pink{
- background:url(/content/images/bg_title_red.gif) no-repeat;
+ background:url(../../images/bg_title_red.gif) no-repeat;
}
#main-bar .orange{
- background:url(/content/images/bg_title_orange.gif) no-repeat;
+ background:url(../../images/bg_title_orange.gif) no-repeat;
}
#main-bar .green{
- background:url(/content/images/bg_title_green.gif) no-repeat;
+ background:url(../../images/bg_title_green.gif) no-repeat;
}
#tab{
@@ -906,7 +906,7 @@ h4 {display:block;font-size:90%; font-family:Verdana;color:#ccc;}
/* 2 textarea resizer styles */
div.grippie {
- background:#EEEEEE url(/content/images/grippie.png) no-repeat scroll center 2px;
+ background:#EEEEEE url(../../images/grippie.png) no-repeat scroll center 2px;
border-color:#DDDDDD;
border-style:solid;
border-width:0pt 1px 1px;
@@ -923,14 +923,14 @@ div.grippie {
}
.openid-input{
- background:url(/content/images/openid.gif) no-repeat;
+ background:url(../../images/openid.gif) no-repeat;
padding-left:15px;
cursor:pointer;
}
.openid-login-input{
background-position:center left;
- background:url(/content/images/openid.gif) no-repeat 0% 50%;
+ background:url(../../images/openid.gif) no-repeat 0% 50%;
padding:5px 5px 5px 15px;
cursor:pointer;
font-family:Trebuchet MS;
@@ -941,7 +941,7 @@ div.grippie {
.openid-login-submit{
padding:6px;
- #padding:4px;
+ /*padding:4px;*/
cursor:pointer;
font-weight:bold;
font-size:120%;
@@ -990,7 +990,6 @@ div.grippie {
.item-right{
float:left;
-
}
.vote-number{
@@ -1609,7 +1608,9 @@ div.comments {
}
div.post-comments{
- width:585px
+ width:585px;
+ clear:both;
+ float:left;
}
form.post-comments textarea {
diff --git a/templates/content/style/jquery.autocomplete.css b/templates/content/style/jquery.autocomplete.css
index 7c3127d1..3bf2c2d9 100644
--- a/templates/content/style/jquery.autocomplete.css
+++ b/templates/content/style/jquery.autocomplete.css
@@ -36,7 +36,7 @@
}
.ac_loading {
- background: white url('/content/images/indicator.gif') right center no-repeat;
+ background: white url(../../images/indicator.gif) right center no-repeat;
}
.ac_odd {
diff --git a/templates/content/style/style.css b/templates/content/style/style.css
index 7ccf1af3..4038e8a1 100644
--- a/templates/content/style/style.css
+++ b/templates/content/style/style.css
@@ -1,15 +1,16 @@
-@import url(/content/style/jquery.autocomplete.css);
-@import url(/content/style/openid.css);
-@import url(/content/style/prettify.css);
+@import url(jquery.autocomplete.css);
+@import url(openid.css);
+@import url(prettify.css);
/* 公用 */
body{background:#FFF; font-size:12px; line-height:150%; margin:0; padding:0; color:#000; font-family: sans-serif;
}
div{margin:0 auto; padding:0;}
h1,h2,h3,h4,h5,h6,ul,li,dl,dt,dd,form,img,p{margin:0; padding:0; border:none; }
-input, select {font-family:Trebuchet MS,"segoe ui",Helvetica,"Microsoft YaHei",宋体,Tahoma,Verdana,MingLiu,PMingLiu,Arial,sans-serif;}
+label {vertical-align:middle;}
+hr {border:none;border-top: 1px dashed #ccccce;}
+input, select {vertical-align:middle;font-family:Trebuchet MS,"segoe ui",Helvetica,"Microsoft YaHei",宋体,Tahoma,Verdana,MingLiu,PMingLiu,Arial,sans-serif;}
p{margin-bottom:13px; font-size:13px; line-height:140%;}
a {color:#333333; text-decoration:none;}
-
.badges a {color:#763333;text-decoration:underline;}
a:hover {text-decoration:underline;}
.block{width:960px; height:auto;}
@@ -49,6 +50,12 @@ ol
margin-bottom: 1em;
padding-left:0px;
}
+td ul {
+ vertical-align:middle;
+}
+li input {
+ margin: 3px 3px 4px 3px;
+}
pre
{
font-family: Consolas, Monaco, Liberation Mono, Lucida Console, Monospace;
@@ -97,7 +104,6 @@ blockquote
right:0px;
height:20px;
text-align:right;
- color:black;
padding:3px;
background-color:#ffffff;
width:500px;
@@ -113,62 +119,115 @@ blockquote
#navBar .nav {margin:20px 0px 0px 16px;
/*letter-spacing:1px; */
}
-#navBar .nav a {color:#333333; background-color:#F9F7ED;
- border: 1px solid #aaaaaa;
- border-bottom: none;
+#navBar .nav a {color:#333333; background-color:#fff0e0;
+ /*border-left: 1px solid #eeeeec;
+ border-right: 1px solid #babdb6;
+ border-top: 1px solid #eeeeec;*/
+ border: 1px solid #888888;
+ border-bottom: none;
padding:0px 12px 3px 12px; height:25px; line-height:30px;margin-left:10px; font-size:14px; font-weight:400; text-decoration:none;display: block;float: left;}
#navBar .nav a:hover {text-decoration:underline}
-#navBar .nav a.on {height:24px;line-height:28px;border:1px solid #d64000; background:#B02B2C; color:#FFF; font-weight:600; text-decoration:none}
-#navBar .nav a.special {font-size:15px; color:#B02B2C; font-weight:bold; text-decoration:none; }
+#navBar .nav a.on {height:24px;line-height:28px;
+ border-bottom: 1px solid #a40000;
+ border-right:1px solid #820000;
+ border-top:1px solid #d40000;
+ border-left:1px solid #d40000;
+ /*background:#A31E39; */
+ background:#a40000;
+ color:#FFF; font-weight:600; text-decoration:none}
+#navBar .nav a.special {font-size:14px; color:#B02B2C; font-weight:bold; text-decoration:none; }
#navBar .nav a.special:hover {text-decoration:underline;}
#navBar .nav div.focus {float:right; padding-right:0px;}
/*搜索栏*/
-#searchBar {
- background-color:#9db2b1;/*#e9b96e;*/
- padding:5px 0 0 0;} /* #B02B2C */
+#searchBar {width:958px;
+ background-color:#888a85;/*#e9b96e;*/
+ border: 1px solid #aaaaaa;
+ padding:4px 0 0 0;} /* #B02B2C */
#searchBar .content { }
#searchBar .searchInput {font-size:13px; height:18px; width:400px;}
#searchBar .searchBtn {font-size:14px; height:26px; width:80px;}
-#searchBar .options {padding-top:5px; font-size:100%;color:#EEE;
+#searchBar .options {padding:3px 0 3px 0;font-size:100%;color:#EEE;
/*letter-spacing:1px;*/
}
-#searchBar .options INPUT {margin-left:15px;}
+#searchBar .options INPUT {margin:0 3px 0 15px;}
#searchBar .options INPUT:hover {cursor:pointer}
/*问题列表*/
#listA {float:left; background-color:#FFF;padding:0 0px 0 0px; width:100%;}
-#listA .qstA {padding:3px 5px 0 5px; margin:0 0px 10px 0px; background:url(/content/images/quest-bg.gif) repeat-x top;}
+#listA .qstA {
+ position:relative;
+ padding:3px 5px 5px 10px;
+ border-top:1px dashed #ccccce;
+ /*border-left:1px solid #ebebbe;
+ border-right:1px solid #b4b48e;
+ border-bottom:1px solid #b4b48e;*/
+ background: white;/* #f9f7ed;*/
+ margin:10px 0 10px 0;
+ /*background:url(../images/quest-bg.gif) repeat-x top;*/
+}
#listA .qstA thumb {float:left; }
-#listA .qstA H2 {font-size:15px; font-weight:800; margin:8px auto;padding:0px;}
-#listA .qstA H2 a {color:#663333; }
-#listA .qstA .stat {font-size:13px;letter-spacing:1px;float:right;}
+#listA .qstA H2 {font-size:14px; font-weight:800; margin:8px auto;padding:0px;}
+#listA .qstA H2 a {color:333333/*#2e3436*/;font-size:15px;}
+#listA .qstA .stat {
+ position:absolute;
+ right:0px;
+ bottom:5px;
+ font-size:12px;
+ /*letter-spacing:1px;*/
+ float:right;
+}
#listA .qstA .stat span {margin-right:5px;}
#listA .qstA .stat td {min-width:40px;text-align:center;}
-#listA .qstA .stat .num {font-family:arial;color:#905213; font-size:20px; font-weight:800;}
-#listA .qstA .stat .unit {color:#777;}
-#listA .qstA .from {margin-top:5px; font-size:13px;}
-#listA .qstA .from .score {font-family:arial;}
-#listA .qstA .date {margin-left:20px; color:#777;}
-#listA .qstA .wiki {color:#663333;font-size:12px;}
+#listA .qstA .stat .num {
+ font-family:sans-serif;
+ color:#a40000;
+ /*background:#eeeeec;
+ border: 1px solid #babdb6;*/
+ margin:0px;
+ font-size:17px;
+ font-weight:800;
+}
+#listA .qstA table {border-spacing:0px;}
+#listA .qstA table td {padding:0px;width:60px;text-align:center;}
+#listA .qstA .stat .unit {color:#777777;margin:0px}
+#listA .qstA .from {margin-top:5px; font-size:13px;color:#777777;}
+#listA .qstA .from .score {font-family:sans-serif;color:#555555;}
+#listA .qstA .date {margin-left:10px; color:#777777;}
+#listA .qstA .wiki {color:#763333;font-size:12px;}
#listA .qstA .from a {}
#listA .qstA .from IMG {vertical-align:middle;}
#listA .qstA .author {font-weight:400; }
-#listA .qstA .author a{ }
+#listA .qstA .author a{color:#444444; }
#listA .qstA .summary{margin-right:5px;}
-
+#question-table {
+ margin-bottom:10px;
+ /*border-bottom:1px solid #888a85;*/
+}
.evenMore {font-size:14px; font-weight:800;}
.questions-count{font-size:32px;font-family:sans-serif;font-weight:600;padding:0 0 5px 7px;color:#a40000;}
/*内容块*/
-.boxA {background:#777; padding:6px; margin-bottom:8px;}
+.boxA {background:#888a85; padding:6px; margin-bottom:8px;border 1px solid #babdb6;}
.boxA H3 {font-size:13px; font-weight:800; color:#FFF; margin:0; padding:0; margin-bottom:4px;}
.boxA .body {border:1px solid #999; padding:8px; background:#FFF; font-size:13px;}
.boxA .more {padding:2px; text-align:right; font-weight:800;}
-.boxB {background:#F9F7CD; padding:6px; margin-bottom:8px;}
-.boxB H3 {font-size:13px; font-weight:800; color:#000; margin:0; padding:0 0 0 15px; margin-bottom:4px; background:url(/content/images/dot-g.gif) no-repeat left center;}
-.boxB .body {border:1px solid #FFFF88; padding:8px; background:#FFF; font-size:13px; line-height:160%;}
+.boxB {background:#F9F7ED; padding:6px; margin-bottom:8px;border:solid 1px #aaaaaa;}
+.boxB H3 {font-size:13px; font-weight:800; color:#000; margin:0; padding:0 0 0 15px; margin-bottom:4px; background:url(../images/dot-g.gif) no-repeat left center;}
+.boxB .body {border:1px solid #aaaaaa; padding:8px; background:#FFF; font-size:13px; line-height:160%;}
.boxB .more {padding:1px; text-align:right; font-weight:800;}
-.boxC {background:#F5F5F5; padding:6px; margin-bottom:8px;}
+.boxC {
+ background:#babdb6;/*f9f7ed;*/
+ padding:10px;
+ margin-bottom:8px;
+ border-top:1px solid #eeeeec;
+ border-left:1px solid #eeeeec;
+ border-right:1px solid #a9aca5;
+ border-bottom:1px solid #babdb6;
+}
+.boxC p.info-box-follow-up-links {
+ text-align:right;
+ margin:0;
+}
/*分页*/
.pager {margin-top:10px; margin-bottom:16px; float:left;}
.pagesize {margin-top:10px; margin-bottom:16px; float:right;}
@@ -198,7 +257,7 @@ blockquote
border:1px solid #fff;
background-color:#fff;
color:#777;
- padding:.3em;
+ padding:2px 4px 3px 4px;
font:bold 100% sans-serif;
}
@@ -257,29 +316,36 @@ blockquote
.tag-number {font-weight:700;font-family:sans-serif;}
/*奖牌*/
-a.medal { font-size:14px; line-height:250%; font-weight:800; color:#333; text-decoration:none; background:url(/content/images/medala.gif) no-repeat; border-left:1px solid #EEE; border-top:1px solid #EEE; border-bottom:1px solid #CCC; border-right:1px solid #CCC; padding:4px 12px 4px 6px;}
-a:hover.medal {color:#333; text-decoration:none; background:url(/content/images/medala_on.gif) no-repeat; border-left:1px solid #E7E296; border-top:1px solid #E7E296; border-bottom:1px solid #D1CA3D; border-right:1px solid #D1CA3D;}
+a.medal { font-size:14px; line-height:250%; font-weight:800; color:#333; text-decoration:none; background:url(../images/medala.gif) no-repeat; border-left:1px solid #EEE; border-top:1px solid #EEE; border-bottom:1px solid #CCC; border-right:1px solid #CCC; padding:4px 12px 4px 6px;}
+a:hover.medal {color:#333; text-decoration:none; background:url(../images/medala_on.gif) no-repeat; border-left:1px solid #E7E296; border-top:1px solid #E7E296; border-bottom:1px solid #D1CA3D; border-right:1px solid #D1CA3D;}
/*Tab栏*/
-.tabBar{background-color:#FFF;border-bottom: 1px solid #666;height: 30px; width: 100%;clear:both; margin-bottom:3px;}
+.tabBar{background-color:#FFF;border-bottom: 1px solid white;height: 30px; width: 100%;clear:both; margin-bottom:3px;}
.tabsA {background-color:#FFF;float:right;position:relative;display:block;font-weight:bold;height:20px;}
.tabsB {background-color:#FFF;float:left;position:relative;display:block;font-weight:bold;height:20px;}
-.tabsA a.on, .tabsA a.on:hover,.tabsB a.on, .tabsB a.on:hover {background: #fff;
- color:#333;
- border: 1px solid #777;
- border-bottom:2px solid #FFF;
- height: 25px;
+.tabsA a.on, .tabsA a:hover,.tabsB a.on, .tabsB a:hover {
+ background: #fff;
+ color:#a40000;
+ border-top:1px solid #babdb6;
+ border-left:1px solid #babdb6;
+ border-right:1px solid #888a85;
+ border-bottom:1px solid #888a85;
+ height: 24px;
line-height: 26px;
margin-top: 3px;
padding: 0px 11px 0px 11px;}
-.tabsA a {background: #eee;
- border: 1px solid #eee;
- color: #777;
+.tabsA a {
+ background: #f9f7eb;
+ border-top:1px solid #eeeeec;
+ border-left:1px solid #eeeeec;
+ border-right:1px solid #a9aca5;
+ border-bottom:1px solid #888a85;
+ color: #888a85;
display: block;
float: left;
- height: 22px;
- line-height: 28px;
+ height: 20px;
+ line-height: 22px;
margin: 5px 4px 0 0;
padding: 0 11px 0 11px;
text-decoration: none;
@@ -295,19 +361,28 @@ a:hover.medal {color:#333; text-decoration:none; background:url(/content/images
padding: 0 11px 0 11px;
text-decoration: none;
}
-.tabsA a:hover, .tabsB a:hover {background: #fff;border: 1px solid #777;border-bottom:3px solid #FFF;}
+/*.tabsA a:hover, .tabsB a:hover {background: #fff;border: 1px solid #777;border-bottom:3px solid #FFF;}*/
.headlineA {font-size:13px; border-bottom:1px solid #777; padding-bottom:2px; font-weight:800; margin-bottom:12px; text-align:right; height:30px;}
-.headQuestions {float:left; height:23px; line-height:23px; margin:5px 0 0 5px;padding:0px 6px 0px 15px; font-size:15px; font-weight:700; border-bottom:0px solid #777; border-left:0px solid #darkred; background-color:#FFF;background:url(/content/images/dot-list.gif) no-repeat left center;}
-.headAnswers {float:left; padding:3px; font-size:18px; font-weight:800; background:url(/content/images/ico_answers.gif) left 2px no-repeat; padding-left:24px;}
-.headTags {float:left; padding:3px; font-size:18px; font-weight:800; background:url(/content/images/ico_tags.gif) no-repeat; padding-left:24px;}
-.headUsers {float:left; height:23px; line-height:23px; margin:5px 0 0 5px;padding:0px 6px 0px 15px; font-size:15px; font-weight:700; border-bottom:0px solid #777; border-left:0px solid #darkred; background-color:#FFF;background:url(/content/images/dot-list.gif) no-repeat left center;}
-.headMedals {float:left; height:23px; line-height:23px; margin:5px 0 0 5px;padding:0px 6px 0px 15px; font-size:15px; font-weight:700; border-bottom:0px solid #777; border-left:0px solid #darkred; background-color:#FFF;background:url(/content/images/dot-list.gif) no-repeat left center;}
-.headLogin {float:left; padding:3px; font-size:15px; font-weight:800; background:url(/content/images/ico_login.gif) no-repeat; padding-left:24px;}
-.headNormal {text-align:left;padding:3px; font-size:15px; margin-bottom:12px; font-weight:800;border-bottom:1px solid #777;}
-.headUser {text-align:left;padding:5px; font-size:20px; letter-spacing:1px;margin-bottom:12px; font-weight:800;border-bottom:1px solid #777;}
+.headQuestions {float:left; height:23px; line-height:23px; margin:5px 0 0 5px;padding:0px 6px 0px 15px; font-size:15px; font-weight:700; border-bottom:0px solid #777; border-left:0px solid #darkred; background-color:#FFF;background:url(../images/dot-list.gif) no-repeat left center;}
+.headAnswers {float:left; padding:3px; font-size:18px; font-weight:800; background:url(../images/ico_answers.gif) left 2px no-repeat; padding-left:24px;}
+.headTags {float:left; padding:3px; font-size:18px; font-weight:800; background:url(../images/ico_tags.gif) no-repeat; padding-left:24px;}
+.headUsers {float:left; height:23px; line-height:23px; margin:5px 0 0 5px;padding:0px 6px 0px 15px; font-size:15px; font-weight:700; border-bottom:0px solid #777; border-left:0px solid #darkred; background-color:#FFF;background:url(../images/dot-list.gif) no-repeat left center;}
+.headMedals {float:left; height:23px; line-height:23px; margin:5px 0 0 5px;padding:0px 6px 0px 15px; font-size:15px; font-weight:700; border-bottom:0px solid #777; border-left:0px solid #darkred; background-color:#FFF;background:url(../images/dot-list.gif) no-repeat left center;}
+.headLogin {float:left; padding:3px; font-size:15px; font-weight:800; background:url(../images/ico_login.gif) no-repeat; padding-left:24px;}
+.headNormal {
+ text-align:left;
+ padding:3px;
+ font-size:15px;
+ margin-bottom:12px;
+ font-weight:bold;
+ border-bottom: 1px solid #777;
+}
+.headUser {text-align:left;padding:5px; font-size:20px;
+ /*letter-spacing:1px;*/
+ margin-bottom:12px; font-weight:800;border-bottom:1px solid #777;}
/*RSS订阅*/
#feeds {margin:10px 0; }
-#feeds a {background:url(/content/images/feed-icon-small.png) no-repeat 0; padding-left:18px; font-weight:700; font-size:13px; }
+#feeds a {background:url(../images/feed-icon-small.png) no-repeat 0; padding-left:18px; font-weight:700; font-size:13px; }
/*问题*/
#question {margin-bottom:30px;}
@@ -355,9 +430,9 @@ a:hover.medal {color:#333; text-decoration:none; background:url(/content/images
font-weight:bold;
color:#777;
}
-.question-img-upvote:hover{background:url(/content/images/vote-arrow-up-on.png)}
-.question-img-downvote:hover{background:url(/content/images/vote-arrow-down-on.png)}
-.question-img-favorite:hover{background:url(/content/images/vote-favorite-on.png)}
+.question-img-upvote:hover{background:url(../images/vote-arrow-up-on.png)}
+.question-img-downvote:hover{background:url(../images/vote-arrow-down-on.png)}
+.question-img-favorite:hover{background:url(../images/vote-favorite-on.png)}
.favorite-number{padding:0px;font-size:100%; font-family:Arial;font-weight:bold;color:#777;}
.vote-notification
{
@@ -405,7 +480,7 @@ a:hover.medal {color:#333; text-decoration:none; background:url(/content/images
cursor:pointer;
}
-.action-link a:hover{
+.action-link: a hover{
background-color:#777;
text-decoration:none;
color:#fff;
@@ -425,8 +500,11 @@ div.comments {
}
div.post-comments{
+ clear:both;
+ background: url(../images/gray-up-arrow-h18px.png) no-repeat;
width:100%;
- margin-bottom:10px;
+ padding-left: 12px;
+ margin:3px 0 10px 0;
}
form.post-comments textarea {
@@ -442,6 +520,7 @@ form.post-comments input {
}
span.text-counter {
margin-right:20px;
+ font-size:11px;
}
span.form-error {
@@ -454,13 +533,7 @@ p.form-item {
}
div.comments-container, div.comments-container-accepted, div.comments-container-owner, div.comments-container-deleted {
- display:none;
- margin-top:-1px;
- padding:0 5px 5px;
-}
-
-div.comments-container, a.comments-link {
- background-color:#EEEEEE;
+ padding:0;
}
.post-comments a {
@@ -470,7 +543,9 @@ div.comments-container, a.comments-link {
a.comments-link, a.comments-link-accepted, a.comments-link-owner, a.comments-link-deleted {
color:black;
- padding:2px;
+ font-size:11px;
+ background: #eeeeee;
+ padding:3px;
cursor:pointer;
}
@@ -482,7 +557,7 @@ a.comments-link, a.comments-link-accepted, a.comments-link-owner, a.comments-lin
a.comment-user, a.comment-user:hover {
background-color:inherit;
- color:#0077CC;
+ color:blue;
padding:0;
}
@@ -494,6 +569,7 @@ a.comment-user:hover {
.answer{
padding-top:10px;
width: 100%;
+ border-bottom:1px solid #ccccce;
}
.answer-body{
min-height:80px;
@@ -556,7 +632,7 @@ a.comment-user:hover {
color: #E1E818;
}
-.answer-img-accept:hover{background:url(/content/images/vote-accepted-on.png)}
+.answer-img-accept:hover{background:url(../images/vote-accepted-on.png)}
.deleted{
background:#F4E7E7 none repeat scroll 0 0;
@@ -575,21 +651,44 @@ a.comment-user:hover {
.list-item LI{list-style-type:disc; font-size:13px; line-height:20px; margin-bottom:10px;}
/* openid styles */
.form-row{line-height:25px;}
+table.form-as-table {
+ margin-top:5px;
+}
+table.form-as-table ul {
+ list-style-type:none;
+ display: inline;
+}
+table.form-as-table li {
+ display: inline;
+}
+table.form-as-table td {
+ text-align:right;
+}
+table.form-as-table th {
+ text-align:left;
+ font-weight:normal;
+}
+/*.form-row li label {
+ display: inline
+}*/
.submit-row{line-height:30px;padding-top:10px;}
.errors{line-height:20px;color:red;}
-.error{color:red;}
+.error{
+ color:darkred;
+ margin:0;
+ font-size: 10px;
+}
.error-list li{padding:5px;}
-.login{margin-bottom:10px;}
.fieldset{
/* border:solid 1px #777;*/
border: none;
margin-top:10px;
padding:10px;
}
-.openid-input{background:url(/content/images/openid.gif) no-repeat;padding-left:15px;cursor:pointer;}
+.openid-input{background:url(../images/openid.gif) no-repeat;padding-left:15px;cursor:pointer;}
.openid-login-input{
background-position:center left;
- background:url(/content/images/openid.gif) no-repeat 0% 50%;
+ background:url(../images/openid.gif) no-repeat 0% 50%;
padding:5px 5px 5px 15px;
cursor:pointer;
font-family:Trebuchet MS;
@@ -627,7 +726,7 @@ span.form-error {
margin-left:5px;
}
.title-desc{
- color:#999;
+ color:#666666;
font-size:90%;
}
@@ -705,6 +804,8 @@ span.form-error {
.revision .summary span{
background-color:yellow;
+ padding-left:3px;
+ padding-right:3px;
display:inline;
}
.revision h1{
@@ -716,6 +817,7 @@ span.form-error {
.revision-mark{
width:200px;
text-align:left;
+ display:inline-block;
font-size:90%;
overflow:hidden;
}
@@ -751,7 +853,7 @@ background-color: #97ff97;
}
.user-details{font-size:13px;}
.user-about{background-color:#EEEEEE;height:200px;line-height:20px; overflow:auto;padding:10px;width:90%;}
-.user-edit-link {background:url(/content/images/edit.png) no-repeat; padding-left:20px; font-weight:600;}
+.user-edit-link {background:url(../images/edit.png) no-repeat; padding-left:20px;}
.favorites-count-off {
color:#919191;
float:left;
@@ -815,7 +917,8 @@ width:950;margin-bottom:10px;
}
.narrow .summary {
- width:620px;
+ width:600px;
+ display:inline-block;
}
.narrow .summary h3 {
@@ -824,8 +927,8 @@ width:950;margin-bottom:10px;
}
.narrow .views {
- float:left;
height:42px;
+ float:left;
margin:0 7px 0 0;
/*padding:5px 0 5px 4px;*/
padding: 5px;
@@ -851,11 +954,22 @@ width:950;margin-bottom:10px;
.narrow .vote-count-post {
font-weight:800;
+ display:block;
margin:0;
font-size: 190%; color:#555; line-height:20px;
}
-.narrow .answer-count-post{font-weight:800;margin:0; font-size: 190%; }
-.narrow .views-count-post{font-weight:800;margin:0; font-size: 190%;}
+.narrow .answer-count-post{
+ font-weight:800;
+ display:block;
+ margin:0;
+ font-size: 190%;
+}
+.narrow .views-count-post{
+ font-weight:800;
+ display:block;
+ margin:0;
+ font-size: 190%;
+}
div.started {
color:#999999;
float:right;
@@ -886,6 +1000,7 @@ div.started .reputation-score {
.narrow .tags{float:left;}
.answer-summary {
+ display:block;
clear:both;
padding:3px;
}
@@ -1009,7 +1124,7 @@ div.started .reputation-score {
a.comment {background:#EEE; color:#993300; padding:4px;}
a.permLink {padding:2px;}
a.offensive {color:#999;}
-ul.bulleta li {background:url(/content/images/bullet_green.gif) no-repeat 0px 2px; padding-left:16px; margin-bottom:4px;}
+ul.bulleta li {background:url(../images/bullet_green.gif) no-repeat 0px 2px; padding-left:16px; margin-bottom:4px;}
.user {padding:5px; line-height:140%; width:170px;}
.user ul {margin:0; list-style-type:none;}
.user .thumb{clear:both;float:left; margin-right:4px; display:inline;}
@@ -1028,6 +1143,9 @@ ul.bulleta li {background:url(/content/images/bullet_green.gif) no-repeat 0px 2p
.message p {
margin-bottom:0px;
}
+.message p.space-above {
+ margin-top:10px;
+}
.warning{color:red;}
.darkred{color:darkred;}
@@ -1036,13 +1154,15 @@ ul.bulleta li {background:url(/content/images/bullet_green.gif) no-repeat 0px 2p
/*letter-spacing:1px;*/
background-color:#D4D0C8;
height:40px;
- border:1px solid #777;
+ border:1px solid #777777;
/* width:100px; */
font-weight:bold;
+ padding-bottom:4px;
font-size:120%;}
.submit:hover{text-decoration:underline;}
.ask-body{padding-right:10px;}
.thousand{color:orange;}
+
.notify
{
position: fixed;
@@ -1056,11 +1176,13 @@ ul.bulleta li {background:url(/content/images/bullet_green.gif) no-repeat 0px 2p
color: #444;
background-color: #F4A83D;
}
+
.notify p {
margin-top:5px;
margin-bottom:5px;
font-size:16px;
}
+
#close-notify
{
position:absolute;
@@ -1093,7 +1215,9 @@ ul.bulleta li {background:url(/content/images/bullet_green.gif) no-repeat 0px 2p
color:#d64000;
font-weight:bold;
}
-
+.grey {
+ color:#808080;
+}
.about div {
padding:10px 5px 10px 5px;
border-top:1px dashed #aaaaaa;
@@ -1115,3 +1239,186 @@ ul.bulleta li {background:url(/content/images/bullet_green.gif) no-repeat 0px 2p
.highlight {
background-color:#FFF8C6;
}
+.nomargin {
+ margin:0;
+}
+.margin-bottom {
+ margin-bottom: 10px;
+}
+.inline-block {
+ display:inline-block;
+}
+.action-status {
+ margin:0;
+ border:none;
+ text-align:center;
+ line-height:10px;
+ font-size:12px;
+ padding:0;
+}
+.action-status span {
+ padding:3px 5px 3px 5px;
+ background-color:#fff380;/* nice yellow */
+ font-weight:normal;
+ -moz-border-radius: 5px;
+ -khtml-border-radius: 5px;
+ -webkit-border-radius: 5px;
+}
+.tight {
+ margin:0;
+ padding:0;
+}
+
+.list-table td {
+ vertical-align:top;
+}
+
+p.comment {
+ border-top: 1px dotted #ccccce;
+ margin:0;
+ font-size:11px;
+ color: #444444;
+ padding:5px 0 5px 0;
+}
+
+.delete-icon {
+ vertical-align:middle;
+ padding-left:3px;
+}
+/* these need to go */
+table.form-as-table .errorlist {
+ display: block;
+ margin:0;
+ padding:0 0 0 5px;
+ text-align:left;
+ font-size:10px;
+ color:darkred;
+}
+table.form-as-table input {
+ display: inline;
+ margin-left: 4px;
+}
+table.form-as-table th {
+ vertical-align:bottom;
+ padding-bottom:4px;
+}
+.form-row-vertical {
+ margin-top: 8px;
+ display: block;
+}
+.form-row-vertical label {
+ margin-bottom:3px;
+ display:block;
+}
+/* above stuff needs to go */
+.text-align-right {
+ text-align: center;
+}
+ul.form-horizontal-rows {
+ list-style:none;
+ margin:0;
+}
+ul.form-horizontal-rows li {
+ position:relative;
+ height:40px;
+}
+ul.form-horizontal-rows label {
+ display:inline-block;
+}
+ul.form-horizontal-rows ul.errorlist {
+ list-style:none;
+ color:darkred;
+ font-size:10px;
+ line-height:10px;
+ position:absolute;
+ top:2px;
+ left:180px;
+ text-align:left;
+ margin:0;
+}
+ul.form-horizontal-rows ul.errorlist li {
+ height:10px;
+}
+ul.form-horizontal-rows label {
+ position:absolute;
+ left:0px;
+ bottom:6px;
+ margin:0px;
+ line-height: 12px;
+ font-size: 12px;
+}
+ul.form-horizontal-rows li input {
+ position:absolute;
+ bottom:0px;
+ left:180px;
+ margin:0px;
+}
+#emailpw-form li input {
+ left:170px;
+}
+#emailpw-form ul.errorlist {
+ left:170px;
+}
+#changepw-form li input {
+ left:150px;
+}
+#changepw-form ul.errorlist {
+ left:150px;
+}
+.narrow .summary {
+ float: left;
+}
+.narrow .summary .question-title {
+ font-weight: bold;
+ font-size: 120%;
+}
+.user-profile-tool-links {
+ padding-bottom:10px;
+ font-weight: bold;
+}
+.post-controls {
+ float:left;
+ font-size:11px;
+ line-height:12px;
+ min-width:200px;
+ margin-bottom:5px;
+}
+#question-controls .tags {
+ margin:0 0 3px 0;
+}
+.post-update-info-container {
+ float: right;
+ min-width:190px;
+}
+.post-update-info {
+ display:inline-block;
+ float:right;
+ width:190px;
+ margin-bottom:5px;
+}
+.post-update-info p {
+ font-size:11px;
+ line-height:15px;
+ margin:0 0 4px 0;
+ padding:0;
+}
+.post-update-info img {
+ float: left;
+ width: 32px;
+ margin: 4px 8px 0 0;
+}
+.comments-container {
+ clear:both;
+}
+.admin {
+ background-color:#fff380;/* nice yellow */
+ border: 1px solid darkred;
+ padding: 0 5px 0 5px;
+}
+.admin p {
+ margin-bottom: 3px;
+}
+.admin #action_status {
+ text-align:center;
+ font-weight:bold;
+}
diff --git a/templates/edit_user_email_feeds_form.html b/templates/edit_user_email_feeds_form.html
new file mode 100644
index 00000000..65902e7e
--- /dev/null
+++ b/templates/edit_user_email_feeds_form.html
@@ -0,0 +1,4 @@
+{% load i18n %}
+<table class='form-as-table'>
+{{email_feeds_form.as_table}}
+</table>
diff --git a/templates/faq.html b/templates/faq.html
index 78c433ae..236f4f76 100644
--- a/templates/faq.html
+++ b/templates/faq.html
@@ -19,13 +19,13 @@
</p>
<h3 class="subtitle">{% trans "What questions should I avoid asking?" %}</h3>
- <p>{% trans "Please avoid asking questions that are not relevant to this community, too subjective and argumentative." %}</p>
+ <p>{% trans "Please avoid asking questions that are not relevant to this community, too subjective and argumentative." %}
</p>
</div>
<div>
<h3 class="subtitle">{% trans "What should I avoid in my answers?" %}</h3>
- <p>{% trans "site title" %} {% trans "is a Q&A site, not a discussion group. Therefore - please avoid having discussions in your answers, comment facility allows some space for brief discussions." %}</p>
+ <p>{{ settings.APP_TITLE }} {% trans "is a Q&A site, not a discussion group. Therefore - please avoid having discussions in your answers, comment facility allows some space for brief discussions." %}</p>
</div>
<div>
@@ -39,13 +39,7 @@
<div>
<h3 class="subtitle">{% trans "How does reputation system work?" %}</h3>
<p>{% trans "Rep system summary" %}</p>
- <p>
- For example, if you ask an interesting question or give a helpful answer, your input will be upvoted.
- On the other hand if the answer is misleading - it will be downvoted.
- Each vote in favor will generate <strong>10</strong> points, each vote against will subtract <strong>2</strong> points.
- There is a limit of <strong>200</strong> points that can be accumulated per question or answer.
-
- The table below explains reputation point requirements for each type of moderation task.
+ <p>{% blocktrans %}For example, if you ask an interesting question or give a helpful answer, your input will be upvoted. On the other hand if the answer is misleading - it will be downvoted. Each vote in favor will generate <strong>10</strong> points, each vote against will subtract <strong>2</strong> points. There is a limit of <strong>200</strong> points that can be accumulated per question or answer. The table below explains reputation point requirements for each type of moderation task.{% endblocktrans %}
</p>
<table style="font-family:arial;" cellspacing="3" cellpadding="3">
@@ -78,10 +72,12 @@
<td style="text-align:right;padding-right:5px"><strong>500</strong></td>
<td>{% trans "retag questions" %}</td>
</tr>
+ {% if settings.WIKI_ON %}
<tr>
<td style="text-align:right;padding-right:5px"><strong>750</strong></td>
<td>{% trans "edit community wiki questions" %}</td>
</tr>
+ {% endif %}
<tr>
<td style="text-align:right;padding-right:5px"><strong>2000</strong></td>
<td>{% trans "edit any answer" %}</td>
@@ -105,7 +101,7 @@
<div>
<a id='validate'></a><h3 class="subtitle">{% trans "how to validate email title" %}</h3>
<!--special case here message must contain paragraphs-->
- {% trans "how to validate email info" %}
+ {% blocktrans %}how to validate email info with {{send_email_key_url}} {{gravatar_faq_url}}{% endblocktrans %}
</div>
{% endifequal %}
<div>
@@ -115,7 +111,7 @@
<div>
<h3 class="subtitle">{% trans "To register, do I need to create new password?" %}</h3>
<p>{% trans "No, you don't have to. You can login through any service that supports OpenID, e.g. Google, Yahoo, AOL, etc." %}
- <strong><a href="/account/signin">{% trans "Login now!" %}</a> »</strong>
+ <strong><a href="{% url user_signin %}">{% trans "Login now!" %}</a> »</strong>
</p>
</div>
@@ -127,9 +123,9 @@
</div>
<div>
<h3 class="subtitle">{% trans "Still have questions?" %}</h3>
- <p>{% trans "Please ask your question, help make our community better!" %}
+ <p>{% blocktrans %}Please ask your question at {{ask_question_url}}, help make our community better!{% endblocktrans %}
<!--
- <a href="/tags/faq" class="big">{% trans "site title" %} {% trans "questions" %}</a>{% trans "." %}
+ <a href="{% url tags %}faq" class="big">{{ settings.APP_TITLE }} {% trans "questions" %}</a>{% trans "." %}
-->
</p>
</div>
diff --git a/templates/feedback.html b/templates/feedback.html
new file mode 100644
index 00000000..38bb48ff
--- /dev/null
+++ b/templates/feedback.html
@@ -0,0 +1,55 @@
+{% extends "base_content.html" %}
+<!-- template about.html -->
+{% load i18n %}
+{% load extra_tags %}
+{% load humanize %}
+{% block title %}{% spaceless %}{% trans "Feedback" %}{% endspaceless %}{% endblock %}
+{% block forejs %}
+{% endblock %}
+{% block content %}
+<div class="headNormal">
+{% trans "Give us your feedback!" %}
+</div>
+<div class="content">
+ <form method="post" action="{% url feedback %}" accept-charset="utf-8">
+ {% if user.is_authenticated %}
+ <p class="message">
+ {% blocktrans with user.username as user_name %}
+ <span class='big strong'>Dear {{user_name}}</span>, we look forward to hearing your feedback.
+ Please type and send us your message below.
+ {% endblocktrans %}
+ <p>
+ {% else %}
+ <p class="message">
+ {% blocktrans %}
+ <span class='big strong'>Dear visitor</span>, we look forward to hearing your feedback.
+ Please type and send us your message below.
+ {% endblocktrans %}
+ </p>
+ <div class="form-row"><label>{{form.name.label}}</label><br/>{{form.name}}</div>
+ <div class="form-row">
+ <label>{{form.email.label}}
+ {% if form.errors.email %}
+ <span class='red'>(please enter a valid email)</span>
+ {% endif %}
+ </label><br/>{{form.email}}
+ </div>
+ {% endif %}
+ <div class="form-row">
+ <label>{{form.message.label}}
+ {% if form.errors.message %}
+ <span class="red">{% trans "(this field is required)" %}</span>
+ </label>
+ {% endif %}
+ <br/>
+ {{form.message}}
+ </div>
+ {{form.next}}
+ <div class="submit-row">
+ <input type="submit" class="submit" value="{% trans "Send Feedback" %}"/>
+ <input type="submit" class="submit" name="cancel" value="{% trans "Cancel" %}"/>
+ </div>
+ </form>
+</div>
+{% endblock %}
+<!-- end template about.html -->
diff --git a/templates/feedback_email.txt b/templates/feedback_email.txt
new file mode 100644
index 00000000..df768180
--- /dev/null
+++ b/templates/feedback_email.txt
@@ -0,0 +1,19 @@
+{% load i18n %}
+{% spaceless %}
+{% blocktrans with settings.APP_TITLE|safe as site_title %}
+Hello, this is a {{site_title}} forum feedback message
+{% endblocktrans %}
+{% endspaceless %}
+
+{% spaceless %}
+{% trans "Sender is" %}
+{% if user.is_authenticated %}
+ {{user.username|safe}} {% trans "email" %}:{{user.email|safe}}
+{% else %}
+ {% if name %}{{name|safe}}{% else %}{% trans "anonymous" %}{% endif %}
+ {% if email %}{% trans "email" %}:{{email|safe}}{% endif %}
+{% endif %}
+ ip:{{request.META.REMOTE_ADDR}}
+{% endspaceless %}
+
+{% trans "Message body:" %} {{message|safe}}
diff --git a/templates/footer.html b/templates/footer.html
index 637ca0d8..9d19b41e 100644
--- a/templates/footer.html
+++ b/templates/footer.html
@@ -3,21 +3,37 @@
{% load i18n %}
<!-- 页面底部开始: -->
<div id="ground">
- <div class="footerLinks" >
- <a href="/about">{% trans "about" %}</a><span class="link-separator"> |</span>
- <a href="/faq">{% trans "faq" %}</a><span class="link-separator"> |</span>
- <a href="{{ blog_url }}">{% trans "blog" %}</a><span class="link-separator"> |</span>
- <a href="{{ webmaster_email }}">{% trans "contact us" %}</a><span class="link-separator"> |</span>
- <a href="/privacy">{% trans "privacy policy" %}</a><span class="link-separator"> |</span>
- <a href="{{ feedback_url }}" target="_blank">{% trans "give feedback" %}</a>
- </div>
- <p style="margin-top:10px;">
- <a href="http://code.google.com/p/cnprog/" target="_blank">
- <img src="/content/images/djangomade124x25_grey.gif" border="0" alt="Made with Django." title="Made with Django." >
- </a>
- <!--<div style="font-size:90%;color:#333">{% trans "current revision" %}: R-0120-20090406</div>-->
- </p>
- <p id="licenseLogo"><img src="/content/images/cc-wiki.png" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" /></p>
+ <div>
+ <div class="footerLinks" >
+ <a href="{% url about %}">{% trans "about" %}</a><span class="link-separator"> |</span>
+ <a href="{% url faq %}">{% trans "faq" %}</a><span class="link-separator"> |</span>
+ <!--<a href="{{ blog_url }}">{% trans "blog" %}</a><span class="link-separator"> |</span>-->
+ <!--<a href="{{ webmaster_email }}">{% trans "contact us" %}</a><span class="link-separator"> |</span>-->
+ <a href="{% url privacy %}">{% trans "privacy policy" %}</a><span class="link-separator"> |</span>
+ {% spaceless %}
+ <a href=
+ {% if settings.FEEDBACK_SITE_URL %}
+ "{{settings.FEEDBACK_SITE_URL}}"
+ target="_blank">
+ {% else %}
+ "{% url feedback %}?next={{request.path}}">
+ {% endif %}
+ {% trans "give feedback" %}
+ </a>
+ {% endspaceless %}
+ </div>
+ <p>
+ <a href="http://github.com/cnprog/CNPROG/network" target="_blank">
+ powered by cnprog platform
+ <!--<img src="{% href "/content/images/djangomade124x25_grey.gif" %}" border="0" alt="Made with Django." title="Made with Django." >-->
+ </a>
+ </p>
+ </div>
+ <div id="licenseLogo">
+ <a href="http://creativecommons.org/licenses/by/3.0/">
+ <img src="{% href "/content/images/cc-wiki.png" %}" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" />
+ </a>
+ </div>
</div>
<!-- 页面底部结束: -->
<script type="text/javascript">
@@ -26,7 +42,7 @@
</script>
<script type="text/javascript">
try {
- var pageTracker = _gat._getTracker({{ settings.GOOGLE_ANALYTICS_KEY }});
+ var pageTracker = _gat._getTracker('{{ settings.GOOGLE_ANALYTICS_KEY }}');
pageTracker._trackPageview();
} catch(err) {}
</script>
diff --git a/templates/header.html b/templates/header.html
index db08a39a..42074763 100644
--- a/templates/header.html
+++ b/templates/header.html
@@ -4,42 +4,42 @@
<div id="roof">
<div id="navBar">
<div id="top">
- <!--<div id="header">-->
- {% if request.user.is_authenticated %}
- <a href="/users/{{ request.user.id }}/{{ request.user.username }}/">{{ request.user.username }}</a> {% get_score_badge request.user %}
- <a href="/logout/">{% trans "logout" %}</a>
- {% else %}
- <a href="/account/signin">{% trans "login" %}</a>
- {% endif %}
- <a href="/about">{% trans "about" %}</a>
- <a href="/faq">{% trans "faq" %}</a>
- <!--</div>-->
+ {% if request.user.is_authenticated %}
+ <a href="{% url users %}{{ request.user.id }}/{{ request.user.username }}/">{{ request.user.username }}</a> {% get_score_badge request.user %}
+ <a href="{% url logout %}">{% trans "logout" %}</a>
+ {% else %}
+ <a href="{% url user_signin %}">{% trans "login" %}</a>
+ {% endif %}
+ <a href="{% url about %}">{% trans "about" %}</a>
+ <a href="{% url faq %}">{% trans "faq" %}</a>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="23%">
<div id="logo">
- <a href="/">
- <img src="/content/images/logo.png" title="{% trans "back to home page" %}" />
+ <a href="{% url index %}">
+ <img src="{% href "/content/images/logo.png" %}" title="{% trans "back to home page" %}" alt="{{settings.APP_TITLE}} logo"/>
</a>
</div>
</td>
<td width="77%" valign="bottom">
<div class="nav">
- <a id="nav_questions" href="/questions/" >{% trans "questions" %}</a>
- <a id="nav_tags" href="/tags/">{% trans "tags" %}</a>
- <a id="nav_users" href="/users/">{% trans "users" %}</a>
- <!--<a id="nav_books" href="/books/">{% trans "books" %}</a>-->
- <a id="nav_badges" href="/badges/">{% trans "badges" %}</a>
- <a id="nav_unanswered" href="/questions/unanswered/">{% trans "unanswered questions" %}</a>
+ <a id="nav_questions" href="{% url questions %}" >{% trans "questions" %}</a>
+ <a id="nav_tags" href="{% url tags %}">{% trans "tags" %}</a>
+ <a id="nav_users" href="{% url users %}">{% trans "users" %}</a>
+ {% if settings.BOOKS_ON %}
+ <a id="nav_books" href="{% url books %}">{% trans "books" %}</a>
+ {% endif %}
+ <a id="nav_badges" href="{% url badges %}">{% trans "badges" %}</a>
+ <a id="nav_unanswered" href="{% url unanswered %}">{% trans "unanswered questions" %}</a>
{% comment %}<!-- i think this needs to be removed -e.f. -->
{% if request.user.is_authenticated %}
- <a id="nav_profile" href="/users/{{ request.user.id }}/{{ request.user.username }}/">{% trans "my profile" %}</a>
+ <a id="nav_profile" href="{% url user %}{{ request.user.id }}/{{ request.user.username }}/">{% trans "my profile" %}</a>
{% endif %}
{% endcomment %}
<div class="focus">
- <a id="nav_ask" href="/questions/ask/" class="special">{% trans "ask a question" %}</a>
+ <a id="nav_ask" href="{% url ask %}" class="special">{% trans "ask a question" %}</a>
</div>
</div>
@@ -48,18 +48,19 @@
</table>
</div>
<div id="searchBar">
- <table width="100%" height="60" border="0" cellpadding="0" cellspacing="0" class="content">
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" class="content">
<tr>
<td align="center" valign="middle">
- <form action="/search/" method="GET">
+ <form action="{% url search %}" method="get">
<div>
- <input type="text" class="searchInput" value="{{ keywords }}" name="q" id="keywords" >
- <input type="submit" name="Submit" value="{% trans "search" %}" class="searchBtn" >
+ <input type="text" class="searchInput" value="{{ keywords }}" name="q" id="keywords" />
+ <input type="submit" name="Submit" value="{% trans "search" %}" class="searchBtn" />
</div>
<div class="options">
- <input id="type-question" type="radio" class="" value="question" name="t" checked >{% trans "questions" %}
- <input id="type-tag" type="radio" class="" value="tag" name="t" >{% trans "tags" %}
- <input id="type-user" type="radio" class="" value="user" name="t" >{% trans "users" %}
+ <input id="type-question" type="radio" value="question" name="t"
+ checked="checked" /><label for="type-question">{% trans "questions" %}</label>
+ <input id="type-tag" type="radio" value="tag" name="t" /><label for="type-tag">{% trans "tags" %}</label>
+ <input id="type-user" type="radio" value="user" name="t" /><label for="type-user">{% trans "users" %}</label>
</div>
</form>
</td>
diff --git a/templates/index.html b/templates/index.html
index a1ab06a4..470612b4 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -4,6 +4,7 @@
{% load extra_tags %}
{% load humanize %}
{% load extra_filters %}
+{% load smart_if %}
{% block title %}{% spaceless %}{% trans "Home" %}{% endspaceless %}{% endblock %}
{% block meta %}<meta name="keywords" content="{{ settings.APP_KEYWORDS }}" />
<meta name="description" content="{{ settings.APP_DESCRIPTION }}" />{% endblock %}
@@ -21,10 +22,10 @@
<div class="tabBar">
<div class="headQuestions">{% trans "Questions" %}</div>
<div class="tabsA">
- <a id="latest" href="?sort=latest" title="{% trans "last updated questions" %}" >{% trans "newest" %}</a>
- <a id="hottest" href="?sort=hottest" title="{% trans "hottest questions" %}" >{% trans "hottest" %}</a>
- <a id="mostvoted" href="?sort=mostvoted" title="{% trans "most voted questions" %}" >{% trans "most voted" %}</a>
- <a id="all" href="/questions/" title="{% trans "all questions" %}" >{% trans "all questions" %}</a>
+ <a id="latest" href="{% url questions %}?sort=latest" title="{% trans "last updated questions" %}" >{% trans "newest" %}</a>
+ <a id="hottest" href="{% url questions %}?sort=hottest" title="{% trans "hottest questions" %}" >{% trans "hottest" %}</a>
+ <a id="mostvoted" href="{% url questions %}?sort=mostvoted" title="{% trans "most voted questions" %}" >{% trans "most voted" %}</a>
+ <a id="all" href="{% url questions %}" title="{% trans "all questions" %}" >{% trans "all questions" %}</a>
</div>
</div>
<!-- 问题列表 -->
@@ -32,30 +33,31 @@
{% for question in questions %}
<div class="qstA">
<h2>
- <a href="{{ question.get_absolute_url }}" title="{{ question.summary }}...">
- {{ question.get_question_title }}
- </a>
+ <a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>
</h2>
<div class="stat">
<table>
- <tr>
+ <tr>
<td><span class="num">{{ question.answer_count|intcomma }}</span> </td>
<td><span class="num">{{ question.score|intcomma }}</span> </td>
<td><span class="num">{{ question.view_count|cnprog_intword|safe }}</span> </td>
- </tr>
+ </tr>
<tr>
<td><span class="unit">{% trans "answers" %}</span></td>
<td><span class="unit">{% trans "votes" %}</span></td>
<td><span class="unit">{% trans "views" %}</span></td>
- </tr>
+ </tr>
</table>
</div>
+
<div class="summary">
- {{ question.summary }}...
+ {{ question.summary }}...
</div>
- {% if question.wiki %}
+
+ {% ifequal tab_id 'active'%}
+ {% if question.wiki and settings.WIKI_ON %}
<span class="from wiki">{% trans "community wiki" %}</span>
- <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
<div class="from">
{% comment %}{% gravatar question.last_activity_by 24 %}{% endcomment %}
@@ -64,6 +66,38 @@
<span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
</div>
{% endif %}
+ {% else %}
+ {% if question.wiki and settings.WIKI_ON %}
+ <span class="from wiki">{% trans "community wiki" %}</span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% else %}
+ <div class="from">
+ {% comment %}{% gravatar question.author 24 %}{% endcomment %}
+ {% if question.last_activity_at != question.added_at %}
+ {% if question.author.id != question.last_activity_by.id %}
+ {% trans "Posted:" %}
+ <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
+ <span class="score">{% get_score_badge question.author %} </span>
+ / {% trans "Updated:" %}
+ <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
+ <span class="score">{% get_score_badge question.last_activity_by %} </span>
+ <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ {% else %}
+ {% trans "Updated:" %}
+ <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
+ <span class="score">{% get_score_badge question.last_activity_by %} </span>
+ <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ {% endif %}
+ {% else %}
+ {% trans "Posted:" %}
+ <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
+ <span class="score">{% get_score_badge question.author %} </span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% endif %}
+ </div>
+ {% endif %}
+ {% endifequal %}
+
<div class="tags">
{% for tag in question.tagname_list %}
<a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
@@ -80,45 +114,47 @@
<h3>{% trans "welcome to website" %}</h3>
<div class="body">
{{ settings.APP_INTRO|safe }}
- <div class="more"><a href="/about">{% trans "about" %} »</a></div>
- <div class="more"><a href="/faq">{% trans "faq" %} »</a></div>
+ <div class="more"><a href="{% url about %}">{% trans "about" %} »</a></div>
+ <div class="more"><a href="{% url faq %}">{% trans "faq" %} »</a></div>
</div>
</div>
{% endif %}
-<div class="boxB">
+<div class="boxC">
<h3>{% trans "Recent tags" %}</h3>
<div class="body">
- <p class="tagsbox">
+ <div class="tags">
{% for tag in tags %}
<a rel="tag"
title="{% blocktrans with tag.name as tagname %}see questions tagged '{{tagname}}'{% endblocktrans %}" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
{% endfor %}
- </p>
- <div class="more"><a href="/tags">{% trans "popular tags" %} »</a> </div>
+ </div>
+ <div class="more"><a href="{% url tags %}">{% trans "popular tags" %} »</a> </div>
</div>
</div>
-<div class="boxB">
+{% if awards %}
+<div class="boxC">
<h3>{% trans "Recent awards" %}</h3>
<div class="body">
<ul class="badge-list">
{% for award in awards %}
<li>
- <a href="/badges/{{award.badge_id}}/{{award.badge_name}}" title="{{ award.badge_description }}" class="medal">
+ <a href="{% url badges %}{{award.badge_id}}/{{award.badge_name}}" title="{{ award.badge_description }}" class="medal">
<span class="badge{{ award.badge_type }}">&#9679;</span>&nbsp;{{ award.badge_name }}</a> {% trans "given to" %}
- <a href="/users/{{award.user_id}}/{{award.user_name}}">{{ award.user_name }}</a>
+ <a href="{% url users %}{{award.user_id}}/{{award.user_name}}">{{ award.user_name }}</a>
</li>
{% endfor %}
</ul>
- <div class="more"><a href="/badges/">{% trans "all awards" %} »</a> </div>
+ <div class="more"><a href="{% url badges %}">{% trans "all awards" %} »</a> </div>
</div>
</div>
+{% endif %}
<div id="feeds">
-<a href="/feeds/rss" title="{% trans "subscribe to last 30 questions by RSS" %}">{% trans "subscribe to the questions feed" %}</a>
+<a href="{% href "/feeds/rss" %}" title="{% trans "subscribe to last 30 questions by RSS" %}">{% trans "subscribe to the questions feed" %}</a>
</div>
{% endblock %}
{% block tail %}
<div style="padding:5px 0 5px 5px;">
-<span class="evenMore">{% trans "Still looking for more? See" %} <a href="/questions/">{% trans "complete list of questions" %}</a> {% trans "or" %} <a href="/tags/">{% trans "popular tags" %}</a>{% trans "." %} {% trans "Please help us answer" %} <a href="/questions/unanswered">{% trans "list of unanswered questions" %}</a>{% trans "." %}</span>
+<span class="evenMore">{% trans "Still looking for more? See" %} <a href="{% url questions %}">{% trans "complete list of questions" %}</a> {% trans "or" %} <a href="{% url tags %}">{% trans "popular tags" %}</a>{% trans "." %} {% trans "Please help us answer" %} <a href="{% url questions %}unanswered">{% trans "list of unanswered questions" %}</a>{% trans "." %}</span>
</div>
{% endblock %}
<!-- index.html -->
diff --git a/templates/logout.html b/templates/logout.html
index e05a4328..650ba044 100644
--- a/templates/logout.html
+++ b/templates/logout.html
@@ -8,7 +8,6 @@
<script type="text/javascript">
$().ready(function(){
$('#btLogout').bind('click', function(){ window.location.href='{% url user_signout %}?next={{ next }}'; });
-
});
</script>
{% endblock %}
@@ -19,7 +18,6 @@
<div id="main-body" style="width:100%">
<p>{% trans "As a registered user you can login with your OpenID, log out of the site or permanently remove your account." %}</p>
<input id="btLogout" type="button" class="submit" value="{% trans "Logout now" %}"><!-- style="width:150px">-->
- <br><br>
</div>
{% endblock %}
<!-- end logout.html -->
diff --git a/templates/post_contributor_info.html b/templates/post_contributor_info.html
new file mode 100644
index 00000000..9997be5f
--- /dev/null
+++ b/templates/post_contributor_info.html
@@ -0,0 +1,55 @@
+{% load i18n %}
+{% load smart_if %}
+{% load extra_tags %}
+<div class='post-update-info'>
+{% ifequal contributor_type "original_author" %}
+ {% if wiki %}
+ <p>{% trans "community wiki" %}</p>
+ <p>
+ {% 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 %}
+ <p style="line-height:12px;">
+ {% ifequal post_type "question" %}
+ {% trans "asked" %}
+ {% else %}
+ {% ifequal post_type "answer" %}
+ {% trans "answered" %}
+ {% else %}
+ {% trans "posted" %}
+ {% endifequal %}
+ {% endifequal %}
+ {% ifequal post_type "revision" %}
+ <strong>{% diff_date post.revised_at %}</strong>
+ {% else %}
+ <strong>{% diff_date post.added_at %}</strong>
+ {% endifequal %}
+ </p>
+ {% gravatar post.author 32 %}
+ <p>{{post.author.get_profile_link}}<br/>
+ {% get_score_badge post.author %}</p>
+ {% endif %}
+{% else %}
+ {% if post.last_edited_at %}
+ <p style="line-height:12px;">
+ {% ifequal post_type 'question' %}
+ <a href="{% url question_revisions post.id %}">
+ {% else %}
+ <a href="{% url answer_revisions post.id %}">
+ {% endifequal %}
+ {% trans "updated" %} <strong>{% diff_date post.last_edited_at %}</strong>
+ </a>
+ </p>
+ {% if post.author != post.last_edited_by or wiki %}
+ {% gravatar post.last_edited_by 32 %}
+ <p style="float:left">{{post.last_edited_by.get_profile_link}}<br/>
+ {% get_score_badge post.last_edited_by %}</p>
+ {% endif %}
+ {% endif %}
+{% endifequal %}
+</div>
diff --git a/templates/privacy.html b/templates/privacy.html
index d5d7dd43..e66086dd 100644
--- a/templates/privacy.html
+++ b/templates/privacy.html
@@ -37,7 +37,6 @@
<h3 class="subtitle">{% trans "Policy Changes" %}</h3>
<p>{% trans "how privacy policies can be changed" %}
</p>
- <br><br>
</div>
{% endblock %}
<!-- end privacy.html -->
diff --git a/templates/question.html b/templates/question.html
index eaff9da3..9183767f 100644
--- a/templates/question.html
+++ b/templates/question.html
@@ -2,18 +2,23 @@
<!-- question.html -->
{% load extra_tags %}
{% load extra_filters %}
+{% load smart_if %}
{% load humanize %}
{% load i18n %}
{% block title %}{% spaceless %}{{ question.get_question_title }}{% endspaceless %}{% endblock %}
{% block forejs %}
- {% if not question.closed and request.user.is_authenticated %}
- <script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/wmd/showdown.js'></script>
- <script type='text/javascript' src='/content/js/wmd/wmd.js'></script>
- <link rel="stylesheet" type="text/css" href="/content/js/wmd/wmd.css" />
+ <meta name="description" content="{{question.summary}}" />
+ <meta name="keywords" content="{{question.tagname_meta_generator}}" />
+ <link rel="canonical" href="{{settings.APP_URL}}{{question.get_absolute_url}}" />
+ {% if not question.closed %}
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.editor.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/wmd/showdown.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/wmd/wmd.js" %}'></script>
+ <link rel="stylesheet" type="text/css" href="{% href "/content/js/wmd/wmd.css" %}" />
{% endif %}
- <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
- <script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.post.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.validate.pack.js" %}'></script>
+
<script type="text/javascript">
// define reputation needs for comments
var repNeededForComments = 50;
@@ -27,7 +32,7 @@
{% if not question.closed and request.user.is_authenticated %}initEditor();{% endif %}
lanai.highlightSyntax();
- $('#btLogin').bind('click', function(){window.location.href='/account/signin/'; } )
+ $('#btLogin').bind('click', function(){window.location.href='{% url user_signin %}'; } )
});
function initEditor(){
@@ -58,46 +63,60 @@
</div>
<div id="main-body" class="">
<div id="askform">
- <form id="fmanswer" action="{% url answer question.id %}" method="post">
<table style="width:100%;" id="question-table" {% if question.deleted %}class="deleted"{%endif%}>
<tr>
<td style="width:30px;vertical-align:top">
<div class="vote-buttons">
{% if question_vote %}
<img id="question-img-upvote-{{ question.id }}" class="question-img-upvote"
- src="/content/images/vote-arrow-up{% if question_vote.is_upvote %}-on{% endif %}.png"
- title="{% trans "i like this post (click again to cancel)" %}" >
+ {% if question_vote.is_upvote %}
+ src="{% href "/content/images/vote-arrow-up-on.png" %}"
+ {% else %}
+ src="{% href "/content/images/vote-arrow-up.png" %}"
+ {% endif %}
+ alt="{% trans "i like this post (click again to cancel)" %}"
+ title="{% trans "i like this post (click again to cancel)" %}" />
<div id="question-vote-number-{{ question.id }}" class="vote-number"
title="{% trans "current number of votes" %}">
{{ question.score }}
</div>
<img id="question-img-downvote-{{ question.id }}" class="question-img-downvote"
- src="/content/images/vote-arrow-down{% if question_vote.is_downvote %}-on{% endif %}.png"
- title="{% trans "i dont like this post (click again to cancel)" %}" >
+ {% if question_vote.is_downvote %}
+ src="{% href "/content/images/vote-arrow-down-on.png" %}"
+ {% else %}
+ src="{% href "/content/images/vote-arrow-down.png" %}"
+ {% endif %}
+ alt="{% trans "i dont like this post (click again to cancel)" %}"
+ title="{% trans "i dont like this post (click again to cancel)" %}" />
{% else %}
<img id="question-img-upvote-{{ question.id }}" class="question-img-upvote"
- src="/content/images/vote-arrow-up.png"
- title="{% trans "i like this post (click again to cancel)" %}" >
+ alt="{% trans "i like this post (click again to cancel)" %}"
+ src="{% href "/content/images/vote-arrow-up.png" %}"
+ title="{% trans "i like this post (click again to cancel)" %}" />
<div id="question-vote-number-{{ question.id }}" class="vote-number"
title="{% trans "current number of votes" %}">
{{ question.score }}
</div>
<img id="question-img-downvote-{{ question.id }}" class="question-img-downvote"
- src="/content/images/vote-arrow-down.png" title="{% trans "i dont like this post (click again to cancel)" %}" >
+ src="{% href "/content/images/vote-arrow-down.png" %}"
+ alt="{% trans "i dont like this post (click again to cancel)" %}"
+ title="{% trans "i dont like this post (click again to cancel)" %}" />
{% endif %}
- <br><br>
{% if favorited %}
- <img class="question-img-favorite" src="/content/images/vote-favorite-on.png"
- title="{% trans "mark this question as favorite (click again to cancel)" %}" >
+ <img class="question-img-favorite" src="{% href "/content/images/vote-favorite-on.png" %}"
+ alt="{% trans "mark this question as favorite (click again to cancel)" %}"
+ title="{% trans "mark this question as favorite (click again to cancel)" %}" />
<div id="favorite-number" class="favorite-number my-favorite-number">
{{ question.favourite_count }}
</div>
{% else %}
- <img class="question-img-favorite" src="/content/images/vote-favorite-off.png"
- title="{% trans "remove favorite mark from this question (click again to restore mark)" %}" >
- <div id="favorite-number" class="favorite-number">{% ifnotequal question.favourite_count 0 %}{{ question.favourite_count }}{% endifnotequal %}
+ <img class="question-img-favorite" src="{% href "/content/images/vote-favorite-off.png" %}"
+ alt="{% trans "remove favorite mark from this question (click again to restore mark)" %}"
+ title="{% trans "remove favorite mark from this question (click again to restore mark)" %}" />
+ <div id="favorite-number" class="favorite-number">
+ {% ifnotequal question.favourite_count 0 %}{{ question.favourite_count }}{% endifnotequal %}
</div>
{% endif %}
@@ -109,137 +128,87 @@
<div class="question-body">
{{ question.html|safe }}
</div>
- <div id="question-tags" class="tags" >
- {% for tag in question.tagname_list %}
- <a href="{% url forum.views.tag tag|urlencode %}" class="post-tag"
- title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
- {% endfor %}
+ <div id="question-controls" class="post-controls">
+ <div id="question-tags" class="tags">
+ {% for tag in question.tagname_list %}
+ <a href="{% url forum.views.tag tag|urlencode %}" class="post-tag"
+ title="{% blocktrans with tag as tagname %}see questions tagged '{{ tagname }}'{% endblocktrans %}" rel="tag">{{ tag }}</a>
+ {% endfor %}
+ </div>
+ {% joinitems using '<span class="action-link-separator">|</span>' %}
+ {% if request.user|can_edit_post:question %}
+ <span class="action-link"><a href="{% url edit_question question.id %}">{% trans 'edit' %}</a></span>
+ {% endif %}
+ {% separator %}
+ {% if question.closed %}
+ {% if request.user|can_reopen_question:question %}
+ <span class="action-link"><a href="{% url reopen question.id %}">{% trans "reopen" %}</a></span>
+ {% endif %}
+ {% else %}
+ {% if request.user|can_close_question:question %}
+ <span class="action-link"><a href="{% url close question.id %}">{% trans "close" %}</a></span>
+ {% endif %}
+ {% endif %}
+ {% separator %}
+ {% if request.user|can_flag_offensive %}
+ <span id="question-offensive-flag-{{ question.id }}" class="offensive-flag"
+ title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
+ <a>{% trans "flag offensive" %}</a>
+ {% if request.user|can_view_offensive_flags and question.offensive_flag_count %}
+ <span class="darkred">({{ question.offensive_flag_count }})</span>
+ {% endif %}
+ </span>
+ {% endif %}
+ {% separator %}
+ {% if request.user|can_delete_post:question %}
+ <span class="action-link"><a id="question-delete-link-{{question.id}}">{% trans "delete" %}</a></span>
+ {% endif %}
+ {% endjoinitems %}
</div>
- <div id="question-controls" style="clear:both;">
- <table width="100%">
- <tr>
- <td width="210px" style="vertical-align:top">
-
- {% if request.user|can_edit_post:question %}
- <span class="action-link"><a href="{% url edit_question question.id %}">{% trans 'edit' %}</a></span>
- <span class="action-link-separator">|</span>
- {% endif %}
- {% if request.user|can_delete_post:question %}
- <span class="action-link"><a id="question-delete-link-{{question.id}}">{% trans "delete" %}</a></span>
- <span class="action-link-separator">|</span>
- {% endif %}
- {% if question.closed %}
- {% if request.user|can_reopen_question:question %}
- <span class="action-link"><a href="{% url reopen question.id %}">{% trans "reopen" %}</a></span>
- <span class="action-link-separator">|</span>
- {% endif %}
- {% else %}
- {% if request.user|can_close_question:question %}
- <span class="action-link"><a href="{% url close question.id %}">{% trans "close" %}</a></span>
- <span class="action-link-separator">|</span>
- {% endif %}
- {% endif %}
-
- <span id="question-offensive-flag-{{ question.id }}" class="offensive-flag"
- title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
- <a>{% trans "flag offensive" %}</a>
- <span class="darkred">{% if request.user|can_view_offensive_flags %}
- {% if question.offensive_flag_count %}({{ question.offensive_flag_count }}){% endif %}{% endif %}</span>
- </span>
-
- </td>
- <td width="210px" style="vertical-align:top">
- {% if question.last_edited_by %}
- <div class="question-edit" >
- <table width="200px" >
- <tr>
- <td colspan="2">
- {% trans "updated" %} <a href="{% url question_revisions question.id %}"><strong title="{{question.last_edited_at }}">{% diff_date question.last_edited_at %}</strong></a>
- </td>
-
- </tr>
- {% if question.wiki %}
- <tr>
- <td style="width:40px;vertical-align:bottom">
- {% gravatar question.last_edited_by 32 %}
- </td>
- <td style="width:160px; vertical-align:top">
- <a href="/users/{{ question.last_edited_by.id }}/{{ question.last_edited_by.username }}">{{ question.last_edited_by.username }}</a>
- </td>
- </tr>
- {% else %}
- {% ifequal question.last_edited_by question.author %}
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- {% else %}
- <tr>
- <td style="width:40px;vertical-align:bottom">
- {% gravatar question.last_edited_by 32 %}
- </td>
- <td style="width:160px; vertical-align:top">
- <div><a href="/users/{{ question.last_edited_by.id }}/{{ question.last_edited_by.username }}">{{ question.last_edited_by.username }}</a></div>
-
- <div>
- {% get_score_badge question.last_edited_by %}
- </div>
-
- </td>
- </tr>
- {% endifequal %}
- {% endif %}
- </table>
- </div>
- {% endif %}
-
- </td>
- <td style="vertical-align:top">
- {% if question.wiki %}
- <span class="wiki-category">{% trans "community wiki" %}</span>
- <div style="margin-bottom:10px"></div>
- {% else %}
- <div class="question-mark">
- <table width="200px">
- <tr>
- <td colspan="2">
- {% trans "asked" %} <strong title="{{ question.added_at }}">{% diff_date question.added_at %}</strong>
- </td>
-
- </tr>
-
- <tr>
- <td style="width:40px; vertical-align:bottom">
- {% gravatar question.author 32 %}
- </td>
- <td align="left" style="width:160px;vertical-align:top">
- <div><a href="/users/{{ question.author.id }}/{{ question.author }}">{{ question.author }}</a></div>
- <div>
- {% get_score_badge question.author %}
- </div>
- </td>
- </tr>
-
- </table>
- </div>
- {% endif %}
-
- </td>
- </tr>
- </table>
-
+ <div class="post-update-info-container">
+ {% post_contributor_info question "original_author" %}
+ {% post_contributor_info question "last_updater" %}
+ </div>
+ <div class="comments-container" id="comments-container-question-{{question.id}}">
+ {% for comment in question.get_comments|slice:":5" %}
+ <p class="comment" id="comment-{{comment.id}}">
+ {{comment.comment}}
+ - <a class="comment-user" href="{{comment.user.get_profile_url}}">{{comment.user}}</a>
+ {% spaceless %}
+ <span class="comment-age">({% diff_date comment.added_at %})</span>
+ {% if request.user|can_delete_comment:comment %}
+ <img class="delete-icon"
+ src="{% href "/content/images/close-small.png" %}"
+ title="{% trans "delete this comment" %}"/>
+ {% endif %}
+ {% endspaceless %}
+ </p>
+ {% endfor %}
</div>
-
<div class="post-comments" style="margin-bottom:20px">
- <input id="can-post-comments-question-{{question.id}}" type="hidden" value="{{ request.user|can_add_comments }}"/>
- <a id="comments-link-question-{{question.id}}" class="comments-link">
- {% if question.comment_count %}{% trans "comments" %} <strong>({{question.comment_count}})</strong>
- {% else %}{% trans "add comment" %}
- {% endif %}</a>
- <div id="comments-question-{{question.id}}" class="comments-container">
- <div class="comments"/></div>
+ <input id="can-post-comments-question-{{question.id}}" type="hidden" value="{{ request.user|can_add_comments:question }}"/>
+ {% if request.user|can_add_comments:question or question.comment_count > 5 %}
+ <a id="comments-link-question-{{question.id}}" class="comments-link">
+ {% if request.user|can_add_comments:question %}
+ {% trans "add comment" %}
+ {% 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 %}
+ {% else %}
+ {% 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>
+ {% endif %}
</div>
-
</div>
</td>
@@ -247,20 +216,29 @@
</table>
{% if question.closed %}
<div class="question-status" style="margin-bottom:15px">
- <h3>{% blocktrans %}The question has been closed for the following reason "{{ question.get_close_reason_display }}" by{% endblocktrans %}
+ <h3>{% blocktrans with question.get_close_reason_display as close_reason %}The question has been closed for the following reason "{{ close_reason }}" by{% endblocktrans %}
<a href="{{ question.closed_by.get_profile_url }}">{{ question.closed_by.username }}</a>
- {% blocktrans %}close date {{question.closed_at}}{% endblocktrans %}</h3>
+ {% blocktrans with question.closed_at as closed_at %}close date {{closed_at}}{% endblocktrans %}</h3>
</div>
{% endif %}
-
- {% ifnotequal answers.length 0 %}
+ {% if answers %}
+ <hr/>
<div class="tabBar">
<a name="sort-top"></a>
- <div class="headQuestions">{{ answers|length }}{% trans "Answers" %}:</div>
+ <div class="headQuestions">
+ {% blocktrans count answers|length as counter %}
+ One Answer:
+ {% plural %}
+ {{counter}} Answers:
+ {% endblocktrans %}
+ </div>
<div class="tabsA">
- <a id="oldest" href="?sort=oldest#sort-top" title="{% trans "oldest answers will be shown first" %}">{% trans "oldest answers" %}</a>
- <a id="latest" href="?sort=latest#sort-top" title="{% trans "newest answers will be shown first" %}">{% trans "newest answers" %}</a>
- <a id="votes" href="?sort=votes#sort-top" title="{% trans "most voted answers will be shown first" %}">{% trans "popular answers" %}</a>
+ <a id="oldest" href="{% url question question.id %}?sort=oldest#sort-top"
+ title="{% trans "oldest answers will be shown first" %}">{% trans "oldest answers" %}</a>
+ <a id="latest" href="{% url question question.id %}?sort=latest#sort-top"
+ title="{% trans "newest answers will be shown first" %}">{% trans "newest answers" %}</a>
+ <a id="votes" href="{% url question question.id %}?sort=votes#sort-top"
+ title="{% trans "most voted answers will be shown first" %}">{% trans "popular answers" %}</a>
</div>
</div>
{% cnprog_paginator context %}
@@ -272,24 +250,29 @@
<tr>
<td style="width:30px;vertical-align:top">
<div class="vote-buttons">
- <img id="answer-img-upvote-{{ answer.id }}" class="answer-img-upvote" src="/content/images/vote-arrow-up{% get_user_vote_image user_answer_votes answer.id 1 %}.png" title="{% trans "i like this answer (click again to cancel)" %}">
+ <img id="answer-img-upvote-{{ answer.id }}" class="answer-img-upvote"
+ src="{% blockresource %}/content/images/vote-arrow-up{% get_user_vote_image user_answer_votes answer.id 1 %}.png{% endblockresource %}"
+ alt="{% trans "i like this answer (click again to cancel)" %}"
+ title="{% trans "i like this answer (click again to cancel)" %}"/>
<div id="answer-vote-number-{{ answer.id }}" class="vote-number" title="{% trans "current number of votes" %}">
{{ answer.score }}
</div>
<img id="answer-img-downvote-{{ answer.id }}" class="answer-img-downvote"
- src="/content/images/vote-arrow-down{% get_user_vote_image user_answer_votes answer.id -1 %}.png"
- title="{% trans "i dont like this answer (click again to cancel)" %}" >
+ src="{% blockresource %}/content/images/vote-arrow-down{% get_user_vote_image user_answer_votes answer.id -1 %}.png{% endblockresource %}"
+ alt="{% trans "i dont like this answer (click again to cancel)" %}"
+ title="{% trans "i dont like this answer (click again to cancel)" %}" />
- <br><br>
{% ifequal request.user question.author %}
<img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
- src="/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png"
- title="{% trans "mark this answer as favorite (click again to undo)" %}" >
+ src="{% blockresource %}/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png{% endblockresource %}"
+ alt="{% trans "mark this answer as favorite (click again to undo)" %}"
+ title="{% trans "mark this answer as favorite (click again to undo)" %}" />
{% else %}
{% if answer.accepted %}
<img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
- src="/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png"
- title="{% trans "the author of the question has selected this answer as correct" %}" >
+ src="{% blockresource %}/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png{% endblockresource %}"
+ alt="{% trans "the author of the question has selected this answer as correct" %}"
+ title="{% trans "the author of the question has selected this answer as correct" %}" />
{% endif %}
{% endifequal %}
</div>
@@ -299,124 +282,82 @@
<div class="answer-body">
{{ answer.html|safe }}
</div>
- <div class="answer-controls" style="clear:both;">
- <table width="100%">
- <tr>
- <td width="400px" style="vertical-align:top">
- {% if request.user|can_edit_post:answer %}
- <span class="action-link"><a href="{% url edit_answer answer.id %}">{% trans "edit" %}</a></span>
- <span class="action-link-separator">|</span>
- {% endif %}
- {% if request.user|can_delete_post:answer %}
- <span class="action-link">
- <a id="answer-delete-link-{{answer.id}}">
- {% if answer.deleted %}
- {% trans "undelete" %}
- {% endif %}
- {% if not answer.deleted %}
- {% trans "delete" %}
- {% endif %}
- </a>
- </span>
- <span class="action-link-separator">|</span>
- {% endif %}
- <span class="linksopt">
- <a href="#{{ answer.id }}" title="{% trans "answer permanent link" %}">
- {% trans "permanent link" %}
- </a>
- </span>
- <span class="action-link-separator">|</span>
- <span id="answer-offensive-flag-{{ answer.id }}" class="offensive-flag"
- title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
- <a>{% trans "flag offensive" %}</a>
- <span class="darkred">{% if request.user|can_view_offensive_flags %}{% if answer.offensive_flag_count %}({{ answer.offensive_flag_count }}){% endif %}{% endif %}</span></span>
- </td>
- <td width="110px" style="vertical-align:top">
- {% if answer.last_edited_by %}
- <div class="question-edit" >
- <table width="200px" >
- <tr>
- <td colspan="2">
- {% trans "updated" %}<a href="{% url answer_revisions answer.id %}"><strong title="{{answer.last_edited_at }}">{% diff_date answer.last_edited_at %}</strong></a>
- </td>
- </tr>
- {% if answer.wiki %}
- <tr>
- <td width="40px" style="vertical-align:bottom">
- {% gravatar answer.last_edited_by 32 %}
- </td>
- <td style="width:160px; vertical-align:top">
- <div><a href="/users/{{ answer.last_edited_by.id }}/{{ answer.last_edited_by.username }}">{{ answer.last_edited_by.username }}</a></div>
-
- </td>
- </tr>
- {% else %}
- {% ifequal answer.last_edited_by answer.author %}
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- {% else %}
- <tr>
- <td width="40px" style="vertical-align:bottom">
- {% gravatar answer.last_edited_by 32 %}
- </td>
- <td style="width:160px; vertical-align:top">
- <div><a href="/users/{{ answer.last_edited_by.id }}/{{ answer.last_edited_by.username }}">{{ answer.last_edited_by.username }}</a></div>
- <div>
- {% get_score_badge answer.last_edited_by %}
- </div>
- </td>
- </tr>
- {% endifequal %}
- {% endif %}
- </table>
- </div>
+ <div class="answer-controls post-controls">
+ {% joinitems using '<span class="action-link-separator">|</span>' %}
+ <span class="linksopt">
+ <a href="#{{ answer.id }}" title="{% trans "answer permanent link" %}">
+ {% trans "permanent link" %}
+ </a>
+ </span>
+ {% separator %}
+ {% if request.user|can_edit_post:answer %}
+ <span class="action-link"><a href="{% url edit_answer answer.id %}">{% trans 'edit' %}</a></span>
+ {% endif %}
+ {% separator %}
+ {% if request.user|can_flag_offensive %}
+ <span id="answer-offensive-flag-{{ answer.id }}" class="offensive-flag"
+ title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
+ <a>{% trans "flag offensive" %}</a>
+ {% if request.user|can_view_offensive_flags and answer.offensive_flag_count %}
+ <span class="darkred">({{ answer.offensive_flag_count }})</span>
{% endif %}
-
- </td>
- <td style="vertical-align:top">
- {% if answer.wiki %}
- <span class="wiki-category">{% trans "community wiki" %}</span>
- <div style="margin-bottom:10px"></div>
+ </span>
+ {% endif %}
+ {% separator %}
+ {% if request.user|can_delete_post:answer %}
+ {% spaceless %}
+ <span class="action-link">
+ <a id="answer-delete-link-{{answer.id}}">
+ {% if answer.deleted %}{% trans "undelete" %}{% else %}{% trans "delete" %}{% endif %}</a>
+ </span>
+ {% endspaceless %}
+ {% endif %}
+ {% endjoinitems %}
+ </div>
+ <div class="post-update-info-container">
+ {% post_contributor_info answer "original_author" %}
+ {% post_contributor_info answer "last_updater" %}
+ </div>
+ <div class="comments-container" id="comments-container-answer-{{answer.id}}">
+ {% for comment in answer.get_comments|slice:":5" %}
+ <p id="comment-{{comment.id}}" class="comment">
+ {{comment.comment}}
+ - <a class="comment-user" href="{{comment.user.get_profile_url}}">{{comment.user}}</a>
+ {% spaceless %}
+ <span class="comment-age">({% diff_date comment.added_at %})</span>
+ {% if request.user|can_delete_comment:comment %}
+ <img class="delete-icon"
+ src="{% href "/content/images/close-small.png" %}"
+ title="{% trans "delete this comment" %}"/>
+ {% endif %}
+ {% endspaceless %}
+ </p>
+ {% endfor %}
+ </div>
+ <div class="post-comments" style="margin-bottom:20px">
+ <input id="can-post-comments-answer-{{answer.id}}" type="hidden" value="{{ request.user|can_add_comments:answer}}"/>
+ {% if request.user|can_add_comments:answer or answer.comment_count > 5 %}
+ <a id="comments-link-answer-{{answer.id}}" class="comments-link">
+ {% if request.user|can_add_comments:answer %}
+ {% trans "add comment" %}
+ {% 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 %}
{% else %}
- <div class="answer-mark">
- <table width="200px">
- <tr>
- <td colspan="2">
- {% trans "asked" %} <strong title="{{answer.added_at}}">{% diff_date answer.added_at %}</strong>
- </td>
- </tr>
- <tr>
- <td width="40px" style="vertical-align:bottom">
- {% gravatar answer.author 32 %}
- </td>
- <td style="width:160px; vertical-align:top">
- <div><a href="/users/{{ answer.author.id }}/{{ answer.author.username }}">{{ answer.author }}</a></div>
- <div>
- {% get_score_badge answer.author %}
- </div>
- </td>
- </tr>
- </table>
- </div>
+ {% 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 %}
-
- </td>
- </tr>
-
- </table>
-
- </div>
- <div id="comment-{{ answer.id }}" class="post-comments" >
- <input id="can-post-comments-answer-{{answer.id}}" type="hidden" value="{{ request.user|can_add_comments }}"/>
- <a id="comments-link-answer-{{answer.id}}" class="comments-link">
- {% if answer.comment_count %}{% trans "comments" %}
- <strong>({{answer.comment_count}})</strong>{% else %}{% trans "add comment" %}{% endif %}</a>
- <div id="comments-answer-{{answer.id}}" class="comments-container">
- <div class="comments"/></div>
+ {% endif %}</a>
+ {% endif %}
</div>
-
</div>
</td>
@@ -427,49 +368,102 @@
<div class="paginator-container-left">
{% cnprog_paginator context %}
</div>
+ {% endif %}
+ <form id="fmanswer" action="{% url answer question.id %}" method="post">
+ {% if request.user.is_authenticated %}
+ <p style="padding-left:3px">
+ {{ answer.email_notify }}
+ <label for="question-subscribe-updates">
+ {% ifequal request.user.get_q_sel_email_feed_frequency 'n' %}
+ {% trans "Notify me once a day when there are any new answers" %}
+ {% else %}
+ {% ifequal request.user.get_q_sel_email_feed_frequency 'd' %}
+ {% trans "Notify me once a day when there are any new answers" %}
+ {% else %}
+ {% ifequal request.user.get_q_sel_email_feed_frequency 'w' %}
+ {% trans "Notify me weekly when there are any new answers" %}
+ {% endifequal %}
+ {% endifequal %}
+ {% endifequal %}
+ </label>
+ {% blocktrans with request.user.get_profile_url as profile_url %}
+ You can always adjust frequency of email updates from your {{profile_url}}
+ {% endblocktrans %}
+ </p>
{% else %}
- <div class="line"></div>
- {% endifnotequal %}
+ <p style="padding-left:3px">
+ <input class="nomargin" type="checkbox" disabled="disabled" />
+ <label>{% trans "once you sign in you will be able to subscribe for any updates here" %}</label>
+ </p>
+ {% endif %}
<div style="clear:both">
</div>
{% if not question.closed %}
- <div style="padding:10px 0 0 0;">
- <div class="headNormal">{% trans "Your answer" %}:</div>
- </div>
- {% if not request.user.is_authenticated %}
- <div class="message">{% trans "you can answer anonymously and then login" %}</div>
- {% endif %}
-
- <div id="description" class="" >
- <div id="wmd-button-bar" class="wmd-panel"></div>
- {{ answer.text }}
- <div class="preview-toggle">
- <table width="100%">
- <tr>
- <td>
- <span id="pre-collapse"
- title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
- </td>
- <td style="text-align:right;">
- {{ answer.wiki }} <span style="font-weight:normal;cursor:help" title="{{answer.wiki.help_text}}">{{ answer.wiki.label_tag }} </span>
- </td>
- </tr>
-
- </table>
+ <div style="padding:10px 0 0 0;">
+ {% spaceless %}
+ <div class="headNormal">
+ {% if answers %}
+ {% trans "Your answer" %}
+ {% else %}
+ {% trans "Be the first one to answer this question!" %}
+ {% endif %}
+ </div>
+ {% endspaceless %}
</div>
- <div id="previewer" class="wmd-preview"></div>
- {{ answer.text.errors }}
- </div>
- <br>
- <input type="submit" value="{% trans "Answer the question" %}" class="submit"><span class="form-error"></span>
- {% if request.user.is_authenticated %}
- {{ answer.email_notify }} <label for="question-subscribe-updates">{% trans "Notify me daily if there are any new answers." %}</label>
+ {% if not request.user.is_authenticated %}
+ <div class="message">{% trans "you can answer anonymously and then login" %}</div>
{% else %}
- <input type="checkbox" disabled><label>{% trans "once you sign in you will be able to subscribe for any updates here" %}</label>
+ <p class="message">
+ {% ifequal request.user question.author %}
+ {% trans "answer your own question only to give an answer" %}
+ {% else %}
+ {% trans "please only give an answer, no discussions" %}
+ {% endifequal %}
+ </p>
{% endif %}
+
+ <div id="description" class="" >
+ <div id="wmd-button-bar" class="wmd-panel"></div>
+ {{ answer.text }}
+ <div class="preview-toggle">
+ <table width="100%">
+ <tr>
+ <td>
+ <span id="pre-collapse"
+ title="{% trans "Toggle the real time Markdown editor preview" %}">
+ {% trans "toggle preview" %}
+ </span>
+ </td>
+ {% if settings.WIKI_ON %}
+ <td style="text-align:right;">
+ {{ answer.wiki }}
+ <span style="font-weight:normal;cursor:help"
+ title="{{answer.wiki.help_text}}">
+ {{ answer.wiki.label_tag }}
+ </span>
+ </td>
+ {% endif %}
+ </tr>
+
+ </table>
+ </div>
+ <div id="previewer" class="wmd-preview"></div>
+ {{ answer.text.errors }}
+ </div>
+ <p><span class="form-error"></span></p>
+ <input type="submit"
+ {% if user.is_anonymous %}
+ value="{% trans "Login/Signup to Post Your Answer" %}"
+ {% else %}
+ {% if user == question.author %}
+ value="{% trans "Answer Your Own Question" %}"
+ {% else %}
+ value="{% trans "Answer the question" %}"
+ {% endif %}
+ {% endif %}
+ class="submit" style="float:left"/>
{% endif %}
- <br><br>
</form>
</div>
</div>
@@ -484,17 +478,17 @@
{% for tag in tags %}
<a href="{% url forum.views.tag tag.name|urlencode %}"
title="{% trans "see questions tagged"%}'{{tag.name}}'{% trans "using tags" %}"
- rel="tag">{{ tag.name }}</a> <span class="tag-number">× {{ tag.used_count|intcomma }}</span><br>
+ rel="tag">{{ tag.name }}</a> <span class="tag-number">&#215;{{ tag.used_count|intcomma }}</span><br/>
{% endfor %}
</p>
<p>
- {% trans "question asked" %}: <strong title="{{ question.added_at }}">{{ question.added_at|timesince }} {% trans "ago" %}</strong>
+ {% trans "question asked" %}: <strong title="{{ question.added_at }}">{% diff_date question.added_at %}</strong>
</p>
<p>
{% trans "question was seen" %}: <strong>{{ question.view_count|intcomma }} {% trans "times" %}</strong>
</p>
<p>
- {% trans "last updated" %}: <strong title="{{ question.last_activity_at }}">{{ question.last_activity_at|timesince }} {% trans "ago" %}</strong>
+ {% trans "last updated" %}: <strong title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</strong>
</p>
</div>
@@ -503,11 +497,10 @@
<div class="questions-related">
{% for question in similar_questions %}
<p>
- <a href="/questions/{{question.id}}/{{ question.get_question_title }}">{{ question.get_question_title }}</a>
+ <a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>
</p>
{% endfor %}
</div>
- <br>
</div>
{% endblock %}
diff --git a/templates/question_edit.html b/templates/question_edit.html
index 9ad60a88..8ce980fe 100644
--- a/templates/question_edit.html
+++ b/templates/question_edit.html
@@ -1,14 +1,15 @@
{% extends "base.html" %}
<!-- question_edit.html -->
{% load i18n %}
+{% load extra_tags %}
{% block title %}{% spaceless %}{% trans "Edit question" %}{% endspaceless %}{% endblock %}
{% block forejs %}
- <script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
- <script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
- <script type='text/javascript' src='/content/js/wmd/showdown.js'></script>
- <script type='text/javascript' src='/content/js/wmd/wmd.js'></script>
- <link rel="stylesheet" type="text/css" href="/content/js/wmd/wmd.css" />
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.editor.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.post.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.validate.pack.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/wmd/showdown.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/wmd/wmd.js" %}'></script>
+ <link rel="stylesheet" type="text/css" href="{% href "/content/js/wmd/wmd.css" %}" />
<script type="text/javascript">
//todo move javascript out
$().ready(function(){
@@ -21,7 +22,7 @@
//toggle preview of editor
var display = true;
- var txt = "[{% trans "hide preview"}%]";
+ var txt = "[{% trans "hide preview" %}]";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
@@ -67,14 +68,14 @@
<div id="main-body" class="ask-body">
<div id="askform">
<form id="fmedit" action="{% url edit_question question.id %}" method="post" >
- <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br>
+ <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/>
{% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
<div style="vertical-align:middle">
{{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision"
value="{% trans "select revision"%}">
- </div><br>
+ </div>
<div class="form-item">
- <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br>
+ <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
{{ form.title }} {{ form.title.errors }}
<div class="title-desc">
{{ form.title.help_text }}
@@ -90,36 +91,32 @@
<td>
<span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
</td>
+ {% if settings.WIKI_ON %}
<td style="text-align:right;">
{{ form.wiki }} <span style="color:#000;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
</td>
+ {% endif %}
</tr>
</table>
</div>
<div id="previewer" class="wmd-preview"></div>
- <br>
</div>
<div class="form-item">
- <strong>{{ form.tags.label_tag }}:</strong> <span class="form-error"></span><br>
+ <strong>{{ form.tags.label_tag }}:</strong> <span class="form-error"></span><br/>
{{ form.tags }} {{ form.tags.errors }}
<div class="title-desc">
{{ form.tags.help_text }}
</div>
</div>
- <br>
- <strong>{{ form.summary.label_tag }}</strong> <br>
+ <strong>{{ form.summary.label_tag }}</strong> <br/>
{{ form.summary }} {{ form.summary.errors }}
<div class="title-desc">
{{ form.summary.help_text }}
</div>
- <br>
-
<div class="error" ></div>
<input type="submit" value="{% trans "Save edit" %}" class="submit" />
<input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" />
- <br>
- <br>
</form>
</div>
</div>
diff --git a/templates/question_edit_tips.html b/templates/question_edit_tips.html
index 4ac666a6..4cabea79 100644
--- a/templates/question_edit_tips.html
+++ b/templates/question_edit_tips.html
@@ -13,8 +13,9 @@
{% trans "be clear and concise" %}
</li>
</ul>
- <a href="/faq/" target="_blank" title="{% trans "see frequently asked questions" %}" style="float:right;position:relative">faq »</a>
- <br>
+ <p class='info-box-follow-up-links'>
+ <a href="{% url faq %}" target="_blank" title="{% trans "see frequently asked questions" %}">{% trans "faq" %} »</a>
+ </p>
</div>
</div>
@@ -45,7 +46,8 @@
{% trans "basic HTML tags are also supported" %}
</li>
</ul>
- <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank" style="float:right;position:relative">{% trans "learn more about Markdown" %} »</a>
- <br>
+ <p class='info-box-follow-up-links'>
+ <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans "learn more about Markdown" %} »</a>
+ </p>
</div>
<!-- end question_edit_tips.html -->
diff --git a/templates/question_retag.html b/templates/question_retag.html
index c7062e30..b7957962 100644
--- a/templates/question_retag.html
+++ b/templates/question_retag.html
@@ -1,10 +1,11 @@
{% extends "base.html" %}
<!-- question_retag.html -->
+{% load extra_tags %}
{% block title %}{% spaceless %}{% trans "Change tags" %}{% endspaceless %}{% endblock %}
{% block forejs %}
- <script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
- <script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.editor.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.post.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.validate.pack.js" %}'></script>
<script type="text/javascript">
$().ready(function(){
@@ -63,19 +64,15 @@
<div class="form-item">
- <strong>{{ form.tags.label_tag }}:</strong> <span class="form-error"></span><br>
+ <strong>{{ form.tags.label_tag }}:</strong> <span class="form-error"></span><br/>
{{ form.tags }} {{ form.tags.errors }}
<div class="title-desc">
{{ form.tags.help_text }}
</div>
</div>
- <br>
-
<div class="error" ></div>
<input type="submit" value="{% trans "Save edit" %}" class="submit" />
<input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" />
- <br>
- <br>
</form>
</div>
</div>
@@ -88,15 +85,18 @@
<li>
{% trans "tags help us keep Questions organized" %}
</li>
+ {% comment %}
<li>
修改完整问题需要用户的积分达到一定条件(比如:积分 >= 3000分,自己发布的问题除外),而用户积分达到比较低的时候,就可以修改问题的标签(比如:积分 >= 500, 这里指所有问题的标签)。
</li>
+ {% endcomment %}
<li>
{% trans "tag editors receive special awards from the community" %}
</li>
</ul>
- <a href="{% url faq %}" style="float:right;position:relative">faq »</a>
- <br>
+ <p class='info-box-follow-up-links'>
+ <a href="{% url faq %}">faq »</a>
+ </p>
</div>
{% endblock %}
diff --git a/templates/question_summary_list_roll.html b/templates/question_summary_list_roll.html
new file mode 100644
index 00000000..7312dca9
--- /dev/null
+++ b/templates/question_summary_list_roll.html
@@ -0,0 +1,55 @@
+ <div class="qstA">
+ <h2>
+ <a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>
+ </h2>
+ <div class="stat">
+ <table>
+ <tr>
+ <td><span class="num">{{ question.answer_count|intcomma }}</span> </td>
+ <td><span class="num">{{ question.score|intcomma }}</span> </td>
+ <td><span class="num">{{ question.view_count|cnprog_intword|safe }}</span> </td>
+ </tr>
+ <tr>
+ <td><span class="unit">{% trans "answers" %}</span></td>
+ <td><span class="unit">{% trans "votes" %}</span></td>
+ <td><span class="unit">{% trans "views" %}</span></td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="summary">
+ {{ question.summary }}...
+ </div>
+
+ {% ifequal tab_id 'active'%}
+ {% if question.wiki and settings.WIKI_ON %}
+ <span class="from wiki">{% trans "community wiki" %}</span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% else %}
+ <div class="from">
+ {% comment %}{% gravatar question.last_activity_by 24 %}{% endcomment %}
+ <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
+ <span class="score">{% get_score_badge question.last_activity_by %} </span>
+ <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ </div>
+ {% endif %}
+ {% else %}
+ {% if question.wiki and settings.WIKI_ON %}
+ <span class="from wiki">{% trans "community wiki" %}</span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% else %}
+ <div class="from">
+ {% comment %}{% gravatar question.author 24 %}{% endcomment %}
+ <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
+ <span class="score">{% get_score_badge question.author %} </span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ </div>
+ {% endif %}
+ {% endifequal %}
+
+ <div class="tags">
+ {% for tag in question.tagname_list %}
+ <a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
+ {% endfor %}
+ </div>
+ </div>
diff --git a/templates/questions.html b/templates/questions.html
index 5dac0156..47bda129 100644
--- a/templates/questions.html
+++ b/templates/questions.html
@@ -4,6 +4,7 @@
{% load i18n %}
{% load humanize %}
{% load extra_filters %}
+{% load smart_if %}
{% block title %}{% spaceless %}{% trans "Questions" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
@@ -20,7 +21,21 @@
{% endblock %}
{% block content %}
<div class="tabBar">
- <div class="headQuestions">{% if searchtag %}{% trans "Found by tags" %}{% else %}{% if searchtitle %}{% trans "Found by title" %}{% else %}{% trans "All questions" %}{% endif %}{% endif %}</div>
+ <div class="headQuestions">
+ {% if searchtag %}
+ {% trans "Found by tags" %}
+ {% else %}
+ {% if searchtitle %}
+ {% if settings.USE_SPHINX_SEARCH %}
+ {% trans "Search results" %}
+ {% else %}
+ {% trans "Found by title" %}
+ {% endif %}
+ {% else %}
+ {% trans "All questions" %}
+ {% endif %}
+ {% endif %}
+ </div>
<div class="tabsA">
<a id="latest" href="?sort=latest" class="off" title="{% trans "most recently asked questions" %}">{% trans "newest" %}</a>
<a id="active" href="?sort=active" class="off" title="{% trans "most recently updated questions" %}">{% trans "active" %}</a>
@@ -36,16 +51,16 @@
</h2>
<div class="stat">
<table>
- <tr>
+ <tr>
<td><span class="num">{{ question.answer_count|intcomma }}</span> </td>
<td><span class="num">{{ question.score|intcomma }}</span> </td>
<td><span class="num">{{ question.view_count|cnprog_intword|safe }}</span> </td>
- </tr>
+ </tr>
<tr>
<td><span class="unit">{% trans "answers" %}</span></td>
<td><span class="unit">{% trans "votes" %}</span></td>
<td><span class="unit">{% trans "views" %}</span></td>
- </tr>
+ </tr>
</table>
</div>
@@ -54,7 +69,7 @@
</div>
{% ifequal tab_id 'active'%}
- {% if question.wiki %}
+ {% if question.wiki and settings.WIKI_ON %}
<span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
@@ -66,15 +81,33 @@
</div>
{% endif %}
{% else %}
- {% if question.wiki %}
+ {% if question.wiki and settings.WIKI_ON %}
<span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
<div class="from">
{% comment %}{% gravatar question.author 24 %}{% endcomment %}
- <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
- <span class="score">{% get_score_badge question.author %} </span>
- <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% if question.last_activity_at != question.added_at %}
+ {% if question.author.id != question.last_activity_by.id %}
+ {% trans "Posted:" %}
+ <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
+ <span class="score">{% get_score_badge question.author %} </span>
+ / {% trans "Updated:" %}
+ <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
+ <span class="score">{% get_score_badge question.last_activity_by %} </span>
+ <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ {% else %}
+ {% trans "Updated:" %}
+ <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
+ <span class="score">{% get_score_badge question.last_activity_by %} </span>
+ <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ {% endif %}
+ {% else %}
+ {% trans "Posted:" %}
+ <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
+ <span class="score">{% get_score_badge question.author %} </span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% endif %}
</div>
{% endif %}
{% endifequal %}
@@ -86,8 +119,18 @@
</div>
</div>
{% endfor %}
+ {% if searchtitle %}
+ {% if questions_count == 0 %}
+ <p class="evenMore" style="padding-top:30px;text-align:center;">
+ {% trans "Did not find anything?" %}
+ {% else %}
+ <p class="evenMore" style="padding-left:9px">
+ {% trans "Did not find what you were looking for?" %}
+ {% endif %}
+ <a href="{% url ask %}">{% trans "Please, post your question!" %}</a>
+ </p>
+ {% endif %}
</div>
-
{% endblock %}
{% block tail %}
@@ -104,7 +147,6 @@
{% block sidebar %}
<div class="boxC">
- <p>
{% if searchtag %}
{% blocktrans count questions_count as cnt with questions_count|intcomma as q_num and searchtag as tagname %}
have total {{q_num}} questions tagged {{tagname}}
@@ -113,11 +155,19 @@
{% endblocktrans %}
{% else %}
{% if searchtitle %}
- {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %}
- have total {{q_num}} questions containing {{searchtitle}}
- {% plural %}
- have total {{q_num}} questions containing {{searchtitle}}
- {% endblocktrans %}
+ {% if settings.USE_SPHINX_SEARCH %}
+ {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %}
+ have total {{q_num}} questions containing {{searchtitle}} in full text
+ {% plural %}
+ have total {{q_num}} questions containing {{searchtitle}} in full text
+ {% endblocktrans %}
+ {% else %}
+ {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %}
+ have total {{q_num}} questions containing {{searchtitle}}
+ {% plural %}
+ have total {{q_num}} questions containing {{searchtitle}}
+ {% endblocktrans %}
+ {% endif %}
{% else %}
{% blocktrans count questions as cnt with questions_count|intcomma as q_num %}
have total {{q_num}} questions
@@ -126,38 +176,36 @@
{% endblocktrans %}
{% endif %}
{% endif %}
-
+ <p>
{% ifequal tab_id "latest" %}
- <p>{% trans "latest questions info" %}</p>
+ {% trans "latest questions info" %}
{% endifequal %}
{% ifequal tab_id "active" %}
- <p>{% trans "Questions are sorted by the <strong>time of last update</strong>." %}
- {% trans "Most recently answered ones are shown first." %}</p>
+ {% trans "Questions are sorted by the <strong>time of last update</strong>." %}
+ {% trans "Most recently answered ones are shown first." %}
{% endifequal %}
{% ifequal tab_id "hottest" %}
- <p>{% trans "Questions sorted by <strong>number of responses</strong>." %}
- {% trans "Most answered questions are shown first." %}</p>
+ {% trans "Questions sorted by <strong>number of responses</strong>." %}
+ {% trans "Most answered questions are shown first." %}
{% endifequal %}
{% ifequal tab_id "mostvoted" %}
- <p>{% trans "Questions are sorted by the <strong>number of votes</strong>." %}
- {% trans "Most voted questions are shown first." %}</p>
+ {% trans "Questions are sorted by the <strong>number of votes</strong>." %}
+ {% trans "Most voted questions are shown first." %}
{% endifequal %}
-
-
- </p>
+ </p>
</div>
<div class="boxC">
<h3 class="subtitle">{% trans "Related tags" %}</h3>
<div class="tags">
{% for tag in tags %}
<a rel="tag" title="{% trans "see questions tagged" %}'{{ tag.name }}'{% trans "using tags" %}" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
- <span class="tag-number">× {{ tag.used_count|intcomma }}</span>
- <br>
+ <span class="tag-number">&#215; {{ tag.used_count|intcomma }}</span>
+ <br />
{% endfor %}
- <br>
+ <br />
</div>
</div>
diff --git a/templates/revisions_answer.html b/templates/revisions_answer.html
index 9c2e53eb..974e589c 100644
--- a/templates/revisions_answer.html
+++ b/templates/revisions_answer.html
@@ -6,8 +6,8 @@
{% load humanize %}
{% block title %}{% spaceless %}{% trans "Revision history" %}{% endspaceless %}{% endblock %}
{% block forejs %}
- <script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.editor.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.post.js" %}'></script>
<script type="text/javascript">
//todo - take this out into .js file
$().ready(function(){
@@ -24,7 +24,9 @@
var arrow = $("#rev-arrow-" + id);
var visible = arrow.attr("src").indexOf("hide") > -1;
- arrow.attr("src", "/content/images/expander-arrow-" + (visible ? "show" : "hide") + ".gif");
+ var path = $.i18n._('/') + "content/images/expander-arrow-" +
+ (visible ? "show" : "hide") + ".gif" + "?v={{settings.RESOURCE_REVISION}}";
+ arrow.attr("src", path);
$("#rev-body-" + id).slideToggle("fast");
}
@@ -43,11 +45,14 @@
<div class="header-controls">
<table width="100%">
<tr>
- <td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.revision }}" src="/content/images/expander-arrow-show.gif"></td>
+ <td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.revision }}"
+ src="{% href "/content/images/expander-arrow-show.gif" %}"
+ alt="{% trans "click to hide/show revision" %}"/>
+ </td>
<td width="30px" style="vertical-align:middle"><span class="revision-number" title="{% trans "revision" %} {{ revision.revision }}">{{ revision.revision }}</span></td>
<td width="200px" style="vertical-align:middle">
{% if revision.summary %}
- <div class="summary"><span>{{ revision.summary }}<span></div>
+ <div class="summary"><span>{{ revision.summary }}</span></div>
{% endif %}
{% if request.user|can_edit_post:post %}
<a href="{% url edit_answer post.id %}?revision={{ revision.revision }}">{% trans "edit" %}</a>
@@ -56,31 +61,7 @@
</td>
<td align="right">
<div class="revision-mark" >
- <table width="100%" style="text-align:left" >
- <tr >
- <td colspan="2" style="padding:3px 0 3px 0">
- {% ifequal revision.revision 1 %}
- {% trans "asked" %} <strong title="{{ post.added_at }}">{% diff_date post.added_at %}</strong>
- {% else %}
- {% trans "updated" %} <strong title="{{ post.last_edited_at }}">{% diff_date revision.revised_at %}</strong>
- {% endifequal %}
- </td>
-
- </tr>
- <tr>
- <td width="35px" style="vertical-align:bottom; ">
- {% gravatar revision.author 32 %}
- </td>
- <td style="width:120px; vertical-align:top">
- <div style="height:18px">
- <a href="/users/{{ revision.author.id }}/{{ revision.author.username }}">{{ revision.author.username }}</a></div>
- <div>
- {% get_score_badge revision.author %}
- </div>
- </td>
- </tr>
-
- </table>
+ {% post_contributor_info revision %}
</div>
</td>
</tr>
diff --git a/templates/revisions_question.html b/templates/revisions_question.html
index 7ada3e74..83512e4a 100644
--- a/templates/revisions_question.html
+++ b/templates/revisions_question.html
@@ -7,8 +7,8 @@
{% load humanize %}
{% block title %}{% spaceless %}{% trans "Revision history" %}{% endspaceless %}{% endblock %}
{% block forejs %}
- <script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.editor.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.post.js" %}'></script>
<script type="text/javascript">
//todo - take this out into .js file
$().ready(function(){
@@ -25,7 +25,9 @@
var arrow = $("#rev-arrow-" + id);
var visible = arrow.attr("src").indexOf("hide") > -1;
- arrow.attr("src", "/content/images/expander-arrow-" + (visible ? "show" : "hide") + ".gif");
+ var path = $.i18n._('/') + "content/images/expander-arrow-" +
+ (visible ? "show" : "hide") + ".gif" + "?v={{settings.RESOURCE_REVISION}}";
+ arrow.attr("src", path);
$("#rev-body-" + id).slideToggle("fast");
}
</script>
@@ -43,11 +45,14 @@
<div class="header-controls">
<table width="100%">
<tr>
- <td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.revision }}" src="/content/images/expander-arrow-show.gif"></td>
+ <td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.revision }}"
+ src="{% href "/content/images/expander-arrow-show.gif" %}"
+ alt="{% trans "click to hide/show revision" %}"/>
+ </td>
<td width="30px" style="vertical-align:middle"><span class="revision-number" title="{% trans "revision" %} {{ revision.revision }}">{{ revision.revision }}</span></td>
<td width="200px" style="vertical-align:middle">
{% if revision.summary %}
- <div class="summary"><span>{{ revision.summary }}<span></div>
+ <div class="summary"><span>{{ revision.summary }}</span></div>
{% endif %}
{% if request.user|can_edit_post:post %}
<a href="{% url edit_question post.id %}?revision={{ revision.revision }}">{% trans "edit" %}</a>
@@ -56,31 +61,7 @@
</td>
<td align="right">
<div class="revision-mark" >
- <table width="100%" style="text-align:left" >
- <tr >
- <td colspan="2" style="padding:3px 0 3px 0">
- {% ifequal revision.revision 1 %}
- {% trans "asked" %}<strong title="{{ post.added_at }}">{% diff_date post.added_at %}</strong>
- {% else %}
- {% trans "updated" %}<strong title="{{ post.last_edited_at }}">{% diff_date revision.revised_at %}</strong>
- {% endifequal %}
- </td>
-
- </tr>
- <tr>
- <td width="35px" style="vertical-align:bottom; ">
- {% gravatar revision.author 32 %}
- </td>
- <td style="width:120px; vertical-align:top">
- <div style="height:18px">
- <a href="/users/{{ revision.author.id }}/{{ revision.author.username }}">{{ revision.author.username }}</a></div>
- <div>
- {% get_score_badge revision.author %}
- </div>
- </td>
- </tr>
-
- </table>
+ {% post_contributor_info revision %}
</div>
</td>
</tr>
diff --git a/templates/tags.html b/templates/tags.html
index 6f9b3aed..1bde187f 100644
--- a/templates/tags.html
+++ b/templates/tags.html
@@ -6,6 +6,7 @@
{% block title %}{% spaceless %}{% trans "Tag list" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
+ /*<![CDATA[*/
$().ready(function(){
$("#nav_tags").attr('className',"on");
$("#ipSearchTag").focus();
@@ -20,7 +21,7 @@
Hilite.elementid = "searchtags";
Hilite.debug_referrer = location.href;
});
-
+ /*]]>*/
</script>
{% endblock %}
{% block content %}
@@ -28,8 +29,8 @@
<div class="tabBar">
<div class="headQuestions">{% trans "Tag list" %}</div>
<div class="tabsA">
- <a id="sort_name" href="/tags/?sort=name" class="off" title="{% trans "sorted alphabetically" %}">{% trans "by name" %}</a>
- <a id="sort_used" href="/tags/?sort=used" class="off" title="{% trans "sorted by frequency of tag use" %}">{% trans "by popularity" %}</a>
+ <a id="sort_name" href="{% url tags %}?sort=name" class="off" title="{% trans "sorted alphabetically" %}">{% trans "by name" %}</a>
+ <a id="sort_used" href="{% url tags %}?sort=used" class="off" title="{% trans "sorted by frequency of tag use" %}">{% trans "by popularity" %}</a>
</div>
</div>
<div id="searchtags">
@@ -41,18 +42,20 @@
<span>{% trans "Nothing found" %}</span>
{% endif %}
</p>
+{% if tags.object_list %}
<ul class="tagsList tags">
{% for tag in tags.object_list %}
<li>
<a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">
{{ tag }}
</a>&nbsp;
- <span class="tag-number">× {{ tag.used_count|intcomma }}</span>
- <br>
+ <span class="tag-number">&#215; {{ tag.used_count|intcomma }}</span>
+ <br/>
</li>
{% endfor %}
</ul>
+{% endif %}
</div>
{% endblock %}
diff --git a/templates/unanswered.html b/templates/unanswered.html
index 13b3a3b2..80a23631 100644
--- a/templates/unanswered.html
+++ b/templates/unanswered.html
@@ -4,6 +4,7 @@
{% load i18n %}
{% load humanize %}
{% load extra_filters %}
+{% load smart_if %}
{% block title %}{% spaceless %}{% trans "Unanswered questions" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
@@ -17,65 +18,82 @@
<div class="tabBar">
<span class="headQuestions">{% trans "Unanswered questions" %}</span>
<div class="tabsA">
- <a id="latest" href="?sort=latest" class="on" title="{% trans "most recently asked questions" %}">{% trans "newest" %}</a>
+ <a id="latest" href="{% url unanswered %}?sort=latest" class="on" title="{% trans "most recently asked questions" %}">{% trans "newest" %}</a>
</div>
</div>
-
<div id="listA">
{% for question in questions.object_list %}
<div class="qstA">
- <h2><a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a></h2>
+ <h2>
+ <a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>
+ </h2>
<div class="stat">
<table>
- <tr>
+ <tr>
<td><span class="num">{{ question.answer_count|intcomma }}</span> </td>
<td><span class="num">{{ question.score|intcomma }}</span> </td>
<td><span class="num">{{ question.view_count|cnprog_intword|safe }}</span> </td>
- </tr>
+ </tr>
<tr>
<td><span class="unit">{% trans "answers" %}</span></td>
<td><span class="unit">{% trans "votes" %}</span></td>
<td><span class="unit">{% trans "views" %}</span></td>
- </tr>
+ </tr>
</table>
</div>
+
<div class="summary">
{{ question.summary }}...
</div>
-
+
{% ifequal tab_id 'active'%}
- {% if question.wiki %}
+ {% if question.wiki and settings.WIKI_ON %}
<span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
<div class="from">
- {% comment %}{% gravatar question.last_activity_by 24 %}{% endcomment %}
+ {% comment %}{% gravatar question.last_activity_by 24 %}{% endcomment %}
<span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
<span class="score">{% get_score_badge question.last_activity_by %} </span>
<span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
</div>
{% endif %}
{% else %}
- {% if question.wiki %}
+ {% if question.wiki and settings.WIKI_ON %}
<span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
<div class="from">
- {% comment %}{% gravatar question.author 24 %}{% endcomment %}
- <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
- <span class="score">{% get_score_badge question.author %} </span>
- <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% comment %}{% gravatar question.author 24 %}{% endcomment %}
+ {% if question.last_activity_at != question.added_at %}
+ {% if question.author.id != question.last_activity_by.id %}
+ {% trans "Posted:" %}
+ <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
+ <span class="score">{% get_score_badge question.author %} </span>
+ / {% trans "Updated:" %}
+ <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
+ <span class="score">{% get_score_badge question.last_activity_by %} </span>
+ <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ {% else %}
+ {% trans "Updated:" %}
+ <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
+ <span class="score">{% get_score_badge question.last_activity_by %} </span>
+ <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ {% endif %}
+ {% else %}
+ {% trans "Posted:" %}
+ <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
+ <span class="score">{% get_score_badge question.author %} </span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% endif %}
</div>
{% endif %}
{% endifequal %}
<div class="tags">
- {% for tag in question.tagname_list %}
- <a href="{% url forum.views.tag tag|urlencode %}"
- title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}"
- rel="tag">{{ tag }}
- </a>
- {% endfor %}
+ {% for tag in question.tagname_list %}
+ <a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
+ {% endfor %}
</div>
</div>
{% endfor %}
@@ -93,13 +111,8 @@
{% block sidebar %}
<div class="boxC">
- <p>
- {% blocktrans with questions_count|intcomma as num_q %}have {{num_q}} unanswered questions{% endblocktrans %}
- {% comment %}
- {% trans "Have a total of" %}<br><div class="questions-count">{{ questions_count|intcomma }}</div>
- {% endcomment %}
- <!---<p>问题按 <strong>问题创建时间</strong> 排序。最新加入的问题将显示在最前面。</p>-->
- </p>
+ {% blocktrans with questions_count|intcomma as num_q %}have {{num_q}} unanswered questions{% endblocktrans %}
+ <!---<p>问题按 <strong>问题创建时间</strong> 排序。最新加入的问题将显示在最前面。</p>-->
</div>
<div class="boxC">
<h3 class="subtitle">{% trans "Related tags" %}</h3>
@@ -107,14 +120,13 @@
<div class="tags">
{% for tag in tags %}
<a rel="tag" title="{% trans "see questions tagged"%}'{{ tag.name }}'{% trans "using tags" %}" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
- <span class="tag-number">× {{ tag.used_count|intcomma }}</span>
- <br>
+ <span class="tag-number"> &#215; {{ tag.used_count|intcomma }}</span>
+ <br/>
{% endfor %}
- <br>
+ <br/>
</div>
</div>
</div>
{% endblock %}
-
<!-- end unanswered.html -->
diff --git a/templates/upfiles/1245715031297631.png b/templates/upfiles/1245715031297631.png
deleted file mode 100755
index 89a6aed4..00000000
--- a/templates/upfiles/1245715031297631.png
+++ /dev/null
Binary files differ
diff --git a/templates/upfiles/12457157052552259.png b/templates/upfiles/12457157052552259.png
deleted file mode 100755
index 89a6aed4..00000000
--- a/templates/upfiles/12457157052552259.png
+++ /dev/null
Binary files differ
diff --git a/templates/user.html b/templates/user.html
index efca80e6..6e4098e9 100644
--- a/templates/user.html
+++ b/templates/user.html
@@ -1,6 +1,7 @@
{% extends "base_content.html" %}
<!-- user.html -->
{% load extra_tags %}
+{% load extra_filters %}
{% load humanize %}
{% block title %}{% spaceless %}{{ page_title }}{% endspaceless %}{% endblock %}
{% block forestyle%}
@@ -10,17 +11,22 @@
</style>
{% endblock %}
{% block forejs %}
- <script type="text/javascript">
- $().ready(function(){
- {% ifequal view_user request.user%}
- $("#nav_profile").attr('className',"on");
- {% else %}
- $("#nav_users").attr('className',"on");
- {% endifequal %}
- });
- </script>
- {% block userjs %}
- {% endblock %}
+ {% if request.user|can_moderate_users %}
+ <script type='text/javascript' src='{% href "/content/js/com.cnprog.admin.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.form.js" %}'></script>
+ {% endif %}
+ <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 %}
+ });
+ </script>
+ {% block userjs %}
+ {% endblock %}
{% endblock %}
{% block content %}
<div id="mainbar-full">
@@ -28,6 +34,6 @@
{% include "user_tabs.html" %}
{% block usercontent %}
{% endblock %}
- {% include "user_footer.html" %}
+ {%comment%}{% include "user_footer.html" %}{%endcomment%}
</div>
{% endblock %}<!-- end user.html -->
diff --git a/templates/user_edit.html b/templates/user_edit.html
index b49cea31..5886c071 100644
--- a/templates/user_edit.html
+++ b/templates/user_edit.html
@@ -24,11 +24,11 @@
{% if request.user.email %}
{% gravatar request.user 128 %}
{% else %}
- <img src="/content/images/nophoto.png">
+ <img src="{% href "/content/images/nophoto.png" %}">
{% endif %}
<div style="padding:20px 0 0 20px;font-weight:bold;font-size:150%">
<a href="http://www.gravatar.com/" target="_blank"
- title="gravatar {% trans "image associated with your email address" %}">{% trans "avatar" %}</a>
+ title="gravatar {% trans "image associated with your email address" %}">{% blocktrans %}avatar, see {{gravatar_faq_url}}{% endblocktrans %}</a>
</div>
</div>
@@ -39,6 +39,10 @@
<th width="100px"></th>
<th></th>
</tr>
+ <tr style="height:35px">
+ <td>{{ form.username.label_tag }}:</td>
+ <td>{{ form.username }} <span class="form-error"></span> {{ form.username.errors }} </td>
+ </tr>
<tr style="height:35px">
<td>{{ form.email.label_tag }}:</td>
diff --git a/templates/user_email_subscriptions.html b/templates/user_email_subscriptions.html
new file mode 100644
index 00000000..8f27bd2a
--- /dev/null
+++ b/templates/user_email_subscriptions.html
@@ -0,0 +1,23 @@
+{% extends "user.html" %}
+<!-- user_email_subscriptions.html -->
+{% load i18n %}
+{% load extra_tags %}
+{% load humanize %}
+
+{% block usercontent %}
+ <h2>{% trans "Email subscription settings" %}</h2>
+ <p class="message">{% trans "email subscription settings info" %}</p>
+ <div class='inline-block'>
+ {% if action_status %}
+ <p class="action-status"><span>{{action_status}}</span></p>
+ {% endif %}
+ <form method="POST">
+ {% include "edit_user_email_feeds_form.html" %}
+ <div class="submit-row text-align-right">
+ <input type="submit" class="submit" name="save" value="{% trans "Update" %}"/>
+ <input type="submit" class="submit" name="stop_email" value="{% trans "Stop sending email" %}"/>
+ </div>
+ </form>
+ </div>
+{% endblock %}
+<!-- end user_email_subscriptions.html -->
diff --git a/templates/user_favorites.html b/templates/user_favorites.html
index 185423c6..9db01e9a 100644
--- a/templates/user_favorites.html
+++ b/templates/user_favorites.html
@@ -2,7 +2,6 @@
<!-- user_favorites.html -->
{% load extra_tags %}
{% load humanize %}
-
{% block usercontent %}
{% include "users_questions.html" %}
{% endblock %}
diff --git a/templates/user_info.html b/templates/user_info.html
index 8d35015c..c550e13f 100644
--- a/templates/user_info.html
+++ b/templates/user_info.html
@@ -2,12 +2,11 @@
{% load extra_tags %}
{% load extra_filters %}
{% load humanize %}
+{% load smart_if %}
{% load i18n %}
<div id="subheader" class="headUser">
{{view_user.username}}
-
</div>
-
<table class="user-info-table">
<tr>
<td width="180" style="vertical-align:middle;text-align:center;">
@@ -27,13 +26,34 @@
</td>
<td width="360" style="vertical-align: top;">
<table class="user-details">
- <tr height="30px">
- <th width="130" align="left"><strong>{% trans "Registered user" %}</strong></th>
- <th width="230" align="right">
- {% if request.user|can_view_user_edit:view_user %}
- <span class="user-edit-link"><a href="/users/{{ view_user.id }}/edit/">{% trans "update profile" %}</a></span>
- {% endif %}
- </th>
+ {% if view_user != request.user and request.user|can_moderate_users %}
+ <tr>
+ <td class="admin" align="left" colspan="2">
+ <h3>{% trans "Moderate this user" %}</h3>
+ <form id="moderate_user_form" method="post">
+ {{moderate_user_form.as_p}}
+ </form>
+ <p id="action_status"></p>
+ </td>
+ </tr>
+ {% endif %}
+ {% if request.user|can_view_user_edit:view_user %}
+ <tr>
+ <td class="user-profile-tool-links" align="left" colspan="2">
+ {% joinitems using ' | ' %}
+ {% if request.user|can_view_user_edit:view_user %}
+ <span class="user-edit-link"><a href="{% url users %}{{ view_user.id }}/{% trans "edit/" %}">{% trans "update profile" %}</a></span>
+ {% endif %}
+ {% separator %}
+ {% if request.user.has_usable_password %}
+ <a href="{% url user_changepw %}">change password</a>
+ {% endif %}
+ {% endjoinitems %}
+ </td>
+ </tr>
+ {% endif %}
+ <tr>
+ <th colspan="2" align="left"><h3>{% trans "Registered user" %}</h3></th>
</tr>
{% if view_user.real_name %}
<tr>
@@ -43,12 +63,12 @@
{% endif %}
<tr>
<td>{% trans "member for" %}</td>
- <td>{{ view_user.date_joined|timesince }}</td>
+ <td><strong>{% diff_date view_user.date_joined %}</strong></td>
</tr>
{% if view_user.last_seen %}
<tr>
<td>{% trans "last seen" %}</td>
- <td><strong title="{{ view_user.last_seen }}">{{ view_user.last_seen|timesince }} {% trans "ago" %}</strong></td>
+ <td><strong title="{{ view_user.last_seen }}">{% diff_date view_user.last_seen %}</strong></td>
</tr>
{% endif %}
{% if view_user.website %}
diff --git a/templates/user_preferences.html b/templates/user_preferences.html
deleted file mode 100644
index eb7c4761..00000000
--- a/templates/user_preferences.html
+++ /dev/null
@@ -1,23 +0,0 @@
-{% extends "user.html" %}
-<!-- user_preferences.html -->
-{% load i18n %}
-{% load extra_tags %}
-{% load humanize %}
-
-{% block usercontent %}
- <div style="padding:5px;">
- <fieldset>
- <legend><b>{% trans "Connect with Twitter" %}</b></legend>
- <form>
- <label for="name">{% trans "Twitter account name:" %}</label>
- <input id="name" /><br>
- <label for="password">{% trans "Twitter password:" %}</label>
- <input id="password" type="password"/><br>
- <input id="cbMessage" type="checkbox" />{% trans "Send my Questions to Twitter" %}<br>
- <input id="cbReply" type="checkbox" />{% trans "Send my Answers to Twitter" %}<br>
- <input type="submit" value="{% trans "Save" %}" />
- </form>
- </fieldset>
- </div>
-{% endblock %}
-<!-- end user_preferences.html -->
diff --git a/templates/user_recent.html b/templates/user_recent.html
index 7f6c9c8c..b704ab25 100644
--- a/templates/user_recent.html
+++ b/templates/user_recent.html
@@ -2,7 +2,6 @@
<!-- user_recent.html -->
{% load extra_tags %}
{% load humanize %}
-
{% block usercontent %}
<div style="padding-top:5px;font-size:13px;">
{% for act in activities %}
diff --git a/templates/user_reputation.html b/templates/user_reputation.html
index bb7200de..16127140 100644
--- a/templates/user_reputation.html
+++ b/templates/user_reputation.html
@@ -1,10 +1,11 @@
{% extends "user.html" %}
<!-- user_reputation.html -->
{% load extra_tags %}
+{% load extra_filters %}
{% load humanize %}
{% block userjs %}
- <script type='text/javascript' src='/content/js/excanvas.pack.js'></script>
- <script type='text/javascript' src='/content/js/jquery.flot.pack.js'></script>
+ <script type='text/javascript' src='{% href "/content/js/excanvas.pack.js" %}'></script>
+ <script type='text/javascript' src='{% href "/content/js/jquery.flot.pack.js" %}'></script>
<script type="text/javascript">
$().ready(function(){
@@ -33,7 +34,7 @@
<div style="float:left;width:20px;color:red">{{ rep.negative }}</div>
</div>
- <a href="/questions/{{ rep.question_id }}/{{ rep.title }}">{{ rep.title }}</a> <span class="small">({{ rep.reputed_at }})</span>
+ <a href="{% url question rep.question_id %}{{ rep.title|slugify }}">{{ rep.title }}</a> <span class="small">({{ rep.reputed_at }})</span>
</p>
{% endfor %}
</div>
diff --git a/templates/user_responses.html b/templates/user_responses.html
index d739395b..c4f4ffed 100644
--- a/templates/user_responses.html
+++ b/templates/user_responses.html
@@ -11,7 +11,7 @@
<div style="width:100px;float:left"><a href="{{ response.userlink }}">{{ response.username }}</a></div>
<div style="float:left;overflow:hidden;width:680px">
<strong {% ifequal response.type "question_answered" %}class="user-action-2"{% endifequal %}{% ifequal response.type "answer_accepted" %}class="user-action-8"{% endifequal %}>{{ response.type }}</strong>:
- <a href="{{ response.titlelink }}">{{ response.title }}</a><br>
+ <a href="{{ response.titlelink }}">{{ response.title }}</a><br/>
{{ response.content|safe }}
<div style="height:10px"></div>
</div>
diff --git a/templates/user_stats.html b/templates/user_stats.html
index c324ff48..06f1cd2b 100644
--- a/templates/user_stats.html
+++ b/templates/user_stats.html
@@ -2,97 +2,104 @@
<!-- user_stats.html -->
{% load i18n %}
{% load extra_tags %}
+{% load extra_filters %}
{% load humanize %}
{% block usercontent %}
<a name="questions"></a>
- <table>
- <tr>
- <td>
- <div style="text-align: right;" class="count">{{questions|length}}</div>
- </td>
- <td>
- <h2>{% trans "User questions" %}</h2>
- </td>
- </tr>
- </table>
+ {% spaceless %}
+ <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" %}
- <p>&nbsp;</p>
<a name="answers"></a>
- <table>
- <tr>
- <td>
- <div style="text-align: right;" class="count">{{answered_questions|length}}</div>
- </td>
- <td >
- <h2>{% trans "Answers" %}</h2>
- </td>
- </tr>
- </table>
+ {% spaceless %}
+ <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 %}
<div class="answer-summary">
- <a title="{{answered_question.summary}}" href="/questions/{{answered_question.id}}/{{answered_question.title}}#{{answered_question.answer_id}}">
- <div class="answer-votes {% if answered_question.accepted %}answered-accepted{% endif %}"
- title="{% blocktrans with answered_question.vote_count as vote_count %}the answer has been voted for {{ vote_count }} times{% endblocktrans %}&#13;{% if answered_question.accepted %}{% trans "this answer has been selected as correct" %}{%endif%}">
+ <a title="{{answered_question.summary|collapse}}"
+ href="{% url question answered_question.id %}{{answered_question.title|slugify}}#{{answered_question.answer_id}}">
+ <span class="answer-votes {% if answered_question.accepted %}answered-accepted{% endif %}"
+ title="{% blocktrans with answered_question.vote_count as vote_count %}the answer has been voted for {{ vote_count }} times{% endblocktrans %} {% if answered_question.accepted %}{% trans "this answer has been selected as correct" %}{%endif%}">
{{ answered_question.vote_count }}
- </div>
+ </span>
</a>
<div class="answer-link">
- <a href="/questions/{{answered_question.id}}/{{answered_question.title}}#{{answered_question.answer_id}}">{{answered_question.title}}</a> {% if answered_question.comment_count %}<span
- title="{% blocktrans with answered_question.comment_count as count %}the answer has been commented {{count}} times{% endblocktrans %}">({{answered_question.comment_count}})</span>{% endif %}
+ {% spaceless %}
+ <a href="{% url question answered_question.id %}{{answered_question.title|slugify}}#{{answered_question.answer_id}}">{{answered_question.title}}</a>
+ {% 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 %}
+ </span>
+ {% endif %}
</div>
</div>
{% endfor %}
</div>
- <p>&nbsp;</p>
+ <br/>
<a name="votes"></a>
- <table>
- <tr>
- <td>
- <div style="text-align: right;" class="count">{{total_votes}}</div>
- </td>
- <td >
- <h2>{% trans "votes total" %}</h2>
- </td>
- </tr>
- </table>
+ {% spaceless %}
+ <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 height="50px">
+ <table>
<tr>
<td width="60">
- <img style="cursor: default;" align="absmiddle" src="/content/images/vote-arrow-up-on.png"/>
+ <img style="cursor: default;" src="{% href "/content/images/vote-arrow-up-on.png" %}" alt="{% trans "thumb up" %}" />
<span title="{% trans "user has voted up this many times" %}" class="vote-count">{{up_votes}}</span>
</td>
<td width="60">
- <img style="cursor: default;" align="absmiddle" src="/content/images/vote-arrow-down-on.png"/>
+ <img style="cursor: default;" src="{% href "/content/images/vote-arrow-down-on.png" %}" alt="{% trans "thumb down" %}" />
<span title="{% trans "user voted down this many times" %}" class="vote-count">{{down_votes}}</span>
</td>
</tr>
</table>
</div>
- <p>&nbsp;</p>
<a name="tags"></a>
- <table>
- <tr>
- <td>
- <div style="text-align: right;" class="count">{{tags|length}}</div>
- </td>
- <td >
- <h2>{% trans "Tags" %}</h2>
- </td>
- </tr>
- </table>
+ {% spaceless %}
+ <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">
<tr>
<td width="180" valign="top">
- {% for tag in tags%}
+ {% for tag in user_tags%}
<a rel="tag"
- title="{% blocktrans %}see other questions tagged '{{ tag }}' {% endblocktrans %}"
- href="{% url forum.views.tag tag|urlencode %}">{{tag.name}}</a><span class="tag-number"> × {{ tag.used_count|intcomma }}</span><br>
+ title="{% blocktrans with tag.name as tag_name %}see other questions tagged '{{ tag_name }}' {% endblocktrans %}"
+ href="{% url forum.views.tag tag|urlencode %}?user={{view_user.username}}">{{tag.name}}</a>
+ <span class="tag-number">&#215; {{ tag.user_tag_usage_count|intcomma }}</span><br/>
{% if forloop.counter|divisibleby:"10" %}
</td>
<td width="180" valign="top">
@@ -102,24 +109,22 @@
</tr>
</table>
</div>
- <p>&nbsp;</p>
<a name="badges"></a>
- <table>
- <tr>
- <td>
- <div style="text-align: right;" class="count">{{total_awards}}</div>
- </td>
- <td >
- <h2>{% trans "Badges" %}</h2>
- </td>
- </tr>
- </table>
+ {% spaceless %}
+ <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="/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"> × {{ award.count|intcomma }}</span><br>
+ <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"> &#x2715; {{ award.count|intcomma }}</span><br/>
{% if forloop.counter|divisibleby:"6" %}
</td>
<td width="180" style="line-height:35px">
@@ -129,6 +134,5 @@
</tr>
</table>
</div>
-
{% endblock %}
<!-- end user_stats.html -->
diff --git a/templates/user_tabs.html b/templates/user_tabs.html
index bcc12b8f..908e8430 100644
--- a/templates/user_tabs.html
+++ b/templates/user_tabs.html
@@ -4,28 +4,28 @@
<div class="tabBar">
<div class="tabsA">
<a id="stats" {% ifequal tab_name "stats" %}class="on"{% endifequal %}
- title="{% trans "User profile" %}" href="/users/{{view_user.id}}/{{view_user.username}}?sort=stats">{% trans "overview" %}</a>
+ title="{% trans "User profile" %}" href="{% url users %}{{view_user.id}}/{{view_user.username}}?sort=stats">{% trans "overview" %}</a>
<a id="recent" {% ifequal tab_name "recent" %}class="on"{% endifequal %}
- title="{% trans "recent activity" %}" href="/users/{{view_user.id}}/{{view_user.username}}?sort=recent">{% trans "recent activity" %}</a>
+ title="{% trans "recent activity" %}" href="{% url users %}{{view_user.id}}/{{view_user.username}}?sort=recent">{% trans "recent activity" %}</a>
{% if request.user|is_user_self:view_user %}
<a id="responses" {% ifequal tab_name "responses" %}class="on"{% endifequal %}
title="{% trans "comments and answers to others questions" %}"
- href="/users/{{view_user.id}}/{{view_user.username}}?sort=responses">{% trans "responses" %}</a>
+ href="{% url users %}{{view_user.id}}/{{view_user.username}}?sort=responses">{% trans "responses" %}</a>
{% endif %}
<a id="reputation" {% ifequal tab_name "reputation" %}class="on"{% endifequal %}
title="{% trans "graph of user reputation" %}"
- href="/users/{{view_user.id}}/{{view_user.username}}?sort=reputation">{% trans "reputation history" %}</a>
+ href="{% url users %}{{view_user.id}}/{{view_user.username}}?sort=reputation">{% trans "reputation history" %}</a>
{% if request.user|can_view_user_votes:view_user %}
<a id="votes" {% ifequal tab_name "votes" %}class="on"{% endifequal %}
- title="{% trans "user vote record" %}" href="/users/{{view_user.id}}/{{view_user.username}}?sort=votes">{% trans "casted votes" %}</a>
+ title="{% trans "user vote record" %}" href="{% url users %}{{view_user.id}}/{{view_user.username}}?sort=votes">{% trans "casted votes" %}</a>
{% endif %}
<a id="favorites" {% ifequal tab_name "favorites" %}class="on"{% endifequal %}
- title="{% trans "questions that user selected as his/her favorite"
- href="/users/{{view_user.id}}/{{view_user.username}}?sort=favorites">{% trans "favorites" %}</a>
+ title="{% trans "questions that user selected as his/her favorite" %}"
+ href="{% url users %}{{view_user.id}}/{{view_user.username}}?sort=favorites">{% trans "favorites" %}</a>
{% if request.user|can_view_user_preferences:view_user %}
- <a id="preferences" {% ifequal tab_name "preferences" %}class="on"{% endifequal %}
- title="{% trans "user preference settings" %}"
- href="/users/{{view_user.id}}/{{view_user.username}}?sort=preferences">{% trans "settings" %}</a>
+ <a id="email_subscriptions" {% ifequal tab_name "email_subscriptions" %}class="on"{% endifequal %}
+ title="{% trans "email subscription settings" %}"
+ href="{% url users %}{{view_user.id}}/{{view_user.username}}?sort=email_subscriptions">{% trans "email subscriptions" %}</a>
{% endif %}
</div>
</div>
diff --git a/templates/user_votes.html b/templates/user_votes.html
index 80fa27ee..94d7fcbd 100644
--- a/templates/user_votes.html
+++ b/templates/user_votes.html
@@ -1,6 +1,7 @@
{% extends "user.html" %}
<!-- user_votes.html -->
{% load extra_tags %}
+{% load extra_filters %}
{% load humanize %}
{% load i18n %}
@@ -11,16 +12,16 @@
<div style="width:150px;float:left">{% diff_date vote.voted_at 3 %}</div>
<div style="width:30px;float:left">
{% ifequal vote.vote 1 %}
- <img src="/content/images/vote-arrow-up-on.png" title="{% trans "upvote" %}">
+ <img src="{% href "/content/images/vote-arrow-up-on.png" %}" title="{% trans "upvote" %}">
{% else %}
- <img src="/content/images/vote-arrow-down-on.png" title="{% trans "downvote" %}">
+ <img src="{% href "/content/images/vote-arrow-down-on.png" %}" title="{% trans "downvote" %}">
{% endifequal %}
</div>
<div style="float:left;overflow:hidden;width:750px">
{% ifequal vote.answer_id 0 %}
- <span class="question-title-link"><a href="/questions/{{ vote.question_id }}/{{ vote.title }}">{{ vote.title }}</a></span>
+ <span class="question-title-link"><a href="{% url question vote.question_id %}{{ vote.title|slugify }}">{{ vote.title }}</a></span>
{% else %}
- <span class="answer-title-link" ><a href="/questions/{{ vote.question_id }}/{{ vote.title }}#{{ vote.answer_id }}">{{ vote.title }}</a></span>
+ <span class="answer-title-link" ><a href="{% url question vote.question_id %}{{ vote.title|slugify }}#{{ vote.answer_id }}">{{ vote.title }}</a></span>
{% endifequal %}
<div style="height:5px"></div>
</div>
diff --git a/templates/users.html b/templates/users.html
index 966596fc..3a59b0c0 100644
--- a/templates/users.html
+++ b/templates/users.html
@@ -23,10 +23,10 @@
<div class="tabBar">
<div class="headUsers">{% trans "Users" %}</div>
<div class="tabsA">
- <a id="sort_reputation" href="?sort=reputation" class="off" title="{% trans "reputation" %}">{% trans "reputation" %}</a>
- <a id="sort_newest" href="?sort=newest" class="off" title="{% trans "recent" %}">{% trans "recent" %}</a>
- <a id="sort_last" href="?sort=last" class="off" title="{% trans "oldest" %}">{% trans "oldest" %}</a>
- <a id="sort_user" href="?sort=user" class="off" title="{% trans "by username" %}">{% trans "by username" %}</a>
+ <a id="sort_reputation" href="{% url users %}?sort=reputation" class="off" title="{% trans "reputation" %}">{% trans "reputation" %}</a>
+ <a id="sort_newest" href="{% url users %}?sort=newest" class="off" title="{% trans "recent" %}">{% trans "recent" %}</a>
+ <a id="sort_last" href="{% url users %}?sort=last" class="off" title="{% trans "oldest" %}">{% trans "oldest" %}</a>
+ <a id="sort_user" href="{% url users %}?sort=user" class="off" title="{% trans "by username" %}">{% trans "by username" %}</a>
</div>
</div>
<div id="main-body" style="width:100%">
diff --git a/templates/users_questions.html b/templates/users_questions.html
index dfb87c8f..b445a74c 100644
--- a/templates/users_questions.html
+++ b/templates/users_questions.html
@@ -4,18 +4,20 @@
{% load humanize %}
{% load i18n %}
<div class="user-stats-table">
- {% for question in questions%}
+ {% for question in questions %}
{% if question.favourite_count %}
{% if question.favorited_myself %}
<div class="favorites-count">
<img title="{% trans "this questions was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}"
- src="/content/images/vote-favorite-on.png">
+ alt="{% trans "thumb-up on" %}"
+ src="{% href "/content/images/vote-favorite-on.png" %}"/>
<div><b>{{question.favourite_count|intcomma}}</b></div>
</div>
{% else %}
<div class="favorites-count-off">
<img title="{% trans "this question was selected as favorite" %}{{question.favourite_count}} {% trans "number of times" %}"
- src="/content/images/vote-favorite-off.png">
+ alt="{% trans "thumb-up off" %}"
+ src="{% href "/content/images/vote-favorite-off.png" %}"/>
<div><b>{{question.favourite_count|intcomma}}</b></div>
</div>
{% endif %}
@@ -23,28 +25,26 @@
<div class="favorites-empty"> </div>
{% endif %}
<div id="question-summary-{{question.id}}" class="question-summary narrow">
- <a style="text-decoration: none;" href="/questions/{{question.id}}/{{question.get_question_title}}">
+ <a style="text-decoration: none;" href="{% url question id=question.id %}{{question.title|slugify}}">
<div class="stats">
<div class="votes">
- <div class="vote-count-post">{{question.vote_count|intcomma}}</div>
+ <span class="vote-count-post">{{question.vote_count|intcomma}}</span>
{% trans "votes" %}
-
- </div>
+ </div >
<div title="{% if question.answer_accepted %}{% trans "this answer has been accepted to be correct" %}{% endif %}" class="status {% if question.answer_accepted %}answered-accepted{% endif %} {% ifequal question.answer_count 0 %}unanswered{% endifequal %}{% ifnotequal question.answer_count 0 %}answered{% endifnotequal %}">
- <div class="answer-count-post">{{question.answer_count|intcomma}}</div>
+ <span class="answer-count-post">{{question.answer_count|intcomma}}</span>
{% trans "answers" %}
-
</div>
<div class="views">
- <div class="views-count-post">{{question.view_count|cnprog_intword|safe}}</div>
+ <span class="views-count-post">{{question.view_count|cnprog_intword|safe}}</span>
{% trans "views" %}
</div>
</div>
</a>
<div class="summary">
- <h3>
- <a title="{{question.summary}}" href="/questions/{{question.id}}/{{question.title}}">{{question.title}}</a>
- </h3>
+ <div class="question-title">
+ <a title="{{question.summary}}" href="{% url question id=question.id %}{{question.title|slugify}}">{{question.title}}</a>
+ </div>
<div class="tags">
{% convert2tagname_list question %}
{% for tag in question.tagnames %}
@@ -55,12 +55,12 @@
<div class="started">
<span class="relativetime" title="{{question.last_activity_at}}">{% diff_date question.last_activity_at %}</span>
{% if question.la_username %}
- <a href="/users/{{question.la_user_id}}/{{question.la_username}}">{{question.la_username}}</a> {% get_score_badge_by_details question.la_user_reputation question.la_user_gold question.la_user_silver question.la_user_bronze%}
+ <a href="{% url users %}{{question.la_user_id}}/{{question.la_username}}">{{question.la_username}}</a> {% get_score_badge_by_details question.la_user_reputation question.la_user_gold question.la_user_silver question.la_user_bronze%}
{% endif %}
</div>
</div>
</div>
- <br clear="both"/>
+ <br clear="all"/>
{% endfor %}
</div>
<!-- end users_questions.html -->