Merge pull request #366 from Gluejar/improve_rh_experience

Improve rh experience
pull/1/head
Raymond Yee 2014-07-08 13:32:18 -07:00
commit 3cdae2d6bb
7 changed files with 111 additions and 38 deletions

View File

@ -134,7 +134,7 @@ class Claim(models.Model):
rights_holder = models.ForeignKey("RightsHolder", related_name="claim", null=False )
work = models.ForeignKey("Work", related_name="claim", null=False )
user = models.ForeignKey(User, related_name="claim", null=False )
status = models.CharField(max_length=7, choices=STATUSES, default='pending')
status = models.CharField(max_length=7, choices=STATUSES, default='active')
@property
def can_open_new(self):
@ -394,7 +394,7 @@ class Campaign(models.Model):
# status: INITIALIZED, ACTIVE, SUSPENDED, WITHDRAWN, SUCCESSFUL, UNSUCCESSFUL
status = models.CharField(max_length=15, null=True, blank=False, default="INITIALIZED")
type = models.PositiveSmallIntegerField(null = False, default = REWARDS,
choices=((REWARDS,'Rewards-based fixed duration campaign'),(BUY2UNGLUE,'Buy-to-unglue campaign'),(THANKS,'Thanks-for-ungluing campaign')))
choices=((REWARDS,'Pledge-to-unglue campaign'),(BUY2UNGLUE,'Buy-to-unglue campaign'),(THANKS,'Thanks-for-ungluing campaign')))
edition = models.ForeignKey("Edition", related_name="campaigns", null=True)
email = models.CharField(max_length=100, blank=True)
publisher = models.ForeignKey("Publisher", related_name="campaigns", null=True)

View File

@ -330,7 +330,7 @@ class OpenCampaignForm(forms.ModelForm):
class Meta:
model = Campaign
fields = 'name', 'work', 'managers', 'type'
widgets = { 'work': forms.HiddenInput }
widgets = { 'work': forms.HiddenInput, "name": forms.HiddenInput, }
def getTransferCreditForm(maximum, data=None, *args, **kwargs ):
class TransferCreditForm(forms.Form):

View File

@ -1,5 +1,5 @@
{% ifequal claim.status 'active' %}
{{ claim.rights_holder }}'s claim to {{ claim.work }} on Unglue.it has been approved.
{{ claim.rights_holder }}'s claim to {{ claim.work }} on Unglue.it has been registered.
You are now free to start a campaign to sell or unglue your work. If you're logged in, you will see the option to open a campaign at https://{{ current_site.domain }}/rightsholders . (You can also find this page by clicking on "Rights Holder Tools" at the bottom of any Unglue.it page.)

View File

@ -12,7 +12,7 @@
{{ claim.rights_holder }}'s Claim to {{ claim.work.title }} is now {{ claim.status }}.
<br /><br />
{% ifequal claim.status 'active' %}
{{ claim.rights_holder }}'s claim to {{ claim.work }} on Unglue.it has been approved.
{{ claim.rights_holder }}'s claim to {{ claim.work }} on Unglue.it has been registered.
<br /><br />
You are now free to start a campaign to sell or unglue your work. If you're logged in, you can <a href="{% url rightsholders %}">open a campaign</a>. (You can also find this page by clicking on "Rights Holder Tools" at the bottom of any Unglue.it page.)
<br /><br />

View File

