@@ -87,6 +87,8 @@ def tmpl_get_first_comments_without_ranking(self, recID, ln, comments, nb_commen
87
87
c_user_id = 1
88
88
c_date_creation = 2
89
89
c_body = 3
90
+ c_status = 4
91
+ c_nb_reports = 5
90
92
c_id = 6
91
93
c_body_format = 10
92
94
@@ -125,11 +127,21 @@ def tmpl_get_first_comments_without_ranking(self, recID, ln, comments, nb_commen
125
127
<td>"""
126
128
report_link = '%s/%s/%s/comments/report?ln=%s&comid=%s' % (CFG_SITE_URL , CFG_SITE_RECORD , recID , ln , comment [c_id ])
127
129
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
+ )
133
145
comment_rows += """
134
146
<br />
135
147
<br />
@@ -229,11 +241,13 @@ def tmpl_get_first_comments_with_ranking(self, recID, ln, comments=None, nb_comm
229
241
c_user_id = 1
230
242
c_date_creation = 2
231
243
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
237
251
c_body_format = 14
238
252
239
253
warnings = self .tmpl_warnings (warnings , ln )
@@ -278,16 +292,23 @@ def tmpl_get_first_comments_with_ranking(self, recID, ln, comments=None, nb_comm
278
292
<tr>
279
293
<td>'''
280
294
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
+ )
291
312
comment_rows += '''
292
313
%s %s / %s<br />''' % (_ ("Was this review helpful?" ), useful_yes % {'comid' :comment [c_id ]}, useful_no % {'comid' :comment [c_id ]})
293
314
comment_rows += '''
@@ -359,7 +380,7 @@ def tmpl_get_first_comments_with_ranking(self, recID, ln, comments=None, nb_comm
359
380
write_button_form )
360
381
return out
361
382
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 ):
363
384
"""
364
385
private function
365
386
@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_
416
437
# Check if user is a comment moderator
417
438
record_primary_collection = guess_primary_collection_of_a_record (recID )
418
439
(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 :
420
441
if not auth_code :
421
442
if status == 'dm' :
422
443
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_
462
483
463
484
toggle_visibility_block = ''
464
485
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>""" % \
466
487
{'comid' : com_id ,
467
488
'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' ]}),
468
489
'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_
476
497
<div class="webcomment_comment_title">
477
498
%(title)s
478
499
<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>
480
501
</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">
482
503
<div class="webcomment_comment_body">
483
504
%(body)s
484
505
</div>
@@ -502,7 +523,7 @@ def tmpl_get_comment_without_ranking(self, req, ln, nickname, comment_uid, date_
502
523
}
503
524
return out
504
525
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 ):
506
527
"""
507
528
private function
508
529
@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
559
580
record_primary_collection = guess_primary_collection_of_a_record (recID )
560
581
user_info = collect_user_info (req )
561
582
(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 :
563
584
if not auth_code :
564
585
if status == 'dm' :
565
586
_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,
1012
1033
if matching_value in get_fieldvalues (recID , matching_key ):
1013
1034
deadline_value = get_fieldvalues (recID , deadline_key )
1014
1035
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
1016
1040
datetime_left = deadline_object - datetime .now ()
1017
1041
# People can still submit comments on the day of the
1018
1042
# deadline, so make sure to add a day here.
@@ -1364,7 +1388,7 @@ def tmpl_add_comment_form(self, recID, uid, nickname, ln, msg,
1364
1388
enabled = CFG_WEBCOMMENT_USE_RICH_TEXT_EDITOR ,
1365
1389
file_upload_url = file_upload_url ,
1366
1390
toolbar_set = "WebComment" ,
1367
- custom_configurations_path = '/ckeditor/cds-ckeditor-config.js' ,
1391
+ custom_configurations_path = '/ckeditor/cds-ckeditor-config.js?v=20141016 ' ,
1368
1392
ln = ln )
1369
1393
else :
1370
1394
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
1484
1508
enabled = CFG_WEBCOMMENT_USE_RICH_TEXT_EDITOR ,
1485
1509
# file_upload_url=file_upload_url,
1486
1510
toolbar_set = "WebComment" ,
1487
- custom_configurations_path = '/ckeditor/cds-ckeditor-config.js' ,
1511
+ custom_configurations_path = '/ckeditor/cds-ckeditor-config.js?v=20141016 ' ,
1488
1512
ln = ln )
1489
1513
else :
1490
1514
editor = get_html_text_editor (name = 'msg' ,
@@ -2048,7 +2072,8 @@ def tmpl_admin_comments(self, ln, uid, comID, recID, comment_data, reviews, erro
2048
2072
cmt_tuple [5 ],#nb_votes_total
2049
2073
cmt_tuple [4 ],#nb_votes_yes
2050
2074
cmt_tuple [6 ],#star_score
2051
- cmt_tuple [7 ]))#title
2075
+ cmt_tuple [7 ],#title
2076
+ admin_p = True ))
2052
2077
else :
2053
2078
comments .append (self .tmpl_get_comment_without_ranking (None ,#request object
2054
2079
ln ,
@@ -2065,8 +2090,8 @@ def tmpl_admin_comments(self, ln, uid, comID, recID, comment_data, reviews, erro
2065
2090
None , #delete_links
2066
2091
None , #unreport_link
2067
2092
- 1 , # recid
2068
- cmt_tuple [4 ] # com_id
2069
- ))
2093
+ cmt_tuple [4 ], # com_id
2094
+ admin_p = True ))
2070
2095
users .append (self .tmpl_admin_user_info (ln ,
2071
2096
meta_data [0 ], #nickname
2072
2097
meta_data [1 ], #uid
0 commit comments