IPR disclosure form submission now works.

Closing the ipr_generic.cgi ticket, but leaving ipr.cgi and notify.cgi open
till further testing has been done.  Also adding a new task for the IPR
update form.

There may still be some dead code to clean out, but I'm committing what
I have now since it provides working form submission :-)
 - Legacy-Id: 158
This commit is contained in:
Henrik Levkowetz 2007-05-23 20:11:34 +00:00
parent 2d3bbede29
commit fb5013e849
5 changed files with 133 additions and 42 deletions

View file

@ -79,11 +79,11 @@ class IprDetail(models.Model):
# Patent Information fieldset # Patent Information fieldset
p_applications = models.TextField("Patent Applications", maxlength=255) p_applications = models.TextField("Patent Applications", maxlength=255)
date_applied = models.DateField(maxlength=255) date_applied = models.CharField(maxlength=255)
country = models.CharField(maxlength=100) country = models.CharField(maxlength=100)
p_notes = models.TextField("Additional notes", blank=True) p_notes = models.TextField("Additional notes", blank=True)
selecttype = models.IntegerField("Unpublished Pending Patent Application", null=True, choices=SELECT_CHOICES) selecttype = models.IntegerField("Unpublished Pending Patent Application", blank=True, choices=SELECT_CHOICES)
selectowned = models.IntegerField("Applies to all IPR owned by Submitter", null=True, blank=True, choices=SELECT_CHOICES) selectowned = models.IntegerField("Applies to all IPR owned by Submitter", blank=True, choices=SELECT_CHOICES)
# Licensing Declaration fieldset # Licensing Declaration fieldset
#licensing_option = models.ForeignKey(IprLicensing, db_column='licensing_option') #licensing_option = models.ForeignKey(IprLicensing, db_column='licensing_option')
@ -94,16 +94,18 @@ class IprDetail(models.Model):
comments = models.TextField("Licensing Comments", blank=True) comments = models.TextField("Licensing Comments", blank=True)
lic_checkbox = models.BooleanField("All terms and conditions has been disclosed") lic_checkbox = models.BooleanField("All terms and conditions has been disclosed")
third_party = models.BooleanField(editable=False)
# Other notes fieldset # Other notes fieldset
other_notes = models.TextField(blank=True) other_notes = models.TextField(blank=True)
# Generated fields, not part of the submission form # Generated fields, not part of the submission form
# Hidden fields
third_party = models.BooleanField()
generic = models.BooleanField()
comply = models.BooleanField()
status = models.IntegerField(null=True, blank=True) status = models.IntegerField(null=True, blank=True)
comply = models.BooleanField(editable=False) submitted_date = models.DateField(blank=True)
generic = models.BooleanField(editable=False)
submitted_date = models.DateField(null=True, blank=True)
update_notified_date = models.DateField(null=True, blank=True) update_notified_date = models.DateField(null=True, blank=True)
def __str__(self): def __str__(self):
@ -118,21 +120,21 @@ class IprDetail(models.Model):
return "YES" return "YES"
else: else:
return "NO" return "NO"
def get_patent_holder_contact(self): # def get_patent_holder_contact(self):
try: # try:
return self.contact.filter(contact_type=1)[0] # return self.contact.filter(contact_type=1)[0]
except: # except:
return None # return None
def get_ietf_contact(self): # def get_ietf_contact(self):
try: # try:
return self.contact.filter(contact_type=2)[0] # return self.contact.filter(contact_type=2)[0]
except: # except:
return None # return None
def get_submitter(self): # def get_submitter(self):
try: # try:
return self.contact.filter(contact_type=3)[0] # return self.contact.filter(contact_type=3)[0]
except: # except:
return None # return None
def get_absolute_url(self): def get_absolute_url(self):
return "/ipr/ipr-%s" % self.ipr_id return "/ipr/ipr-%s" % self.ipr_id
class Meta: class Meta:

View file

