More ipr form stuff.

- Legacy-Id: 139
This commit is contained in:
Henrik Levkowetz 2007-05-18 18:46:55 +00:00
parent 8d7053fc5c
commit b0f1f5d845
4 changed files with 47 additions and 15 deletions

View file

@ -1,12 +1,19 @@
import re
import models
import ietf.utils
import django.utils.html
import django.newforms as forms
from django.shortcuts import render_to_response as render
from django.utils.html import escape, linebreaks
from django.utils.html import escape
from ietf.contrib.form_decorator import form_decorator
from ietf.utils import log as log
def linebreaks(value):
if value:
return django.utils.html.linebreaks(value)
else:
return value
def default(request):
"""Default page, with links to sub-pages"""
return render("ipr/disclosure.html", {})
@ -37,25 +44,25 @@ def list(request, template):
section_table = {
"index": { "index": True },
"specific": { "index": False, "title": True,
"specific": { "index": False, "title": True, "specific": True,
"legacy_intro": False, "new_intro": True, "form_intro": False,
"holder": True, "holder_contact": True, "ietf_contact": True,
"ietf_doc": True, "patent_info": True, "licensing": True,
"submitter": True, "notes": True, "form_submit": False,
},
"generic": { "index": False, "title": True,
"generic": { "index": False, "title": True, "generic": True,
"legacy_intro": False, "new_intro": True, "form_intro": False,
"holder": True, "holder_contact": True, "ietf_contact": False,
"ietf_doc": False, "patent_info": True, "licensing": True,
"submitter": True, "notes": True, "form_submit": False,
},
"third_party": {"index": False, "title": True,
"third_party": {"index": False, "title": True, "third_party": True,
"legacy_intro": False, "new_intro": True, "form_intro": False,
"holder": True, "holder_contact": False, "ietf_contact": True,
"ietf_doc": True, "patent_info": True, "licensing": False,
"submitter": False, "notes": False, "form_submit": False,
},
"legacy": { "index": False, "title": True,
"legacy": { "index": False, "title": True, "legacy": True,
"legacy_intro": True, "new_intro": False, "form_intro": False,
"holder": True, "holder_contact": True, "ietf_contact": False,
"ietf_doc": True, "patent_info": False, "licensing": False,
@ -85,8 +92,10 @@ def show(request, ipr_id=None):
ipr.discloser_identify = linebreaks(escape(ipr.discloser_identify))
ipr.comments = linebreaks(escape(ipr.comments))
ipr.other_notes = linebreaks(escape(ipr.other_notes))
ipr.licensing_option = dict(models.LICENSE_CHOICES)[ipr.licensing_option]
ipr.selecttype = dict(models.SELECT_CHOICES)[ipr.selecttype]
if ipr.selectowned:
ipr.selectowned = dict(models.SELECT_CHOICES)[ipr.selectowned]
return render("ipr/details.html", {"ipr": ipr, "section_list": section_list})
@ -103,9 +112,9 @@ def new(request, type):
# define callback methods for special field cases.
def ipr_detail_form_callback(field, **kwargs):
if field.name == "licensing_option":
return forms.IntegerField(widget=forms.RadioSelect(choices=models.LICENSE_CHOICES))
return forms.IntegerField(widget=forms.RadioSelect(choices=models.LICENSE_CHOICES), required=False)
if field.name in ["selecttype", "selectowned"]:
return forms.IntegerField(widget=forms.RadioSelect(choices=((1, "YES"), (2, "NO"))))
return forms.IntegerField(widget=forms.RadioSelect(choices=((1, "YES"), (2, "NO"))), required=False)
return field.formfield(**kwargs)
def ipr_contact_form_callback(field, **kwargs):
@ -181,12 +190,10 @@ def new(request, type):
data = request.POST.copy()
if "ietf_contact_is_submitter" in data:
for subfield in ["name", "title", "department", "address1", "address2", "telephone", "fax", "email"]:
log("Fixing subfield subm_%s ..."%subfield)
try:
data["subm_%s"%subfield] = data["ietf_%s"%subfield]
log("Set to %s"%data["ietf_%s"%subfield])
except Exception, e:
log("Caught exception: %s"%e)
#log("Caught exception: %s"%e)
pass
form = IprForm(data)
if form.ietf_contact_is_submitter:
@ -194,8 +201,11 @@ def new(request, type):
if form.is_valid():
#instance = form.save()
#return HttpResponseRedirect("/ipr/ipr-%s" % instance.ipr_id)
return HttpResponseRedirect("/ipr/")
#return HttpResponseRedirect("/ipr/")
pass
else:
for error in form.errors:
log("Form error: %s"%error)
# Fall through, and let the partially bound form, with error
# indications, be rendered again.
pass

View file

@ -3,7 +3,7 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head><title>{% block title %}IETF Data{% endblock %} - WCF</title>
</head><body><center>
</head><body {% block body_attributes %}{% endblock %}><center>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td><a href="http://www.ietf.org/home.html"><img src="https://www1.ietf.org/images/header/ietflogo_sm.gif" border="0"></a></td>

View file

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% block title %}IPR Details{% endblock %}
{% block body_attributes %}onload="toggle_submitter_info()"{% endblock %}
{% block content %}
{% include "ipr/style.html" %}
@ -133,7 +134,19 @@
{% endif %}
{% if ipr.errors %}
<table border="0" cellpadding="0" cellspacing="0" class="ipr">
{% for error in ipr.errors %}
<tr>
<td colspan="2">
<ul class="errorlist">
<li>{{ error }}</li>
</ul>
</td>
</tr>
{% endfor %}
</table>
{% endif %}
</blockquote>
{% if section_list.holder %}
@ -255,6 +268,12 @@
application?: </i>
<b>{{ ipr.selecttype }}</b>
</tr>
{% if section_list.generic %}
<tr>
<td colspan="2"><i>C. Does this disclosure apply to all IPR owned by
the submitter?:</i> <b>{{ ipr.selectowned }}</b></td>
</tr>
{% else %}
<tr>
<td colspan="2"><i>
C. If an Internet-Draft or RFC includes multiple parts and it is not
@ -270,6 +289,7 @@
{% else %}
<tr><td class="fixwidth"></td><td></span><i>No information submitted</i></td></tr>
{% endif %}
{% endif %}
{% else %}
<tr><td class="fixwidth"></td><td><b>This disclosure relates to an unpublished pending patent application.</b></td></tr>
{% endif %}
@ -318,6 +338,7 @@
{% if ipr.lic_checkbox %}
<tr>
<td colspan="2">
{% ifnotequal ipr.lic_checkbox 1 %}{{ ipr.lic_checkbox }}{% endifnotequal %}
The individual submitting this template represents and warrants that all
terms and conditions that must be satisfied for implementers of any
covered IETF specification to obtain a license have been disclosed in this
@ -352,7 +373,7 @@
<tr>
<td colspan="2">
Same as in Section III above:
<input type="checkbox" name="ietf_contact_is_submitter" onChange="toggle_submitter_info(this.checked);" {{ ipr.ietf_contact_is_submitter_checked }}></td>
<input type="checkbox" name="ietf_contact_is_submitter" onChange="toggle_submitter_info();" {{ ipr.ietf_contact_is_submitter_checked }}></td>
</td>
</tr>
{% endif %}

View file

@ -27,7 +27,8 @@
</style>
<script type="text/javascript">
function toggle_submitter_info (checked) {
function toggle_submitter_info () {
checked = document.form1.ietf_contact_is_submitter.checked;
if (checked) {
document.form1.subm_name.value = document.form1.ietf_name.value;
document.form1.subm_title.value = document.form1.ietf_title.value;