示例#1
0
def get_document_emails(ipr):
    """Returns a list of messages to inform document authors that a new IPR disclosure
    has been posted"""
    messages = []
    for rel in ipr.iprdocrel_set.all():
        doc = rel.document.document
        authors = doc.authors.all()
        
        if is_draft(doc):
            doc_info = 'Internet-Draft entitled "{}" ({})'.format(doc.title,doc.name)
        else:
            doc_info = 'RFC entitled "{}" (RFC{})'.format(doc.title,get_rfc_num(doc))

        addrs = gather_address_lists('ipr_posted_on_doc',doc=doc).as_strings(compact=False)
        author_names = ', '.join([a.person.name for a in authors])
    
        context = dict(
            doc_info=doc_info,
            to_email=addrs.to,
            to_name=author_names,
            cc_email=addrs.cc,
            ipr=ipr)
        text = render_to_string('ipr/posted_document_email.txt',context)
        messages.append(text)
    
    return messages
示例#2
0
文件: views.py 项目: ekr/ietfdb
def get_document_emails(ipr):
    """Returns a list of messages to inform document authors that a new IPR disclosure
    has been posted"""
    messages = []
    for rel in ipr.iprdocrel_set.all():
        doc = rel.document.document

        if is_draft(doc):
            doc_info = 'Internet-Draft entitled "{}" ({})'.format(
                doc.title, doc.name)
        else:
            doc_info = 'RFC entitled "{}" (RFC{})'.format(
                doc.title, get_rfc_num(doc))

        addrs = gather_address_lists('ipr_posted_on_doc',
                                     doc=doc).as_strings(compact=False)

        author_names = ', '.join(
            a.person.name
            for a in doc.documentauthor_set.select_related("person"))

        context = dict(doc_info=doc_info,
                       to_email=addrs.to,
                       to_name=author_names,
                       cc_email=addrs.cc,
                       ipr=ipr)
        text = render_to_string('ipr/posted_document_email.txt', context)
        messages.append(text)

    return messages
示例#3
0
文件: views.py 项目: mcr/ietfdb
def view(request, id):
    ''' 
    View Internet Draft

    **Templates:**

    * ``drafts/view.html``

    **Template Variables:**

    * draft, area, id_tracker_state
    '''
    draft = get_object_or_404(Document, name=id)
    #request.session.clear()

    # TODO fix in Django 1.2
    # some boolean state variables for use in the view.html template to manage display
    # of action buttons.  NOTE: Django 1.2 support new smart if tag in templates which
    # will remove the need for these variables
    state = draft.get_state_slug()
    is_active = True if state == 'active' else False
    is_expired = True if state == 'expired' else False
    is_withdrawn = True if (state in ('auth-rm','ietf-rm')) else False
    
    # TODO should I rewrite all these or just use proxy.InternetDraft?
    # add legacy fields
    draft.iesg_state = draft.get_state('draft-iesg')
    draft.review_by_rfc_editor = bool(draft.tags.filter(slug='rfc-rev'))
    
    # can't assume there will be a new_revision record
    r_event = draft.latest_event(type__in=('new_revision','completed_resurrect'))
    draft.revision_date = r_event.time.date() if r_event else None
    
    draft.start_date = get_start_date(draft)
    
    e = draft.latest_event(type__in=('expired_document', 'new_revision', "completed_resurrect"))
    draft.expiration_date = e.time.date() if e and e.type == "expired_document" else None
    draft.rfc_number = get_rfc_num(draft)
    
    # check for replaced bys
    qs = Document.objects.filter(relateddocument__target__document=draft, relateddocument__relationship='replaces')
    if qs:
        draft.replaced_by = qs[0]
    
    # check for DEVELOPMENT setting and pass to template
    is_development = False
    try:
        is_development = settings.DEVELOPMENT
    except AttributeError:
        pass

    return render_to_response('drafts/view.html', {
        'is_active': is_active,
        'is_expired': is_expired,
        'is_withdrawn': is_withdrawn,
        'is_development': is_development,
        'draft': draft},
        RequestContext(request, {}),
    )
