--- a/src/cm/templates/site/macros/text_tabs.html Tue Jan 26 12:29:05 2010 +0100
+++ b/src/cm/templates/site/macros/text_tabs.html Wed Jan 27 14:57:38 2010 +0100
@@ -21,9 +21,7 @@
{% if user.is_authenticated %}
<li><a id="followup_tab_link" class="cust_behav" href="#followup_settings">{% blocktrans %}Followup{% endblocktrans %}</a></li>
{% endif %}
- {% if can_manage_text %}
<li><a id="embed_tab_link" class="cust_behav" href="#text_embed">{% blocktrans %}Embed{% endblocktrans %}</a></li>
- {% endif %}
</ul>
</div>
@@ -45,54 +43,53 @@
tb_conf['followup-view-url'] = "{% url text-followup text.key %}";
{% endif %}
-{% if can_manage_text %}
tb_conf['embed-view-url'] = "{% url text-embed text.key %}";
-{% endif %}
renderTabs = function (current_tab) {
+ var delta = -1;
var tab_index = 0;
+ delta = delta + 1;
if (current_tab == 'view') {
- tab_index = 0;
+ tab_index = delta;
}
- var delta = 0;
{% if can_edit_text %}
- delta = 1;
+ delta = delta + 1;
if (current_tab == 'edit') {
- tab_index = 1;
+ tab_index = delta;
}
{% endif %}
{% if can_manage_text %}
- delta = 2;
+ delta = delta + 1;
if (current_tab == 'share') {
- tab_index = 2;
+ tab_index = delta;
}
{% endif %}
+ delta = delta + 1;
if (current_tab == 'history') {
- tab_index = 1 + delta;
+ tab_index = delta;
}
{% if can_manage_text %}
- delta = 3;
+ delta = delta + 1;
if (current_tab == 'settings') {
- tab_index = 4;
+ tab_index = delta;
}
{% endif %}
{% if user.is_authenticated %}
+ delta = delta + 1;
if (current_tab == 'followup') {
- tab_index = 2 + delta;
+ tab_index = delta;
}
{% endif %}
- {% if can_manage_text %}
+ delta = delta + 1;
if (current_tab == 'embed') {
- tab_index = 3 + delta;
+ tab_index = delta;
}
- {% endif %}
-
-
+
$("#text-tabs").tabs({ ajaxOptions: { async: false }, selected: tab_index}) ;
$('.cust_behav').click(function() {
--- a/src/cm/templates/site/text_embed.html Tue Jan 26 12:29:05 2010 +0100
+++ b/src/cm/templates/site/text_embed.html Wed Jan 27 14:57:38 2010 +0100
@@ -10,6 +10,7 @@
{% block main %}
{% get_local_perm request can_manage_workspace as can_manage_workspace %}
{% get_local_perm request can_view_unapproved_comment as can_view_unapproved_comment %}
+{% get_local_text_perm request text can_manage_text as can_manage_text %}
<script type="text/javascript">
<!--
@@ -22,16 +23,19 @@
<form id="embed" enctype="multipart/form-data" action="." method="post">
<h2 class="title_first">{% blocktrans %}Embed text{% endblocktrans %}</h2>
-{% blocktrans %}Copy this code into your site to display text with comments. Users will also be able to add comments from your site depending an anonymous users' roles.{% endblocktrans %}
+{% blocktrans %}Copy this code into your site to display text with comments.{% endblocktrans %} {% blocktrans %}Users will also be able to add comments from your site depending on anonymous users' roles.{% endblocktrans %}
(<a title="{% blocktrans %}Help{% endblocktrans %}" target="_blank" href="{% url help %}#embed">?</a>)
<br/>
<br/>
<input style="width:100%;background-color:#DDDDDD;" value="{{ embed_code }}" type="text" readonly="true"></input>
</textarea>
+
{% if not anonymous_can_view_text %}
+{% if can_manage_text %}
<br/>
<span style="color:#F00;">{% blocktrans %}Warning:{% endblocktrans %}</span>{% blocktrans %}You won't successfully embed the text before you give anonymous users a role allowing them to view the text.{% endblocktrans %}</span>
{% endif %}
+{% endif %}
</form>
</div>