Merge branch 'master' of github.com:Gluejar/regluit into fps

pull/1/head
Raymond Yee 2012-04-26 15:50:49 -07:00
commit 47a22f3ccb
70 changed files with 673 additions and 90 deletions

View File

@ -187,7 +187,7 @@ class Campaign(models.Model):
self.save()
active_claim = self.work.claim.filter(status="active")[0]
ungluers = self.work.wished_by()
notification.queue(ungluers, "active_campaign", {'campaign':self, 'active_claim':active_claim}, True)
notification.queue(ungluers, "wishlist_active", {'campaign':self, 'active_claim':active_claim}, True)
return self
@ -587,6 +587,30 @@ class Ebook(models.Model):
def set_provider(self):
self.provider=Ebook.infer_provider(self.url)
return self.provider
@property
def rights_badge(self):
my_rights=self.rights
if not my_rights:
return 'https://i.creativecommons.org/p/mark/1.0/88x31.png'
if my_rights == 'PD-US':
return 'https://i.creativecommons.org/p/mark/1.0/88x31.png'
elif my_rights == 'CC0':
return 'https://i.creativecommons.org/p/zero/1.0/88x31.png'
elif my_rights == 'CC BY':
return 'https://i.creativecommons.org/l/by/3.0/88x31.png'
elif my_rights == 'CC BY-NC-ND':
return 'https://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png'
elif my_rights == 'CC BY-NC-SA':
return 'https://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png'
elif my_rights == 'CC BY-NC':
return 'https://i.creativecommons.org/l/by-nc/3.0/88x31.png'
elif my_rights == 'CC BY-SA':
return 'https://i.creativecommons.org/l/by-sa/3.0/88x31.png'
elif my_rights == 'CC BY-ND':
return 'https://i.creativecommons.org/l/by-nd/3.0/88x31.png'
else:
return ''
@classmethod
def infer_provider(klass, url):

View File