@ -3,10 +3,13 @@ import models
import ietf.utils import ietf.utils
import django.utils.html import django.utils.html
import django.newforms as forms import django.newforms as forms
from datetime import datetime
from django.shortcuts import render_to_response as render from django.shortcuts import render_to_response as render
from ietf.utils import log from ietf.utils import log
from ietf.ipr.view_sections import section_table from ietf.ipr.view_sections import section_table
from ietf.idtracker.models import Rfc, InternetDraft from ietf.idtracker.models import Rfc, InternetDraft
from django.http import HttpResponseRedirect
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# Callback methods for special field cases. # Callback methods for special field cases.
@ -20,6 +23,8 @@ def ipr_detail_form_callback(field, **kwargs):
if field.name in ["rfc_number", "id_document_tag"]: if field.name in ["rfc_number", "id_document_tag"]:
log(field.name) log(field.name)
return forms.CharFieldField(required=False) return forms.CharFieldField(required=False)
if field.name in ["date_applied"]:
return forms.DateField()
return field.formfield(**kwargs) return field.formfield(**kwargs)
def ipr_contact_form_callback(field, **kwargs): def ipr_contact_form_callback(field, **kwargs):
@ -136,6 +141,7 @@ def new(request, type):
if draftlist: if draftlist:
draftlist = re.sub(" *[,;] *", " ", draftlist) draftlist = re.sub(" *[,;] *", " ", draftlist)
draftlist = draftlist.strip().split() draftlist = draftlist.strip().split()
drafts = []
for draft in draftlist: for draft in draftlist:
if draft.endswith(".txt"): if draft.endswith(".txt"):
draft = draft[:-4] draft = draft[:-4]
@ -145,19 +151,41 @@ def new(request, type):
else: else:
filename = draft filename = draft
rev = None rev = None
#log("ID: %s, rev %s" % (filename, rev))
try: try:
id = InternetDraft.objects.get(filename=filename) id = InternetDraft.objects.get(filename=filename)
#log("ID Lookup result: %s, %s" % (id.filename, id.revision))
except Exception, e: except Exception, e:
log("Exception: %s" % e) log("Exception: %s" % e)
raise forms.ValidationError("Unknown Internet-Draft: %s - please correct this." % filename) raise forms.ValidationError("Unknown Internet-Draft: %s - please correct this." % filename)
if rev and id.revision != rev: if rev and id.revision != rev:
raise forms.ValidationError("Unexpected revision '%s' for draft %s - the current revision is %s. Please check this." % (rev, filename, id.revision)) raise forms.ValidationError("Unexpected revision '%s' for draft %s - the current revision is %s. Please check this." % (rev, filename, id.revision))
pass drafts.append("%s-%s" % (filename, id.revision))
return " ".join(drafts)
return ""
def clean_holder_contact(self):
return self.holder_contact.full_clean()
def clean_ietf_contact(self):
return self.ietf_contact.full_clean()
def clean_submitter(self):
return self.submitter.full_clean()
if request.method == 'POST': if request.method == 'POST':
data = request.POST.copy() data = request.POST.copy()
data["submitted_date"] = datetime.now().strftime("%Y-%m-%d")
data["third_party"] = section_list["third_party"]
data["generic"] = section_list["generic"]
data["status"] = "0"
data["comply"] = "1"
if type == "general":
data["document_title"] = """%(p_h_legal_name)s's General License Statement""" % data
if type == "specific":
data["ipr_summary"] = get_ipr_summary(data)
data["document_title"] = """%(p_h_legal_name)s's Statement about IPR related to %(ipr_summary)s""" % data
if type == "third-party":
data["ipr_summary"] = get_ipr_summary(data)
data["document_title"] = """%(submitter)s's Statement about IPR related to %(ipr_summary)s belonging to %(p_h_legal_name)s""" % data
for src in ["hold", "ietf"]: for src in ["hold", "ietf"]:
if "%s_contact_is_submitter" % src in data: if "%s_contact_is_submitter" % src in data:
for subfield in ["name", "title", "department", "address1", "address2", "telephone", "fax", "email"]: for subfield in ["name", "title", "department", "address1", "address2", "telephone", "fax", "email"]:
@ -167,15 +195,53 @@ def new(request, type):
#log("Caught exception: %s"%e) #log("Caught exception: %s"%e)
pass pass
form = IprForm(data) form = IprForm(data)
if form.ietf_contact_is_submitter:
form.ietf_contact_is_submitter_checked = "checked"
if form.is_valid(): if form.is_valid():
#instance = form.save() # Save data :
#return HttpResponseRedirect("/ipr/ipr-%s" % instance.ipr_id) # IprDetail, IprContact+, IprDraft+, IprRfc+, IprNotification
# Save IprDetail
instance = form.save()
contact_type = {"hold":1, "ietf":2, "subm": 3}
# Save IprContact(s)
for prefix in ["hold", "ietf", "subm"]:
# cdata = {"ipr": instance.ipr_id, "contact_type":contact_type[prefix]}
cdata = {"ipr": instance, "contact_type":contact_type[prefix]}
for item in data:
if item.startswith(prefix+"_"):
cdata[item[5:]] = data[item]
try:
del cdata["contact_is_submitter"]
except KeyError:
pass
contact = models.IprContact(**cdata)
contact.save()
# contact = ContactForm(cdata)
# if contact.is_valid():
# contact.save()
# else:
# log("Invalid contact: %s" % contact)
# Save IprDraft(s)
for draft in form.clean_data["draftlist"].split():
id = InternetDraft.objects.get(filename=draft[:-3])
iprdraft = models.IprDraft(document=id, ipr=instance, revision=draft[-2:])
iprdraft.save()
# Save IprRfc(s)
for rfcnum in form.clean_data["rfclist"].split():
rfc = Rfc.objects.get(rfc_number=int(rfcnum))
iprrfc = models.IprRfc(rfc_number=rfc, ipr=instance)
iprrfc.save()
return HttpResponseRedirect("/ipr/ipr-%s" % instance.ipr_id)
#return HttpResponseRedirect("/ipr/") #return HttpResponseRedirect("/ipr/")
pass pass
else: else:
if form.ietf_contact_is_submitter:
form.ietf_contact_is_submitter_checked = "checked"
for error in form.errors: for error in form.errors:
log("Form error for field: %s"%error) log("Form error for field: %s"%error)
# Fall through, and let the partially bound form, with error # Fall through, and let the partially bound form, with error
@ -187,3 +253,21 @@ def new(request, type):
# ietf.utils.log(dir(form.ietf_contact_is_submitter)) # ietf.utils.log(dir(form.ietf_contact_is_submitter))
return render("ipr/details.html", {"ipr": form, "section_list":section_list, "debug": debug}) return render("ipr/details.html", {"ipr": form, "section_list":section_list, "debug": debug})
def get_ipr_summary(data):
rfc_ipr = [ "RFC %s" % item for item in data["rfclist"].split() ]
draft_ipr = data["draftlist"].split()
ipr = rfc_ipr + draft_ipr
if data["other_designations"]:
ipr += [ data["other_designations"] ]
if len(ipr) == 1:
ipr = ipr[0]
elif len(ipr) == 2:
ipr = " and ".join(ipr)
else:
ipr = ", ".join(ipr[:-1] + ", and " + ipr[-1])
return ipr