示例#4
0
文件: views.py 项目: algby/ietfdb
def admin_detail(request, ipr_id):
    if request.POST and request.POST['command']:
        command = request.POST['command']
        if command == 'post':
            return admin_post(request, ipr_id, 'detail', 'post')
        elif command == 'notify':
            return redirect('ipradmin_old_submitter_notify', ipr_id=ipr_id)
        elif command == 'delete':
            return redirect('ipradmin_admin_delete', ipr_id=ipr_id)

    header_text = possible = temp_name = footer_text = ''
    contact_one_data, contact_two_data, document_data, licensing_data,\
        disclosure_data, designations_data, contact_three_data,\
        notes_data, controls = [], [], [], [], [], [], [], [], []
    
    ipr_dtl = IprDetail.objects.get(ipr_id=ipr_id)
    ipr_updates = IprUpdate.objects.filter(processed=0, ipr__ipr_id=ipr_id)

    contact_one, contact_two, contact_three = [
        ipr_dtl.contact.filter(contact_type=x) for x in (1,2,3)
    ]

    if ipr_updates:
        if ipr_dtl.update_notified_date:
            footer_text = mark_safe('<span class="alert">This update was notifed to the submitter of the IPR that is being updated on %s.</span>' % ipr_dtl.update_notified_date)
        else:
            controls = ['notify']
    if not ipr_updates or ipr_dtl.update_notified_date:
        controls = ['post']

    controls.append('delete')

    if ipr_dtl.third_party:
        temp_name = 'Notification'
        possible = 'Possible '
        displaying_section = "I, II, and III"
        header_text = '''This form is used to let the IETF know about patent information regarding an IETF document or contribution when the person letting the IETF know about the patent has no relationship with the patent owners.<br>
  Click <a href="./ipr.cgi"> here</a> if you want to disclose information about patents or patent applications where you do have a relationship to the patent owners or patent applicants.'''
    elif ipr_dtl.generic:
        temp_name = "Generic IPR Disclosures"
        displaying_section = "I and II"
        header_text = '''This document is an IETF IPR Patent Disclosure and Licensing Declaration 
     Template and is submitted to inform the IETF of a) patent or patent application information that is not related to a specific IETF document or contribution, and b) an IPR Holder's intention with respect to the licensing of its necessary patent claims.
     No actual license is implied by submission of this template.'''
    else:
        temp_name = "Specific IPR Disclosures"
        displaying_section = "I, II, and IV"
        header_text = '''This document is an IETF IPR Disclosure and Licensing Declaration 
   Template and is submitted to inform the IETF of a) patent or patent application information regarding
   the IETF document or contribution listed in Section IV, and b) an IPR Holder\'s intention with respect to the licensing of its necessary patent claims.
   No actual license is implied by submission of this template. 
   Please complete and submit a separate template for each IETF document or contribution to which the
   disclosed patent information relates.'''
    
    legacy_links = (
        (ipr_dtl.legacy_url_1 or '', ipr_dtl.legacy_title_1 or ''),
        (ipr_dtl.legacy_url_2 or '', ipr_dtl.legacy_title_2 or ''),
    )

    comply_statement = '' if ipr_dtl.comply else mark_safe('<div class="alert">This IPR disclosure does not comply with the formal requirements of Section 6, "IPR Disclosures," of RFC 3979, "Intellectual Property Rights in IETF Technology."</div>')

    # FIXME: header_text is assembled in perl code but never printed
    if ipr_dtl.legacy_url_0:
        #header_text = header_text + '''
        header_text = '''
     This IPR disclosure was submitted by e-mail.<br>
    %s
    Sections %s of "The Patent Disclosure and Licensing Declaration Template for %s" have been completed for this IPR disclosure. Additional information may be available in the original submission.<br>
     Click <a href="%s">here</a> to view the content of the original IPR disclosure.''' % (comply_statement, displaying_section, temp_name, ipr_dtl.legacy_url_0)
    else:
        #header_text = header_text + '''
        header_text = '''
    Only those sections of the "Patent Disclosure and Licensing Declaration Template for %s" where the submitter provided information are displayed.''' % temp_name
    
    if not ipr_dtl.generic or not (not ipr_dtl.legacy_url_0 and (ipr_dtl.notes or ipr_dtl.patents)):
        # FIXME: behavior as perl, but is quite confusing and seems wrong
        if contact_one and contact_one[0].name:
            contact_one = contact_one[0]
            contact_one_data = [
                ('II. Patent Holder\'s Contact for License Application:'),
                ('Name:', contact_one.name),
                ('Title:', contact_one.title),
                ('Department:', contact_one.department),
                ('Address1:', contact_one.address1),
                ('Address2:', contact_one.address2),
                ('Telephone:', contact_one.telephone),
                ('Fax:', contact_one.fax),
                ('Email:', contact_one.email)
            ]

    if not ipr_dtl.generic:
                  
        if contact_two and contact_two[0].name:
            contact_two = contact_two[0]
            contact_two_data = [
                ('III. Contact Information for the IETF Participant Whose Personal Belief Triggered this Disclosure:'),
                ('Name:', contact_two.name),
                ('Title:', contact_two.title),
                ('Department:', contact_two.department),
                ('Address1:', contact_two.address1),
                ('Address2:', contact_two.address2),
                ('Telephone:', contact_two.telephone),
                ('Fax:', contact_two.fax),
                ('Email:', contact_two.email)
            ]

        # conversion
        #rfcs = ipr_dtl.rfcs.all()
        #drafts = ipr_dtl.drafts.all()
        rfcs = ipr_dtl.docs().filter(doc_alias__name__startswith='rfc')
        drafts = ipr_dtl.docs().exclude(doc_alias__name__startswith='rfc')
        titles_data, rfcs_data, drafts_data, designations_data = (), (), (), ()
        rfc_titles, draft_titles = [], []
        if rfcs:
            rfc_titles = [
                rfc.doc_alias.document.title for rfc in rfcs
            ]
            rfcs_data = tuple([
                'RFC Number:',
                [get_rfc_num(rfc.doc_alias.document) for rfc in rfcs]
            ])
        if drafts:
            draft_titles = [
                draft.doc_alias.document.title for draft in drafts
            ]
            drafts_data = tuple([
                'ID Filename:',
                [draft.doc_alias.document.name+'.txt' for draft in drafts]
            ])
        if ipr_dtl.other_designations:
            designations_data = tuple([
                'Designations for Other Contributions:',
                ipr_dtl.other_designations
            ])
        if drafts or rfcs:
            titles_data = tuple([
                'Title:',
                rfc_titles + draft_titles
            ])

        if rfcs_data or drafts_data or designations_data:
            document_data = [
                ('IV. IETF Document or Other Contribution to Which this IPR Disclosure Relates'),
                titles_data,
                rfcs_data,
                drafts_data,
                designations_data,
            ]
                  
    if not ipr_dtl.legacy_url_0 and (ipr_dtl.notes or ipr_dtl.patents):
        if ipr_dtl.generic:
            disclosure_c = (
                'C. Does this disclosure apply to all IPR owned by the submitter?',
                'YES' if ipr_dtl.applies_to_all else 'NO' 
            )
        else:
            disclosure_c = (
                '''C. If an Internet-Draft or RFC includes multiple parts and it is not
   reasonably apparent which part of such Internet-Draft or RFC is alleged
   to be covered by the patent information disclosed in Section
   V(A) or V(B), it is helpful if the discloser identifies here the sections of
   the Internet-Draft or RFC that are alleged to be so
   covered.''', 
                ipr_dtl.document_sections
            )
        disclosure_data = [
            ('V. Disclosure of Patent Information (i.e., patents or patent applications required to be disclosed by Section 6 of RFC 3979)'),
            ('A. For granted patents or published pending patent applications, please provide the following information', ''),
            ('Patent, Serial, Publication, Registration, or Application/File number(s):', ipr_dtl.patents),
            ('Date(s) granted or applied for:', ipr_dtl.date_applied),
            ('Country:', ipr_dtl.country),
            ('Additional Notes:', ipr_dtl.notes),
            #('B. Does your disclosure relate to an unpublished pending patent application?', 'YES' if ipr_dtl.applies_to_all else 'NO'),
            ('B. Does your disclosure relate to an unpublished pending patent application?', 'YES' if ipr_dtl.is_pending == 1 else 'NO'),
            disclosure_c
        ]

    if not ipr_dtl.third_party and ipr_dtl.licensing_option: 
        lic_idx = ipr_dtl.licensing_option
        chosen_declaration = LICENSE_CHOICES[lic_idx-1][1]
        sub_opt = bool(
            lic_idx == 0 and ipr_dtl.lic_opt_a_sub
            or lic_idx == 1 and ipr_dtl.lic_opt_b_sub
            or lic_idx == 2 and ipr_dtl.lic_opt_c_sub
        )
        chosen_declaration += STDONLY_CHOICES[1][1] if sub_opt else ''
        chosen_declaration = (mark_safe("<strong>%s</strong>" % chosen_declaration), '')

        comments = ipr_dtl.comments or None
        lic_checkbox = ipr_dtl.lic_checkbox or None
        if comments or lic_checkbox:
            comments_notes_label = ('Licensing information, comments, notes or URL for further information:'),
            comments_notes = (mark_safe(
                "<strong>%s<br /><br />%s</strong>" % (
                    comments,
                    '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 IPR disclosure statement.' if lic_checkbox else ''
                )),
                ''
            )
        else:
            comments_notes_label = comments_notes = ''

        licensing_data = [
           ('VI. Licensing Declaration:'),
           ('The Patent Holder states that its position with respect to licensing any patent claims contained in the patent(s) or patent application(s) disclosed above that would necessarily be infringed by implementation of the technology required by the relevant IETF specification ("Necessary Patent Claims"), for the purpose of implementing such specification, is as follows(select one licensing declaration option only):', ''), 
            chosen_declaration,
            comments_notes_label,
            comments_notes 
        ]

    if contact_three and contact_three[0].name:
        contact_three = contact_three[0]
        contact_three_data = [
            ('VII. Contact Information of Submitter of this Form (if different from IETF Participant in Section III above):'),
            ('Name:', contact_three.name),
            ('Title:', contact_three.title),
            ('Department:', contact_three.department),
            ('Address1:', contact_three.address1),
            ('Address2:', contact_three.address2),
            ('Telephone:', contact_three.telephone),
            ('Fax:', contact_three.fax),
            ('Email:', contact_three.email)
        ]
    
    if ipr_dtl.other_notes:
        notes_data = (
            ('VIII. Other Notes:'),
            (mark_safe("<strong>%s</strong>" % ipr_dtl.other_notes), '')
        )    

    if not (not ipr_dtl.legacy_url_0 and (ipr_dtl.notes or ipr_dtl.patents)):
        # FIXME: behavior as perl, but is quite confusing and seems wrong
        licensing_data = contact_three_data = notes_data = ()


    page_data = [
        [
           ('I. %sPatent Holder/Applicant ("Patent Holder"):' % possible),
           ('Legal Name:', ipr_dtl.legal_name),
        ],
        contact_one_data,
        contact_two_data,
        document_data,
        disclosure_data,
        licensing_data,
        contact_three_data,
        notes_data,
    ]
    return dict(
        ipr_title = ipr_dtl.title,
        header_text = header_text,
        legacy_links = legacy_links,
        submitted_date = ipr_dtl.submitted_date,
        page_data = page_data,
        footer_text = footer_text,
        controls = controls,
    )
