HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/tracopt/ticket/__pycache__/deleter.cpython-310.pyc
o

�k�`'�@s�ddlmZddlmZmZmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZmZdd	lmZmZmZmZmZGd
d�de�ZdS)
�)�
Attachment)�	Component�	TracError�
implements)�Ticket)�TicketModule)�get_reporter_id)�from_utimestamp)�_)�IRequestFilter�IRequestHandler)�ITemplateProvider�
add_notice�
add_script�add_script_data�add_stylesheetc@sLeZdZdZeeee�dd�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dS)�
TicketDeletera�Ticket and ticket comment deleter.

    This component allows deleting ticket comments and complete tickets. For
    users having `TICKET_ADMIN` permission, it adds a "Delete" button next to
    each "Reply" button on the page. The button in the ticket description
    requests deletion of the complete ticket, and the buttons in the change
    history request deletion of a single comment.

    '''Comment and ticket deletion are irreversible (and therefore
    ''dangerous'') operations.''' For that reason, a confirmation step is
    requested. The confirmation page shows the ticket box (in the case of a
    ticket deletion) or the ticket change (in the case of a comment deletion).
    ccs"�ddlm}d|td�fVdS)Nr��resource_filename�	ticketopt�htdocs��
pkg_resourcesr�__name__��selfr�r�8/usr/lib/python3/dist-packages/tracopt/ticket/deleter.py�get_htdocs_dirs-s�zTicketDeleter.get_htdocs_dirscCsddlm}|td�gS)Nrr�	templatesrrrrr�get_templates_dirs1sz TicketDeleter.get_templates_dirscCs.|t|j�ur	|S|j�d�}|dvr|S|S)N�action)�delete�delete-comment)r�env�args�get)r�req�handlerr!rrr�pre_process_request7sz!TicketDeleter.pre_process_requestcCsX|dvr'|�d�}|r'|jr'd|�|j�vr't|d�t|d|j�d�id�|||fS)N)zticket.htmlzticket_preview.html�ticket�TICKET_ADMINzticketopt/ticketdeleter.js�use_symbolszui.use_symbols)�ui)r&�exists�perm�resourcerr�session)rr'�template�data�metadatar*rrr�post_process_request@s



�
z"TicketDeleter.post_process_requestcCsdS)NFr)rr'rrr�
match_requestLszTicketDeleter.match_requestcCs$|j�d�}|�d|��d�t|j|�}|jd}|j�d�}|jdkr�d|jvr?|j�	|�}|dkr:|d	|7}|�
|�|d
krt|��t|t
d|jd��|j��}d
|jvrn|jd
��}t|j�|vrn|jd}|�
|�n(|dkr�tt|j�d���}	|j|	d�t|t
d||jd��|�
|j�	|��t|j�}
|
�||�}|
�|||t|d�i�|j|dd�|dkr�|j�d�|d<tt|d��}	|dD]}|�d�|	kr�||d<|�d�|d<n	q�tt
d|d���n|d
k�r	t�|j|j|j�}
|jt|
�d�t |d�d|fS)N�idr*r+r!�cnum�POST�cancelr#z#comment:%sr"z0Ticket #%(num)s and all associated data removed.)�num�
query_tickets�
query_href�cdate)r>z>The ticket comment %(num)s on ticket #%(id)s has been deleted.)r;r7�author)r!r>�changes�date�changezComment %(num)s not found)�attachmentszcommon/css/ticket.csszticket_delete.html)!r%�getintr/�requirerr$r&�method�hrefr*�redirectr"rr
r7�queryr1�split�strr	�int�
delete_changer�
_prepare_data�_insert_ticket_datar�updaterr�select�realm�listr)rr'r7r*r!r8rG�redirect_to�ticketsr>�tmr3rBrCrrr�process_requestOsf



�


�


���

zTicketDeleter.process_requestN)r�
__module__�__qualname__�__doc__rr
rrrr r)r5r6rWrrrrrs	rN)�trac.attachmentr�	trac.corerrr�trac.ticket.modelr�trac.ticket.web_uir�	trac.utilr�trac.util.datefmtr	�trac.util.translationr
�trac.web.apirr�trac.web.chromer
rrrrrrrrr�<module>s