Skip to content

Commit b0f1f5d

Browse files
committed
More ipr form stuff.
- Legacy-Id: 139
1 parent 8d7053f commit b0f1f5d

4 files changed

Lines changed: 47 additions & 15 deletions

File tree

ietf/ipr/views.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import re
22
import models
33
import ietf.utils
4+
import django.utils.html
45
import django.newforms as forms
56
from django.shortcuts import render_to_response as render
6-
from django.utils.html import escape, linebreaks
7+
from django.utils.html import escape
78
from ietf.contrib.form_decorator import form_decorator
89
from ietf.utils import log as log
910

11+
def linebreaks(value):
12+
if value:
13+
return django.utils.html.linebreaks(value)
14+
else:
15+
return value
16+
1017
def default(request):
1118
"""Default page, with links to sub-pages"""
1219
return render("ipr/disclosure.html", {})
@@ -37,25 +44,25 @@ def list(request, template):
3744

3845
section_table = {
3946
"index": { "index": True },
40-
"specific": { "index": False, "title": True,
47+
"specific": { "index": False, "title": True, "specific": True,
4148
"legacy_intro": False, "new_intro": True, "form_intro": False,
4249
"holder": True, "holder_contact": True, "ietf_contact": True,
4350
"ietf_doc": True, "patent_info": True, "licensing": True,
4451
"submitter": True, "notes": True, "form_submit": False,
4552
},
46-
"generic": { "index": False, "title": True,
53+
"generic": { "index": False, "title": True, "generic": True,
4754
"legacy_intro": False, "new_intro": True, "form_intro": False,
4855
"holder": True, "holder_contact": True, "ietf_contact": False,
4956
"ietf_doc": False, "patent_info": True, "licensing": True,
5057
"submitter": True, "notes": True, "form_submit": False,
5158
},
52-
"third_party": {"index": False, "title": True,
59+
"third_party": {"index": False, "title": True, "third_party": True,
5360
"legacy_intro": False, "new_intro": True, "form_intro": False,
5461
"holder": True, "holder_contact": False, "ietf_contact": True,
5562
"ietf_doc": True, "patent_info": True, "licensing": False,
5663
"submitter": False, "notes": False, "form_submit": False,
5764
},
58-
"legacy": { "index": False, "title": True,
65+
"legacy": { "index": False, "title": True, "legacy": True,
5966
"legacy_intro": True, "new_intro": False, "form_intro": False,
6067
"holder": True, "holder_contact": True, "ietf_contact": False,
6168
"ietf_doc": True, "patent_info": False, "licensing": False,
@@ -85,8 +92,10 @@ def show(request, ipr_id=None):
8592
ipr.discloser_identify = linebreaks(escape(ipr.discloser_identify))
8693
ipr.comments = linebreaks(escape(ipr.comments))
8794
ipr.other_notes = linebreaks(escape(ipr.other_notes))
95+
8896
ipr.licensing_option = dict(models.LICENSE_CHOICES)[ipr.licensing_option]
8997
ipr.selecttype = dict(models.SELECT_CHOICES)[ipr.selecttype]
98+
9099
if ipr.selectowned:
91100
ipr.selectowned = dict(models.SELECT_CHOICES)[ipr.selectowned]
92101
return render("ipr/details.html", {"ipr": ipr, "section_list": section_list})
@@ -103,9 +112,9 @@ def new(request, type):
103112
# define callback methods for special field cases.
104113
def ipr_detail_form_callback(field, **kwargs):
105114
if field.name == "licensing_option":
106-
return forms.IntegerField(widget=forms.RadioSelect(choices=models.LICENSE_CHOICES))
115+
return forms.IntegerField(widget=forms.RadioSelect(choices=models.LICENSE_CHOICES), required=False)
107116
if field.name in ["selecttype", "selectowned"]:
108-
return forms.IntegerField(widget=forms.RadioSelect(choices=((1, "YES"), (2, "NO"))))
117+
return forms.IntegerField(widget=forms.RadioSelect(choices=((1, "YES"), (2, "NO"))), required=False)
109118
return field.formfield(**kwargs)
110119

111120
def ipr_contact_form_callback(field, **kwargs):
@@ -181,21 +190,22 @@ def clean(self):
181190
data = request.POST.copy()
182191
if "ietf_contact_is_submitter" in data:
183192
for subfield in ["name", "title", "department", "address1", "address2", "telephone", "fax", "email"]:
184-
log("Fixing subfield subm_%s ..."%subfield)
185193
try:
186194
data["subm_%s"%subfield] = data["ietf_%s"%subfield]
187-
log("Set to %s"%data["ietf_%s"%subfield])
188195
except Exception, e:
189-
log("Caught exception: %s"%e)
196+
#log("Caught exception: %s"%e)
190197
pass
191198
form = IprForm(data)
192199
if form.ietf_contact_is_submitter:
193200
form.ietf_contact_is_submitter_checked = "checked"
194201
if form.is_valid():
195202
#instance = form.save()
196203
#return HttpResponseRedirect("/ipr/ipr-%s" % instance.ipr_id)
197-
return HttpResponseRedirect("/ipr/")
204+
#return HttpResponseRedirect("/ipr/")
205+
pass
198206
else:
207+
for error in form.errors:
208+
log("Form error: %s"%error)
199209
# Fall through, and let the partially bound form, with error
200210
# indications, be rendered again.
201211
pass

ietf/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
44
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
55
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head><title>{% block title %}IETF Data{% endblock %} - WCF</title>
6-
</head><body><center>
6+
</head><body {% block body_attributes %}{% endblock %}><center>
77
<table border=0 cellpadding=0 cellspacing=0>
88
<tr>
99
<td><a href="http://www.ietf.org/home.html"><img src="https://www1.ietf.org/images/header/ietflogo_sm.gif" border="0"></a></td>

ietf/templates/ipr/details.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{% extends "base.html" %}
22
{% block title %}IPR Details{% endblock %}
3+
{% block body_attributes %}onload="toggle_submitter_info()"{% endblock %}
34
{% block content %}
45

56
{% include "ipr/style.html" %}
@@ -133,7 +134,19 @@ <h4 class="ipr">The Patent Disclosure and Licensing Declaration Template for {{
133134
{% endif %}
134135

135136

136-
137+
{% if ipr.errors %}
138+
<table border="0" cellpadding="0" cellspacing="0" class="ipr">
139+
{% for error in ipr.errors %}
140+
<tr>
141+
<td colspan="2">
142+
<ul class="errorlist">
143+
<li>{{ error }}</li>
144+
</ul>
145+
</td>
146+
</tr>
147+
{% endfor %}
148+
</table>
149+
{% endif %}
137150
</blockquote>
138151

139152
{% if section_list.holder %}
@@ -255,6 +268,12 @@ <h4 class="ipr">The Patent Disclosure and Licensing Declaration Template for {{
255268
application?: </i>
256269
<b>{{ ipr.selecttype }}</b>
257270
</tr>
271+
{% if section_list.generic %}
272+
<tr>
273+
<td colspan="2"><i>C. Does this disclosure apply to all IPR owned by
274+
the submitter?:</i> <b>{{ ipr.selectowned }}</b></td>
275+
</tr>
276+
{% else %}
258277
<tr>
259278
<td colspan="2"><i>
260279
C. If an Internet-Draft or RFC includes multiple parts and it is not
@@ -270,6 +289,7 @@ <h4 class="ipr">The Patent Disclosure and Licensing Declaration Template for {{
270289
{% else %}
271290
<tr><td class="fixwidth"></td><td></span><i>No information submitted</i></td></tr>
272291
{% endif %}
292+
{% endif %}
273293
{% else %}
274294
<tr><td class="fixwidth"></td><td><b>This disclosure relates to an unpublished pending patent application.</b></td></tr>
275295
{% endif %}
@@ -318,6 +338,7 @@ <h4 class="ipr">The Patent Disclosure and Licensing Declaration Template for {{
318338
{% if ipr.lic_checkbox %}
319339
<tr>
320340
<td colspan="2">
341+
{% ifnotequal ipr.lic_checkbox 1 %}{{ ipr.lic_checkbox }}{% endifnotequal %}
321342
The individual submitting this template represents and warrants that all
322343
terms and conditions that must be satisfied for implementers of any
323344
covered IETF specification to obtain a license have been disclosed in this
@@ -352,7 +373,7 @@ <h4 class="ipr">The Patent Disclosure and Licensing Declaration Template for {{
352373
<tr>
353374
<td colspan="2">
354375
Same as in Section III above:
355-
<input type="checkbox" name="ietf_contact_is_submitter" onChange="toggle_submitter_info(this.checked);" {{ ipr.ietf_contact_is_submitter_checked }}></td>
376+
<input type="checkbox" name="ietf_contact_is_submitter" onChange="toggle_submitter_info();" {{ ipr.ietf_contact_is_submitter_checked }}></td>
356377
</td>
357378
</tr>
358379
{% endif %}

ietf/templates/ipr/style.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
</style>
2828

2929
<script type="text/javascript">
30-
function toggle_submitter_info (checked) {
30+
function toggle_submitter_info () {
31+
checked = document.form1.ietf_contact_is_submitter.checked;
3132
if (checked) {
3233
document.form1.subm_name.value = document.form1.ietf_name.value;
3334
document.form1.subm_title.value = document.form1.ietf_title.value;

0 commit comments

Comments
 (0)