@ -66,23 +66,40 @@ registration.signals.user_activated.connect(merge_emails)
# create notification types (using django-notification) -- tie to syncdb
def create_notice_types(app, created_models, verbosity, **kwargs):
notification.create_notice_type("wishlist_comment", _("Wishlist Comment"), _("a comment has been received on one of your wishlist books"), default = 1)
notification.create_notice_type("comment_on_commented", _("Comment on Commented Work"), _("a comment has been received on a book that you've commented on"))
notification.create_notice_type("successful_campaign", _("Successful Campaign"), _("a campaign that you have supported or followed has succeeded"))
notification.create_notice_type("active_campaign", _("New Campaign"), _("a book you've wishlisted has a newly launched campaign"))
notification.create_notice_type("comment_on_commented", _("Comment on Commented Work"), _("A comment has been received on a book that you've commented on."))
notification.create_notice_type("wishlist_comment", _("Wishlist Comment"), _("A comment has been received on one of your wishlist books."), default = 1)
notification.create_notice_type("wishlist_work_claimed", _("Rights Holder is Active"), _("A rights holder has shown up for a book that you want unglued."), default = 1)
notification.create_notice_type("wishlist_active", _("New Campaign"), _("A book you've wishlisted has a newly launched campaign."))
notification.create_notice_type("wishlist_near_target", _("Campaign Near Target"), _("A book you want is near its ungluing target."))
notification.create_notice_type("wishlist_near_deadline", _("Campaign Near Deadline"), _("A book you want is almost out of time."))
notification.create_notice_type("wishlist_premium_limited_supply", _("Only a Few Premiums Left"), _("You have a last chance for an ungluing premium you might like."))
notification.create_notice_type("wishlist_successful", _("Successful Campaign"), _("An ungluing campaign that you have supported or followed has succeeded."))
notification.create_notice_type("wishlist_unsuccessful", _("Unsuccessful Campaign"), _("An ungluing campaign that you supported didn't succeed this time."))
notification.create_notice_type("wishlist_updated", _("Campaign Updated"), _("An ungluing campaign you support has been updated."), default = 1)
notification.create_notice_type("wishlist_message", _("Campaign Communication"), _("There's a message about an ungluing campaign you're interested in."))
notification.create_notice_type("wishlist_price_drop", _("Campaign Price Drop"), _("An ungluing campign you're interested in has a reduced target."), default = 1)
notification.create_notice_type("wishlist_unglued_book_released", _("Unglued Book!"), _("Another book you wanted has been unglued!"))
notification.create_notice_type("pledge_you_have_pledged", _("Thanks For Your Pledge!"), _("Your ungluing pledge has been entered."))
notification.create_notice_type("pledge_status_change", _("Your Pledge Has Been Modified"), _("Your ungluing plegde has been modified."))
notification.create_notice_type("pledge_charged", _("Your Pledge has been Executed"), _("You have contributed to a successful ungluing campaign."))
notification.create_notice_type("rights_holder_created", _("Agreement Accepted"), _("You become a verified Ungue.it rights holder."))
notification.create_notice_type("rights_holder_claim_approved", _("Claim Accepted"), _("A claim you've entered has been accepted."))
signals.post_syncdb.connect(create_notice_types, sender=notification)
# define the notifications and tie them to corresponding signals
from django.contrib.comments.signals import comment_was_posted
def notify_comment(comment, request, **kwargs):
logger.info('comment %s notifying' % comment.pk)
other_commenters = User.objects.filter(comment_comments__content_type=comment.content_type, comment_comments__object_pk=comment.object_pk).distinct().exclude(id=comment.user.id)
other_wishers = comment.content_object.wished_by().exclude(id=comment.user.id).exclude(id__in=other_commenters)
notification.queue(other_commenters, "comment_on_commented", {'comment':comment}, True)
notification.queue(other_wishers, "wishlist_comment", {'comment':comment}, True)
from regluit.core.tasks import emit_notifications
emit_notifications.delay()
comment_was_posted.connect(notify_comment)
@ -99,7 +116,9 @@ def notify_successful_campaign(campaign, **kwargs):
supporters = (User.objects.get(id=k) for k in campaign.supporters())
site = Site.objects.get_current()
notification.queue(itertools.chain(staff, supporters), "successful_campaign", {'campaign':campaign, 'site':site}, True)
notification.queue(itertools.chain(staff, supporters), "wishlist_successful", {'campaign':campaign, 'site':site}, True)
from regluit.core.tasks import emit_notifications
emit_notifications.delay()
# successful_campaign -> send notices
successful_campaign.connect(notify_successful_campaign)

View File

