Ejemplo n.º 1
0
 function display($tpl = NULL)
 {
     FSS_Helper::AddSCEditor();
     if (FSS_Input::getInt('sigid')) {
         return $this->display_edit();
     }
     $this->sigs = SupportCanned::GetAllSigs(null);
     $this->_display("list");
 }
Ejemplo n.º 2
0
 function preview()
 {
     $this->ticketid = FSS_Input::getInt('ticketid');
     $this->sigid = FSS_Input::getInt('sigid');
     $ticket = new SupportTicket();
     $ticket->load($this->ticketid);
     $ticket->loadAll();
     $this->ticket = $ticket;
     $this->signature = SupportCanned::AppendSig($this->sigid, $this->ticket);
     include $this->view->snippet(JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'views' . DS . 'admin_support' . DS . 'snippet' . DS . '_signature_preview.php');
     return true;
 }
Ejemplo n.º 3
0
 function dropdown()
 {
     echo SupportCanned::CannedDropdown(FSS_Input::getCmd('elem'), false);
     exit;
 }
Ejemplo n.º 4
0
echo JText::_('JCANCEL');
?>
</a>
			<a class="btn btn-info" href="#" onclick='jQuery("#what").val("draft");jQuery("#newticket").submit();return false;'><?php 
echo JText::_('SAVE_DRAFT');
?>
</a>
		</div>
	</div>

</form>


<div id="canned_replies" style="display: none;">
<?php 
echo SupportCanned::CannedList($this->ticket);
?>
</div>

<ul class="nav nav-tabs <?php 
if (FSS_Input::getInt('ticketid') > 0) {
    echo "nav-always";
}
?>
">

	<li class="active">
		<a href='#messages' data-toggle="tab">
			<?php 
echo JText::_('MESSAGES');
?>
Ejemplo n.º 5
0
    ?>
	
	<div id="canned_replies" style="display: none;">
		<?php 
    echo SupportCanned::CannedList(null);
    ?>
	</div>
	
	<div class="control-group">
		<label class="control-label"><?php 
    echo JText::_("MESSAGE");
    ?>