示例#5
0
文件: views.py 项目: algby/ietfdb
def get_document_relatives(ipr_dtl, docalias):
    '''
    This function takes a IprDetail object and a DocAlias object and returns an email.
    '''
    text = ''
    doc = docalias.document
    doc_info, author_names, author_emails, cc_list = '', '', '', ''
    authors = doc.authors.all()
    
    if is_draft(doc):
        doc_info = 'Internet-Draft entitled "%s" (%s)' \
            % (doc.title, doc.name)
        updated_id = doc.pk

    else: # not i-draft, therefore rfc
        rfc_num = get_rfc_num(doc)
        doc_info = 'RFC entitled "%s" (RFC%s)' \
            % (doc.title, rfc_num)
        updated_id = rfc_num

    # if the document is not associated with a group copy job owner or Gernal Area Director
    if doc.group.acronym == 'none':
        if doc.ad and is_draft(doc):
            cc_list = doc.ad.role_email('ad').address
        else:
            role = Role.objects.filter(group__acronym='gen',name='ad')[0]
            cc_list = role.email.address
            
    else:
        cc_list = get_wg_email_list(doc.group)

    author_emails = ','.join([a.address for a in authors])
    author_names = ', '.join([a.person.name for a in authors])
    
    cc_list += ", [email protected]"

    submitted_date = ipr_dtl.submitted_date
    ipr_title = ipr_dtl.title

    email_body = '''
An IPR disclosure that pertains to your %s was submitted to the IETF Secretariat on %s and has been posted on the "IETF Page of Intellectual Property Rights Disclosures" (https://datatracker.ietf.org/ipr/%s/). The title of the IPR disclosure is "%s."");
    ''' % (doc_info, submitted_date, ipr_dtl.ipr_id, ipr_title)
    wrapper = TextWrapper(width=80, break_long_words=False)
    email_body = wrapper.fill(email_body)

    text = '''
<h4>Notification for %s</h4>
<textarea name="notify_%s" rows=25 cols=80>
To: %s
From: IETF Secretariat <*****@*****.**>
Subject: IPR Disclosure: %s
Cc: %s

Dear %s:

%s

The IETF Secretariat

</textarea>
<br><br>
    ''' % (doc_info, updated_id, author_emails, ipr_title, cc_list, author_names, email_body)
    # FIXME: why isn't this working - done in template now, also
    return mark_safe(text)
示例#6
0
文件: forms.py 项目: algby/ietfdb
    def __init__(self, *args, **kwargs):
        formtype = kwargs.get('formtype')
        if formtype:
            del kwargs['formtype']
        super(IprDetailForm, self).__init__(*args, **kwargs)
        self.fields['legacy_url_0'].label='Old IPR Url'
        self.fields['title'].label='IPR Title'
        self.fields['legacy_title_1'].label='Text for Update Link'
        self.fields['legacy_url_1'].label='URL for Update Link'
        self.fields['legacy_title_2'].label='Additional Old Title 2'
        self.fields['legacy_url_2'].label='Additional Old URL 2'
        self.fields['document_sections'].label='C. If an Internet-Draft or RFC includes multiple parts and it is not reasonably apparent which part of such Internet-Draft or RFC is alleged to be covered by the patent information disclosed in Section V(A) or V(B), it is helpful if the discloser identifies here the sections of the Internet-Draft or RFC that are alleged to be so covered.' 
        self.fields['patents'].label='Patent, Serial, Publication, Registration, or Application/File number(s)'
        self.fields['date_applied'].label='Date(s) granted or applied for (YYYY-MM-DD)'
        self.fields['comments'].label='Licensing information, comments, notes or URL for further information'
        self.fields['lic_checkbox'].label='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 IPR disclosure statement.'
        self.fields['third_party'].label='Third Party Notification?'
        self.fields['generic'].label='Generic IPR?'
        self.fields['comply'].label='Complies with RFC 3979?'
        self.fields['is_pending'].label="B. Does your disclosure relate to an unpublished pending patent application?"
        # textarea sizes
        self.fields['patents'].widget.attrs['rows'] = 2
        self.fields['patents'].widget.attrs['cols'] = 70
        self.fields['notes'].widget.attrs['rows'] = 3
        self.fields['notes'].widget.attrs['cols'] = 70
        self.fields['document_sections'].widget.attrs['rows'] = 3
        self.fields['document_sections'].widget.attrs['cols'] = 70
        self.fields['comments'].widget.attrs['rows'] = 3
        self.fields['comments'].widget.attrs['cols'] = 70
        self.fields['other_notes'].widget.attrs['rows'] = 5
        self.fields['other_notes'].widget.attrs['cols'] = 70
        
        #self.fields['is_pending'].widget.check_test = mytest
        self.fields['is_pending'].widget = forms.Select(choices=self.IS_PENDING_CHOICES)

        if formtype == 'update':
            if self.instance.generic:
                self.fields['document_sections'] = forms.ChoiceField(
                    widget=forms.RadioSelect, 
                    choices=self.DOCUMENT_SECTIONS_CHOICES, 
                    required=False,
                    label='C. Does this disclosure apply to all IPR owned by the submitter?')
            legacy_url = self.instance.legacy_url_0
            self.fields['legacy_url_0'].label = mark_safe(
                '<a href="%s">Old IPR Url</a>' % legacy_url
            )

            updates = self.instance.updates.all()
            if updates:
                self.fields['updated'].initial = updates[0].updated.ipr_id

            rfcs = {}
            for rfc in self.instance.docs().filter(doc_alias__name__startswith='rfc'):
                rfcs[rfc.doc_alias.id] = get_rfc_num(rfc.doc_alias.document)+" "+rfc.doc_alias.document.title
                
            drafts = {}
            for draft in self.instance.docs().exclude(doc_alias__name__startswith='rfc'):
                drafts[draft.doc_alias.id] = draft.doc_alias.document.name
            self.initial['rfc_num'] = json.dumps(rfcs)
            self.initial['id_filename'] = json.dumps(drafts)
        
        else:
            # if this is a new IPR hide status field
            self.fields['status'].widget = forms.HiddenInput()
