Forward works, though needs refinement! also is shown in ticket info bar
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
3e5568e760
commit
d140af612e
8 changed files with 114 additions and 49 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Assigned{
|
class Forwarded{
|
||||||
|
|
||||||
private $group;
|
private $group;
|
||||||
private $ticket;
|
private $ticket;
|
||||||
|
@ -22,6 +22,11 @@ class Assigned{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getSGroupOfTicket($ticket_id) {
|
||||||
|
$forw = new self();
|
||||||
|
$forw->load($ticket_id);
|
||||||
|
return $forw->getGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function isForwarded( $ticket_id) {
|
public static function isForwarded( $ticket_id) {
|
||||||
|
@ -48,7 +53,7 @@ class Assigned{
|
||||||
public function create() {
|
public function create() {
|
||||||
$dbl = new DBLayer("lib");
|
$dbl = new DBLayer("lib");
|
||||||
$query = "INSERT INTO `forwarded` (`Group`,`Ticket`) VALUES (:group, :ticket)";
|
$query = "INSERT INTO `forwarded` (`Group`,`Ticket`) VALUES (:group, :ticket)";
|
||||||
$values = Array('user' => $this->getGroup(), 'ticket' => $this->getTicket());
|
$values = Array('group' => $this->getGroup(), 'ticket' => $this->getTicket());
|
||||||
$dbl->execute($query, $values);
|
$dbl->execute($query, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +68,7 @@ class Assigned{
|
||||||
//Load with sGroupId
|
//Load with sGroupId
|
||||||
public function load( $ticket_id) {
|
public function load( $ticket_id) {
|
||||||
$dbl = new DBLayer("lib");
|
$dbl = new DBLayer("lib");
|
||||||
$statement = $dbl->execute("SELECT * FROM `forwarded` WHERE `Ticket` = :ticket_id", Array('ticket_id' => $ticket_id);
|
$statement = $dbl->execute("SELECT * FROM `forwarded` WHERE `Ticket` = :ticket_id", Array('ticket_id' => $ticket_id));
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
$this->set($row);
|
$this->set($row);
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,20 @@ class Support_Group{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//returns list of all category objects
|
||||||
|
public static function getAllSupportGroups() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->executeWithoutParams("SELECT * FROM `support_group`");
|
||||||
|
$row = $statement->fetchAll();
|
||||||
|
$result = Array();
|
||||||
|
foreach($row as $group){
|
||||||
|
$instance = new self();
|
||||||
|
$instance->set($group);
|
||||||
|
$result[] = $instance;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
|
@ -161,6 +161,22 @@ class Ticket{
|
||||||
return "TICKET_NOT_EXISTING";
|
return "TICKET_NOT_EXISTING";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function forwardTicket($user_id, $ticket_id, $group_id){
|
||||||
|
if(self::ticketExists($ticket_id)){
|
||||||
|
if(isset($group_id) && $group_id != ""){
|
||||||
|
return Forwarded::forwardTicket($group_id, $ticket_id);
|
||||||
|
}else{
|
||||||
|
return "INVALID_SGROUP";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return "TICKET_NOT_EXISTING";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
||||||
|
@ -272,6 +288,24 @@ class Ticket{
|
||||||
return $user_id;
|
return $user_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getForwardedGroupName(){
|
||||||
|
$group_id = Forwarded::getSGroupOfTicket($this->getTId());
|
||||||
|
if ($group_id == ""){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return Support_Group::getGroup($group_id)->getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getForwardedGroupId(){
|
||||||
|
$group_id = Forwarded::getSGroupOfTicket($this->getTId());
|
||||||
|
if ($group_id == ""){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return $group_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function setTId($id){
|
public function setTId($id){
|
||||||
|
|
|
@ -26,6 +26,10 @@ title = "Title"
|
||||||
t_reply = "Reply on ticket"
|
t_reply = "Reply on ticket"
|
||||||
t_fill = "Fill in your reply"
|
t_fill = "Fill in your reply"
|
||||||
t_send = "Send reply"
|
t_send = "Send reply"
|
||||||
|
invalid_sgroup = "Invalid support group!"
|
||||||
|
ticket_not_existing = "That's an invalid ticket"
|
||||||
|
success_forwarded = "The ticket was forwarded successfully!"
|
||||||
|
public_sgroup = "Public"
|
||||||
|
|
||||||
[show_user]
|
[show_user]
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,10 @@ title = "Titre"
|
||||||
t_reply = "Repondre a billet"
|
t_reply = "Repondre a billet"
|
||||||
t_fill = "Remplissez votre reponse"
|
t_fill = "Remplissez votre reponse"
|
||||||
t_send = "Envoyer la reponse"
|
t_send = "Envoyer la reponse"
|
||||||
|
invalid_sgroup = "Invalide support group!"
|
||||||
|
ticket_not_existing = "c'est un billet invalide"
|
||||||
|
success_forwarded = "ce billet est renvoyee bien!"
|
||||||
|
public_sgroup = "Publique"
|
||||||
|
|
||||||
[show_user]
|
[show_user]
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,19 @@ function show_ticket(){
|
||||||
$target_ticket = new Ticket();
|
$target_ticket = new Ticket();
|
||||||
$target_ticket->load_With_TId($result['ticket_id']);
|
$target_ticket->load_With_TId($result['ticket_id']);
|
||||||
|
|
||||||
|
if(Ticket_User::isMod($_SESSION['ticket_user'] )){
|
||||||
|
if(isset($_POST['action'])){
|
||||||
|
switch($_POST['action']){
|
||||||
|
case "forward":
|
||||||
|
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$group_id = filter_var($_POST['group'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$result['ACTION_RESULT'] = Ticket::forwardTicket($_SESSION['ticket_user']->getTUserId(), $ticket_id, $group_id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || Ticket_User::isMod($_SESSION['ticket_user'] )){
|
if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || Ticket_User::isMod($_SESSION['ticket_user'] )){
|
||||||
|
|
||||||
$show_as_admin = false;
|
$show_as_admin = false;
|
||||||
|
@ -17,6 +30,8 @@ function show_ticket(){
|
||||||
$entire_ticket = Ticket::getEntireTicket( $result['ticket_id'],$show_as_admin);
|
$entire_ticket = Ticket::getEntireTicket( $result['ticket_id'],$show_as_admin);
|
||||||
Ticket_Log::createLogEntry($result['ticket_id'],$_SESSION['ticket_user']->getTUserId(), 3);
|
Ticket_Log::createLogEntry($result['ticket_id'],$_SESSION['ticket_user']->getTUserId(), 3);
|
||||||
$result['ticket_tId'] = $entire_ticket['ticket_obj']->getTId();
|
$result['ticket_tId'] = $entire_ticket['ticket_obj']->getTId();
|
||||||
|
$result['ticket_forwardedGroupName'] = $entire_ticket['ticket_obj']->getForwardedGroupName();
|
||||||
|
$result['ticket_forwardedGroupId'] = $entire_ticket['ticket_obj']->getForwardedGroupId();
|
||||||
$result['ticket_title'] = $entire_ticket['ticket_obj']->getTitle();
|
$result['ticket_title'] = $entire_ticket['ticket_obj']->getTitle();
|
||||||
$result['ticket_timestamp'] = $entire_ticket['ticket_obj']->getTimestamp();
|
$result['ticket_timestamp'] = $entire_ticket['ticket_obj']->getTimestamp();
|
||||||
$result['ticket_status'] = $entire_ticket['ticket_obj']->getStatus();
|
$result['ticket_status'] = $entire_ticket['ticket_obj']->getStatus();
|
||||||
|
@ -35,6 +50,7 @@ function show_ticket(){
|
||||||
if(Ticket_User::isMod($_SESSION['ticket_user'])){
|
if(Ticket_User::isMod($_SESSION['ticket_user'])){
|
||||||
$result['isMod'] = "TRUE";
|
$result['isMod'] = "TRUE";
|
||||||
$result['statusList'] = Ticket::getStatusArray();
|
$result['statusList'] = Ticket::getStatusArray();
|
||||||
|
$result['sGroups'] = Gui_Elements::make_table_with_key_is_id(Support_Group::getAllSupportGroups(), Array("getName"), "getSGroupId" );
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<legend>All support groups</legend>
|
<legend>All members of the {$groupsname} Support Group</legend>
|
||||||
<table class="table table-striped table-bordered bootstrap-datatable datatable">
|
<table class="table table-striped table-bordered bootstrap-datatable datatable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -23,7 +23,15 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>Category: </strong>{$ticket_category}</td>
|
<td><strong>Category: </strong>{$ticket_category}</td>
|
||||||
<td><strong>Priority: </strong>{$ticket_prioritytext}</td>
|
<td><strong>Priority: </strong>{$ticket_prioritytext}</td>
|
||||||
<td><strong>Associated: </strong><span class="label label-info">Ticket#33</span></td>
|
<td><strong>Support Group: </strong>
|
||||||
|
<span class="label label-info">
|
||||||
|
{if $ticket_forwardedGroupName eq "0"}
|
||||||
|
<i>{$public_sgroup}</i>
|
||||||
|
{else}
|
||||||
|
<a href="index.php?page=show_sgroup&id={$ticket_forwardedGroupId}"><font color="white">{$ticket_forwardedGroupName}</font></a>
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -130,62 +138,42 @@
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
|
||||||
<form id="addTag" class="form-vertical" method="post" action="index.php">
|
{if isset($isMod) and $isMod eq "TRUE"}
|
||||||
<legend>Tags</legend>
|
<form id="forward" class="form-vertical" method="post" action="">
|
||||||
|
<legend>Forward to Group</legend>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">Current Tags</label>
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-prepend">
|
<select name="group">
|
||||||
<div id="checkbox1" class="checker"><span class="checked"><input style="opacity: 0;" id="inlineCheckbox2" value="option2" checked="checked" type="checkbox"></span></div> Hacked
|
<option></option>
|
||||||
<div id="checkbox1" class="checker"><span class="checked"><input style="opacity: 0;" id="inlineCheckbox2" value="option2" checked="checked" type="checkbox"></span></div> Botanic
|
{foreach from=$sGroups key=k item=v}
|
||||||
<div id="checkbox1" class="checker"><span class="checked"><input style="opacity: 0;" id="inlineCheckbox2" value="option2" checked="checked" type="checkbox"></span></div> evilwebsite.comz
|
<option value="{$k}">{$v}</option>
|
||||||
<div id="checkbox1" class="checker"><span class="checked"><input style="opacity: 0;" id="inlineCheckbox2" value="option2" checked="checked" type="checkbox"></span></div> keylogger
|
{/foreach}
|
||||||
</div>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" name="ticket_id" value="{$ticket_tId}">
|
||||||
|
<input type="hidden" name="action" value="forward">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">New Tag</label>
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-prepend">
|
<button type="submit" class="btn btn-primary" >Forward</button>
|
||||||
<input type="text" class="span8" id="newTag" name="newTag">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label"></label>
|
|
||||||
<div class="controls">
|
|
||||||
<button type="submit" class="btn btn-primary" >Update</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{if isset($ACTION_RESULT) and $ACTION_RESULT eq "INVALID_SGROUP"}
|
||||||
<form id="addTag" class="form-vertical" method="post" action="index.php">
|
<div class="alert alert-error">
|
||||||
<legend>Associations</legend>
|
{$invalid_sgroup}
|
||||||
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">Current Associations</label>
|
|
||||||
<div class="controls">
|
|
||||||
<div class="input-prepend">
|
|
||||||
<div id="checkbox1" class="checker"><span class="checked"><input style="opacity: 0;" id="inlineCheckbox2" value="option2" checked="checked" type="checkbox"></span></div> Ticket #33
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "TICKET_NOT_EXISTING"}
|
||||||
<label class="control-label">New Association</label>
|
<div class="alert alert-error">
|
||||||
<div class="controls">
|
{$ticket_not_existing}
|
||||||
<div class="input-prepend">
|
|
||||||
<input type="text" class="span8" id="newTag" name="newTag">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_FORWARDED"}
|
||||||
<label class="control-label"></label>
|
<div class="alert alert-success">
|
||||||
<div class="controls">
|
{$success_forwarded}
|
||||||
<button type="submit" class="btn btn-primary" >Update</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
{/if}
|
||||||
|
{/if}
|
||||||
<legend>Actions</legend>
|
<legend>Actions</legend>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button>
|
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button>
|
||||||
|
|
Loading…
Reference in a new issue