Skip to content
Snippets Groups Projects
  • Jared Hancock's avatar
    Dynamic data for osTicket · 9e75169e
    Jared Hancock authored
    *This is a major redesign / rework of the osTicket base*
    
    This patch drops the concept of static ticket metadata and allows for an
    admin-configurable arbitrary data that is attachable to tickets
    
    The system is architected such that the base osTicket install now comes with
    a "default" form that has fields for subject, name, email, and phone number.
    This form is editable to allow for the addition of arbitrary other fields;
    however, the basic fields must remain in order to be associated with a
    help-topic and attached to a ticket.
    
    This concept can be expanded to allow for arbitrary data associated with
    registered clients or ticket thread items.
    
    Forms are comprised of sections. Sections have a title and instructions
    properties and a list of fields. Fields have various implementations to
    represent different data such as text, long answer, phone number, datetime,
    yes/no, and selections, and are configurable to define the look and feel and
    interpretation of the respective form field.
    
    Dropdown lists are represented as "Dynamic Lists", which are
    admin-configurable lists of items. Dropdowns can be optionally represented
    as Bootstrap typeahead fields.
    
    This also adds the start of a simple ORM which will hopefully be expanded in
    the future to support multiple database platforms. Currently, only MySQL is
    implemented.
    9e75169e
ajax.php 1.40 KiB
<?php
/*********************************************************************
    ajax.php

    Ajax utils for client interface.

    Peter Rotich <peter@osticket.com>
    Copyright (c)  2006-2013 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/

function clientLoginPage($msg='Unauthorized') {
    Http::response(403,'Must login: '.Format::htmlchars($msg));
    exit;
}

require('client.inc.php');

if(!defined('INCLUDE_DIR'))	Http::response(500, 'Server configuration error');
require_once INCLUDE_DIR.'/class.dispatcher.php';
require_once INCLUDE_DIR.'/class.ajax.php';

$dispatcher = patterns('',
    url('^/config/', patterns('ajax.config.php:ConfigAjaxAPI',
        url_get('^client$', 'client')
    )),
    url('^/draft/', patterns('ajax.draft.php:DraftAjaxAPI',
        url_post('^(?P<id>\d+)$', 'updateDraftClient'),
        url_post('^(?P<id>\d+)/attach$', 'uploadInlineImageClient'),
        url_get('^(?P<namespace>[\w.]+)$', 'getDraftClient'),
        url_post('^(?P<namespace>[\w.]+)$', 'createDraftClient')
    )),
    url('^/form/', patterns('ajax.forms.php:DynamicFormsAjaxAPI',
        url_get('^help-topic/(?P<id>\d+)$', 'getClientFormsForHelpTopic')
    ))
);
print $dispatcher->resolve($ost->get_path_info());
?>