示例#7
0
    def __init__(self, *args, **kwargs):
        formtype = kwargs.get('formtype')
        if formtype:
            del kwargs['formtype']
        super(IprDetailForm, self).__init__(*args, **kwargs)
        self.fields['legacy_url_0'].label = 'Old IPR Url'
        self.fields['title'].label = 'IPR Title'
        self.fields['legacy_title_1'].label = 'Text for Update Link'
        self.fields['legacy_url_1'].label = 'URL for Update Link'
        self.fields['legacy_title_2'].label = 'Additional Old Title 2'
        self.fields['legacy_url_2'].label = 'Additional Old URL 2'
        self.fields[
            'document_sections'].label = 'C. If an Internet-Draft or RFC includes multiple parts and it is not reasonably apparent which part of such Internet-Draft or RFC is alleged to be covered by the patent information disclosed in Section V(A) or V(B), it is helpful if the discloser identifies here the sections of the Internet-Draft or RFC that are alleged to be so covered.'
        self.fields[
            'patents'].label = 'Patent, Serial, Publication, Registration, or Application/File number(s)'
        self.fields[
            'date_applied'].label = 'Date(s) granted or applied for (YYYY-MM-DD)'
        self.fields[
            'comments'].label = 'Licensing information, comments, notes or URL for further information'
        self.fields[
            'lic_checkbox'].label = '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 IPR disclosure statement.'
        self.fields['third_party'].label = 'Third Party Notification?'
        self.fields['generic'].label = 'Generic IPR?'
        self.fields['comply'].label = 'Complies with RFC 3979?'
        self.fields[
            'is_pending'].label = "B. Does your disclosure relate to an unpublished pending patent application?"
        # textarea sizes
        self.fields['patents'].widget.attrs['rows'] = 2
        self.fields['patents'].widget.attrs['cols'] = 70
        self.fields['notes'].widget.attrs['rows'] = 3
        self.fields['notes'].widget.attrs['cols'] = 70
        self.fields['document_sections'].widget.attrs['rows'] = 3
        self.fields['document_sections'].widget.attrs['cols'] = 70
        self.fields['comments'].widget.attrs['rows'] = 3
        self.fields['comments'].widget.attrs['cols'] = 70
        self.fields['other_notes'].widget.attrs['rows'] = 5
        self.fields['other_notes'].widget.attrs['cols'] = 70

        #self.fields['is_pending'].widget.check_test = mytest
        self.fields['is_pending'].widget = forms.Select(
            choices=self.IS_PENDING_CHOICES)

        if formtype == 'update':
            if self.instance.generic:
                self.fields['document_sections'] = forms.ChoiceField(
                    widget=forms.RadioSelect,
                    choices=self.DOCUMENT_SECTIONS_CHOICES,
                    required=False,
                    label=
                    'C. Does this disclosure apply to all IPR owned by the submitter?'
                )
            legacy_url = self.instance.legacy_url_0
            self.fields['legacy_url_0'].label = mark_safe(
                '<a href="%s">Old IPR Url</a>' % legacy_url)

            updates = self.instance.updates.all()
            if updates:
                self.fields['updated'].initial = updates[0].updated.ipr_id

            rfcs = {}
            for rfc in self.instance.documents.filter(
                    doc_alias__name__startswith='rfc'):
                rfcs[rfc.doc_alias.id] = get_rfc_num(
                    rfc.doc_alias.document
                ) + " " + rfc.doc_alias.document.title

            drafts = {}
            for draft in self.instance.documents.exclude(
                    doc_alias__name__startswith='rfc'):
                drafts[draft.doc_alias.id] = draft.doc_alias.document.name
            self.initial['rfc_num'] = simplejson.dumps(rfcs)
            self.initial['id_filename'] = simplejson.dumps(drafts)

        else:
            # if this is a new IPR hide status field
            self.fields['status'].widget = forms.HiddenInput()
示例#8
0
def create_proceedings(meeting, group, is_final=False):
    '''
    This function creates the  proceedings html document.  It gets called anytime there is an
    update to the meeting or the slides for the meeting.
    NOTE: execution is aborted if the meeting is older than 79 because the format changed.
    '''
    # abort, proceedings from meetings before 79 have a different format, don't overwrite
    if meeting.type_id == 'ietf' and int(meeting.number) < 79:
        return

    sessions = Session.objects.filter(meeting=meeting,group=group)
    if sessions:
        session = sessions[0]
        agenda,minutes,slides = get_material(session)
    else:
        agenda = None
        minutes = None
        slides = None

    chairs = group.role_set.filter(name='chair')
    secretaries = group.role_set.filter(name='secr')
    if group.parent:        # Certain groups like Tools Team do no have a parent
        ads = group.parent.role_set.filter(name='ad')
    else:
        ads = None
    tas = group.role_set.filter(name='techadv')

    docs = Document.objects.filter(group=group,type='draft').order_by('time')

    meeting_root = get_upload_root(meeting)
    if meeting.type.slug == 'ietf':
        url_root = "%sproceedings/%s/" % (settings.MEDIA_URL,meeting.number)
    else:
        url_root = "%sproceedings/interim/%s/%s/" % (
            settings.MEDIA_URL,
            meeting.date.strftime('%Y/%m/%d'),
            group.acronym)

    # Only do these tasks if we are running official proceedings generation,
    # otherwise skip them for expediency.  This procedure is called any time meeting
    # materials are uploaded/deleted, and we don't want to do all this work each time.

    if is_final:
        # ----------------------------------------------------------------------
        # Find active Drafts and RFCs, copy them to id and rfc directories

        drafts = docs.filter(states__slug='active')
        for draft in drafts:
            source = os.path.join(draft.get_file_path(),draft.filename_with_rev())
            target = os.path.join(meeting_root,'id')
            if not os.path.exists(target):
                os.makedirs(target)
            if os.path.exists(source):
                shutil.copy(source,target)
                draft.bytes = os.path.getsize(source)
            else:
                draft.bytes = 0
            draft.url = url_root + "id/%s" % draft.filename_with_rev()

        rfcs = docs.filter(states__slug='rfc')
        for rfc in rfcs:
            # TODO should use get_file_path() here but is incorrect for rfcs
            rfc_num = get_rfc_num(rfc)
            filename = "rfc%s.txt" % rfc_num
            alias = rfc.docalias_set.filter(name='rfc%s' % rfc_num)
            source = os.path.join(settings.RFC_PATH,filename)
            target = os.path.join(meeting_root,'rfc')
            rfc.rmsg = ''
            rfc.msg = ''

            if not os.path.exists(target):
                os.makedirs(target)
            try:
                shutil.copy(source,target)
                rfc.bytes = os.path.getsize(source)
            except IOError:
                pass
            rfc.url = url_root + "rfc/%s" % filename
            rfc.num = "RFC %s" % rfc_num
            # check related documents
            # check obsoletes
            related = rfc.relateddocument_set.all()
            for item in related.filter(relationship='obs'):
                rfc.msg += 'obsoletes %s ' % item.target.name
                #rfc.msg += ' '.join(item.__str__().split()[1:])
            updates_list = [x.target.name.upper() for x in related.filter(relationship='updates')]
            if updates_list:
                rfc.msg += 'updates ' + ','.join(updates_list)
            # check reverse related
            rdocs = RelatedDocument.objects.filter(target=alias)
            for item in rdocs.filter(relationship='obs'):
                rfc.rmsg += 'obsoleted by RFC %s ' % get_rfc_num(item.source)
            updated_list = ['RFC %s' % get_rfc_num(x.source) for x in rdocs.filter(relationship='updates')]
            if updated_list:
                rfc.msg += 'updated by ' + ','.join(updated_list)
        # ----------------------------------------------------------------------
        # check for blue sheets
        pattern = os.path.join(meeting_root,'bluesheets','bluesheets-%s-%s-*' % (meeting.number,group.acronym.lower()))
        files = glob.glob(pattern)
        bluesheets = []
        for name in files:
            basename = os.path.basename(name)
            obj = {'name': basename,
                   'url': url_root + "bluesheets/" + basename}
            bluesheets.append(obj)
        bluesheets = sorted(bluesheets, key = lambda x: x['name'])
        # ----------------------------------------------------------------------
    else:
        drafts = rfcs = bluesheets = None

    # the simplest way to display the charter is to place it in a <pre> block
    # however, because this forces a fixed-width font, different than the rest of
    # the document we modify the charter by adding replacing linefeeds with <br>'s
    if group.charter:
        charter = get_charter_text(group).replace('\n','<br />')
        ctime = group.charter.time
    else:
        charter = None
        ctime = None


    # rather than return the response as in a typical view function we save it as the snapshot
    # proceedings.html
    response = render_to_response('proceedings/proceedings.html',{
        'bluesheets': bluesheets,
        'charter': charter,
        'ctime': ctime,
        'drafts': drafts,
        'group': group,
        'chairs': chairs,
        'secretaries': secretaries,
        'ads': ads,
        'tas': tas,
        'meeting': meeting,
        'rfcs': rfcs,
        'slides': slides,
        'minutes': minutes,
        'agenda': agenda}
    )

    # save proceedings
    proceedings_path = get_proceedings_path(meeting,group)

    f = open(proceedings_path,'w')
    f.write(response.content)
    f.close()
    try:
        os.chmod(proceedings_path, 0664)
    except OSError:
        pass

    # rebuild the directory
    if meeting.type.slug == 'interim':
        create_interim_directory()
