@@ -87,6 +87,8 @@ def tmpl_get_first_comments_without_ranking(self, recID, ln, comments, nb_commen
8787 c_user_id = 1
8888 c_date_creation = 2
8989 c_body = 3
90+ c_status = 4
91+ c_nb_reports = 5
9092 c_id = 6
9193 c_body_format = 10
9294
@@ -125,11 +127,21 @@ def tmpl_get_first_comments_without_ranking(self, recID, ln, comments, nb_commen
125127 <td>"""
126128 report_link = '%s/%s/%s/comments/report?ln=%s&comid=%s' % (CFG_SITE_URL , CFG_SITE_RECORD , recID , ln , comment [c_id ])
127129 reply_link = '%s/%s/%s/comments/add?ln=%s&comid=%s&action=REPLY' % (CFG_SITE_URL , CFG_SITE_RECORD , recID , ln , comment [c_id ])
128- comment_rows += self .tmpl_get_comment_without_ranking (req = None , ln = ln , nickname = messaging_link , comment_uid = comment [c_user_id ],
129- date_creation = comment [c_date_creation ],
130- body = comment [c_body ], body_format = comment [c_body_format ],
131- status = '' , nb_reports = 0 ,
132- report_link = report_link , reply_link = reply_link , recID = recID )
130+ comment_rows += self .tmpl_get_comment_without_ranking (
131+ req = None ,
132+ ln = ln ,
133+ nickname = messaging_link ,
134+ comment_uid = comment [c_user_id ],
135+ date_creation = comment [c_date_creation ],
136+ body = comment [c_body ],
137+ body_format = comment [c_body_format ],
138+ status = comment [c_status ],
139+ nb_reports = comment [c_nb_reports ],
140+ reply_link = reply_link ,
141+ report_link = report_link ,
142+ recID = recID ,
143+ com_id = comment [c_id ]
144+ )
133145 comment_rows += """
134146 <br />
135147 <br />
@@ -229,11 +241,13 @@ def tmpl_get_first_comments_with_ranking(self, recID, ln, comments=None, nb_comm
229241 c_user_id = 1
230242 c_date_creation = 2
231243 c_body = 3
232- c_nb_votes_yes = 4
233- c_nb_votes_total = 5
234- c_star_score = 6
235- c_title = 7
236- c_id = 8
244+ c_status = 4
245+ c_nb_reports = 5
246+ c_nb_votes_yes = 6
247+ c_nb_votes_total = 7
248+ c_star_score = 8
249+ c_title = 9
250+ c_id = 10
237251 c_body_format = 14
238252
239253 warnings = self .tmpl_warnings (warnings , ln )
@@ -278,16 +292,23 @@ def tmpl_get_first_comments_with_ranking(self, recID, ln, comments=None, nb_comm
278292 <tr>
279293 <td>'''
280294 report_link = '%s/%s/%s/reviews/report?ln=%s&comid=%s' % (CFG_SITE_URL , CFG_SITE_RECORD , recID , ln , comment [c_id ])
281- comment_rows += self .tmpl_get_comment_with_ranking (None , ln = ln , nickname = messaging_link ,
282- comment_uid = comment [c_user_id ],
283- date_creation = comment [c_date_creation ],
284- body = comment [c_body ],
285- body_format = comment [c_body_format ],
286- status = '' , nb_reports = 0 ,
287- nb_votes_total = comment [c_nb_votes_total ],
288- nb_votes_yes = comment [c_nb_votes_yes ],
289- star_score = comment [c_star_score ],
290- title = comment [c_title ], report_link = report_link , recID = recID )
295+ comment_rows += self .tmpl_get_comment_with_ranking (
296+ req = None ,
297+ ln = ln ,
298+ nickname = messaging_link ,
299+ comment_uid = comment [c_user_id ],
300+ date_creation = comment [c_date_creation ],
301+ body = comment [c_body ],
302+ body_format = comment [c_body_format ],
303+ status = comment [c_status ],
304+ nb_reports = comment [c_nb_reports ],
305+ nb_votes_total = comment [c_nb_votes_total ],
306+ nb_votes_yes = comment [c_nb_votes_yes ],
307+ star_score = comment [c_star_score ],
308+ title = comment [c_title ],
309+ report_link = report_link ,
310+ recID = recID
311+ )
291312 comment_rows += '''
292313 %s %s / %s<br />''' % (_ ("Was this review helpful?" ), useful_yes % {'comid' :comment [c_id ]}, useful_no % {'comid' :comment [c_id ]})
293314 comment_rows += '''
@@ -359,7 +380,7 @@ def tmpl_get_first_comments_with_ranking(self, recID, ln, comments=None, nb_comm
359380 write_button_form )
360381 return out
361382
362- def tmpl_get_comment_without_ranking (self , req , ln , nickname , comment_uid , date_creation , body , body_format , status , nb_reports , reply_link = None , report_link = None , undelete_link = None , delete_links = None , unreport_link = None , recID = - 1 , com_id = '' , attached_files = None , collapsed_p = False ):
383+ def tmpl_get_comment_without_ranking (self , req , ln , nickname , comment_uid , date_creation , body , body_format , status , nb_reports , reply_link = None , report_link = None , undelete_link = None , delete_links = None , unreport_link = None , recID = - 1 , com_id = '' , attached_files = None , collapsed_p = False , admin_p = False ):
363384 """
364385 private function
365386 @param req: request object to fetch user info
@@ -416,7 +437,7 @@ def tmpl_get_comment_without_ranking(self, req, ln, nickname, comment_uid, date_
416437 # Check if user is a comment moderator
417438 record_primary_collection = guess_primary_collection_of_a_record (recID )
418439 (auth_code , auth_msg ) = acc_authorize_action (user_info , 'moderatecomments' , collection = record_primary_collection )
419- if status in ['dm' , 'da' ] and req :
440+ if status in ['dm' , 'da' ] and not admin_p :
420441 if not auth_code :
421442 if status == 'dm' :
422443 final_body = '<div class="webcomment_deleted_comment_message">(Comment deleted by the moderator) - not visible for users<br /><br />' + \
@@ -462,7 +483,7 @@ def tmpl_get_comment_without_ranking(self, req, ln, nickname, comment_uid, date_
462483
463484 toggle_visibility_block = ''
464485 if not isGuestUser (user_info ['uid' ]):
465- toggle_visibility_block = """<div class="webcomment_toggle_visibility"><a id="collapsible_ctr_%(comid)s" class="%(collapse_ctr_class)s" href="%(toggle_url)s" onclick="return toggle_visibility(this, %(comid)i );" title="%(collapse_label)s"><span style="display:none">%(collapse_label)s</span></a></div>""" % \
486+ toggle_visibility_block = """<div class="webcomment_toggle_visibility"><a id="collapsible_ctr_%(comid)s" class="%(collapse_ctr_class)s" href="%(toggle_url)s" onclick="return toggle_visibility(this, %(comid)s );" title="%(collapse_label)s"><span style="display:none">%(collapse_label)s</span></a></div>""" % \
466487 {'comid' : com_id ,
467488 'toggle_url' : create_url (CFG_SITE_URL + '/' + CFG_SITE_RECORD + '/' + str (recID ) + '/comments/toggle' , {'comid' : com_id , 'ln' : ln , 'collapse' : collapsed_p and '0' or '1' , 'referer' : user_info ['uri' ]}),
468489 'collapse_ctr_class' : collapsed_p and 'webcomment_collapse_ctr_right' or 'webcomment_collapse_ctr_down' ,
@@ -476,9 +497,9 @@ def tmpl_get_comment_without_ranking(self, req, ln, nickname, comment_uid, date_
476497 <div class="webcomment_comment_title">
477498 %(title)s
478499 <div class="webcomment_comment_date">%(date)s</div>
479- <a class="webcomment_permalink" title="Permalink to this comment" href="#C%(comid)i ">¶</a>
500+ <a class="webcomment_permalink" title="Permalink to this comment" href="#C%(comid)s ">¶</a>
480501 </div>
481- <div class="collapsible_content" id="collapsible_content_%(comid)i " style="%(collapsible_content_style)s">
502+ <div class="collapsible_content" id="collapsible_content_%(comid)s " style="%(collapsible_content_style)s">
482503 <div class="webcomment_comment_body">
483504 %(body)s
484505 </div>
@@ -502,7 +523,7 @@ def tmpl_get_comment_without_ranking(self, req, ln, nickname, comment_uid, date_
502523 }
503524 return out
504525
505- def tmpl_get_comment_with_ranking (self , req , ln , nickname , comment_uid , date_creation , body , body_format , status , nb_reports , nb_votes_total , nb_votes_yes , star_score , title , report_link = None , delete_links = None , undelete_link = None , unreport_link = None , recID = - 1 ):
526+ def tmpl_get_comment_with_ranking (self , req , ln , nickname , comment_uid , date_creation , body , body_format , status , nb_reports , nb_votes_total , nb_votes_yes , star_score , title , report_link = None , delete_links = None , undelete_link = None , unreport_link = None , recID = - 1 , admin_p = False ):
506527 """
507528 private function
508529 @param req: request object to fetch user info
@@ -559,7 +580,7 @@ def tmpl_get_comment_with_ranking(self, req, ln, nickname, comment_uid, date_cre
559580 record_primary_collection = guess_primary_collection_of_a_record (recID )
560581 user_info = collect_user_info (req )
561582 (auth_code , auth_msg ) = acc_authorize_action (user_info , 'moderatecomments' , collection = record_primary_collection )
562- if status in ['dm' , 'da' ] and req :
583+ if status in ['dm' , 'da' ] and not admin_p :
563584 if not auth_code :
564585 if status == 'dm' :
565586 _body = '<div class="webcomment_deleted_review_message">(Review deleted by moderator) - not visible for users<br /><br />' + \
@@ -1012,7 +1033,10 @@ def tmpl_get_comments(self, req, recID, ln,
10121033 if matching_value in get_fieldvalues (recID , matching_key ):
10131034 deadline_value = get_fieldvalues (recID , deadline_key )
10141035 if deadline_value :
1015- deadline_object = datetime .strptime (deadline_value [0 ], deadline_value_format )
1036+ try :
1037+ deadline_object = datetime .strptime (deadline_value [0 ], deadline_value_format )
1038+ except ValueError :
1039+ break
10161040 datetime_left = deadline_object - datetime .now ()
10171041 # People can still submit comments on the day of the
10181042 # deadline, so make sure to add a day here.
@@ -1364,7 +1388,7 @@ def tmpl_add_comment_form(self, recID, uid, nickname, ln, msg,
13641388 enabled = CFG_WEBCOMMENT_USE_RICH_TEXT_EDITOR ,
13651389 file_upload_url = file_upload_url ,
13661390 toolbar_set = "WebComment" ,
1367- custom_configurations_path = '/ckeditor/cds-ckeditor-config.js' ,
1391+ custom_configurations_path = '/ckeditor/cds-ckeditor-config.js?v=20141016 ' ,
13681392 ln = ln )
13691393 else :
13701394 editor = get_html_text_editor (name = 'msg' ,
@@ -1484,7 +1508,7 @@ def tmpl_add_comment_form_with_ranking(self, recID, uid, nickname, ln, msg, scor
14841508 enabled = CFG_WEBCOMMENT_USE_RICH_TEXT_EDITOR ,
14851509 # file_upload_url=file_upload_url,
14861510 toolbar_set = "WebComment" ,
1487- custom_configurations_path = '/ckeditor/cds-ckeditor-config.js' ,
1511+ custom_configurations_path = '/ckeditor/cds-ckeditor-config.js?v=20141016 ' ,
14881512 ln = ln )
14891513 else :
14901514 editor = get_html_text_editor (name = 'msg' ,
@@ -2048,7 +2072,8 @@ def tmpl_admin_comments(self, ln, uid, comID, recID, comment_data, reviews, erro
20482072 cmt_tuple [5 ],#nb_votes_total
20492073 cmt_tuple [4 ],#nb_votes_yes
20502074 cmt_tuple [6 ],#star_score
2051- cmt_tuple [7 ]))#title
2075+ cmt_tuple [7 ],#title
2076+ admin_p = True ))
20522077 else :
20532078 comments .append (self .tmpl_get_comment_without_ranking (None ,#request object
20542079 ln ,
@@ -2065,8 +2090,8 @@ def tmpl_admin_comments(self, ln, uid, comID, recID, comment_data, reviews, erro
20652090 None , #delete_links
20662091 None , #unreport_link
20672092 - 1 , # recid
2068- cmt_tuple [4 ] # com_id
2069- ))
2093+ cmt_tuple [4 ], # com_id
2094+ admin_p = True ))
20702095 users .append (self .tmpl_admin_user_info (ln ,
20712096 meta_data [0 ], #nickname
20722097 meta_data [1 ], #uid
0 commit comments