diff --git a/bootstrap.php b/bootstrap.php index a4e56510c61a44e676040d6e20a54f2b89abb583..08fe94ab9fc7fffc36050e8403c98040d7fb849d 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -94,9 +94,12 @@ class Bootstrap { define('TICKET_EVENT_TABLE',$prefix.'ticket_event'); define('TICKET_EMAIL_INFO_TABLE',$prefix.'ticket_email_info'); define('TICKET_COLLABORATOR_TABLE', $prefix.'ticket_collaborator'); + define('TICKET_STATUS_TABLE', $prefix.'ticket_status'); define('TICKET_PRIORITY_TABLE',$prefix.'ticket_priority'); + define('PRIORITY_TABLE',TICKET_PRIORITY_TABLE); + define('FORM_SEC_TABLE',$prefix.'form'); define('FORM_FIELD_TABLE',$prefix.'form_field'); diff --git a/include/class.list.php b/include/class.list.php index 07c7119d6f4f431158bdc86bc949b3db9b2844d5..e2d7592af596a0285ed3ef60f0a0a8ca44061a76 100644 --- a/include/class.list.php +++ b/include/class.list.php @@ -129,8 +129,14 @@ abstract class BuiltInCustomList implements CustomList { } static function getLists() { - //TODO: define built-in lists - return array(); + + $list['status'] = array ( //Ticket statuses + 'name' => 'Ticket Status', + 'handler' => 'TicketStatusList', + 'icon' => 'icon-flag', + ); + + return $list; } } @@ -451,4 +457,89 @@ class DynamicListItem extends VerySimpleModel { } } + +/* + * Ticket status List + * + * + */ + +class TicketStatusList extends BuiltInCustomList { + + var $ht = array( + 'id' => 'status', + 'name' => 'Status', + 'name_plural' => 'Statuses', + ); + // Fields of interest we need to store + static $config_fields = array('sort_mode', 'notes'); + + function getId() { + return $this->ht['id']; + } + + function getName() { + return $this->ht['name']; + } + + function getPluralName() { + return $this->ht['name_plural']; + } + + function getSortMode() { + return $this->ht['sort_mode']; + } + + function getNotes() { + return $this->ht['notes']; + } + + function getInfo() { + return $this->config->getInfo() + $this->ht; + } + + function getNumItems() { + return 0; + } + + function getAllItems() { + + } + + function getItems($criteria) { + + } + + function hasProperties() { + return true; + } + + function getListOrderBy() { + switch ($this->setSortMode()) { + case 'Alpha': + return 'name'; + case '-Alpha': + return '-name'; + case 'SortCol': + default: + return 'sort'; + } + } + + function getForm() { + return null; + } + + function update($vars, &$errors) { + + foreach (static::$config_fields as $f) { + if (!isset($vars[$f])) continue; + + if (parent::set($f, $vars[$f])) + $this->ht[$field] = $vars[$f]; + } + + return true; + } +} ?> diff --git a/include/staff/dynamic-lists.inc.php b/include/staff/dynamic-lists.inc.php index 3ef22874d6103bfefd76bc60f97eb3a31c0d8e11..9a818ec5d521bb8d60e6c9edf5899860f5818dd2 100644 --- a/include/staff/dynamic-lists.inc.php +++ b/include/staff/dynamic-lists.inc.php @@ -10,21 +10,43 @@ $page = ($_GET['p'] && is_numeric($_GET['p'])) ? $_GET['p'] : 1; $count = DynamicList::objects()->count(); $pageNav = new Pagenate($count, $page, PAGE_LIMIT); $pageNav->setURL('lists.php'); -$showing=$pageNav->showing().' custom lists'; -?> +$showing=$pageNav->showing().' Dynamic Lists'; + +// Get built-in list +$builtInList = BuiltInCustomList::getLists(); +?> <form action="lists.php" method="POST" name="lists"> <?php csrf_token(); ?> <input type="hidden" name="do" value="mass_process" > <input type="hidden" id="action" name="a" value="" > <table class="list" border="0" cellspacing="1" cellpadding="0" width="940"> - <caption><?php echo $showing; ?></caption> + <caption>Custom Lists</caption> + <?php + if ($builtInList) { ?> + <thead> + <tr> + <th width="7"> </th> + <th colspan=3> Built-In Lists</th> + </tr> + </thead> + <tbody> + <?php foreach ($builtInList as $id => $list) { ?> + <tr> + <td><i class="<?php echo $list['icon']; ?>"></i></td> + <td colspan=3><a href="?id=<?php echo $id; ?>"><?php echo $list['name']; ?></a></td> + </tr> + <?php } + ?> + </tbody> + <?php + } ?> <thead> <tr> <th width="7"> </th> - <th>List Name</th> - <th>Created</th> - <th>Last Updated</th> + <th> Dynamic Lists</th> + <th width="250">Created</th> + <th width="250">Last Updated</th> </tr> </thead> <tbody> @@ -36,9 +58,11 @@ $showing=$pageNav->showing().' custom lists'; $sel = true; ?> <tr> <td> - <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $list->get('id'); ?>" + <input width="7" type="checkbox" class="ckb" name="ids[]" + value="<?php echo $list->getId(); ?>" <?php echo $sel?'checked="checked"':''; ?>></td> - <td><a href="?id=<?php echo $list->get('id'); ?>"><?php echo $list->get('name'); ?></a></td> + <td><a href="?id=<?php echo $list->getId(); ?>"><?php echo + $list->getName(); ?></a></td> <td><?php echo $list->get('created'); ?></td> <td><?php echo $list->get('updated'); ?></td> </tr> @@ -76,7 +100,7 @@ if ($count) //Show options.. <hr/> <p class="confirm-action" style="display:none;" id="delete-confirm"> <font color="red"><strong>Are you sure you want to DELETE selected lists?</strong></font> - <br><br>Deleted forms CANNOT be recovered. + <br><br>Deleted list CANNOT be recovered. </p> <div>Please confirm to continue.</div> <hr style="margin-top:1em"/> diff --git a/scp/lists.php b/scp/lists.php index 1b8e40675aa17dd45d0853c6158edf079b17c372..56232c76c3c482da7abb8092c3a52daed7ee0a8e 100644 --- a/scp/lists.php +++ b/scp/lists.php @@ -4,11 +4,17 @@ require_once(INCLUDE_DIR.'class.list.php'); $list=null; -if($_REQUEST['id'] && !($list=DynamicList::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid dynamic list ID.'; - -if ($list) - $form = $list->getForm(); +if ($_REQUEST['id']) { + if (is_numeric($_REQUEST['id'])) + $list = DynamicList::lookup($_REQUEST['id']); + else + $list = BuiltInCustomList::lookup($_REQUEST['id']); + + if ($list) + $form = $list->getForm(); + else + $errors['err'] = 'Unknown or invalid dynamic list ID.'; +} if($_POST) { $fields = array('name', 'name_plural', 'sort_mode', 'notes');