--- a/.hgignore Mon Nov 23 15:31:03 2009 +0100
+++ b/.hgignore Mon Nov 23 16:07:45 2009 +0100
@@ -1,5 +1,7 @@
syntax: regexp
+^downloads$
+syntax: regexp
^settings_local\.py$
syntax: regexp
^urls_local\.py$
@@ -10,4 +12,8 @@
syntax: regexp
^eggs$
syntax: regexp
-^src/comt\.egg-info$
\ No newline at end of file
+^src/comt\.egg-info$
+syntax: regexp
+^parts$
+syntax: regexp
+^\.installed\.cfg$
--- a/src/cm/templates/site/text_notifications.html Mon Nov 23 15:31:03 2009 +0100
+++ b/src/cm/templates/site/text_notifications.html Mon Nov 23 16:07:45 2009 +0100
@@ -70,20 +70,17 @@
-->
</script>
-<h2>{% blocktrans %}Embed the text{% endblocktrans %}</h2>
+<h2>{% 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 %}
(<a title="{% blocktrans %}Help{% endblocktrans %}" target="_blank" href="{% url help %}#embed">?</a>)
-<br />
-{% 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 %}
<br/>
<br/>
-<textarea rows="4" cols="80" readonly="true">
-<iframe frameborder="0" src="{{ SITE_URL }}{% url text-view-comments-frame text.key %}" style="height: 166px; width: 99.9%; position: relative; top: 0px;">
-</iframe>
+<input style="width:100%;background-color:#DDDDDD;" value="{{ embed_code }}" type="text" readonly="true"></input>
</textarea>
{% if not anonymous_can_view_text %}
<br/>
{% url text-share text.key as text_users_link %}
-<span style="color:#F00;">{% blocktrans %}Warning:{% endblocktrans %}</span>{% blocktrans %}You won't be able to successfully embed the text before you <a href='{{ text_users_link }}'>give anonymous users</a> a role allowing them to view the text{% endblocktrans %}</span>
+<span style="color:#F00;">{% blocktrans %}Warning:{% endblocktrans %}</span>{% blocktrans %}You won't successfully embed the text before you <a href='{{ text_users_link }}'>give anonymous users</a> a role allowing them to view the text{% endblocktrans %}</span>
{% endif %}
</form>
</div>
--- a/src/cm/views/notifications.py Mon Nov 23 15:31:03 2009 +0100
+++ b/src/cm/views/notifications.py Mon Nov 23 16:07:45 2009 +0100
@@ -13,7 +13,6 @@
from django.template.loader import render_to_string
from django.utils import feedgenerator
from django.utils.translation import ugettext as _
-from cm.security import user_has_perm # import here!
import re
import time
@@ -72,12 +71,14 @@
text = get_text_by_keys_or_404(key)
user = request.user if request.user.is_authenticated() else None
- anonymous_can_view_text = False
- anonymous_user_role = UserRole.objects.get(user=None, text=text)
- if anonymous_user_role :
- anonymous_can_view_text = user_has_perm(anonymous_user_role.user, 'can_view_text', text=text)
+ from cm.security import user_has_perm # import here!
+ anonymous_can_view_text = user_has_perm(None, 'can_view_text', text=text)
own_check = Notification.objects.filter(text=text,type='own',user=user).count()
all_check = Notification.objects.filter(text=text,type=None,user=user).count()
+
+
+ embed_code = '<iframe frameborder="0" src="%s%s" style="height: 166px; width: 99.9%%; position: relative; top: 0px;">'%(settings.SITE_URL, reverse('text-view-comments-frame', args=[text.key]))
+
if request.method == 'POST':
if 'activate' in request.POST:
text.private_feed_key = generate_key()
@@ -98,6 +99,7 @@
template_dict = {
'text' : text,
'all_check' : all_check,
- 'anonymous_can_view_text' : anonymous_can_view_text
+ 'anonymous_can_view_text' : anonymous_can_view_text,
+ 'embed_code': embed_code
}
return render_to_response('site/text_notifications.html', template_dict , context_instance=RequestContext(request))