Changeset 2:bc4b7b630f6a
- Timestamp:
- 11/23/09 16:07:45 (6 days ago)
- Branch:
- default
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
.hgignore
r1 r2 1 1 2 syntax: regexp 3 ^downloads$ 2 4 syntax: regexp 3 5 ^settings_local\.py$ … … 12 14 syntax: regexp 13 15 ^src/comt\.egg-info$ 16 syntax: regexp 17 ^parts$ 18 syntax: regexp 19 ^\.installed\.cfg$ -
src/cm/templates/site/text_notifications.html
r0 r2 71 71 </script> 72 72 73 <h2>{% blocktrans %}Embed the text{% endblocktrans %}</h2> 73 <h2>{% blocktrans %}Embed text{% endblocktrans %}</h2> 74 {% 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 %} 74 75 (<a title="{% blocktrans %}Help{% endblocktrans %}" target="_blank" href="{% url help %}#embed">?</a>) 75 <br />76 {% 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 %}77 76 <br/> 78 77 <br/> 79 <textarea rows="4" cols="80" readonly="true"> 80 <iframe frameborder="0" src="{{Â SITE_URL }}{% url text-view-comments-frame text.key %}" style="height: 166px; width: 99.9%; position: relative; top: 0px;"> 81 </iframe> 78 <input style="width:100%;background-color:#DDDDDD;" value="{{Â embed_code }}" type="text" readonly="true"></input> 82 79 </textarea> 83 80 {% if not anonymous_can_view_text %} 84 81 <br/> 85 82 {% url text-share text.key as text_users_link %} 86 <span style="color:#F00;">{% blocktrans %}Warning:{% endblocktrans %}</span>{% blocktrans %}You won't be able tosuccessfully embed the text before you <a href='{{ text_users_link }}'>give anonymous users</a> a role allowing them to view the text{% endblocktrans %}</span>83 <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> 87 84 {% endif %} 88 85 </form> -
src/cm/views/notifications.py
r0 r2 14 14 from django.utils import feedgenerator 15 15 from django.utils.translation import ugettext as _ 16 from cm.security import user_has_perm # import here!17 16 18 17 import re … … 73 72 user = request.user if request.user.is_authenticated() else None 74 73 75 anonymous_can_view_text = False 76 anonymous_user_role = UserRole.objects.get(user=None, text=text) 77 if anonymous_user_role : 78 anonymous_can_view_text = user_has_perm(anonymous_user_role.user, 'can_view_text', text=text) 74 from cm.security import user_has_perm # import here! 75 anonymous_can_view_text = user_has_perm(None, 'can_view_text', text=text) 79 76 own_check = Notification.objects.filter(text=text,type='own',user=user).count() 80 77 all_check = Notification.objects.filter(text=text,type=None,user=user).count() 78 79 80 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])) 81 81 82 if request.method == 'POST': 82 83 if 'activate' in request.POST: … … 99 100 'text' : text, 100 101 'all_check' : all_check, 101 'anonymous_can_view_text' : anonymous_can_view_text 102 'anonymous_can_view_text' : anonymous_can_view_text, 103 'embed_code': embed_code 102 104 } 103 105 return render_to_response('site/text_notifications.html', template_dict , context_instance=RequestContext(request))