diff --git a/Web/Presenters/SupportPresenter.php b/Web/Presenters/SupportPresenter.php index a94fe855..9fc4defc 100644 --- a/Web/Presenters/SupportPresenter.php +++ b/Web/Presenters/SupportPresenter.php @@ -31,6 +31,7 @@ final class SupportPresenter extends OpenVKPresenter $tickets = $this->tickets->getTicketsByuId($this->user->id); if($tickets) $this->template->tickets = $tickets; + if($_SERVER["REQUEST_METHOD"] === "POST") { if(!empty($this->postParam("name")) && !empty($this->postParam("text"))) { $this->assertNoCSRF(); @@ -111,11 +112,11 @@ final class SupportPresenter extends OpenVKPresenter if(!$ticket || $ticket->isDeleted() != 0 || $ticket->getUserId() !== $this->user->id && !$this->hasPermission('openvk\Web\Models\Entities\TicketReply', 'write', 0)) { $this->notFound(); } else { - header("HTTP/1.1 302 Found"); if($ticket->getUserId() !== $this->user->id && $this->hasPermission('openvk\Web\Models\Entities\TicketReply', 'write', 0)) - header("Location: /support/tickets"); + $this->redirect("/support/tickets"); else - header("Location: /support"); + $this->redirect("/support"); + $ticket->delete(); } } @@ -182,13 +183,12 @@ final class SupportPresenter extends OpenVKPresenter if(!empty($this->postParam("text")) && !empty($this->postParam("status"))) { $ticket->setType($this->postParam("status")); $ticket->save(); - - $this->assertNoCSRF(); + $comment = new TicketComment; $comment->setUser_id($this->user->id); $comment->setUser_type(1); $comment->setText($this->postParam("text")); - $comment->setTicket_id($id); + $comment->setTicket_Id($id); $comment->setCreated(time()); $comment->save(); } elseif(empty($this->postParam("text"))) { diff --git a/Web/Presenters/templates/Support/AnswerTicket.xml b/Web/Presenters/templates/Support/AnswerTicket.xml index ac57b034..7c4091be 100644 --- a/Web/Presenters/templates/Support/AnswerTicket.xml +++ b/Web/Presenters/templates/Support/AnswerTicket.xml @@ -6,138 +6,129 @@ {/block} {block content} -
- - - {$ticket->getName()} - - -
{_author}: {$ticket->getUser()->getFullName()} | {$ticket->getUser()->getRegistrationIP()} | {_status}: {$ticket->getStatus()}. -
-
- {$ticket->getText()|noescape} -

-
-
- {$ticket->getTime()} |  - {_delete} -

-
-
- -
- -
- -
-
- - -
-
- {_fast_answers} -
-
-
-
-
-

{_no_comments}

-{var $printedSupportGreeting = false} - - - - {if $comment->getUType() === 0} - - {else} - - {/if} - + + +
- - - - - {if $comment->getUType() === 0} -
- + {/block} diff --git a/Web/Presenters/templates/Support/Index.xml b/Web/Presenters/templates/Support/Index.xml index 9f9443f5..c0f71b8a 100644 --- a/Web/Presenters/templates/Support/Index.xml +++ b/Web/Presenters/templates/Support/Index.xml @@ -6,63 +6,68 @@ {/block} {block content} + {var isMain = $mode === 'faq'} + {var isNew = $mode === 'new'} + {var isList = $mode === 'list'} -{var isMain = $mode === 'faq'} -{var isNew = $mode === 'new'} -{var isList = $mode === 'list'} - -{if $thisUser} -
-
- {_support_faq} -
-
- {_support_list} -
-
- {_support_new} -
-
-
- -{if $isNew} -
-
-

-

- -

-
-
-{/if}{/if} - -{if $isMain} -

{_support_faq}


-
-
{_support_faq_title}
-
{_support_faq_content}
-
-{/if} - -{if $isList} - - - - - - - -
-
{_support_ticket}
-
-
-{/if} +
+ {_support_new} +
+ + +
+ + {if $isNew} +
+
+
+

+

+ +

+
+
+
+ {/if} + {/if} + + {if $isMain} +

{_support_faq}


+
+
{_support_faq_title}
+
{_support_faq_content}
+
+ {/if} + + {if $isList} + + + + + + + +
+
+ {_support_ticket} +
+
+ +
+ {_status}: {$ticket->getStatus()} +
+
+ {/if} {/block} diff --git a/Web/Presenters/templates/Support/View.xml b/Web/Presenters/templates/Support/View.xml index ecd2ceaa..8f502fc3 100644 --- a/Web/Presenters/templates/Support/View.xml +++ b/Web/Presenters/templates/Support/View.xml @@ -6,144 +6,132 @@ {/block} {block content} - -{if $ticket->isDeleted() == 0 } -
- - - {$ticket->getName()} - - -
{_status}: {$ticket->getStatus()} -
-
- {$ticket->getText()|noescape} -

-
-
- {$ticket->getTime()} |  - {_delete} -
-{if $ticket->getType() !== 2} -
-
-
- -
- -
- -
- -
+ function errorHandler(id, mark) { + document.getElementById("markText-" + id).innerHTML = {_error}; + } + + + {if $ticket->isDeleted() == 0} +
+ {$ticket->getName()} +
{_status}: {$ticket->getStatus()}
-{/if} -
-

{_no_comments}

-{var $printedSupportGreeting = false} - - - - {if $comment->getUType() === 0} - - {else} - - {/if} - + + +
- - - - - {if $comment->getUType() === 0} -
+ {/if} {/block}