</label>
		<div class="controls">
			<?php 
    echo SupportCanned::CannedDropdown("body");
    ?>
		</div>
	</div>
	
	<script>	
		function insertCanned(value, id)
		{
			var bbcode = jQuery('#canned_reply_' + value).html();
			bbcode = bbcode.replace(/\n/g, "");
			bbcode = bbcode.replace(/\r/g, "");
			bbcode = bbcode.replace(new RegExp(String.fromCharCode(182), "g"), "\n");
			bbcode = jQuery('<textarea />').html(bbcode).text();
	
			<?php 
    if (FSS_Settings::Get('support_sceditor')) {
Ejemplo n.º 6
0
 function display($tpl = NULL)
 {
     FSS_Helper::AddSCEditor();
     $editid = FSS_Input::getInt('cannedid', -2);
     if ($editid != -2) {
         if ($editid > 0) {
             $db = JFactory::getDBO();
             $qry = "SELECT * FROM #__fss_ticket_fragments WHERE id = " . FSSJ3Helper::getEscaped($db, $editid);
             $db->setQuery($qry);
             $this->canned_item = $db->loadObject();
         } else {
             $this->canned_item = new stdClass();
             $this->canned_item->id = 0;
             $this->canned_item->description = "";
             $this->canned_item->grouping = "";
             $this->canned_item->content = "";
         }
         return $this->_display("edit");
     }
     // if we are saving, then save
     $saveid = FSS_Input::getInt('saveid', -2);
     if ($saveid != -2) {
         $description = FSS_Input::getString('description');
         $grouping = FSS_Input::getString('grouping');
         $content = FSS_Input::getHTML('content');
         if ($saveid == 0) {
             $qry = "INSERT INTO #__fss_ticket_fragments (description, grouping, content, type) VALUES (";
             $qry .= "'" . FSSJ3Helper::getEscaped($db, $description) . "',";
             $qry .= "'" . FSSJ3Helper::getEscaped($db, $grouping) . "',";
             $qry .= "'" . FSSJ3Helper::getEscaped($db, $content) . "', 0)";
             $db = JFactory::getDBO();
             $db->setQuery($qry);
             $db->Query();
         } else {
             $qry = "UPDATE #__fss_ticket_fragments SET description = '" . FSSJ3Helper::getEscaped($db, $description) . "', ";
             $qry .= "grouping = '" . FSSJ3Helper::getEscaped($db, $grouping) . "', ";
             $qry .= "content = '" . FSSJ3Helper::getEscaped($db, $content) . "' WHERE id = " . FSSJ3Helper::getEscaped($db, $saveid);
             $db = JFactory::getDBO();
             $db->setQuery($qry);
             $db->Query();
         }
         $mainframe = JFactory::getApplication();
         $link = JRoute::_('index.php?option=com_fss&view=admin_support&layout=canned&tmpl=component', false);
         $mainframe->redirect($link);
     }
     // if we are editing then show edit
     // otherwise show list
     $deleteid = FSS_Input::getInt('deleteid');
     if ($deleteid > 0) {
         $qry = "DELETE FROM #__fss_ticket_fragments WHERE id = " . FSSJ3Helper::getEscaped($db, $deleteid);
         $db = JFactory::getDBO();
         $db->setQuery($qry);
         $db->Query();
     }
     $search = FSS_Input::getString('search');
     if ($search) {
         $db = JFactory::getDBO();
         $qry = "SELECT * FROM #__fss_ticket_fragments WHERE type = 0 AND (description LIKE '%" . $db->escape($search) . "%' OR content LIKE '%" . $db->escape($search) . "%')";
         $db->setQuery($qry);
         $this->canned = $db->loadObjectList();
     } else {
         $this->canned = SupportCanned::GetCannedReplies();
     }
     $this->_display("list");
 }
Ejemplo n.º 7
0
 function saveReply()
 {
     $this->removeDraft(FSS_Input::getInt('draft'));
     // get posted data
     $ticketid = FSS_Input::getInt('ticketid');
     $reply_type = FSS_Input::getCmd('reply_type');
     $user_message = FSS_Input::getBBCode('body');
     $handler_message = FSS_Input::getBBCode('body2');
     $subject = FSS_Input::getString('subject');
     // load ticket
     $ticket = new SupportTicket();
     if (!$ticket->load($ticketid)) {
         exit;
     }
     // set up some variables
     $user_id = JFactory::getUser()->id;
     $handler_id = $user_id;
     $old_st = $ticket->getStatus();
     $action_name = "";
     $action_params = array();
     $message_id = 0;
     $files_private = 0;
     // add signatures to messages
     if (FSS_Input::getInt('signature')) {
         if ($user_message) {
             $user_message .= SupportCanned::AppendSig(FSS_Input::getInt('signature'), $ticket);
         }
         if ($handler_message) {
             $handler_message .= SupportCanned::AppendSig(FSS_Input::getInt('signature'), $ticket);
         }
     }
     $extra_time = 0;
     $timestart = 0;
     $timeend = 0;
     if (FSS_Settings::Get('time_tracking') != "") {
         if (FSS_Settings::get('time_tracking_type') == 'se') {
             $timestart = strtotime("1970-01-01 " . FSS_Input::getString('timetaken_start'));
             $timeend = strtotime("1970-01-01 " . FSS_Input::getString('timetaken_end'));
             $extra_time = (int) (($timeend - $timestart) / 60);
         } elseif (FSS_Settings::get('time_tracking_type') == 'tm') {
             $timestart = strtotime(FSS_Input::getString('timetaken_start'));
             $timeend = strtotime(FSS_Input::getString('timetaken_end'));
             $extra_time = (int) (($timeend - $timestart) / 60);
         } else {
             $extra_time = (int) (FSS_Input::getInt('timetaken_hours') * 60 + FSS_Input::getInt('timetaken_mins'));
         }
     }
     // different reply types
     switch ($reply_type) {
         case 'reply':
             // post reply to user
             if ($user_message) {
                 $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
             } elseif ($extra_time > 0) {
                 // no message, add time if needed
                 $ticket->addTime($extra_time, "", true, $timestart, $timeend);
             }
             // update status
             $new_status = FSS_Input::getInt('reply_status');
             $ticket->updateStatus($new_status);
             // reassign ticket if needed
             if (FSS_Settings::get('support_assign_reply') == 1 && FSS_Input::getInt('dontassign') == 0) {
                 $ticket->assignHandler($handler_id, TICKET_ASSIGN_TOOK_OWNER);
             } elseif (FSS_Settings::get('support_autoassign') == 3 && $ticket->admin_id == 0 && FSS_Input::getInt('dontassign') == 0) {
                 $ticket->assignHandler($handler_id, TICKET_ASSIGN_ASSIGNED);
             }
             // call SupportActions handler for admin reply
             $action_name = "Admin_Reply";
             $action_params = array('subject' => $subject, 'user_message' => $user_message, 'status' => $new_status);
             break;
         case 'private':
             // add message to ticket
             if ($handler_message) {
                 $message_id = $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
             } else {
                 if ($extra_time > 0) {
                     $ticket->addTime($extra_time, "", true, $timestart, $timeend);
                 }
             }
             $files_private = 1;
             // call support actions for private comment
             $action_name = "Admin_Private";
             $action_params = array('subject' => $subject, 'handler_message' => $handler_message);
             break;
         case 'user':
             // update user on ticket
             $new_user_id = FSS_Input::getInt("user_id");
             $ticket->updateUser($new_user_id);
             if ($user_message) {
                 $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
             } else {
                 if ($extra_time > 0) {
                     $ticket->addTime($extra_time, "", true, $timestart, $timeend);
                     $extra_time = 0;
                 }
             }
             $action_name = "Admin_ForwardUser";
             $action_params = array('subject' => $subject, 'user_message' => $user_message, 'user_id' => $new_user_id);
             //
             break;
         case 'product':
             $new_handler_id = FSS_Input::getInt('new_handler');
             // update product and department
             $new_product_id = FSS_Input::getInt("new_product_id");
             $new_department_id = FSS_Input::getInt("new_department_id");
             $ticket->updateProduct($new_product_id);
             $ticket->updateDepartment($new_department_id);
             /**
              * -2 - Auto Assign
              * -1 - Unchanged
              * 0 - Unassigned
              * X - Hander
              **/
             if ($new_handler_id == -1) {
                 //$ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD);
             } else {
                 if ($new_handler_id == 0) {
                     $ticket->assignHandler(0, -1);
                 } else {
                     if ($new_handler_id > 0) {
                         $ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD);
                     } else {
                         if ($new_handler_id == -2) {
                             // auto assign new handler
                             $admin_id = FSS_Ticket_Helper::AssignHandler($new_product_id, $new_department_id, $ticket->ticket_cat_id, true);
                             $ticket->assignHandler($admin_id, TICKET_ASSIGN_FORWARD);
                         }
                     }
                 }
             }
             if ($user_message) {
                 $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
                 $extra_time = 0;
             }
             if ($handler_message) {
                 $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
                 $extra_time = 0;
             }
             if ($extra_time > 0) {
                 $ticket->addTime($extra_time, "", true, $timestart, $timeend);
             }
             $action_name = "Admin_ForwardProduct";
             $action_params = array('subject' => $subject, 'user_message' => $user_message, 'handler_message' => $handler_message, 'product_id' => $new_product_id, 'department_id' => $new_department_id);
             break;
         case 'handler':
             $new_handler_id = FSS_Input::getInt('new_handler');
             if ($new_handler_id == -2) {
                 // auto assign new handler
                 $admin_id = FSS_Ticket_Helper::AssignHandler($ticket->prod_id, $ticket->ticket_dept_id, $ticket->ticket_cat_id, true);
                 $ticket->assignHandler($admin_id, TICKET_ASSIGN_FORWARD);
             } else {
                 if ($new_handler_id != -1) {
                     $ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD);
                 }
             }
             // update status
             $new_status = FSS_Input::getCmd('reply_status');
             $ticket->updateStatus($new_status);
             if ($user_message) {
                 $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
                 $extra_time = 0;
             }
             if ($handler_message) {
                 $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
                 $extra_time = 0;
             }
             if ($extra_time > 0) {
                 $ticket->addTime($extra_time, "", true, $timestart, $timeend);
             }
             $action_name = "Admin_ForwardHandler";
             $action_params = array('subject' => $subject, 'user_message' => $user_message, 'handler_message' => $handler_message, 'handler_id' => $new_handler_id);
             break;
     }
     // add posted files
     $files = $ticket->addFilesFromPost($message_id, -1, $files_private);
     $ticket->stripImagesFromMessage($message_id);
     $action_params['files'] = $files;
     // call action handler
     SupportActions::DoAction($action_name, $ticket, $action_params);
     // Redirect to new page
     $link = FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticket->id, false);
     $new_st = $ticket->getStatus();
     if ($reply_type == "reply") {
         if ($new_st->is_closed && SupportUsers::getSetting("return_on_close")) {
             $link = SupportHelper::parseRedirectType($old_st->id, SupportUsers::getSetting("return_on_close"));
         } else {
             if (SupportUsers::getSetting("return_on_reply")) {
                 $link = SupportHelper::parseRedirectType($old_st->id, SupportUsers::getSetting("return_on_reply"));
             }
         }
     }
     JFactory::getApplication()->redirect($link);
 }