示例#9
0
def get_progress_stats(sdate,edate):
    '''
    This function takes a date range and produces a dictionary of statistics / objects for use
    in a progress report.
    '''
    data = {}
    data['sdate'] = sdate
    data['edate'] = edate

    # Activty Report Section
    new_docs = Document.objects.filter(type='draft').filter(docevent__type='new_revision',
                                                            docevent__newrevisiondocevent__rev='00',
                                                            docevent__time__gte=sdate,
                                                            docevent__time__lte=edate)
    data['new'] = new_docs.count()
    data['updated'] = 0
    data['updated_more'] = 0
    for d in new_docs:
        updates = d.docevent_set.filter(type='new_revision',time__gte=sdate,time__lte=edate).count()
        if updates > 1:
            data['updated'] += 1
        if updates > 2:
            data['updated_more'] +=1

    # calculate total documents updated, not counting new, rev=00
    result = set()
    events = DocEvent.objects.filter(doc__type='draft',time__gte=sdate,time__lte=edate)
    for e in events.filter(type='new_revision').exclude(newrevisiondocevent__rev='00'):
        result.add(e.doc)
    data['total_updated'] = len(result)

    # calculate sent last call
    data['last_call'] = events.filter(type='sent_last_call').count()

    # calculate approved
    data['approved'] = events.filter(type='iesg_approved').count()

    # get 4 weeks
    monday = Meeting.get_ietf_monday()
    cutoff = monday + datetime.timedelta(days=3)
    ff1_date = cutoff - datetime.timedelta(days=28)
    #ff2_date = cutoff - datetime.timedelta(days=21)
    #ff3_date = cutoff - datetime.timedelta(days=14)
    #ff4_date = cutoff - datetime.timedelta(days=7)

    ff_docs = Document.objects.filter(type='draft').filter(docevent__type='new_revision',
                                                           docevent__newrevisiondocevent__rev='00',
                                                           docevent__time__gte=ff1_date,
                                                           docevent__time__lte=cutoff)
    ff_new_count = ff_docs.count()
    ff_new_percent = format(ff_new_count / float(data['new']),'.0%')

    # calculate total documents updated in final four weeks, not counting new, rev=00
    result = set()
    events = DocEvent.objects.filter(doc__type='draft',time__gte=ff1_date,time__lte=cutoff)
    for e in events.filter(type='new_revision').exclude(newrevisiondocevent__rev='00'):
        result.add(e.doc)
    ff_update_count = len(result)
    ff_update_percent = format(ff_update_count / float(data['total_updated']),'.0%')

    data['ff_new_count'] = ff_new_count
    data['ff_new_percent'] = ff_new_percent
    data['ff_update_count'] = ff_update_count
    data['ff_update_percent'] = ff_update_percent

    # Progress Report Section
    data['docevents'] = DocEvent.objects.filter(doc__type='draft',time__gte=sdate,time__lte=edate)
    data['action_events'] = data['docevents'].filter(type='iesg_approved')
    data['lc_events'] = data['docevents'].filter(type='sent_last_call')

    data['new_groups'] = Group.objects.filter(type='wg',
                                              groupevent__changestategroupevent__state='active',
                                              groupevent__time__gte=sdate,
                                              groupevent__time__lte=edate)

    data['concluded_groups'] = Group.objects.filter(type='wg',
                                                    groupevent__changestategroupevent__state='conclude',
                                                    groupevent__time__gte=sdate,
                                                    groupevent__time__lte=edate)

    data['new_docs'] = Document.objects.filter(type='draft').filter(docevent__type='new_revision',
                                                                    docevent__time__gte=sdate,
                                                                    docevent__time__lte=edate).distinct()

    data['rfcs'] = DocEvent.objects.filter(type='published_rfc',
                                           doc__type='draft',
                                           time__gte=sdate,
                                           time__lte=edate)

    # attach the ftp URL for use in the template
    for event in data['rfcs']:
        num = get_rfc_num(event.doc)
        event.ftp_url = 'ftp://ftp.ietf.org/rfc/rfc%s.txt' % num

    data['counts'] = {'std':data['rfcs'].filter(doc__intended_std_level__in=('ps','ds','std')).count(),
                      'bcp':data['rfcs'].filter(doc__intended_std_level='bcp').count(),
                      'exp':data['rfcs'].filter(doc__intended_std_level='exp').count(),
                      'inf':data['rfcs'].filter(doc__intended_std_level='inf').count()}

    return data
示例#10
0
def get_progress_stats(sdate,edate):
    '''
    This function takes a date range and produces a dictionary of statistics / objects for use
    in a progress report.
    '''
    data = {}
    data['sdate'] = sdate
    data['edate'] = edate
    
    # Activty Report Section
    new_docs = Document.objects.filter(type='draft').filter(docevent__type='new_revision',
                                                            docevent__newrevisiondocevent__rev='00',
                                                            docevent__time__gte=sdate,
                                                            docevent__time__lte=edate)
    data['new'] = new_docs.count()
    data['updated'] = 0
    data['updated_more'] = 0
    for d in new_docs:
        updates = d.docevent_set.filter(type='new_revision',time__gte=sdate,time__lte=edate).count()
        if updates > 1:
            data['updated'] += 1
        if updates > 2:
            data['updated_more'] +=1
    
    # calculate total documents updated, not counting new, rev=00
    result = set()
    events = DocEvent.objects.filter(doc__type='draft',time__gte=sdate,time__lte=edate)
    for e in events.filter(type='new_revision').exclude(newrevisiondocevent__rev='00'):
        result.add(e.doc)
    data['total_updated'] = len(result)
    
    # calculate sent last call
    data['last_call'] = events.filter(type='sent_last_call').count()
    
    # calculate approved
    data['approved'] = events.filter(type='iesg_approved').count()
    
    # get 4 weeks
    monday = Meeting.get_ietf_monday()
    cutoff = monday + datetime.timedelta(days=3)
    ff1_date = cutoff - datetime.timedelta(days=28)
    ff2_date = cutoff - datetime.timedelta(days=21)
    ff3_date = cutoff - datetime.timedelta(days=14)
    ff4_date = cutoff - datetime.timedelta(days=7)
    
    ff_docs = Document.objects.filter(type='draft').filter(docevent__type='new_revision',
                                                           docevent__newrevisiondocevent__rev='00',
                                                           docevent__time__gte=ff1_date,
                                                           docevent__time__lte=cutoff)
    ff_new_count = ff_docs.count()
    ff_new_percent = format(ff_new_count / float(data['new']),'.0%')
    
    # calculate total documents updated in final four weeks, not counting new, rev=00
    result = set()
    events = DocEvent.objects.filter(doc__type='draft',time__gte=ff1_date,time__lte=cutoff)
    for e in events.filter(type='new_revision').exclude(newrevisiondocevent__rev='00'):
        result.add(e.doc)
    ff_update_count = len(result)
    ff_update_percent = format(ff_update_count / float(data['total_updated']),'.0%')
    
    data['ff_new_count'] = ff_new_count
    data['ff_new_percent'] = ff_new_percent
    data['ff_update_count'] = ff_update_count
    data['ff_update_percent'] = ff_update_percent
    
    # Progress Report Section
    data['docevents'] = DocEvent.objects.filter(doc__type='draft',time__gte=sdate,time__lte=edate)
    data['action_events'] = data['docevents'].filter(type='iesg_approved')
    data['lc_events'] = data['docevents'].filter(type='sent_last_call')
    
    data['new_groups'] = Group.objects.filter(type='wg',
                                              groupevent__changestategroupevent__state='active',
                                              groupevent__time__gte=sdate,
                                              groupevent__time__lte=edate)
    
    data['concluded_groups'] = Group.objects.filter(type='wg',
                                                    groupevent__changestategroupevent__state='conclude',
                                                    groupevent__time__gte=sdate,
                                                    groupevent__time__lte=edate)
                                  
    data['new_docs'] = Document.objects.filter(type='draft').filter(docevent__type='new_revision',
                                                                    docevent__time__gte=sdate,
                                                                    docevent__time__lte=edate).distinct()
    
    data['rfcs'] = DocEvent.objects.filter(type='published_rfc',
                                           doc__type='draft',
                                           time__gte=sdate,
                                           time__lte=edate)
    
    # attach the ftp URL for use in the template
    for event in data['rfcs']:
        num = get_rfc_num(event.doc)
        event.ftp_url = 'ftp://ftp.ietf.org/rfc/rfc%s.txt' % num
        
    data['counts'] = {'std':data['rfcs'].filter(doc__intended_std_level__in=('ps','ds','std')).count(),
                      'bcp':data['rfcs'].filter(doc__intended_std_level='bcp').count(),
                      'exp':data['rfcs'].filter(doc__intended_std_level='exp').count(),
                      'inf':data['rfcs'].filter(doc__intended_std_level='inf').count()}
    
    return data
