[cc-commits] [SCM] License chooser & etc (branch master) updated. 3eb06e93b0740ff4953be1c3aa36af02793a002c
git version control
git at a7.creativecommons.org
Thu Jan 28 12:04:58 EST 2010
The branch, master has been updated
via 3eb06e93b0740ff4953be1c3aa36af02793a002c (commit)
via b43e088b551151a089ebec8799cdfbca1782e28c (commit)
via a95c56f992aadbe779b1e79c8736f8e0cb7c1c95 (commit)
via f57f599ea54e8eea38a6470af79409ec6a16530a (commit)
via ddfd97ed4057c29945852da4c18a754e30c291f2 (commit)
via 45a1e137d86166ccf29bb563edde5f86835087a6 (commit)
via 06f93f34d611165f2c8ef1fa80b68909ce8b2ff3 (commit)
via 9354a24ef2ab914dbc3de638fb27455a2944bdd7 (commit)
via ce5cef449348aafd855586207bc09db9e7d9033c (commit)
from f9e2ed399a4f8a730944855cf125c4611c15c9ab (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3eb06e93b0740ff4953be1c3aa36af02793a002c
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Thu Jan 28 11:04:57 2010 -0600
Use the cc0 formatter view from cc.license
commit b43e088b551151a089ebec8799cdfbca1782e28c
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Fri Jan 22 15:02:18 2010 -0600
request.url, and now it resolves with a blank request form at least
commit a95c56f992aadbe779b1e79c8736f8e0cb7c1c95
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Fri Jan 22 15:01:38 2010 -0600
email_requested variable
commit f57f599ea54e8eea38a6470af79409ec6a16530a
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Fri Jan 22 14:47:32 2010 -0600
cc0 rdfa generation
commit ddfd97ed4057c29945852da4c18a754e30c291f2
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Fri Jan 22 14:36:34 2010 -0600
part of the cc0_results view, including the can_issue context variable
commit 45a1e137d86166ccf29bb563edde5f86835087a6
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Fri Jan 22 14:33:23 2010 -0600
Forgot the python: on a line in the template
commit 06f93f34d611165f2c8ef1fa80b68909ce8b2ff3
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Fri Jan 22 14:21:51 2010 -0600
removing a space
commit 9354a24ef2ab914dbc3de638fb27455a2944bdd7
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Fri Jan 22 14:20:42 2010 -0600
Changed variables in the template a bit and etc
commit ce5cef449348aafd855586207bc09db9e7d9033c
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Tue Jan 19 23:04:02 2010 -0600
The base of the confirm view
-----------------------------------------------------------------------
Summary of changes (followed by patch):
cc/engine/chooser/views.py | 70 ++++++++++++++++++---
cc/engine/templates/chooser_pages/zero/results.pt | 43 ++++++-------
2 files changed, 80 insertions(+), 33 deletions(-)
diff --git a/cc/engine/chooser/views.py b/cc/engine/chooser/views.py
index 4738963..0f5ea85 100644
--- a/cc/engine/chooser/views.py
+++ b/cc/engine/chooser/views.py
@@ -8,8 +8,10 @@ from webob import Response, exc
from cc.engine import util
from cc.i18npkg import ccorg_i18n_setup
import cc.license
-from cc.license.formatters.classes import HTMLFormatter
+from cc.license.formatters.classes import HTMLFormatter, CC0HTMLFormatter
+HTML_FORMATTER = HTMLFormatter()
+CC0_HTML_FORMATTER = CC0HTMLFormatter()
def _base_context(request):
context = {
@@ -278,8 +280,7 @@ def choose_results_view(request):
work_info = _work_info(request_form)
license_slim_logo = license.logo_method('80x15')
- html_formatter = HTMLFormatter()
- license_html = html_formatter.format(license, work_info)
+ license_html = HTML_FORMATTER.format(license, work_info)
context.update(
{'engine_template': engine_template,
@@ -303,8 +304,7 @@ def get_html(request):
request_form = request.GET or request.POST
license = _issue_license(request_form)
work_info = _work_info(request_form)
- html_formatter = HTMLFormatter()
- license_html = html_formatter.format(license, work_info)
+ license_html = HTML_FORMATTER.format(license, work_info)
return Response(license_html, content_type='text/html; charset=UTF-8')
@@ -343,8 +343,7 @@ def work_email_popup(request):
request_form = request.GET or request.POST
license = _issue_license(request_form)
work_info = _work_info(request_form)
- html_formatter = HTMLFormatter()
- license_html = html_formatter.format(license, work_info)
+ license_html = HTML_FORMATTER.format(license, work_info)
template = util.get_zpt_template('chooser_pages/htmlpopup.pt')
popup_template = util.get_zpt_template('macros_templates/popup.pt')
@@ -462,8 +461,7 @@ def publicdomain_result(request):
'./publicdomain-3', urlencode(request.GET)))
work_info = _work_info(request_form)
- html_formatter = HTMLFormatter()
- license_html = html_formatter.format(
+ license_html = HTML_FORMATTER.format(
cc.license.by_code('publicdomain'),
work_info)
@@ -507,3 +505,57 @@ def cc0_waiver(request):
'country_list': util.CODE_COUNTRY_LIST})
return Response(template.pt_render(context))
+
+
+def cc0_confirm(request):
+ template = util.get_zpt_template(
+ 'chooser_pages/zero/confirm.pt')
+ engine_template = util.get_zpt_template(
+ 'macros_templates/engine.pt')
+
+ request_form = request.GET or request.POST
+
+ context = _base_context(request)
+ context.update({
+ 'engine_template': engine_template,
+ 'request_form': request_form})
+
+ return Response(template.pt_render(context))
+
+
+def cc0_results(request):
+ template = util.get_zpt_template(
+ 'chooser_pages/zero/results.pt')
+ engine_template = util.get_zpt_template(
+ 'macros_templates/engine.pt')
+
+ request_form = request.GET or request.POST
+
+ ## Do we confirm, understand and accept the conditions of cc0?
+ confirm = request_form.get('confirm', False)
+ understand = request_form.get('understand', False)
+ accept = request_form.get('waiver-affirm', False) and \
+ request_form.get('waiver-decline', True)
+
+ can_issue = (confirm and understand and accept)
+
+ ## RDFA generation
+ work_info = _work_info(request_form)
+ license_html = CC0_HTML_FORMATTER.format(
+ cc.license.by_code('CC0'), work_info).strip()
+
+ ## Did the user request an email?
+ email_requested = request_form.has_key('email')
+ #### TODO send email here instead of doing it in the template...
+
+ context = _base_context(request)
+ context.update({
+ 'engine_template': engine_template,
+ 'request_form': request_form,
+ 'can_issue': can_issue,
+ 'rdfa': license_html,
+ 'email_requested': email_requested})
+
+ return Response(template.pt_render(context))
+
+
diff --git a/cc/engine/templates/chooser_pages/zero/results.pt b/cc/engine/templates/chooser_pages/zero/results.pt
index b01f9ec..ef60adc 100644
--- a/cc/engine/templates/chooser_pages/zero/results.pt
+++ b/cc/engine/templates/chooser_pages/zero/results.pt
@@ -2,12 +2,11 @@
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xmlns:metal="http://xml.zope.org/namespaces/metal"
- metal:use-macro="context/@@engine/page"
+ metal:use-macro="engine_template/macros/page"
i18n:domain="cc_org">
<head>
<title metal:fill-slot="title">CC0: Results</title>
-
<metal:headers fill-slot="headers">
<link rel="stylesheet" type="text/css"
@@ -15,12 +14,13 @@
<link rel="stylesheet" type="text/css"
href="http://yui.yahooapis.com/2.6.0/build/container/assets/container.css">
- <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/element/element-beta-min.js"></script>
+ <script type="text/javascript"
+ src="http://yui.yahooapis.com/2.6.0/build/element/element-beta-min.js"></script>
<script type="text/javascript"
src="http://yui.yahooapis.com/2.6.0/build/button/button-min.js"></script>
<link rel="stylesheet" type="text/css" href="zero.css"
- tal:attributes="href context/++resource++cc/includes/zero.css" />
+ tal:attributes="href python:request.staticdirect('/includes/zero.css')" />
<script type="text/javascript">
@@ -48,7 +48,7 @@ YAHOO.util.Event.onDOMReady(function() {
<div class="yui-skin-sam">
<div id="error" class="yui-module"
- tal:condition="not:view/can_issue">
+ tal:condition="not:can_issue">
<div class="bd">
<p i18n:translate="license.zero.declined">
You did not affirm your decision to waive the rights
@@ -64,7 +64,7 @@ YAHOO.util.Event.onDOMReady(function() {
</div>
</div>
- <div id="results" class="yui-module" tal:condition="view/can_issue">
+ <div id="results" class="yui-module" tal:condition="can_issue">
<div class="bd" id="waiver-results">
<p i18n:translate="license.choose_button">
@@ -76,17 +76,15 @@ YAHOO.util.Event.onDOMReady(function() {
<tr>
<td valign="bottom" align="center">
<img src="http://i.creativecommons.org/l/zero/1.0/88x31.png"
- style="border:0px;" /><br/>
+ style="border:0px;" /><br/>
<input type="radio" name="button" checked
- onclick="swapbutton('http://i.creativecommons.org/l/zero/1.0/88x31.png')"
- />
+ onclick="swapbutton('http://i.creativecommons.org/l/zero/1.0/88x31.png')" />
</td>
<td valign="bottom" align="center">
<img src="http://i.creativecommons.org/l/zero/1.0/80x15.png"
- style="border:0px;" /><br/>
+ style="border:0px;" /><br/>
<input type="radio" name="button"
- onclick="swapbutton('http://i.creativecommons.org/l/zero/1.0/80x15.png')"
- />
+ onclick="swapbutton('http://i.creativecommons.org/l/zero/1.0/80x15.png')"/>
</td>
</tr>
@@ -99,7 +97,7 @@ YAHOO.util.Event.onDOMReady(function() {
</span>
<div class="preview" id="results-preview"
- tal:content="structure view/rdfa">
+ tal:content="structure rdfa">
</div>
<h3 i18n:translate="license.have_your_own_website">Have a website?</h3>
@@ -113,16 +111,16 @@ YAHOO.util.Event.onDOMReady(function() {
<textarea id="codetocopy" cols="70" rows="6"
onfocus="select()"
- tal:content="structure view/rdfa">
+ tal:content="structure rdfa">
</textarea>
<div class="more-metadata-container">
<h3 style="margin-top:0;"
i18n:translate="license.zero.send_email">Send Email</h3>
- <metal:email_results tal:condition="view/email_requested">
+ <metal:email_results tal:condition="email_requested">
<metal:email_container
- tal:define="success view/send_email">
+ tal:define="success send_email">
<div class="more-metadata-container error"
tal:condition="not:success"
i18n:translate="license.zero.email_error">
@@ -135,8 +133,7 @@ YAHOO.util.Event.onDOMReady(function() {
</div>
<div class="more-metadata-container success"
- tal:condition="success"
- >
+ tal:condition="success">
<p i18n:translate="license.zero.email_sent">
The suggested HTML has been sent to <span
tal:replace="request/form/email"
@@ -150,24 +147,22 @@ YAHOO.util.Event.onDOMReady(function() {
request has been sent on your behalf; you must click the link in
the confirmation email to complete the sign-up process.
</span>
-
</div>
</metal:email_container>
</metal:email_results>
- <metal:request_email tal:condition="not:view/email_requested">
+ <metal:request_email tal:condition="not:email_requested">
<p i18n:translate="license.zero.send_email_updates">
If you'd like to get the HTML with embedded metadata via
email and optionally receive updates about CC0, fill in your
email address below.
</p>
- <form action="" tal:attributes="action request/URL">
-
- <metal:form-vals tal:repeat="key python:view.request.form.keys()">
+ <form action="" tal:attributes="action request/url">
+ <metal:form-vals tal:repeat="key python:request_form.keys()">
<input type="hidden" name="key" value=""
tal:attributes="name key;
- value python:view.request.form[key]" />
+ value python:request_form[key]" />
</metal:form-vals>
<div class="more-metadata">
hooks/post-receive
--
License chooser & etc
More information about the cc-commits
mailing list