Merged in botanic/rc-botanic-webdev/rc-botanic-webdev (pull request #35)

fixed groups etc
This commit is contained in:
Matthew Lagoe 2013-10-24 02:25:28 -07:00
parent 6f97c0ade9
commit 84d5e2d0bd
9 changed files with 76 additions and 35 deletions

View file

@ -60,9 +60,10 @@ class Support_Group{
* @return a string that specifies if it was a success or not (SUCCESS, SIZE_ERROR, NAME_TAKEN or TAG_TAKEN )
*/
public static function createSupportGroup( $name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password) {
if(strlen($name) < 21 && strlen($name) > 4 &&strlen($tag) < 8 && strlen($tag) > 1 ){
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
if(strlen($name) <= 21 && strlen($name) >= 4 &&strlen($tag) <= 8 && strlen($tag) >= 2 ){
$notExists = self::supportGroup_EntryNotExists($name, $tag);
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
if ( $notExists == "SUCCESS" ){
$sGroup = new self();
$values = array('Name' => $name, 'Tag' => $tag, 'GroupEmail' => $groupemail, 'IMAP_MailServer' => $imap_mailserver, 'IMAP_Username' => $imap_username, 'IMAP_Password' => $imap_password);
@ -79,12 +80,14 @@ class Support_Group{
$sGroup->setIMAP_Password($enc_password);
$sGroup->create();
return "SUCCESS";
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
}else{
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
//return NAME_TAKEN or TAG_TAKEN
return $notExists;
}
}else{
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
//RETURN ERROR that indicates SIZE
return "SIZE_ERROR";
}

View file

@ -84,14 +84,18 @@ class Ticket_Queue{
if($who == "user"){
$selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User";
if ($how == "assigned"){
if ($how == "both"){
$assign = "";
}else if ($how == "assigned"){
$assign = "tu.TUserId = :id" ;
}else if ($how == "not_assigned"){
$assign = "(tu.TUserId != :id OR a.Ticket IS NULL)";
}
}else if ($who == "support_group"){
$selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User LEFT JOIN `forwarded` f ON t.TId = f.Ticket";
if ($how == "assigned"){
if ($how == "both"){
$assign = "";
}else if ($how == "assigned"){
$assign = "f.Group = :id";
}else if ($how == "not_assigned"){
$assign = "(f.Group != :id OR f.Ticket IS NULL)" ;
@ -101,23 +105,34 @@ class Ticket_Queue{
if ($what == "waiting_for_support"){
$status = "t.Status = 1";
}else if ($what == "waiting_for_user"){
}else if ($what == "waiting_for_users"){
$status = "t.Status = 0";
}else if ($what == "closed"){
$status = "t.Status = 3";
}
if ($assign == "") {
$query = $selectfrom;
if(isset($status)){
$query = $query . " WHERE " . $status;
}
} else {
$query = $selectfrom ." WHERE " . $assign;
if(isset($status)){
$query = $query . " AND " . $status;
}
}
if($who == "user"){
$params = array('id' => $userid);
}else if ($who == "support_group"){
$params = array('id' => $groupid);
}
$this->query = $query;
$this->params = $params;
//print_r($this);
}

View file

@ -35,7 +35,7 @@
<tr><td>
<p><h3>Add a Support group</h3></p>
<form id="addSGroup" class="form-vertical" method="post" action="{$ingame_webpath}">
<form id="addSGroup" class="form-vertical" method="post" action="{$ingame_webpath}?page=sgroup_list">
<table cellpadding="1">
<tr>
<td>

View file

@ -23,20 +23,20 @@ function add_sgroup(){
//create a new support group
$result['RESULT_OF_ADDING'] = Support_Group::createSupportGroup($name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password);
//$result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
//$result['no_visible_elements'] = 'FALSE';
//$result['username'] = $_SESSION['user'];
//global $SITEBASE;
//require($SITEBASE . '/inc/sgroup_list.php');
//$result= array_merge($result, sgroup_list());
//return helpers :: loadtemplate( 'sgroup_list', $result, true);
if (Helpers::check_if_game_client()) {
$result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
$result['no_visible_elements'] = 'FALSE';
$result['username'] = $_SESSION['user'];
global $SITEBASE;
require($SITEBASE . '/inc/sgroup_list.php');
$result= array_merge($result, sgroup_list());
return $result;
/*if (Helpers::check_if_game_client()) {
header("Location: ".$INGAME_WEBPATH."?page=sgroup_list");
}else{
header("Location: ".$WEBPATH."?page=sgroup_list");
}
exit;
*/
}else{
//ERROR: No access!
$_SESSION['error_code'] = "403";

View file

@ -47,6 +47,16 @@ function show_sgroup(){
}
global $INGAME_WEBPATH;
$result['ingame_webpath'] = $INGAME_WEBPATH;
$result['teamlist'] = Gui_Elements::make_table(Ticket_User::getModsAndAdmins(), Array("getTUserId","getExternId"), Array("tUserId","externId"));
$i = 0;
foreach( $result['teamlist'] as $member){
$web_teammember = new Webusers($member['externId']);
if (!In_Support_Group::userExistsInSGroup($member['externId'], $result['target_id'])) {
$result['users'][$i]['name'] = $web_teammember->getUsername();
}
$i++;
}
return $result;

View file

@ -125,6 +125,10 @@
</form>
</div>
</div>
</div>
<div class="box span4">
<div class="box-header well" data-original-title="">
<h2><i class="icon-envelope"></i> Ticket updates</h2>
<div class="box-icon">
@ -132,6 +136,8 @@
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<div class="row-fluid">
<form id="changeReceiveMail" class="form-vertical" method="post" action="index.php?page=settings&id={$target_id}">

View file

@ -51,7 +51,7 @@
<div class="box-content">
<div class="row-fluid">
<form id="addSGroup" class="form-vertical" method="post" action="index.php">
<form id="addSGroup" class="form-vertical" method="post" action="index.php?page=sgroup_list">
<legend>Add a support group</legend>

View file

@ -16,32 +16,33 @@
<form id="create_queue" class="form-vertical" method="post" action="index.php?page=show_queue&get=create" style="margin:0px 0px 0px;">
Show
<select style="width: 136px;" name="what">
<option value="all" {if isset($prev_created_what) eq "all"}selected="selected"{/if}>all</option>
<option value="waiting_for_support" {if isset($prev_created_what) eq "waiting_for_support"}selected="selected"{/if}>waiting for support</option>
<option value="waiting_for_users" {if isset($prev_created_what) eq "waiting_for_users"}selected="selected"{/if}>waiting for user</option>
<option value="closed" {if isset($prev_created_what) eq "closed"}selected="selected"{/if}>closed</option>
<option value="all" {if isset($prev_created_what) AND $prev_created_what eq "all"}selected="selected"{/if}>all</option>
<option value="waiting_for_support" {if isset($prev_created_what) AND $prev_created_what eq "waiting_for_support"}selected="selected"{/if}>waiting for support</option>
<option value="waiting_for_users" {if isset($prev_created_what) AND $prev_created_what eq "waiting_for_users"}selected="selected"{/if}>waiting for user</option>
<option value="closed" {if isset($prev_created_what) AND $prev_created_what eq "closed"}selected="selected"{/if}>closed</option>
</select>
tickets
<select style="width: 110px;" name="how">
<option value="assigned" {if isset($prev_created_how) eq "assigned"}selected="selected"{/if}>assigned</option>
<option value="not_assigned" {if isset($prev_created_how) eq "not_assigned"}selected="selected"{/if}>not assigned</option>
<option value="assigned" {if isset($prev_created_how) AND $prev_created_how eq "assigned"}selected="selected"{/if}>assigned</option>
<option value="not_assigned" {if isset($prev_created_how) AND $prev_created_how eq "not_assigned"}selected="selected"{/if}>not assigned</option>
<option value="both" {if isset($prev_created_how) AND $prev_created_how eq "both"}selected="selected"{/if}>both</option>
</select>
to
<select style="width: 140px;" name="who" onchange="aimedforwhochanged(this.value);">
<option value="user" {if isset($prev_created_who) eq "user"}selected="selected"{/if}>user</option>
<option value="support_group" {if isset($prev_created_who) eq "support_group"}selected="selected"{/if}>support group</option>
<option value="user" {if isset($prev_created_who) AND $prev_created_who eq "user"}selected="selected"{/if}>user</option>
<option value="support_group" {if isset($prev_created_who) AND $prev_created_who eq "support_group"}selected="selected"{/if}>support group</option>
</select>
<span id="userList" {if isset($prev_created_who) eq "user"}style="display:inline;"{else if isset($prev_created_who) eq "support_group"}style="display:none;"{else}style="display:inline;"{/if}>
<span id="userList" {if isset($prev_created_who) AND $prev_created_who eq "user"}style="display:inline;"{else if isset($prev_created_who) AND $prev_created_who eq "support_group"}style="display:none;"{else}style="display:inline;"{/if}>
<select style="width: 140px;" name="userid">
{foreach from=$teamlist item=member}
<option value="{$member.tUserId}" {if isset($prev_created_userid)} {if $prev_created_userid eq $member.tUserId}selected="selected"{/if}{else if $user_id eq $member.tUserId}selected="selected"{/if}>{$member.name}</option>
{/foreach}
</select>
</span>
<span id="supportGroupList" {if isset($prev_created_who) eq "user"}style="display:none;"{else if isset($prev_created_who) eq "support_group"}style="display:inline;"{else}style="display:none;"{/if}>
<span id="supportGroupList" {if isset($prev_created_who) AND $prev_created_who eq "user"}style="display:none;"{else if isset($prev_created_who) AND $prev_created_who eq "support_group"}style="display:inline;"{else}style="display:none;"{/if}>
<select style="width: 140px;" name="groupid">
{foreach from=$grouplist item=group}
<option value="{$group.sGroupId}" {if $prev_created_groupid eq $group.sGroupId}selected="selected"{/if}>{$group.name}</option>
<option value="{$group.sGroupId}" {if isset($prev_created_groupid) AND $prev_created_groupid eq $group.sGroupId}selected="selected"{/if}>{$group.name}</option>
{/foreach}
</select>
</span>

View file

@ -54,9 +54,11 @@
<div class="control-group" style="display: inline-block; ">
<label class="control-label">username</label>
<div class="controls">
<div class="input-prepend">
<input type="text" maxlength="15" id="Name" name="Name">
</div>
<select style="width: 140px;" name="Name">
{foreach from=$users item=member}
<option value="{$member.name}" >{$member.name}</option>
{/foreach}
</select>
</div>
</div>
@ -95,6 +97,9 @@
</div>
</div>
</div><!--/span-->
<div class="box span3">
<div class="box-header well" data-original-title="">
<h2><i class="icon-pencil"></i> Modify Email Settings</h2>
<div class="box-icon">
@ -172,7 +177,8 @@
</form>
</div>
</div>
</div><!--/span-->
</div>
{/if}
</div><!--/row-->