示例#11
0
def create_proceedings(meeting, group, is_final=False):
    '''
    This function creates the  proceedings html document.  It gets called anytime there is an
    update to the meeting or the slides for the meeting.
    NOTE: execution is aborted if the meeting is older than 79 because the format changed.
    '''
    # abort, proceedings from meetings before 79 have a different format, don't overwrite
    if meeting.type_id == 'ietf' and int(meeting.number) < 79:
        return
        
    sessions = Session.objects.filter(meeting=meeting,group=group)
    if sessions:
        session = sessions[0]
        agenda,minutes,slides = get_material(session)
    else:
        agenda = None
        minutes = None
        slides = None
        
    chairs = group.role_set.filter(name='chair')
    secretaries = group.role_set.filter(name='secr')
    if group.parent:        # Certain groups like Tools Team do no have a parent
        ads = group.parent.role_set.filter(name='ad')
    else:
        ads = None
    tas = group.role_set.filter(name='techadv')
    
    docs = Document.objects.filter(group=group,type='draft').order_by('time')

    meeting_root = get_upload_root(meeting)
    if meeting.type.slug == 'ietf':
        url_root = "%s/proceedings/%s/" % (settings.MEDIA_URL,meeting.number)
    else:
        url_root = "%s/proceedings/interim/%s/%s/" % (
            settings.MEDIA_URL,
            meeting.date.strftime('%Y/%m/%d'),
            group.acronym)
    
    # Only do these tasks if we are running official proceedings generation,
    # otherwise skip them for expediency.  This procedure is called any time meeting 
    # materials are uploaded/deleted, and we don't want to do all this work each time.
    
    if is_final:
        # ----------------------------------------------------------------------
        # Find active Drafts and RFCs, copy them to id and rfc directories
        
        drafts = docs.filter(states__slug='active')
        for draft in drafts:
            source = os.path.join(draft.get_file_path(),draft.filename_with_rev())
            target = os.path.join(meeting_root,'id')
            if not os.path.exists(target):
                os.makedirs(target)
            if os.path.exists(source):
                shutil.copy(source,target)
                draft.bytes = os.path.getsize(source)
            else:
                draft.bytes = 0
            draft.url = url_root + "id/%s" % draft.filename_with_rev()
            
        rfcs = docs.filter(states__slug='rfc')
        for rfc in rfcs:
            # TODO should use get_file_path() here but is incorrect for rfcs
            rfc_num = get_rfc_num(rfc)
            filename = "rfc%s.txt" % rfc_num
            alias = rfc.docalias_set.filter(name='rfc%s' % rfc_num)
            source = os.path.join(settings.RFC_PATH,filename)
            target = os.path.join(meeting_root,'rfc')
            rfc.rmsg = ''
            rfc.msg = ''
            
            if not os.path.exists(target):
                os.makedirs(target)
            shutil.copy(source,target)
            rfc.url = url_root + "rfc/%s" % filename
            rfc.bytes = os.path.getsize(source)
            rfc.num = "RFC %s" % rfc_num
            # check related documents
            # check obsoletes
            related = rfc.relateddocument_set.all()
            for item in related.filter(relationship='obs'):
                rfc.msg += 'obsoletes %s ' % item.target.name
                #rfc.msg += ' '.join(item.__str__().split()[1:])
            updates_list = [x.target.name.upper() for x in related.filter(relationship='updates')]
            if updates_list:
                rfc.msg += 'updates ' + ','.join(updates_list)
            # check reverse related
            rdocs = RelatedDocument.objects.filter(target=alias)
            for item in rdocs.filter(relationship='obs'):
                rfc.rmsg += 'obsoleted by RFC %s ' % get_rfc_num(item.source)
            updated_list = ['RFC %s' % get_rfc_num(x.source) for x in rdocs.filter(relationship='updates')]
            if updated_list:
                rfc.msg += 'updated by ' + ','.join(updated_list)
        # ----------------------------------------------------------------------
        # check for blue sheets
        pattern = os.path.join(meeting_root,'bluesheets','bluesheets-%s-%s-*' % (meeting.number,group.acronym.lower()))
        files = glob.glob(pattern)
        bluesheets = []
        for name in files:
            basename = os.path.basename(name)
            obj = {'name': basename,
                   'url': url_root + "bluesheets/" + basename}
            bluesheets.append(obj)
        bluesheets = sorted(bluesheets, key = lambda x: x['name'])
        # ----------------------------------------------------------------------
    else:
        drafts = rfcs = bluesheets = None
        
    # the simplest way to display the charter is to place it in a <pre> block
    # however, because this forces a fixed-width font, different than the rest of
    # the document we modify the charter by adding replacing linefeeds with <br>'s
    if group.charter:
        charter = get_charter_text(group).replace('\n','<br />')
        ctime = group.charter.time
    else:
        charter = None
        ctime = None
    
    
    # rather than return the response as in a typical view function we save it as the snapshot
    # proceedings.html
    response = render_to_response('proceedings/proceedings.html',{
        'bluesheets': bluesheets,
        'charter': charter,
        'ctime': ctime,
        'drafts': drafts,
        'group': group,
        'chairs': chairs,
        'secretaries': secretaries,
        'ads': ads,
        'tas': tas,
        'meeting': meeting,
        'rfcs': rfcs,
        'slides': slides,
        'minutes': minutes,
        'agenda': agenda}
    )
    
    # save proceedings
    proceedings_path = get_proceedings_path(meeting,group)
    
    f = open(proceedings_path,'w')
    f.write(response.content)
    f.close()
    try:
        os.chmod(proceedings_path, 0664)
    except OSError:
        pass
    
    # rebuild the directory
    if meeting.type.slug == 'interim':
        create_interim_directory()