Ejemplo n.º 8
0
 static function GetAllSigs($ticket)
 {
     if (empty(self::$all_sigs)) {
         $userid = JFactory::getUser()->id;
         $db = JFactory::getDBO();
         $query = 'SELECT * FROM #__fss_ticket_fragments WHERE type = 1';
         $db->setQuery($query);
         $rows = $db->loadObjectList();
         self::$all_sigs = array();
         foreach ($rows as $row) {
             $row->params = json_decode($row->params, true);
             if (is_string($row->params)) {
                 $row->params = array();
             }
             $row->default = 0;
             $row->personal = 0;
             if (isset($row->params['userid'])) {
                 if ($row->params['userid'] > 0 && $userid != $row->params['userid']) {
                     continue;
                 }
                 $row->personal = 1;
             }
             self::$all_sigs[] = $row;
         }
         $qry = "SELECT * FROM #__fss_users WHERE user_id = {$userid}";
         $db->setQuery($qry);
         $user = $db->loadObject();
         if ($user) {
             $settings = json_decode($user->settings, true);
         }
         $def_sig = SupportUsers::getSetting('default_sig');
         $ds = 0;
         if ($def_sig > 0) {
             foreach (self::$all_sigs as &$sig) {
                 if ($sig->id == $def_sig) {
                     $sig->default = 1;
                 }
             }
         }
     }
     return self::$all_sigs;
 }
Ejemplo n.º 9
0
/**
 * @package Freestyle Joomla
 * @author Freestyle Joomla
 * @copyright (C) 2013 Freestyle Joomla
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die;
$def_sig = SupportUsers::getSetting("default_sig");
?>
<select name="signature" id="signature">
	<optgroup label="<?php 
echo JText::_('Signatures');
?>
:">
		<?php 
foreach (SupportCanned::GetAllSigs(null) as $sig) {
    ?>
			<?php 
    if ($sig_txt == "") {
        $sig_txt = $sig->content;
    }
    ?>
			<option value="<?php 
    echo $sig->id;
    ?>
" 
				<?php 
    if ($sig->id == $def_sig) {
        echo "selected";
    }
    ?>