@@ -158,7 +158,7 @@ def document_main(request, name, rev=None):
158158 person__user = request .user )))
159159 can_edit_iana_state = has_role (request .user , ("Secretariat" , "IANA" ))
160160
161- can_edit_replaces = has_role (request .user , ("Area Director" , "Secretariat" , "WG Chair" , "RG Chair" , "WG Secretary" , "RG Secretary" ))
161+ can_edit_replaces = has_role (request .user , ("Area Director" , "Secretariat" , "IRTF Chair" , " WG Chair" , "RG Chair" , "WG Secretary" , "RG Secretary" ))
162162
163163 is_author = unicode (request .user ) in set ([email .address for email in doc .authors .all ()])
164164 can_view_possibly_replaces = can_edit_replaces or is_author
@@ -197,7 +197,7 @@ def document_main(request, name, rev=None):
197197 file_urls .append (("pdf" , base + "pdfrfc/" + name + ".txt.pdf" ))
198198
199199 if "txt" in found_types :
200- file_urls .append (("html" , "https://tools.ietf.org/html/" + name ))
200+ file_urls .append (("html" , settings . TOOLS_ID_HTML_URL + name ))
201201
202202 if not found_types :
203203 content = "This RFC is not currently available online."
@@ -216,21 +216,19 @@ def document_main(request, name, rev=None):
216216 possible_types = ["pdf" , "xml" , "ps" ]
217217 found_types = ["txt" ] + [t for t in possible_types if os .path .exists (base_path + t )]
218218
219- tools_base = "https://tools.ietf.org/"
220-
221219 if doc .get_state_slug () == "active" :
222- base = "https://www.ietf.org/id/"
220+ base = settings . IETF_ID_URL
223221 else :
224- base = tools_base + "id/"
222+ base = settings . IETF_ID_ARCHIVE_URL
225223
226224 file_urls = []
227225 for t in found_types :
228226 label = "plain text" if t == "txt" else t
229227 file_urls .append ((label , base + doc .name + "-" + doc .rev + "." + t ))
230228
231229 if "pdf" not in found_types :
232- file_urls .append (("pdf" , tools_base + "pdf/" + doc .name + "-" + doc .rev + ".pdf" ))
233- file_urls .append (("html" , tools_base + "html/" + doc .name + "-" + doc .rev ))
230+ file_urls .append (("pdf" , settings . TOOLS_ID_PDF_URL + doc .name + "-" + doc .rev + ".pdf" ))
231+ file_urls .append (("html" , settings . TOOLS_ID_HTML_URL + doc .name + "-" + doc .rev ))
234232
235233 # latest revision
236234 latest_revision = doc .latest_event (NewRevisionDocEvent , type = "new_revision" )
@@ -648,11 +646,22 @@ def document_history(request, name):
648646 augment_events_with_revision (doc , events )
649647 add_links_in_new_revision_events (doc , events , diff_revisions )
650648
649+ # figure out if the current user can add a comment to the history
650+ if doc .type_id == "draft" and doc .group != None :
651+ can_add_comment = bool (has_role (request .user , ("Area Director" , "Secretariat" , "IRTF Chair" , "IANA" , "RFC Editor" )) or (
652+ request .user .is_authenticated () and
653+ Role .objects .filter (name__in = ("chair" , "secr" ),
654+ group__acronym = doc .group .acronym ,
655+ person__user = request .user )))
656+ else :
657+ can_add_comment = has_role (request .user , ("Area Director" , "Secretariat" , "IRTF Chair" ))
658+
651659 return render_to_response ("doc/document_history.html" ,
652660 dict (doc = doc ,
653661 top = top ,
654662 diff_revisions = diff_revisions ,
655663 events = events ,
664+ can_add_comment = can_add_comment ,
656665 ),
657666 context_instance = RequestContext (request ))
658667
@@ -889,7 +898,7 @@ def extract_name(s):
889898class AddCommentForm (forms .Form ):
890899 comment = forms .CharField (required = True , widget = forms .Textarea )
891900
892- @role_required ('Area Director' , 'Secretariat' , 'IANA' , 'RFC Editor' )
901+ @role_required ('Area Director' , 'Secretariat' , 'IRTF Chair' , 'WG Chair' , 'RG Chair' , 'WG Secretary' , 'RG Secretary' , ' IANA' , 'RFC Editor' )
893902def add_comment (request , name ):
894903 """Add comment to history of document."""
895904 doc = get_object_or_404 (Document , docalias__name = name )
0 commit comments