示例#12
0
def admin_detail(request, ipr_id):
    if request.POST and request.POST['command']:
        command = request.POST['command']
        if command == 'post':
            return admin_post(request, ipr_id, 'detail', 'post')
        elif command == 'notify':
            return HttpResponseRedirect(
                reverse('ipr_old_submitter_notify', args=[ipr_id]))
        elif command == 'delete':
            return HttpResponseRedirect(
                reverse('ipr_admin_delete', args=[ipr_id]))

    header_text = possible = temp_name = footer_text = ''
    contact_one_data, contact_two_data, document_data, licensing_data,\
        disclosure_data, designations_data, contact_three_data,\
        notes_data, controls = [], [], [], [], [], [], [], [], []

    ipr_dtl = IprDetail.objects.get(ipr_id=ipr_id)
    ipr_updates = IprUpdate.objects.filter(processed=0, ipr__ipr_id=ipr_id)

    contact_one, contact_two, contact_three = [
        ipr_dtl.contact.filter(contact_type=x) for x in (1, 2, 3)
    ]

    if ipr_updates:
        if ipr_dtl.update_notified_date:
            footer_text = mark_safe(
                '<span class="alert">This update was notifed to the submitter of the IPR that is being updated on %s.</span>'
                % ipr_dtl.update_notified_date)
        else:
            controls = ['notify']
    if not ipr_updates or ipr_dtl.update_notified_date:
        controls = ['post']

    controls.append('delete')

    if ipr_dtl.third_party:
        temp_name = 'Notification'
        possible = 'Possible '
        displaying_section = "I, II, and III"
        header_text = '''This form is used to let the IETF know about patent information regarding an IETF document or contribution when the person letting the IETF know about the patent has no relationship with the patent owners.<br>
  Click <a href="./ipr.cgi"> here</a> if you want to disclose information about patents or patent applications where you do have a relationship to the patent owners or patent applicants.'''
    elif ipr_dtl.generic:
        temp_name = "Generic IPR Disclosures"
        displaying_section = "I and II"
        header_text = '''This document is an IETF IPR Patent Disclosure and Licensing Declaration 
     Template and is submitted to inform the IETF of a) patent or patent application information that is not related to a specific IETF document or contribution, and b) an IPR Holder's intention with respect to the licensing of its necessary patent claims.
     No actual license is implied by submission of this template.'''
    else:
        temp_name = "Specific IPR Disclosures"
        displaying_section = "I, II, and IV"
        header_text = '''This document is an IETF IPR Disclosure and Licensing Declaration 
   Template and is submitted to inform the IETF of a) patent or patent application information regarding
   the IETF document or contribution listed in Section IV, and b) an IPR Holder\'s intention with respect to the licensing of its necessary patent claims.
   No actual license is implied by submission of this template. 
   Please complete and submit a separate template for each IETF document or contribution to which the
   disclosed patent information relates.'''

    legacy_links = (
        (ipr_dtl.legacy_url_1 or '', ipr_dtl.legacy_title_1 or ''),
        (ipr_dtl.legacy_url_2 or '', ipr_dtl.legacy_title_2 or ''),
    )

    comply_statement = '' if ipr_dtl.comply else mark_safe(
        '<div class="alert">This IPR disclosure does not comply with the formal requirements of Section 6, "IPR Disclosures," of RFC 3979, "Intellectual Property Rights in IETF Technology."</div>'
    )

    # FIXME: header_text is assembled in perl code but never printed
    if ipr_dtl.legacy_url_0:
        #header_text = header_text + '''
        header_text = '''
     This IPR disclosure was submitted by e-mail.<br>
    %s
    Sections %s of "The Patent Disclosure and Licensing Declaration Template for %s" have been completed for this IPR disclosure. Additional information may be available in the original submission.<br>
     Click <a href="%s">here</a> to view the content of the original IPR disclosure.''' % (
            comply_statement, displaying_section, temp_name,
            ipr_dtl.legacy_url_0)
    else:
        #header_text = header_text + '''
        header_text = '''
    Only those sections of the "Patent Disclosure and Licensing Declaration Template for %s" where the submitter provided information are displayed.''' % temp_name

    if not ipr_dtl.generic or not (not ipr_dtl.legacy_url_0 and
                                   (ipr_dtl.notes or ipr_dtl.patents)):
        # FIXME: behavior as perl, but is quite confusing and seems wrong
        if contact_one and contact_one[0].name:
            contact_one = contact_one[0]
            contact_one_data = [
                ('II. Patent Holder\'s Contact for License Application:'),
                ('Name:', contact_one.name), ('Title:', contact_one.title),
                ('Department:', contact_one.department),
                ('Address1:', contact_one.address1),
                ('Address2:', contact_one.address2),
                ('Telephone:', contact_one.telephone),
                ('Fax:', contact_one.fax), ('Email:', contact_one.email)
            ]

    if not ipr_dtl.generic:

        if contact_two and contact_two[0].name:
            contact_two = contact_two[0]
            contact_two_data = [(
                'III. Contact Information for the IETF Participant Whose Personal Belief Triggered this Disclosure:'
            ), ('Name:', contact_two.name), ('Title:', contact_two.title),
                                ('Department:', contact_two.department),
                                ('Address1:', contact_two.address1),
                                ('Address2:', contact_two.address2),
                                ('Telephone:', contact_two.telephone),
                                ('Fax:', contact_two.fax),
                                ('Email:', contact_two.email)]

        # conversion
        #rfcs = ipr_dtl.rfcs.all()
        #drafts = ipr_dtl.drafts.all()
        rfcs = ipr_dtl.documents.filter(doc_alias__name__startswith='rfc')
        drafts = ipr_dtl.documents.exclude(doc_alias__name__startswith='rfc')
        titles_data, rfcs_data, drafts_data, designations_data = (), (), (), ()
        rfc_titles, draft_titles = [], []
        if rfcs:
            rfc_titles = [rfc.doc_alias.document.title for rfc in rfcs]
            rfcs_data = tuple([
                'RFC Number:',
                [get_rfc_num(rfc.doc_alias.document) for rfc in rfcs]
            ])
        if drafts:
            draft_titles = [draft.doc_alias.document.title for draft in drafts]
            drafts_data = tuple([
                'ID Filename:',
                [draft.doc_alias.document.name + '.txt' for draft in drafts]
            ])
        if ipr_dtl.other_designations:
            designations_data = tuple([
                'Designations for Other Contributions:',
                ipr_dtl.other_designations
            ])
        if drafts or rfcs:
            titles_data = tuple(['Title:', rfc_titles + draft_titles])

        if rfcs_data or drafts_data or designations_data:
            document_data = [
                ('IV. IETF Document or Other Contribution to Which this IPR Disclosure Relates'
                 ),
                titles_data,
                rfcs_data,
                drafts_data,
                designations_data,
            ]

    if not ipr_dtl.legacy_url_0 and (ipr_dtl.notes or ipr_dtl.patents):
        if ipr_dtl.generic:
            disclosure_c = (
                'C. Does this disclosure apply to all IPR owned by the submitter?',
                'YES' if ipr_dtl.applies_to_all else 'NO')
        else:
            disclosure_c = (
                '''C. If an Internet-Draft or RFC includes multiple parts and it is not
   reasonably apparent which part of such Internet-Draft or RFC is alleged
   to be covered by the patent information disclosed in Section
   V(A) or V(B), it is helpful if the discloser identifies here the sections of
   the Internet-Draft or RFC that are alleged to be so
   covered.''', ipr_dtl.document_sections)
        disclosure_data = [
            ('V. Disclosure of Patent Information (i.e., patents or patent applications required to be disclosed by Section 6 of RFC 3979)'
             ),
            ('A. For granted patents or published pending patent applications, please provide the following information',
             ''),
            ('Patent, Serial, Publication, Registration, or Application/File number(s):',
             ipr_dtl.patents),
            ('Date(s) granted or applied for:', ipr_dtl.date_applied),
            ('Country:', ipr_dtl.country),
            ('Additional Notes:', ipr_dtl.notes),
            #('B. Does your disclosure relate to an unpublished pending patent application?', 'YES' if ipr_dtl.applies_to_all else 'NO'),
            ('B. Does your disclosure relate to an unpublished pending patent application?',
             'YES' if ipr_dtl.is_pending == 1 else 'NO'),
            disclosure_c
        ]

    if not ipr_dtl.third_party and ipr_dtl.licensing_option:
        lic_idx = ipr_dtl.licensing_option
        chosen_declaration = LICENSE_CHOICES[lic_idx - 1][1]
        sub_opt = bool(lic_idx == 0 and ipr_dtl.lic_opt_a_sub
                       or lic_idx == 1 and ipr_dtl.lic_opt_b_sub
                       or lic_idx == 2 and ipr_dtl.lic_opt_c_sub)
        chosen_declaration += STDONLY_CHOICES[1][1] if sub_opt else ''
        chosen_declaration = (mark_safe("<strong>%s</strong>" %
                                        chosen_declaration), '')

        comments = ipr_dtl.comments or None
        lic_checkbox = ipr_dtl.lic_checkbox or None
        if comments or lic_checkbox:
            comments_notes_label = (
                'Licensing information, comments, notes or URL for further information:'
            ),
            comments_notes = (mark_safe("<strong>%s<br /><br />%s</strong>" % (
                comments,
                '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 IPR disclosure statement.'
                if lic_checkbox else '')), '')
        else:
            comments_notes_label = comments_notes = ''

        licensing_data = [
            ('VI. Licensing Declaration:'),
            ('The Patent Holder states that its position with respect to licensing any patent claims contained in the patent(s) or patent application(s) disclosed above that would necessarily be infringed by implementation of the technology required by the relevant IETF specification ("Necessary Patent Claims"), for the purpose of implementing such specification, is as follows(select one licensing declaration option only):',
             ''), chosen_declaration, comments_notes_label, comments_notes
        ]

    if contact_three and contact_three[0].name:
        contact_three = contact_three[0]
        contact_three_data = [(
            'VII. Contact Information of Submitter of this Form (if different from IETF Participant in Section III above):'
        ), ('Name:', contact_three.name), ('Title:', contact_three.title),
                              ('Department:', contact_three.department),
                              ('Address1:', contact_three.address1),
                              ('Address2:', contact_three.address2),
                              ('Telephone:', contact_three.telephone),
                              ('Fax:', contact_three.fax),
                              ('Email:', contact_three.email)]

    if ipr_dtl.other_notes:
        notes_data = (('VIII. Other Notes:'),
                      (mark_safe("<strong>%s</strong>" % ipr_dtl.other_notes),
                       ''))

    if not (not ipr_dtl.legacy_url_0 and (ipr_dtl.notes or ipr_dtl.patents)):
        # FIXME: behavior as perl, but is quite confusing and seems wrong
        licensing_data = contact_three_data = notes_data = ()

    page_data = [
        [
            ('I. %sPatent Holder/Applicant ("Patent Holder"):' % possible),
            ('Legal Name:', ipr_dtl.legal_name),
        ],
        contact_one_data,
        contact_two_data,
        document_data,
        disclosure_data,
        licensing_data,
        contact_three_data,
        notes_data,
    ]
    return dict(
        ipr_title=ipr_dtl.title,
        header_text=header_text,
        legacy_links=legacy_links,
        submitted_date=ipr_dtl.submitted_date,
        page_data=page_data,
        footer_text=footer_text,
        controls=controls,
    )
