From cde233d2b3e77593a9c9ebbd056eb9c3ae91c75c Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 8 Apr 2015 16:27:09 -0500 Subject: [PATCH] forms: Emit media when form is rendered --- include/class.dynamic_forms.php | 3 +++ include/class.forms.php | 1 + include/client/templates/dynamic-form.tmpl.php | 2 -- include/client/view.inc.php | 1 + include/staff/ticket-edit.inc.php | 1 - 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index e84b4b6a6..1c9c44fb0 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -731,6 +731,9 @@ class DynamicFormEntry extends VerySimpleModel { } return $form; } + function getMedia() { + return $this->getForm()->getMedia(); + } function getFields() { if (!isset($this->_fields)) { diff --git a/include/class.forms.php b/include/class.forms.php index 5ac0738d6..01bd11ade 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -110,6 +110,7 @@ class Form { include(STAFFINC_DIR . 'templates/dynamic-form.tmpl.php'); else include(CLIENTINC_DIR . 'templates/dynamic-form.tmpl.php'); + echo $this->getMedia(); } function getMedia() { diff --git a/include/client/templates/dynamic-form.tmpl.php b/include/client/templates/dynamic-form.tmpl.php index 12b394407..9c36caaed 100644 --- a/include/client/templates/dynamic-form.tmpl.php +++ b/include/client/templates/dynamic-form.tmpl.php @@ -5,8 +5,6 @@ ?> <tr><td colspan="2"><hr /> <div class="form-header" style="margin-bottom:0.5em"> - <?php print ($form instanceof DynamicFormEntry) - ? $form->getForm()->getMedia() : $form->getMedia(); ?> <h3><?php echo Format::htmlchars($form->getTitle()); ?></h3> <em><?php echo Format::htmlchars($form->getInstructions()); ?></em> </div> diff --git a/include/client/view.inc.php b/include/client/view.inc.php index 509315ff4..1821aea04 100644 --- a/include/client/view.inc.php +++ b/include/client/view.inc.php @@ -179,6 +179,7 @@ if (!$ticket->isClosed() || $ticket->isReopenable()) { ?> if ($messageField->isAttachmentsEnabled()) { ?> <?php print $attachments->render(true); + print $attachments->getForm()->getMedia(); ?> <?php } ?> diff --git a/include/staff/ticket-edit.inc.php b/include/staff/ticket-edit.inc.php index 2001e2850..96d1abe6f 100644 --- a/include/staff/ticket-edit.inc.php +++ b/include/staff/ticket-edit.inc.php @@ -134,7 +134,6 @@ if ($_POST) <?php if ($forms) foreach ($forms as $form) { $form->render(true, false, array('mode'=>'edit','width'=>160,'entry'=>$form)); - print $form->getForm()->getMedia(); } ?> </table> <table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2"> -- GitLab