@ -97,6 +97,13 @@ class ProfileForm(forms.ModelForm):
'tagline': forms.Textarea(attrs={'rows': 5, 'onKeyUp': "counter(this, 140)", 'onBlur': "counter(this, 140)"}),
}
class UserEmail(forms.Form):
email = forms.EmailField(
label=_("new email address"),
max_length=100,
error_messages={'required': 'Please enter an email address.'},
)
class UserData(forms.Form):
username = forms.RegexField(
label=_("New Username"),

View File

@ -91,7 +91,7 @@ Welcome to the alpha version of Unglue.It. This site is a preview of our full f
<span>About unglue.it</span>
<ul>
<li><a href="{{ abouturl }}">About</a></li>
<li><a href="http://www.gluejar.com/Blog">Blog</a></li>
<li><a href="http://blog.unglue.it">Blog</a></li>
<li><a href="{{ pressurl }}">Press</a></li>
<li><a href="http://eepurl.com/fKLfI">Newsletter</a></li>
</ul>

View File

@ -141,7 +141,7 @@
{% else %}{% if first_ebook %}
<span class="listview boolist-ebook">
{% for ebook in work.ebooks|slice:":3" %}
<a href="{{ebook.url}}">{{ ebook.format }}</a>
<a href="{{ ebook.url }}"><img src="/static/images/{{ ebook.format }}32.png" height="32" alt="{{ ebook.rights}} {{ ebook.format }} at {{ebook.provider}}" title="{{ ebook.rights}} {{ ebook.format }} at {{ebook.provider}}" /></a>
{% endfor %}
</span>
{% else %}

View File

@ -488,7 +488,7 @@ Need more ideas? We're happy to work with rights holders personally to craft a
<dt>Are contributions refundable?</dt>
<dd>Ungluers are free to modify or cancel their pledges before a campaign ends. At that point, their credit cards will be charged nonrefundably.</dd>
<dd>No. Once a campaign to which you have pledged succeeds, your credit card will be charged the full amount of your pledge nonrefundably. However, you will not be charged until, and unless, the campaign succeeds. Before that time you may modify or cancel your pledge without charge.</dd>
<dt>What if an ungluer contests a charge?</dt>

View File

@ -1,13 +0,0 @@
Congratulations, you wished for it, and now there is an active Campaign for {{ campaign.work.title }} to be Unglued. If ungluers like you pledge {{ campaign.target }} by {{ campaign.deadline }}, this book will be released under a Creative Commons license for everyone to enjoy.
You can help!
<a href="{% url pledge work_id=campaign.work.id %}">Pledge</a> toward ungluing.
Tell your friends -- there are handy share options on the <a href="{% url work campaign.work.id %}">campaign page</a>. There's even a widget you can put on your blog or home page.
<a href="{% url work campaign.work.id %}?tab=2">Join the discussion</a>: share why you love {{ campaign.work.title }} and the world will too.
Thank you!
{{ active_claim.rights_holder.rights_holder_name }} (rights holder for {{ campaign.work.title }}) and the Unglue.It Team

View File

@ -1,7 +1,7 @@
{% extends "notification/base.html" %}
{% load i18n %}
{% load truncatechars %}
{% block title %}{% trans "Notification Settings" %}{% endblock %}
{% block extra_css %}
@ -9,7 +9,7 @@
{% endblock %}
{% block doccontent %}
<h2>{% trans "Settings" %}</h2>
<h2>{% trans "Notification Settings" %}</h2>
<a href="{% url notification_notices %}">
<div class="notices_menu">
@ -19,19 +19,20 @@
<div class="comments"></div>
<div class="notice_settings">
<p>Which notifications would you like to receive via email?</p>
<form method="POST" action="">
{% csrf_token %}
<table class="notice_settings table table-striped">
<h3>Comment Notifications</h3>
<table class="notice_settings table table-striped" width="90%">
<tr>
<th>{% trans "Notification Type" %}</th>
<th>{% trans "Notify me when..." %}</th>
{% for header in notice_settings.column_headers %}
<th>{{ header }}</th>
{% endfor %}
</tr>
{% for row in notice_settings.rows %}
{% if row.notice_type.label|truncatechars:11 == 'comment_...' %}
<tr class="{% cycle 'row1' 'row2' %}">
<td>{% trans row.notice_type.display %}<br/>
<td>
<span class="notice_type_description">{% trans row.notice_type.description %}</span>
</td>
{% for cell in row.cells %}
@ -40,6 +41,85 @@
</td>
{% endfor %}
</tr>
{% endif %}
{% endfor %}
<tr>
<td colspan="2" id="last"><input type="submit" value="{% trans 'Change' %}"></input></td>
</tr>
</table>
<h3>Wishlist Notifications</h3>
<table class="notice_settings table table-striped" width="90%">
<tr>
<th>{% trans "Notify me when..." %}</th>
{% for header in notice_settings.column_headers %}
<th>{{ header }}</th>
{% endfor %}
</tr>
{% for row in notice_settings.rows %}
{% if row.notice_type.label|truncatechars:12 == 'wishlist_...' %}
<tr class="{% cycle 'row1' 'row2' %}">
<td>
<span class="notice_type_description">{% trans row.notice_type.description %}</span>
</td>
{% for cell in row.cells %}
<td>
<input type="checkbox" name="{{ cell.0 }}" {% if cell.1 %}checked="yes"{% endif %}/>
</td>
{% endfor %}
</tr>
{% endif %}
{% endfor %}
<tr>
<td colspan="2" id="last"><input type="submit" value="{% trans 'Change' %}"></input></td>
</tr>
</table>
<h3>Pledge Notifications</h3>
<table class="notice_settings table table-striped" width="90%">
<tr>
<th>{% trans "Notify me when..." %}</th>
{% for header in notice_settings.column_headers %}
<th>{{ header }}</th>
{% endfor %}
</tr>
{% for row in notice_settings.rows %}
{% if row.notice_type.label|truncatechars:10 == 'pledge_...' %}
<tr class="{% cycle 'row1' 'row2' %}">
<td>
<span class="notice_type_description">{% trans row.notice_type.description %}</span>
</td>
{% for cell in row.cells %}
<td>
<input type="checkbox" name="{{ cell.0 }}" {% if cell.1 %}checked="yes"{% endif %}/>
</td>
{% endfor %}
</tr>
{% endif %}
{% endfor %}
<tr>
<td colspan="2" id="last"><input type="submit" value="{% trans 'Change' %}"></input></td>
</tr>
</table>
<h3>Rights Holder Notifications</h3>
<table class="notice_settings table table-striped" width="90%">
<tr>
<th>{% trans "Notify me when..." %}</th>
{% for header in notice_settings.column_headers %}
<th>{{ header }}</th>
{% endfor %}
</tr>
{% for row in notice_settings.rows %}
{% if row.notice_type.label|truncatechars:10 == 'rights_...' %}
<tr class="{% cycle 'row1' 'row2' %}">
<td>
<span class="notice_type_description">{% trans row.notice_type.description %}</span>
</td>
{% for cell in row.cells %}
<td>
<input type="checkbox" name="{{ cell.0 }}" {% if cell.1 %}checked="yes"{% endif %}/>
</td>
{% endfor %}
</tr>
{% endif %}
{% endfor %}
<tr>
<td colspan="2" id="last"><input type="submit" value="{% trans 'Change' %}"></input></td>
@ -47,20 +127,20 @@
</table>
</form>
{% url acct_email as email_url %}
<h4>Your email</h4>
<h3>Your email</h3>
{% if user.email %}
<p>
{{ user.email }}<br />
</p>
<p>
({% blocktrans %}You can change this under <a href="{{ email_url }}">Account</a>.{% endblocktrans %})
({% blocktrans %}You can change this under <a href="{{ editurl }}">Account</a>.{% endblocktrans %})
</p>
{% else %}
<div class="errorlist">
{% blocktrans %}
You do not have a verified email address to which notices can be sent.
You can add one by going to <a href="{{ email_url }}">Account</a>.
You can add one by going to <a href="{{ editurl }}">Account</a>.
{% endblocktrans %}
</div>
{% endif %}

View File

@ -39,7 +39,7 @@
{% endif %}
{% endfor %}
{% else %}
<p>{% trans "No notices." %}</p>
<p>{% trans "You have no unseen notices." %}</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,13 @@
Congratulations, you wished for it, and now there is an active Campaign for {{ campaign.work.title }} to be Unglued. If ungluers like you pledge {{ campaign.target }} by {{ campaign.deadline }}, this book will be released under a Creative Commons license for everyone to enjoy.
You can help!
Pledge toward ungluing. {% url pledge work_id=campaign.work.id %}
Tell your friends -- there are handy share options on the campaign page. There's even a widget you can put on your blog or home page. {% url work campaign.work.id %}
Join the discussion: share why you love {{ campaign.work.title }} and the world will too. {% url work campaign.work.id %}?tab=2
Thank you!
{{ active_claim.rights_holder.rights_holder_name }} (rights holder for {{ campaign.work.title }}) and the Unglue.It Team

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,7 @@
Message! About {{ campaign.work.title}}
(http://{{site.domain}}{% url work campaign.work.id %}?tab=2) something.
You will something.
You will be also something.
Give ebooks to the world; give income to authors and publishers. Unglue.it.

View File

@ -0,0 +1,19 @@
<div class="comments clearfix">
<div class="comments_book">
<a href="{% url work campaign.work.id %}?tab=2"><img src="{{ campaign.work.cover_image_thumbnail }}" alt="cover image for {{ campaign.work.title }}" /></a>
</div>
<div class="comments_info">
<div class="comments_graphical">
</div>
<div class="comments_textual">
<p>
text comments
</p>
<p class="classname">Give ebooks to the world; give income to authors and publishers. Unglue.it</p>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
blurb for {{campaign.work.title}}

View File

@ -0,0 +1,6 @@
The email address for your unglue.it accound has been changed from {{oldemail}} to {{request.user.email}}.
If there's any reason that this is in error, please contact us at support@gluejar.com
Sincerely,
The unglue.it Team

View File

@ -1,16 +1,26 @@
{% extends "registration/registration_base.html" %}
{% block title %}Change User Data{% endblock %}
{% block doccontent %}
<h1>Changing Your Username</h1>
<h2>Changing Your Username</h2>
<p> If you change your username, the web address for your profile page will change as well.</p>
<div>
<p> <b>Your current username:</b> {{ user.username }}</p>
<form method="POST" action="#">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="submit" value="Change username" id="submit">
<input type="submit" name="change_username" value="Change username" id="submit_username">
</form>
</div>
<div>
<h2>Changing Your Email</h2>
<p> <b>Your current email:</b> {{ user.email }}</p>
<form method="POST" action="#">
{% csrf_token %}
{{ emailform.as_p }}
<input type="submit" name="change_email" value="Change email" id="submit_email">
</form>
</div>
<p>Want to <a href="/accounts/password/change/">change your password</a> instead?</p>
{% endblock %}

View File

@ -110,9 +110,20 @@ $j(document).ready(function(){
{% endif %}
</div>
</div>
{% if work.first_ebook %}
<div class="get-book">
<label>Get it:</label>
<span class="find-link">
{% for ebook in work.ebooks %}
<a href="{{ ebook.url }}"><img src="/static/images/{{ ebook.format }}32.png" height="32" alt=" {{ ebook.format }} at {{ebook.provider}}" title=" {{ ebook.format }} at {{ebook.provider}}" /><img src="{{ebook.rights_badge}}" height="31" width="88" alt="{{ebook.rights}}" title="{{ebook.rights}}" /></a>
{% endfor %}
</span>
</div>
{% endif %}
<div class="find-book">
<label>Find it:</label>
<div class="find-link">
<div class="find-link">
<a id="find-google" href="{{ work.googlebooks_url }}"><img src="/static/images/supporter_icons/googlebooks_square.png" title="Find on Google Books" alt="Find on Google Books" /></a>
<a rel="nofollow" class="find-openlibrary" href="{% url work_openlibrary work.id %}"><img src="/static/images/supporter_icons/openlibrary_square.png" title="Find on OpenLibrary" alt="Find on OpenLibrary" /></a>
{% if not request.user.is_anonymous %}
@ -167,13 +178,6 @@ $j(document).ready(function(){
<span id="w{{ work.googlebooks_id }}">Add to Wishlist</span>
</div>
{% endif %}{% endif %}{% endif %}
{% if work.first_ebook %}
<span class="boolist-ebook">
{% for ebook in work.ebooks %}
<a href="{{ ebook.url }}">{{ ebook.format }}</a> {{ebook.rights}} at {{ebook.provider}}<br />
{% endfor %}
</span>
{% endif %}
</div>
</div>
</div>

View File

@ -12,7 +12,6 @@ from re import sub
from itertools import islice
from decimal import Decimal as D
from xml.etree import ElementTree as ET
import requests
import oauth2 as oauth
from django import forms
@ -20,7 +19,6 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail import send_mail
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.comments import Comment
@ -29,6 +27,7 @@ from django.forms import Select
from django.forms.models import modelformset_factory
from django.http import HttpResponseRedirect, Http404
from django.http import HttpResponse, HttpResponseNotFound
from django.template.loader import render_to_string
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from django.views.generic.edit import FormView
@ -38,11 +37,12 @@ from django.shortcuts import render, render_to_response, get_object_or_404
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from regluit.core import tasks
from regluit.core.tasks import send_mail_task
from regluit.core import models, bookloader, librarything
from regluit.core import userlists
from regluit.core.search import gluejar_search
from regluit.core.goodreads import GoodreadsClient
from regluit.frontend.forms import UserData, ProfileForm, CampaignPledgeForm, GoodreadsShelfLoadingForm
from regluit.frontend.forms import UserData, UserEmail, ProfileForm, CampaignPledgeForm, GoodreadsShelfLoadingForm
from regluit.frontend.forms import RightsHolderForm, UserClaimForm, LibraryThingForm, OpenCampaignForm
from regluit.frontend.forms import ManageCampaignForm, DonateForm, CampaignAdminForm, EmailShareForm, FeedbackForm
from regluit.frontend.forms import EbookForm, CustomPremiumForm, EditManagersForm
@ -1089,20 +1089,35 @@ def supporter(request, supporter_username, template_name):
return render(request, template_name, context)
def edit_user(request):
form=UserData()
if not request.user.is_authenticated():
return HttpResponseRedirect(reverse('auth_login'))
return HttpResponseRedirect(reverse('auth_login'))
form=UserData()
emailform = UserEmail({'email':request.user.email})
oldusername=request.user.username
oldemail= request.user.email
if request.method == 'POST':
# surely there's a better way to add data to the POST data?
postcopy=request.POST.copy()
postcopy['oldusername']=oldusername
form = UserData(postcopy)
if form.is_valid(): # All validation rules pass, go and change the username
request.user.username=form.cleaned_data['username']
request.user.save()
return HttpResponseRedirect(reverse('home')) # Redirect after POST
return render(request,'registration/user_change_form.html', {'form': form},)
if 'change_username' in request.POST.keys():
# surely there's a better way to add data to the POST data?
postcopy=request.POST.copy()
postcopy['oldusername']=oldusername
form = UserData(postcopy)
if form.is_valid(): # All validation rules pass, go and change the username
request.user.username=form.cleaned_data['username']
request.user.save()
return HttpResponseRedirect(reverse('home')) # Redirect after POST
elif 'change_email' in request.POST.keys():
emailform = UserEmail(request.POST)
if emailform.is_valid():
request.user.email=emailform.cleaned_data['email']
request.user.save()
send_mail_task.delay(
'unglue.it email changed',
render_to_string('registration/email_changed.txt',{'oldemail':oldemail,'request':request}),
None,
[request.user.email,oldemail]
)
return HttpResponseRedirect(reverse('home')) # Redirect after POST
return render(request,'registration/user_change_form.html', {'form': form,'emailform': emailform})
def search(request):
@ -1601,7 +1616,7 @@ def emailshare(request):
message = form.cleaned_data['message']
sender = form.cleaned_data['sender']
recipient = form.cleaned_data['recipient']
send_mail(subject, message, sender, [recipient])
send_mail_task.delay(subject, message, sender, [recipient])
try:
next = form.cleaned_data['next']
except:
@ -1609,41 +1624,41 @@ def emailshare(request):
return HttpResponseRedirect(next)
else:
sender = request.user.email
try:
next = request.GET['next']
if "pledge" in request.path:
work_id = next.split('=')[1]
book = models.Work.objects.get(pk=int(work_id))
title = book.title
message = "I just pledged to unglue one of my favorite books, "+title+", on Unglue.It: http://unglue.it/work/"+work_id+". If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth. Will you join me?"
subject = "Help me unglue "+title
work_id = next.split('=')[1]
book = models.Work.objects.get(pk=int(work_id))
title = book.title
message = "I just pledged to unglue one of my favorite books, "+title+", on Unglue.It: http://unglue.it/work/"+work_id+". If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth. Will you join me?"
subject = "Help me unglue "+title
else:
work_id = next.split('/')[-2]
work_id = int(work_id)
book = models.Work.objects.get(pk=work_id)
title = book.title
# if title requires unicode let's ignore it for now
try:
title = ', '+str(title)+', '
except:
title = ' '
try:
status = book.last_campaign().status
except:
status = None
work_id = next.split('/')[-2]
work_id = int(work_id)
book = models.Work.objects.get(pk=work_id)
title = book.title
# if title requires unicode let's ignore it for now
try:
title = ', '+str(title)+', '
except:
title = ' '
try:
status = book.last_campaign().status
except:
status = None
# customize the call to action depending on campaign status
if status == 'ACTIVE':
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: http://unglue.it/'+next+'. If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth.'
else:
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: http://unglue.it'+next+'. If enough of us wishlist this book, Unglue.It may start a campaign to pay the creator and make the ebook free to everyone on earth.'
subject = 'Come see one of my favorite books on Unglue.It'
form = EmailShareForm(initial={'next':next, 'subject': subject, 'message': message})
# customize the call to action depending on campaign status
if status == 'ACTIVE':
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: http://unglue.it/'+next+'. If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth.'
else:
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: http://unglue.it'+next+'. If enough of us wishlist this book, Unglue.It may start a campaign to pay the creator and make the ebook free to everyone on earth.'
subject = 'Come see one of my favorite books on Unglue.It'
form = EmailShareForm(initial={'sender': sender, 'next':next, 'subject': subject, 'message': message})
except:
next = ''
sender = ''
form = EmailShareForm(initial={'next':next, 'subject': 'Come join me on Unglue.It', 'message':"I'm ungluing books on Unglue.It. Together we're paying creators and making ebooks free to everyone on earth. Join me! http://unglue.it"})
form = EmailShareForm(initial={'sender': sender, 'next':next, 'subject': 'Come join me on Unglue.It', 'message':"I'm ungluing books on Unglue.It. Together we're paying creators and making ebooks free to everyone on earth. Join me! http://unglue.it"})
return render(request, "emailshare.html", {'form':form})
@ -1666,7 +1681,7 @@ def feedback(request):
else:
ungluer = request.user.username
message = "<<<This feedback is about "+page+". Original user message follows\nfrom "+sender+", ungluer name "+ungluer+"\nwith user agent "+useragent+"\n>>>\n"+message
send_mail(subject, message, sender, [recipient])
send_mail_task.delay(subject, message, sender, [recipient])
return render(request, "thanks.html", {"page":page})

View File

@ -287,6 +287,18 @@ ul.menu {
list-style: none;
border: none;
}
.errorlist + input {
border: 2px solid #e35351 !important;
}
.errorlist + input:focus {
border: 1px solid #8dc63f !important;
}
.errorlist + textarea {
border: 2px solid #e35351 !important;
}
.errorlist + textarea:focus {
border: 2px solid #8dc63f !important;
}
/* add class clearfix to floats to make them self-clear */
.clearfix:after {
content: ".";

BIN
static/images/EPUB32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
static/images/HTML32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
static/images/MOBI32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
static/images/PDF32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/images/TEXT32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -188,6 +188,22 @@ ul.menu{
.errors;
}
.errorlist + input {
border: 2px solid @alert !important;
&:focus {
border: 1px solid @call-to-action !important;
}
}
.errorlist + textarea {
border: 2px solid @alert !important;
&:focus {
border: 2px solid @call-to-action !important;
}
}
/* add class clearfix to floats to make them self-clear */
.clearfix:after {
content: ".";

View File

@ -22,6 +22,19 @@ def all_zones():
def all_rds():
return rds.get_all_dbinstances()
def all_rds_parameter_groups():
return rds.get_all_dbparameter_groups()
def modify_please1_pg_group():
"""kinda ugly
http://stackoverflow.com/a/9085381/7782
After doing this, I changed please db to talk to this parameter group and rebooted db
"""
pg = conn.get_all_dbparameters('mygroup')
pg2 = rds.get_all_dbparameters('mygroup', marker = pg.Marker)
pg2['tx_isolation'].value = True
pg2['tx_isolation'].apply(True)
def all_snapshots(owner=GLUEJAR_ACCOUNT_ID):
"""by default, return only snapshots owned by Gluejar -- None returns all snapshots available to us"""
return ec2.get_all_snapshots(owner=owner)
@ -72,7 +85,6 @@ def launch_time(instance):
def max_cpu(instance):
pass
def stats_for_instances(instances=None):
"""return basic stats for input instances"""
if instances is None: