mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 13:01:42 +00:00
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
|
||||
|
||||
class Assigned{
|
||||
class Forwarded{
|
||||
|
||||
private $group;
|
||||
private $ticket;
|
||||
|
@ -22,7 +22,12 @@ class Assigned{
|
|||
|
||||
}
|
||||
|
||||
|
||||
public static function getSGroupOfTicket($ticket_id) {
|
||||
$forw = new self();
|
||||
$forw->load($ticket_id);
|
||||
return $forw->getGroup();
|
||||
}
|
||||
|
||||
|
||||
public static function isForwarded( $ticket_id) {
|
||||
$dbl = new DBLayer("lib");
|
||||
|
@ -48,7 +53,7 @@ class Assigned{
|
|||
public function create() {
|
||||
$dbl = new DBLayer("lib");
|
||||
$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);
|
||||
}
|
||||
|
||||
|
@ -63,7 +68,7 @@ class Assigned{
|
|||
//Load with sGroupId
|
||||
public function load( $ticket_id) {
|
||||
$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();
|
||||
$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////////////////////////////////////////////////////
|
||||
|
||||
public function __construct() {
|
||||
|
|
|
@ -161,6 +161,22 @@ class Ticket{
|
|||
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////////////////////////////////////////////////////
|
||||
public function __construct() {
|
||||
|
||||
|
@ -272,6 +288,24 @@ class Ticket{
|
|||
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////////////////////////////////////////////////////
|
||||
|
||||
public function setTId($id){
|
||||
|
|
|
@ -26,6 +26,10 @@ title = "Title"
|
|||
t_reply = "Reply on ticket"
|
||||
t_fill = "Fill in your 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]
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@ title = "Titre"
|
|||
t_reply = "Repondre a billet"
|
||||
t_fill = "Remplissez votre 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]
|
||||
|
||||
|
|
|
@ -7,6 +7,19 @@ function show_ticket(){
|
|||
$result['ticket_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
|
||||
$target_ticket = new Ticket();
|
||||
$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'] )){
|
||||
|
||||
|
@ -17,6 +30,8 @@ function show_ticket(){
|
|||
$entire_ticket = Ticket::getEntireTicket( $result['ticket_id'],$show_as_admin);
|
||||
Ticket_Log::createLogEntry($result['ticket_id'],$_SESSION['ticket_user']->getTUserId(), 3);
|
||||
$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_timestamp'] = $entire_ticket['ticket_obj']->getTimestamp();
|
||||
$result['ticket_status'] = $entire_ticket['ticket_obj']->getStatus();
|
||||
|
@ -35,6 +50,7 @@ function show_ticket(){
|
|||
if(Ticket_User::isMod($_SESSION['ticket_user'])){
|
||||
$result['isMod'] = "TRUE";
|
||||
$result['statusList'] = Ticket::getStatusArray();
|
||||
$result['sGroups'] = Gui_Elements::make_table_with_key_is_id(Support_Group::getAllSupportGroups(), Array("getName"), "getSGroupId" );
|
||||
}
|
||||
return $result;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
<div class="box-content">
|
||||
<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">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -23,7 +23,15 @@
|
|||
<tr>
|
||||
<td><strong>Category: </strong>{$ticket_category}</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>
|
||||
</table>
|
||||
|
||||
|
@ -130,62 +138,42 @@
|
|||
<div class="box-content">
|
||||
<div class="row-fluid">
|
||||
|
||||
<form id="addTag" class="form-vertical" method="post" action="index.php">
|
||||
<legend>Tags</legend>
|
||||
{if isset($isMod) and $isMod eq "TRUE"}
|
||||
<form id="forward" class="form-vertical" method="post" action="">
|
||||
<legend>Forward to Group</legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Current Tags</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> Hacked
|
||||
<div id="checkbox1" class="checker"><span class="checked"><input style="opacity: 0;" id="inlineCheckbox2" value="option2" checked="checked" type="checkbox"></span></div> Botanic
|
||||
<div id="checkbox1" class="checker"><span class="checked"><input style="opacity: 0;" id="inlineCheckbox2" value="option2" checked="checked" type="checkbox"></span></div> evilwebsite.comz
|
||||
<div id="checkbox1" class="checker"><span class="checked"><input style="opacity: 0;" id="inlineCheckbox2" value="option2" checked="checked" type="checkbox"></span></div> keylogger
|
||||
</div>
|
||||
<select name="group">
|
||||
<option></option>
|
||||
{foreach from=$sGroups key=k item=v}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="ticket_id" value="{$ticket_tId}">
|
||||
<input type="hidden" name="action" value="forward">
|
||||
<div class="control-group">
|
||||
<label class="control-label">New Tag</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<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>
|
||||
<button type="submit" class="btn btn-primary" >Forward</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form id="addTag" class="form-vertical" method="post" action="index.php">
|
||||
<legend>Associations</legend>
|
||||
|
||||
<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>
|
||||
{if isset($ACTION_RESULT) and $ACTION_RESULT eq "INVALID_SGROUP"}
|
||||
<div class="alert alert-error">
|
||||
{$invalid_sgroup}
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">New Association</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="text" class="span8" id="newTag" name="newTag">
|
||||
</div>
|
||||
</div>
|
||||
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "TICKET_NOT_EXISTING"}
|
||||
<div class="alert alert-error">
|
||||
{$ticket_not_existing}
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label"></label>
|
||||
<div class="controls">
|
||||
<button type="submit" class="btn btn-primary" >Update</button>
|
||||
</div>
|
||||
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_FORWARDED"}
|
||||
<div class="alert alert-success">
|
||||
{$success_forwarded}
|
||||
</div>
|
||||
</form>
|
||||
{/if}
|
||||
{/if}
|
||||
<legend>Actions</legend>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button>
|
||||
|
|
Loading…
Reference in a new issue