View file

@ -1,7 +1,8 @@
section_table = { section_table = {
"index": { "index": True }, "index": { "index": True },
"specific": { "index": False, "title": True, "specific": True, "specific": { "index": False, "title": True,
"specific": 1, "generic": 0, "third_party": 0,
"legacy_intro": False, "new_intro": True, "form_intro": False, "legacy_intro": False, "new_intro": True, "form_intro": False,
"holder": True, "holder_contact": True, "ietf_contact": True, "holder": True, "holder_contact": True, "ietf_contact": True,
"ietf_doc": True, "patent_info": True, "licensing": True, "ietf_doc": True, "patent_info": True, "licensing": True,
@ -9,7 +10,8 @@ section_table = {
"disclosure_type": "Specific", "form_legend": False, "disclosure_type": "Specific", "form_legend": False,
"per_rfc_disclosure": True, "also_specific": False, "per_rfc_disclosure": True, "also_specific": False,
}, },
"generic": { "index": False, "title": True, "generic": True, "generic": { "index": False, "title": True,
"specific": 0, "generic": 1, "third_party": 0,
"legacy_intro": False, "new_intro": True, "form_intro": False, "legacy_intro": False, "new_intro": True, "form_intro": False,
"holder": True, "holder_contact": True, "ietf_contact": False, "holder": True, "holder_contact": True, "ietf_contact": False,
"ietf_doc": False, "patent_info": True, "licensing": True, "ietf_doc": False, "patent_info": True, "licensing": True,
@ -17,7 +19,8 @@ section_table = {
"disclosure_type": "Generic", "form_legend": False, "disclosure_type": "Generic", "form_legend": False,
"per_rfc_disclosure": False, "also_specific": True, "per_rfc_disclosure": False, "also_specific": True,
}, },
"third-party": {"index": False, "title": True, "third_party": True, "third-party": {"index": False, "title": True,
"specific": 0, "generic": 0, "third_party": 1,
"legacy_intro": False, "new_intro": True, "form_intro": False, "legacy_intro": False, "new_intro": True, "form_intro": False,
"holder": True, "holder_contact": False, "ietf_contact": True, "holder": True, "holder_contact": False, "ietf_contact": True,
"ietf_doc": True, "patent_info": True, "licensing": False, "ietf_doc": True, "patent_info": True, "licensing": False,

View file

@ -5,6 +5,7 @@ from django.shortcuts import render_to_response as render
from django.utils.html import escape from django.utils.html import escape
from ietf.ipr.view_new import new from ietf.ipr.view_new import new
from ietf.ipr.view_sections import section_table from ietf.ipr.view_sections import section_table
from ietf.utils import log
def linebreaks(value): def linebreaks(value):
if value: if value:
@ -54,7 +55,7 @@ def show(request, ipr_id=None):
elif contact.contact_type == 3: elif contact.contact_type == 3:
ipr.submitter = contact ipr.submitter = contact
else: else:
raise KeyError("Unexpected contact_type in ipr_contacts: ipr_id=%s" % ipr.ipr_id) raise KeyError("Unexpected contact_type (%s) in ipr_contacts for ipr_id=%s" % (contact.contact_type, ipr.ipr_id))
# do escaping and line-breaking here instead of in the template, # do escaping and line-breaking here instead of in the template,
# so that we can use the template for the form display, too. # so that we can use the template for the form display, too.
ipr.p_notes = linebreaks(escape(ipr.p_notes)) ipr.p_notes = linebreaks(escape(ipr.p_notes))
@ -62,9 +63,10 @@ def show(request, ipr_id=None):
ipr.comments = linebreaks(escape(ipr.comments)) ipr.comments = linebreaks(escape(ipr.comments))
ipr.other_notes = linebreaks(escape(ipr.other_notes)) ipr.other_notes = linebreaks(escape(ipr.other_notes))
ipr.licensing_option = dict(models.LICENSE_CHOICES)[ipr.licensing_option] if ipr.licensing_option:
ipr.selecttype = dict(models.SELECT_CHOICES)[ipr.selecttype] ipr.licensing_option = dict(models.LICENSE_CHOICES)[ipr.licensing_option]
if ipr.selecttype:
ipr.selecttype = dict(models.SELECT_CHOICES)[ipr.selecttype]
if ipr.selectowned: if ipr.selectowned:
ipr.selectowned = dict(models.SELECT_CHOICES)[ipr.selectowned] ipr.selectowned = dict(models.SELECT_CHOICES)[ipr.selectowned]
return render("ipr/details.html", {"ipr": ipr, "section_list": section_list}) return render("ipr/details.html", {"ipr": ipr, "section_list": section_list})
@ -82,9 +84,9 @@ def get_section_list(ipr):
if ipr.old_ipr_url: if ipr.old_ipr_url:
return section_table["legacy"] return section_table["legacy"]
elif ipr.generic: elif ipr.generic:
assert not ipr.third_party #assert not ipr.third_party
return section_table["generic"] return section_table["generic"]
elif ipr.third_party: elif ipr.third_party:
return section_table["third_party"] return section_table["third-party"]
else: else:
return section_table["specific"] return section_table["specific"]

View file

@ -359,10 +359,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<b>{{ ipr.licensing_option }} <b>{{ ipr.licensing_option }}</b>
{{ ipr.get_lic_opt_a_sub_display }}
{{ ipr.get_lic_opt_b_sub_display }}
{{ ipr.get_lic_opt_c_sub_display }}</b>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -475,6 +472,9 @@
{% endif %} {% endif %}
{% if section_list.form_submit %} {% if section_list.form_submit %}
<input type="hidden" name="third_party" value="{{ section_list.third_party }}">
<input type="hidden" name="generic" value="{{ section_list.generic }}">
<input type="hidden" name="comply" value="1">
<center><input type="submit" name="submit" value="Submit"></center> <center><input type="submit" name="submit" value="Submit"></center>
</form> </form>
<blockquote> <blockquote>