@ -19,16 +19,29 @@
<div class="presstoc"><div class="pressemail">
Any questions not covered here? Please email us at <a href="mailto:rights@gluejar.com">rights@gluejar.com</a>.
</div></div>
<h2>Contents</h2>
<ul class="bullets">
{% if campaigns %}
<li><a href="#managed_campaigns">Campaigns You Manage</a></li>
{% endif %}
{% if request.user.rights_holder.count %}
<li><a href="#open_campaigns">Works You Have Claimed</a></li>
{% endif %}
{% if request.user.rights_holder.count %}
<li><a href="#your_rhs">Rights Holders That You Administer</a></li>
{% endif %}
<li><a href="#how_to">How to Make an Unglue.it Campaign</a></li>
<li><a href="#about_campaigns">About Campaigns</a></li>
</ul>
{% comment %}
<h2>Getting started</h2>
<p>
<a href="/static/images/How_to_claim_your_work.mp4">How to claim your work</a> (screencast)
</p>
{% comment %}
<p>
<a href="/static/images/How_to_set_up_your_campaign.mp4">How to set up your campaign</a> (screencast)
</p>
{% endcomment %}
<p>
<a href="/static/images/How_to_embed_a_widget.mp4">How to embed a widget for your book</a> in your blog, web site, etc. (screencast)
</p>
@ -40,9 +53,10 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
<p>
<a href="/static/images/How_to_embed_a_video.mp4">How to embed a video</a> in your campaign page (screencast)
</p>
{% endcomment %}
{% if campaigns %}
<h2>Campaigns You Manage</h2>
<h2 id="managed_campaigns">Campaigns You Manage</h2>
<dl>
{% for campaign in campaigns %}
<dt><a href="{% url work work_id=campaign.work.id %}">{{campaign.name }}</a></dt>
@ -96,7 +110,7 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
</dl>
{% endif %}
{% if request.user.rights_holder.count %}
<h2>Works You Have Claimed</h2>
<h2 id="open_campaigns">Works You Have Claimed</h2>
<dl>
{% for claim in claims %}
<dt>Title: <a href="{% url work work_id=claim.work.id %}">{{claim.work.title }}</a>&nbsp;&nbsp;&nbsp;(work #{{ claim.work.id }})</dt>
@ -106,11 +120,11 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
<br />Date of Claim : {{ claim.created }}
<br />Status of Claim: {{ claim.get_status_display }}
{% if claim.campaign_form %}
<h3>Open a blank campaign for this work</h3>
<h3>Initialize a campaign for this work</h3>
<div class="work_campaigns clearfix" style="padding: 5px;">
<form method="POST" action="#">
<p>{% csrf_token %}
Name the Campaign: {{ claim.campaign_form.name }}{{ claim.campaign_form.name.errors }}</p>
<form method="POST" action="#managed_campaigns">
{% csrf_token %}
{{ claim.campaign_form.name }}{{ claim.campaign_form.name.errors }}
{% if claim.rights_holder.can_sell %}
<p>Choose the Campaign Type: {{ claim.campaign_form.type }}{{ claim.campaign_form.type.errors }}</p>
<ol>
@ -121,10 +135,10 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
{% else %}
<input type="hidden" id="type" name="type" value="1" />
{% endif %}
<p>Add a Campaign Manager(s) by their Unglue.it username: </p>
<p>Add another Campaign Manager(s) by their Unglue.it username: </p>
<div style="width:220px; padding-left:20px" >{{ claim.campaign_form.managers }}{{ claim.campaign_form.managers.errors }}
<br />
<input type="submit" name="submit" value="Open Campaign">
<input type="submit" name="submit" value="Initialize Campaign">
</div>
<p>
{{ claim.campaign_form.work }}{{ claim.campaign_form.work.errors }}
@ -190,7 +204,7 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
</dl>
{% endif %}
{% if request.user.rights_holder.count %}
<h2>Rights Holders That You Administer</h2>
<h2 id="your_rhs">Rights Holders That You Administer</h2>
<dl>
{% for rights_holder in request.user.rights_holder.all %}
<dt>Name: {{ rights_holder.rights_holder_name }}&nbsp;&nbsp;&nbsp;(rights holder #{{ rights_holder.id }})</dt>
@ -201,7 +215,7 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
{% else %}
<I>If you were a registered rights holder with Unglue.it, you'd be able to see and manage your campaigns here. If you hold electronic rights to one or more works and you'd like to be a registered rights holder, please contact us at <a href="mailto:rights@gluejar.com">rights@gluejar.com</a>.</I>
{% endif %}
<h2>How to launch an Unglue.it campaign</h2>
<h2 id="how_to">How to Make an Unglue.it Campaign</h2>
<ol>
{% if not request.user.is_authenticated %}
@ -209,31 +223,43 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
{% else %}
<li class="checked">You've already set up an Unglue.it account.</li>
{% endif %}
{% if not request.user.rights_holder.count %}<li>{% else %}<li class="checked">{% endif %}Email <a href="mailto:rights@gluejar.com?subject=Becoming%20an%20authorized%20rights%20holder">rights@gluejar.com</a> about becoming an authorized rights holder.</li>
{% if not request.user.rights_holder.count %}<li>{% else %}<li class="checked">{% endif %}After we review your credentials, sign a <a href="https://www.docracy.com/1mud3ve9w8/unglue-it-non-exclusive-platform-services-agreement">Platform Services Agreement</a>. Unglue.it uses Docracy.com to manage rights holder agreements. Once you've reviewed the agreement, <a href="mailto:rights@gluejar.com?subject=signing%20document">ask us</a> to send you an agreement for signing.</li>
<li>Claim your work(s)...
<ul>
<li>Find them through the search box at the top of every page.</li>
{% if not request.user.rights_holder.count %}<li>{% else %}<li class="checked">{% endif %}Sign a <a href="https://www.docracy.com/1mud3ve9w8/unglue-it-non-exclusive-platform-services-agreement">Platform Services Agreement</a>. Unglue.it uses Docracy.com to manage rights holder agreements. If you have any questions, <a href="mailto:rights@gluejar.com?subject=agreement">ask us</a>.</li>
{% if claims %}
<li class="checked"><i>You have claimed {{ claims.count }}</i> work(s). You can claim more.
{% else %}
<li><i>Claim</i> your work(s) or send us metadata for books you have rights to.
{% endif %}
<p><b>Claiming a work</b></p>
<p>If your book is indexed in Google books, we can add it to our database automagically. Click on the result list to add your book to our database.</p>
<form action="{% url search %}" method="get">
<div class="inputalign">
<input type="text" id="watermark" size="25" onfocus="imgfocus()" onblur="imgblur(15)" class="inputbox" name="q" value="{{ q }}">
<input type="submit" class="button">
</div>
</form>
<ul class="bullets">
<li>Use the Claim option on the More... tab of each book's page.</li>
<li>Agree to our <a href="{{ termsurl }}">Terms</a> on the following page. This includes agreeing that you are making the claim in good faith and can substantiate that you have legal control over worldwide electronic rights to the work.</li>
<li>If you have any questions or you claim a work by mistake, <a href="mailto:rights@gluejar.com?subject=claiming%20works">email us</a>.</li>
<li>We will review your claim. We may contact you at {{ request.user.email }} if we have any questions. If this is the wrong email address, please <a href="{% url regluit.frontend.views.edit_user %}">change the email address</a> for your account.</li>
</ul></li>
<li>...or send us metadata for books you have rights to.
<ul>
</ul>
<p><b>Entering a work</b></p>
<p>If your book is not in Google books, you'll need to enter the metadata yourself.</p>
<ul class="bullets">
<li>Use <a href="{% url new_edition '' '' %}">this form</a> to enter the metadata.</li>
<li>Your ebooks must have ISBNs assigned.</li>
<li>Your ebooks must have ISBNs or OCLC numbers assigned.</li>
<li>Your metadata should have title, authors, language, description.</li>
<li><a href="mailto:support@gluejar.com?subject=loading%20metadata">Contact us</a> to load ONIX or CSV files for you.</li>
<li>If you have a lot of books to enter, <a href="mailto:support@gluejar.com?subject=loading%20metadata">contact us</a> to load ONIX or CSV files for you.</li>
</ul></li>
<li>Once your claim is approved (you should get an email), you can set up a campaign for it. All the campaigns you can manage will be listed on this page, above.</li>
<li>You may optionally add other Unglue.it users as campaign managers, if you'd like them to be able to edit your campaign. That option will also appear on this page, above.</li>
{% if campaigns %}
<li class="checked">You've set up {{ campaigns.count }} campaign(s). Manage them <a href="#managed_campaigns">above.</a></li>
{% else %}
<li>{% if claims %}<a href="#open_campaigns">Set up a campaign</a> for for your book.{% else %} Set up a campaign. All the campaigns you can manage will be listed on this page, above.{% endif %}</li>
{% endif %}
</ol>
<h2>Campaigns </h2>
<p> If you have already released your work under a Creative Commons license, you need to use a "Thanks for Ungluing" campaign. If you have an EPUB file ready to sell, you should use a "Buy to Unglue" campaign. Otherwise, you'll want to offer rewards in a "Pledge" campaign. </p>
<h2 id="about_campaigns">About Campaigns </h2>
<p> If you have already released your work under a Creative Commons license, you need to use a "Thanks for Ungluing" campaign. If you have an EPUB file ready to sell, you should use a "Buy to Unglue" campaign. Otherwise, you'll want to offer rewards in a "Pledge-to-Unglue" campaign. </p>
<p>For Pledge campaigns, you can run campaigns for books that haven't been converted to digital.
Any print book can be scanned to create a digital file that can then become an ePub-format unglued ebook to be released after the Pledge Campaign succeeds.</p>
<h2>Thanks-for-Ungluing Campaigns</h2>
<p>Thanks-for-Ungluing is a program designed to help rights holders promote and monetize their Creative Commons licensed books. Rights holders participating in the Thanks-for-Ungluing program can request payment for their books on a pay-what-you-want basis. They can also set suggested prices as well as metadata and descriptions for books that they claim. </p>
@ -245,14 +271,15 @@ There are no “rewards” for a “Buy to Unglue” campaign, but you may offer
<p>
A Buy-to-Unglue Campaign provides long-term promotion and sales opportunities for your ebook before it becomes an Unglued Ebook. Until the revenue goal is reached, supporters and libraries know that every book that gets purchased through Unglue.it brings the ungluing date closer to the present.
</p>
<h2>Rewards for Pledge Campaigns</h2>
<h2>Pledge-to-Unglue Campaigns</h2>
<p>For Pledge campaigns, you can run campaigns for books that haven't been converted to digital.
Any print book can be scanned to create a digital file that can then become an ePub-format unglued ebook to be released after the Pledge Campaign succeeds.</p>
<p>Rewards</p>
<p>Campaigns run for a short period (2-6 months) and can have rewards as a way to motivate and thank supporters for helping to reach your goal. You are strongly encouraged to add rewards - they are given special prominence on the campaign page.</p>
<p>What should you add as rewards? Anything (legal) that you think you can reasonably deliver that will get supporters excited about the book. For example: other books, whether electronic or physical; artwork or multimedia relating to the book, its author, or its themes; in-person or online chats with the author; memorabilia.</p>
<h2>Acknowledgements for Pledge Campaigns</h2>
<p>Acknowledgements for Pledge Campaigns</p>
<p>Here are the standard acknowledgements. These automatically combine with your rewards. For example, if you offer a $30 reward, ungluers who pledge $30 will receive the $25 acknowledgement as well.</p>
<ul class="terms">
<li><em>Any amount</em> &#8212; The unglued ebook</li>

View File

@ -1675,7 +1675,7 @@ def claim(request):
# make sure we're not creating a duplicate claim
if not models.Claim.objects.filter(work=form.cleaned_data['work'], rights_holder=form.cleaned_data['rights_holder']).exclude(status='release').count():
form.save()
return HttpResponseRedirect(reverse('work', kwargs={'work_id': form.cleaned_data['work'].id}))
return HttpResponseRedirect(reverse('rightsholders'))
else:
try:
work = models.Work.objects.get(id=data['claim-work'])

46
payment/sales_credit.py Normal file
View File

@ -0,0 +1,46 @@
import csv
import json
import datetime
from decimal import Decimal as D
#import Tkinter, tkFileDialog
from StringIO import StringIO
from regluit.core.models import Campaign
#root = Tkinter.Tk()
#root.withdraw()
last_month = datetime.datetime.today().month -1
last_month = 12 if last_month==0 else last_month
#stripe_reader= csv.DictReader(open(tkFileDialog.askopenfilename(),'rb'), dialect="excel")
stripe_reader= csv.DictReader(open('/Users/eric/Downloads/stripe.csv','rb'), dialect="excel")
royalties_due={}
for purchase in stripe_reader:
created = purchase['Created']
paid = purchase['Status'] == 'Paid'
created_date = datetime.datetime.strptime(created, '%Y-%m-%d %H:%M')
if (created_date.month == last_month) and paid:
description = purchase['Description']
if description and description[0]=='{':
description = json.load(StringIO(description))
campaign_id = description['tc.id']
try:
campaign = Campaign.objects.get(id = campaign_id)
#print campaign.name
except Campaign.DoesNotExist:
print 'missing campaign:'+ campaign_id
continue
if royalties_due.has_key(campaign.id):
royalty_due = royalties_due[campaign.id].royalty_due
else:
royalty_due = D(0)
if campaign.type==2:
#b2U
royalty_due = royalty_due + (D(purchase['Amount']))*D(0.75) -D(0.25)
elif campaign.type==3:
#t4u
royalty_due = royalty_due + (D(purchase['Amount']))*D(0.92) -D(0.25)
else:
continue
campaign.royalty_due=royalty_due
royalties_due[campaign.id]=campaign
for campaign in royalties_due.values():
print campaign.rightsholder + ' '+campaign.name+' '+str(campaign.royalty_due)