示例#13
0
def get_document_relatives(ipr_dtl, docalias):
    '''
    This function takes a IprDetail object and a DocAlias object and returns an email.
    '''
    text = ''
    doc = docalias.document
    doc_info, author_names, author_emails, cc_list = '', '', '', ''
    authors = doc.authors.all()

    if is_draft(doc):
        doc_info = 'Internet-Draft entitled "%s" (%s)' \
            % (doc.title, doc.name)
        updated_id = doc.pk

    else:  # not i-draft, therefore rfc
        rfc_num = get_rfc_num(doc)
        doc_info = 'RFC entitled "%s" (RFC%s)' \
            % (doc.title, rfc_num)
        updated_id = rfc_num

    # if the document is not associated with a group copy job owner or Gernal Area Director
    if doc.group.acronym == 'none':
        if doc.ad and is_draft(doc):
            cc_list = doc.ad.role_email('ad').address
        else:
            role = Role.objects.filter(group__acronym='gen', name='ad')[0]
            cc_list = role.email.address

    else:
        cc_list = get_wg_email_list(doc.group)

    author_emails = ','.join([a.address for a in authors])
    author_names = ', '.join([a.person.name for a in authors])

    cc_list += ", [email protected]"

    submitted_date = ipr_dtl.submitted_date
    ipr_title = ipr_dtl.title

    email_body = '''
An IPR disclosure that pertains to your %s was submitted to the IETF Secretariat on %s and has been posted on the "IETF Page of Intellectual Property Rights Disclosures" (https://datatracker.ietf.org/ipr/%s/). The title of the IPR disclosure is "%s."");
    ''' % (doc_info, submitted_date, ipr_dtl.ipr_id, ipr_title)
    wrapper = TextWrapper(width=80, break_long_words=False)
    email_body = wrapper.fill(email_body)

    text = '''
<h4>Notification for %s</h4>
<textarea name="notify_%s" rows=25 cols=80>
To: %s
From: IETF Secretariat <*****@*****.**>
Subject: IPR Disclosure: %s
Cc: %s

Dear %s:

%s

The IETF Secretariat

</textarea>
<br><br>
    ''' % (doc_info, updated_id, author_emails, ipr_title, cc_list,
           author_names, email_body)
    # FIXME: why isn't this working - done in template now, also
    return mark_safe(text)
示例#14
0
def view(request, id):
    ''' 
    View Internet Draft

    **Templates:**

    * ``drafts/view.html``

    **Template Variables:**

    * draft, area, id_tracker_state
    '''
    draft = get_object_or_404(Document, name=id)

    # TODO fix in Django 1.2
    # some boolean state variables for use in the view.html template to manage display
    # of action buttons.  NOTE: Django 1.2 support new smart if tag in templates which
    # will remove the need for these variables
    state = draft.get_state_slug()
    is_active = True if state == 'active' else False
    is_expired = True if state == 'expired' else False
    is_withdrawn = True if (state in ('auth-rm', 'ietf-rm')) else False

    # TODO should I rewrite all these or just use proxy.InternetDraft?
    # add legacy fields
    draft.iesg_state = draft.get_state('draft-iesg')
    draft.review_by_rfc_editor = bool(draft.tags.filter(slug='rfc-rev'))

    # can't assume there will be a new_revision record
    r_event = draft.latest_event(type__in=('new_revision',
                                           'completed_resurrect'))
    draft.revision_date = r_event.time.date() if r_event else None

    draft.start_date = get_start_date(draft)

    e = draft.latest_event(type__in=('expired_document', 'new_revision',
                                     "completed_resurrect"))
    draft.expiration_date = e.time.date(
    ) if e and e.type == "expired_document" else None
    draft.rfc_number = get_rfc_num(draft)

    # check for replaced bys
    qs = Document.objects.filter(relateddocument__target__document=draft,
                                 relateddocument__relationship='replaces')
    if qs:
        draft.replaced_by = qs[0]

    # check for DEVELOPMENT setting and pass to template
    is_development = False
    try:
        is_development = settings.DEVELOPMENT
    except AttributeError:
        pass

    return render(
        request,
        'drafts/view.html',
        {
            'is_active': is_active,
            'is_expired': is_expired,
            'is_withdrawn': is_withdrawn,
            'is_development': is_development,
            'draft': draft
        },
    )