From e988b8db06156f91e1eedff43476beeca4a19c73 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@enhancesoft.com> Date: Mon, 30 Oct 2017 05:07:11 +0000 Subject: [PATCH] queue: Add ability to delete custom queues --- include/ajax.search.php | 12 ++++- include/staff/templates/confirm.tmpl.php | 63 ++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 include/staff/templates/confirm.tmpl.php diff --git a/include/ajax.search.php b/include/ajax.search.php index 0186f8d22..f5b5480eb 100644 --- a/include/ajax.search.php +++ b/include/ajax.search.php @@ -260,9 +260,19 @@ class SearchAjaxAPI extends AjaxController { Http::response(500, 'Unable to delete queue'); } Http::response(201, 'Have a nice day'); + $_SESSION['::sysmsgs']['msg'] = sprintf(__( 'Successfully deleted%s.'), + $queue->getName()); } - include STAFFINC_DIR . 'templates/queue-delete-confirm.tmpl.php'; + $info = array( + ':action' => sprintf('#queue/%s/delete', $queue->getId()), + ':title' => sprintf('%s %s', __('Please Confirm'), __('Queue Deletion')), + 'warn' => __('Deleted Queues cannot be recovered'), + ':message' => sprintf('Are you sure you want to delete %s queue?', $queue->getName()), + ':confirm' => 'Yes, Delete!' + ); + + include STAFFINC_DIR . 'templates/confirm.tmpl.php'; } function previewQueue($id=false) { diff --git a/include/staff/templates/confirm.tmpl.php b/include/staff/templates/confirm.tmpl.php new file mode 100644 index 000000000..29e2070dc --- /dev/null +++ b/include/staff/templates/confirm.tmpl.php @@ -0,0 +1,63 @@ +<?php + +if (!$info[':title']) + $info[':title'] = __('Please Confirm'); +?> +<h3 class="drag-handle"><?php echo $info[':title']; ?></h3> +<b><a class="close" href="#"><i class="icon-remove-circle"></i></a></b> +<div class="clear"></div> +<hr/> +<?php +if ($info['error']) { + echo sprintf('<p id="msg_error">%s</p>', $info['error']); +} elseif ($info['warn']) { + echo sprintf('<p id="msg_warning">%s</p>', $info['warn']); +} elseif ($info['msg']) { + echo sprintf('<p id="msg_notice">%s</p>', $info['msg']); +} elseif ($info['notice']) { + echo sprintf('<p id="msg_info"><i class="icon-info-sign"></i> %s</p>', + $info['notice']); +} + + +$action = $info[':action'] ?: ('#'); +?> +<div style="display:block; margin:5px;"> +<form class="mass-action" method="post" + name="delete" + id="delete" + action="<?php echo $action; ?>"> + <table width="100%"> + <?php + if ($info[':extra']) { + ?> + <tbody> + <tr><td colspan="2"><strong><?php echo $info[':extra']; + ?></strong></td> </tr> + </tbody> + <?php + } + ?> + <tbody> + <tr> + <td colspan="2"> + <?php echo $info[':message']; ?> + </td> + </tr> + </tbody> + </table> + <hr> + <p class="full-width"> + <span class="buttons pull-left"> + <input type="reset" value="<?php echo __('Reset'); ?>"> + <input type="button" name="cancel" class="close" + value="<?php echo __('Cancel'); ?>"> + </span> + <span class="buttons pull-right"> + <input type="submit" class="red button" value="<?php + echo $info[':confirm'] ?: __('Yes, Do it!'); ?>"> + </span> + </p> +</form> +</div> +<div class="clear"></div> -- GitLab