/** */ protected function _title() { if (($query = $this->_getQuery()) && $query->name) { return Horde::link(Whups::urlFor('query', empty($query->slug) ? array('id' => $query->id) : array('slug' => $query->slug))) . htmlspecialchars($query->name) . '</a>'; } return $this->getName(); }
public function __construct(&$vars) { parent::__construct($vars, _("Edit Attribute")); $attribute = $vars->get('attribute'); $info = $GLOBALS['whups_driver']->getAttributeDesc($attribute); $this->addHidden('', 'type', 'int', true, true); $this->addHidden('', 'attribute', 'int', true, true); $pname =& $this->addVariable(_("Attribute Name"), 'attribute_name', 'text', true); $pname->setDefault($info['name']); $pdesc =& $this->addVariable(_("Attribute Description"), 'attribute_description', 'text', true); $pdesc->setDefault($info['description']); $preq =& $this->addVariable(_("Required Attribute?"), 'attribute_required', 'boolean', false); $preq->setDefault($info['required']); $ptype =& $this->addVariable(_("Attribute Type"), 'attribute_type', 'enum', true, false, null, array(Whups::fieldTypeNames())); $ptype->setAction(Horde_Form_Action::factory(array('whups', 'whups_reload'), array('formname' => 'whups_form_admin_editattributesteptwo_reload'))); $ptype->setDefault($info['type']); $type = $vars->get('attribute_type'); if (empty($type)) { $type = $info['type']; } foreach (Whups::fieldTypeParams($type) as $param => $param_info) { $pparam =& $this->addVariable($param_info['label'], 'attribute_params[' . $param . ']', $param_info['type'], false); if (isset($info['params'][$param])) { $pparam->setDefault($info['params'][$param]); } } }
public function validate(&$vars) { if (Whups::hasPermission($this->_queue, 'queue', Horde_Perms::DELETE)) { $this->_warn->setDefault('<span class="horde-form-error">' . _("Permission Denied.") . '</span>'); } return parent::validate($vars); }
public function validate(&$vars) { if (!Whups::hasPermission($this->_queue, 'queue', Horde_Perms::DELETE)) { $this->setError('yesno', _("Permission Denied.")); } return parent::validate($vars); }
/** * Generates a table with ticket information. * * @param array $tickets A list of tickets. * @param string $tableClass The DOM ID to use for the generated table. * * @return string Table HTML code. */ protected function _table($tickets, $tableId = null) { if (!$tableId) { $tableId = get_class($this); } $columns = isset($this->_params['columns']) ? $this->_params['columns'] : null; $sortby = $GLOBALS['prefs']->getValue('sortby'); $sortdirclass = ' class="' . ($GLOBALS['prefs']->getValue('sortdir') ? 'sortup' : 'sortdown') . '"'; $html = '<thead><tr><th' . ($sortby == 'id' ? $sortdirclass : '') . '>' . _("Id") . '</th>'; foreach (Whups::getSearchResultColumns('block', $this->_params['columns']) as $name => $column) { if ($column == 'id') { continue; } $html .= '<th' . ($sortby == $column ? $sortdirclass : '') . '>' . $name . '</th>'; } $html .= '</tr></thead><tbody>'; Whups::sortTickets($tickets); foreach ($tickets as $ticket) { foreach (Whups::getSearchResultColumns('block', $columns) as $column) { $thevalue = Whups::formatColumn($ticket, $column); $sortval = ''; if ($column == 'timestamp' || $column == 'due' || substr($column, 0, 5) == 'date_') { $sortval = strlen($ticket[$column]) ? ' sortval="' . $ticket[$column] . '"' : ''; } $html .= '<td' . $sortval . '>' . (strlen($thevalue) ? $thevalue : ' ') . '</td>'; } $html .= '</tr>'; } $GLOBALS['page_output']->addScriptFile('tables.js', 'horde'); return '<table id="' . htmlspecialchars($tableId) . '" class="horde-table sortable" style="width:100%">' . $html . '</tbody></table>'; }
/** */ protected function _content() { global $whups_driver; $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ); $qsummary = $whups_driver->getQueueSummary(array_keys($queues)); if (!$qsummary) { return '<p class="horde-content"><em>' . _("There are no open tickets.") . '</em></p>'; } $summary = $types = array(); foreach ($qsummary as $queue) { $types[$queue['type']] = $queue['type']; if (!isset($summary[$queue['id']])) { $summary[$queue['id']] = $queue; } $summary[$queue['id']][$queue['type']] = $queue['open_tickets']; } $html = '<thead><tr>'; $sortby = 'queue_name'; foreach (array_merge(array('queue_name' => _("Queue")), $types) as $column => $name) { $html .= '<th' . ($sortby == $column ? ' class="sortdown"' : '') . '>' . $name . '</th>'; } $html .= '</tr></thead><tbody>'; foreach ($summary as $queue) { $html .= '<tr><td>' . Horde::link(Whups::urlFor('queue', $queue, true), $queue['description']) . htmlspecialchars($queue['name']) . '</a></td>'; foreach ($types as $type) { $html .= '<td>' . (isset($queue[$type]) ? $queue[$type] : ' ') . '</td>'; } $html .= '</tr>'; } $GLOBALS['page_output']->addScriptFile('tables.js', 'horde'); return '<table id="whups_block_queuesummary" class="horde-table sortable" style="width:100%">' . $html . '</tbody></table>'; }
public function __construct(&$vars) { global $whups_driver, $conf; parent::__construct($vars, _("Create Ticket - Step 4")); /* Preserve previously uploaded attachments. */ $this->addHidden('', 'deferred_attachment', 'text', false); /* Groups. */ $mygroups = $GLOBALS['injector']->getInstance('Horde_Group')->listAll($conf['prefs']['assign_all_groups'] ? null : $GLOBALS['registry']->getAuth()); asort($mygroups); $users = $whups_driver->getQueueUsers($vars->get('queue')); $f_users = array(); foreach ($users as $user) { $f_users['user:'******'group:' . $id] = $group; } } if (count($f_users)) { asort($f_users); $owners = $this->addVariable(_("Owners"), 'owners', 'multienum', false, false, null, array($f_users)); } if (count($f_groups)) { asort($f_groups); $group_owners = $this->addVariable(_("Group Owners"), 'group_owners', 'multienum', false, false, null, array($f_groups)); } if (!count($f_users) && !count($f_groups)) { $owner_params = array(_("There are no users to which this ticket can be assigned.")); $this->addVariable(_("Owners"), 'owners', 'invalid', false, false, null, $owner_params); } }
/** */ protected function _getAddressbookSearchParams() { $params = Whups::getAddressbookSearchParams(); $ob = new stdClass(); $ob->fields = $params['fields']; $ob->sources = $params['sources']; return $ob; }
/** */ protected function _content() { $queue_ids = array_keys(Whups::permissionsFilter($GLOBALS['whups_driver']->getQueues(), 'queue', Horde_Perms::READ)); $info = array('owner' => Whups::getOwnerCriteria($GLOBALS['registry']->getAuth()), 'nores' => true, 'queue' => $queue_ids); $assigned = $GLOBALS['whups_driver']->getTicketsByProperties($info); if (!$assigned) { return '<p class="horde-content"><em>' . _("No tickets are assigned to you.") . '</em></p>'; } return $this->_table($assigned); }
/** */ protected function _content() { global $whups_driver, $prefs; $queue_ids = array_keys(Whups::permissionsFilter($GLOBALS['whups_driver']->getQueues(), 'queue', Horde_Perms::READ)); $info = array('requester' => $GLOBALS['registry']->getAuth(), 'notowner' => 'user:'******'registry']->getAuth(), 'nores' => true, 'queue' => $queue_ids); $requests = $GLOBALS['whups_driver']->getTicketsByProperties($info); if (!$requests) { return '<p class="horde-content"><em>' . _("You have no open requests.") . '</em></p>'; } return $this->_table($requests); }
public function validate(&$vars, $canAutoFill = false) { global $conf; if (!parent::validate($vars, $canAutoFill)) { if (!$GLOBALS['registry']->getAuth() && !empty($conf['guests']['captcha'])) { $vars->remove('captcha'); $this->removeVariable($varname = 'captcha'); $this->insertVariableBefore('newcomment', _("Spam protection"), 'captcha', 'figlet', true, null, null, array(Whups::getCAPTCHA(true), $conf['guests']['figlet_font'])); } return false; } return true; }
/** */ private function _getQueue() { if (empty($this->_params['queue'])) { return false; } if (!Whups::permissionsFilter(array($this->_params['queue'] => true), 'queue', Horde_Perms::READ)) { return false; } try { return $GLOBALS['whups_driver']->getQueue($this->_params['queue']); } catch (Whups_Exception $e) { return false; } }
public function __construct(&$vars) { global $whups_driver, $registry; parent::__construct($vars); $queue = $vars->get('queue'); try { $info = $whups_driver->getQueue($queue); } catch (Whups_Exception $e) { $this->addVariable(_("Invalid Queue"), 'invalid', 'invalid', true, false, null, array(_("Invalid Queue"))); return; } $this->setTitle(sprintf(_("Edit %s"), $info['name'])); $this->addHidden('', 'queue', 'int', true, true); $mname = $this->addVariable(_("Queue Name"), 'name', 'text', true, $info['readonly']); $mname->setDefault($info['name']); $mdesc = $this->addVariable(_("Queue Description"), 'description', 'text', true, $info['readonly']); $mdesc->setDefault($info['description']); $mslug = $this->addVariable(_("Queue Slug"), 'slug', 'text', false, $info['readonly']); $mslug->setDefault($info['slug']); $memail = $this->addVariable(_("Queue Email"), 'email', 'email', false, $info['readonly']); $memail->setDefault($info['email']); $types = $whups_driver->getAllTypes(); $mtypes = $this->addVariable(_("Ticket Types associated with this Queue"), 'types', 'set', true, false, null, array($types)); $mtypes->setDefault(array_keys($whups_driver->getTypes($queue))); $mdefaults = $this->addVariable(_("Default Ticket Type"), 'default', 'enum', false, false, null, array($types)); $mdefaults->setDefault($whups_driver->getDefaultType($queue)); /* Versioned and version link. */ $mversioned = $this->addVariable(_("Keep a set of versions for this queue?"), 'versioned', 'boolean', false, $info['readonly']); $mversioned->setDefault($info['versioned']); if ($registry->hasMethod('tickets/listVersions') == $registry->getApp()) { $versionlink = array('text' => _("Edit the versions for this queue"), 'url' => Horde::url('admin/?formname=whups_form_admin_editversionstepone')->add('queue', $queue)); $this->addVariable('', 'link', 'link', false, true, null, array($versionlink)); } /* Usertype and usertype link. */ $users = $whups_driver->getQueueUsers($queue); $f_users = array(); foreach ($users as $user) { $f_users[$user] = Whups::formatUser($user); } asort($f_users); $musers = $this->addVariable(_("Users responsible for this Queue"), 'users', 'set', false, true, null, array($f_users)); $musers->setDefault($whups_driver->getQueueUsers($queue)); $userlink = array('text' => _("Edit the users responsible for this queue"), 'url' => Horde::url('admin/?formname=edituserform')->add('queue', $queue)); $this->addVariable('', 'link', 'link', false, true, null, array($userlink)); /* Permissions link. */ if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => Horde_Perms::EDIT))) { $permslink = array('text' => _("Edit the permissions on this queue"), 'url' => Horde::url('admin/perms/edit.php', false, array('app' => 'horde'))->add(array('category' => 'whups:queues:' . $queue, 'autocreate' => '1'))); $this->addVariable('', 'link', 'link', false, true, null, array($permslink)); } }
/** * Constructor. */ public function __construct($vars, $title = '') { global $whups_driver; parent::__construct($vars, $title); $this->addHidden('', 'tickets', 'text', true, true); $this->addHidden('', 'url', 'text', true, true); $tickets = array(); foreach ((array) $vars->get('ticket') as $id) { $ticket = $whups_driver->getTicketDetails($id, false); if (Whups::hasPermission($ticket['queue'], 'queue', Horde_Perms::DELETE)) { $this->_tickets[] = (int) $id; $this->addVariable(_("Ticket") . ' ' . $id, 'summary' . $id, 'text', false, true)->setDefault($ticket['summary']); } } $this->addVariable('', 'warn', 'html', false)->setDefault('<span class="horde-form-error">' . _("Really delete these tickets? They will NOT be archived, and will be gone forever.") . '</span>'); $this->setButtons(array(array('class' => 'horde-delete', 'value' => _("Delete")), array('class' => 'horde-cancel', 'value' => _("Cancel")))); }
public function __construct(&$vars) { parent::__construct($vars, _("Add Attribute")); $this->addHidden('', 'type', 'int', true, true); $this->addVariable(_("Attribute Name"), 'attribute_name', 'text', true); $this->addVariable(_("Attribute Description"), 'attribute_description', 'text', true); $this->addVariable(_("Required Attribute?"), 'attribute_required', 'boolean', false); $v =& $this->addVariable(_("Attribute Type"), 'attribute_type', 'enum', true, false, null, array(Whups::fieldTypeNames())); $v->setDefault('text'); $v->setAction(Horde_Form_Action::factory(array('whups', 'whups_reload'), array('formname' => 'whups_form_admin_addattribute_reload'))); $type = $vars->get('attribute_type'); if (empty($type)) { $type = 'text'; } foreach (Whups::fieldTypeParams($type) as $param => $info) { $this->addVariable($info['label'], 'attribute_params[' . $param . ']', $info['type'], false); } }
public function run() { $this->_runtime = time(); // See if we need to include the reminders config file. if (filemtime(WHUPS_BASE . '/config/reminders.php') > $this->_filestamp) { $this->_filestamp = $this->_runtime; $this->_reminders = Horde::loadConfiguration('reminders.php', 'reminders', 'whups'); } foreach ($this->_reminders as $reminder) { $ds = new Horde_Scheduler_Cron_Date($reminder['frequency']); if ($ds->scheduledAt($this->_runtime)) { if (!empty($reminder['server_name'])) { $GLOBALS['conf']['server']['name'] = $reminder['server_name']; } $vars = new Horde_Variables($reminder); Whups::sendReminders($vars); } } }
public function __construct(&$vars) { global $whups_driver; parent::__construct($vars, _("Send Reminders")); $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::EDIT); if (count($queues)) { $modtype = 'enum'; $type_params = array($queues); } else { $modtype = 'invalid'; $type_params = array(_("There are no queues available.")); } $this->addVariable(_("Send only for this list of ticket ids"), 'id', 'intlist', false); $this->addVariable(_("For tickets from these queues"), 'queue', $modtype, false, false, null, $type_params); $cats = $whups_driver->getCategories(); unset($cats['resolved']); $categories = $this->addVariable(_("For tickets which are"), 'category', 'multienum', false, false, null, array($cats, 3)); $categories->setDefault(array('assigned')); $this->addVariable(_("Unassigned tickets"), 'unassigned', 'email', false, false, _("If you select any tickets that do not have an owner, who should we send email to?")); }
public function __construct(&$vars) { global $whups_driver, $registry; if ($registry->hasMethod('tickets/listQueues') == $registry->getApp()) { parent::__construct($vars, _("Edit or Delete Queues")); $this->setButtons(array(_("Edit Queue"), array('class' => 'horde-delete', 'value' => _("Delete Queue")))); } else { parent::__construct($vars, _("Edit Queues")); $this->setButtons(array(_("Edit Queue"))); } $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::EDIT); if ($queues) { $modtype = 'enum'; $type_params = array($queues); } else { $modtype = 'invalid'; $type_params = array(_("There are no queues to edit")); } $this->addVariable(_("Queue Name"), 'queue', $modtype, true, false, null, $type_params); }
public function __construct(&$vars, $title = '') { parent::__construct($vars, $title); $this->addHidden('', 'id', 'int', true, true); /* Queues. */ $this->addVariable(_("New Queue"), 'queue', 'enum', true, false, null, array(Whups::permissionsFilter($GLOBALS['whups_driver']->getQueues(), 'queue', Horde_Perms::EDIT))); $this->addVariable(_("Comment"), 'newcomment', 'longtext', false); /* Group restrictions. */ if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => Horde_Perms::EDIT)) || $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('whups:hiddenComments', $GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { $groups = $GLOBALS['injector']->getInstance('Horde_Group'); $mygroups = $groups->listGroups($GLOBALS['registry']->getAuth()); if ($mygroups) { foreach (array_keys($mygroups) as $gid) { $grouplist[$gid] = $groups->getName($gid, true); } asort($grouplist); $grouplist = array_merge(array(0 => _("Any Group")), $grouplist); $this->addVariable(_("Viewable only by members of"), 'group', 'enum', true, false, null, array($grouplist)); } } }
public function __construct(&$vars) { global $whups_driver; $this->appendButtons(array(array('class' => 'horde-delete', 'value' => _("Remove User")))); parent::__construct($vars, _("Responsible Users")); $queue = $vars->get('queue'); $users = $whups_driver->getQueueUsers($queue); $f_users = array(); foreach ($users as $user) { $f_users[$user] = Whups::formatUser($user); } if ($f_users) { asort($f_users); $usertype = 'enum'; $type_params = array($f_users); } else { $usertype = 'invalid'; $type_params = array(_("There are no users responsible for this queue.")); } $this->addHidden('', 'queue', 'int', true, true); $this->addVariable(_("Users responsible for this queue"), 'user', $usertype, true, false, null, $type_params); }
public function __construct($vars) { global $whups_driver; parent::__construct($vars, _("Create Ticket - Step 1")); $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::EDIT); if (!$queues) { $this->addVariable(_("Queue Name"), 'queue', 'invalid', true, false, null, array(_("There are no queues which you can create tickets in."))); } else { foreach (array_keys($queues) as $queue_id) { $info = $whups_driver->getQueue($queue_id); if (!empty($info['description'])) { $queues[$queue_id] .= ' [' . $info['description'] . ']'; } } // Auto-select the only queue if only one option is available if (count($queues) == 1) { $vars->set('queue', array_pop(array_keys($queues))); } $queues = $this->addVariable(_("Queue Name"), 'queue', 'enum', true, false, null, array($queues, _("Choose:"))); $queues->setAction(Horde_Form_Action::factory('submit')); } }
/** * Fetch the field values of the submitted form. * * @param Horde_Variables $vars A Horde_Variables instance, optional since Horde 3.2. * @param array $info Array to be filled with the submitted field * values. */ public function getInfo($vars, &$info) { parent::getInfo($vars, $info); if (empty($info['queue'])) { $info['queue'] = array_keys(Whups::permissionsFilter($GLOBALS['whups_driver']->getQueues(), 'queue', Horde_Perms::READ, $GLOBALS['registry']->getAuth(), $GLOBALS['registry']->getAuth())); } else { $info['queue'] = array($info['queue']); } if (empty($info['states'])) { unset($info['states']); } // ... if we were given a set of states if (isset($info['states'])) { // collect them into a list of state_id $info['state_id'] = array(); foreach ($info['states'] as $states) { if (isset($states)) { // because null === array_merge(array, null) $info['state_id'] = array_merge($info['state_id'], $states); } } unset($info['states']); } // Remove any queues that don't have a state selected. $types = array(); foreach ($info['queue'] as $queue) { foreach ($GLOBALS['whups_driver']->getTypeIds($queue) as $type) { $types[$type][$queue] = true; } } $queues = array(); foreach ($info['state_id'] as $stateId) { $state = $GLOBALS['whups_driver']->getState($stateId); if (isset($types[$state['type']])) { $queues = array_merge($queues, array_keys($types[$state['type']])); } } $info['queue'] = array_intersect($info['queue'], $queues); }
public function __construct($vars) { global $whups_driver; parent::__construct($vars, $vars->get('edit') ? _("Edit Property Criterion") : _("Add Property Criterion"), 'Whups_Form_Query_PropertyCriterion'); $this->addHidden('', 'edit', 'boolean', false); $this->addVariable(_("Id"), 'id', 'intlist', false); /* Types. */ $this->addVariable(_("Type"), 'ttype', 'enum', false, false, null, array($whups_driver->getAllTypes(), _("Any"))); /* Queues. */ $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ); if (count($queues)) { $v = $this->addVariable(_("Queue"), 'queue', 'enum', false, false, null, array($queues, _("Any"))); $v->setAction(Horde_Form_Action::factory('reload')); if ($vars->get('queue')) { $this->addVariable(_("Version"), 'version', 'enum', false, false, null, array($whups_driver->getVersions($vars->get('queue')), _("Any"))); } } /* States. */ $states = $whups_driver->getStates(); $this->addVariable(_("State"), 'state', 'enum', false, false, null, array($states, _("Any"))); /* Priorities. */ $priorities = $whups_driver->getPriorities(); $this->addVariable(_("Priority"), 'priority', 'enum', false, false, null, array($priorities, _("Any"))); }
/** * Copyright 2001-2002 Robert E. Coyle <*****@*****.**> * Copyright 2001-2014 Horde LLC (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. */ require_once __DIR__ . '/../lib/Application.php'; Horde_Registry::appInit('whups'); $empty = ''; $beendone = 0; $wereerrors = 0; $vars = Horde_Variables::getDefaultVariables($empty); $formname = $vars->get('formname'); Whups::addTopbarSearch(); $form1 = new Whups_Form_Ticket_CreateStepOne($vars); $form2 = new Whups_Form_Ticket_CreateStepTwo($vars); $form3 = new Whups_Form_Ticket_CreateStepThree($vars); $form4 = new Whups_Form_Ticket_CreateStepFour($vars); $r = new Horde_Form_Renderer(array('varrenderer_driver' => array('whups', 'whups'))); $valid4 = $form4->validate($vars) && $formname == 'whups_form_ticket_createstepfour'; $valid3 = $form3->validate($vars, true); $valid2 = $form2->validate($vars, !$form1->isSubmitted()); $valid1 = $form1->validate($vars, true); $doAssignForm = $GLOBALS['registry']->getAuth() && $whups_driver->isCategory('assigned', $vars->get('state')); if ($valid1 && $valid2 && $valid3 && (!$doAssignForm || $valid4)) { $form1->getInfo($vars, $info); $form2->getInfo($vars, $info); $form3->getInfo($vars, $info); if ($doAssignForm) {
/** */ public function display(Horde_Core_Prefs_Ui $ui) { $search = Whups::getAddressbookSearchParams(); return Horde_Core_Prefs_Ui_Widgets::addressbooks(array('fields' => $search['fields'], 'sources' => $search['sources'])); }
_open(); $form1 = new Whups_Form_Admin_EditReplyStepOne($vars); $form1->renderActive($renderer, $vars, $adminurl, 'post'); echo '<br />'; $form2 = new Whups_Form_Admin_AddReply($vars); $form2->renderActive($renderer, $vars, $adminurl, 'post'); } else { _open(); $form->renderActive($renderer, $vars, $adminurl, 'post'); } break; case 'whups_form_sendreminder': $form = new Whups_Form_SendReminder($vars); if ($form->validate($vars)) { try { Whups::sendReminders($vars); $notification->push(_("Reminders were sent."), 'horde.success'); } catch (Whups_Exception $e) { $notification->push($e, 'horde.error'); _open(); $form->renderActive($renderer, $vars, $adminurl, 'post'); } } else { _open(); $form->renderActive($renderer, $vars, $adminurl, 'post'); } break; case 'mtmatrix': $vars->set('action', 'mtmatrix'); $queues = $whups_driver->getQueues(); $types = $whups_driver->getAllTypes();
/** * Loads a set of tickets, and cache the result inside the Whups_Reports:: * object to save on database access. * * @param string $type 'open', 'closed', or 'all' - the set of * tickets to fetch. A previously cached set * will be returned if it is available. * @param boolean $expanded List tickets once for each owner of the * ticket? * * @return array The ticket set. */ protected function &_getTicketSet($type, $expanded = false) { $queues = array_keys(Whups::permissionsFilter($this->_backend->getQueues(), 'queue')); $expanded = (int) $expanded; switch ($type) { case 'open': if (is_null($this->_opentickets[$expanded])) { $this->_opentickets[$expanded] = $this->_backend->getTicketsByProperties(array('nores' => true, 'queue' => $queues), true, $expanded); } return $this->_opentickets[$expanded]; case 'closed': if (is_null($this->_closedtickets[$expanded])) { $this->_closedtickets[$expanded] = $this->_backend->getTicketsByProperties(array('res' => true, 'queue' => $queues), true, $expanded); } return $this->_closedtickets[$expanded]; case 'all': if (is_null($this->_alltickets[$expanded])) { $this->_alltickets[$expanded] = $this->_backend->getTicketsByProperties(array('queue' => $queues), true, $expanded); } return $this->_alltickets[$expanded]; } }
/** * Returns ticket details. * * @param integer $ticket A ticket ID. * @param boolean $checkPerms Enforce permissions? * * @return array A ticket information hash. * @throws Horde_Exception_NotFound * @throws Horde_Exception_PermissionDenied */ public function getTicketDetails($ticket, $checkPerms = true) { $result = $this->getTicketsByProperties(array('id' => $ticket)); if (!isset($result[0])) { throw new Horde_Exception_NotFound(sprintf(_("Ticket %s was not found."), $ticket)); } $queues = Whups::permissionsFilter($this->getQueues(), 'queue', Horde_Perms::READ, $GLOBALS['registry']->getAuth(), $result[0]['user_id_requester']); if ($checkPerms && !in_array($result[0]['queue'], array_flip($queues))) { throw new Horde_Exception_PermissionDenied(sprintf(_("You do not have permission to access this ticket (%s)."), $ticket)); } return $result[0]; }
/** * Copyright 2002-2015 Horde LLC (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. * * @author Chuck Hagenbuch <*****@*****.**> */ require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('whups'); // Get refresh interval. if ($r_time = $prefs->getValue('summary_refresh_time') && !$browser->hasFeature('xmlhttpreq')) { $page_output->metaRefresh($r_time, Horde::url('mybugs.php')); } Whups::addTopbarSearch(); // Load layout from preferences for authenticated users, and a default // block set for guests. if (!$registry->isAuthenticated()) { $prefs->setValue('mybugs_layout', serialize(array(array(array('app' => 'whups', 'params' => array('type2' => 'whups_Block_Myqueries', 'params' => false), 'height' => 1, 'width' => 1)), array(array('app' => 'whups', 'params' => array('type2' => 'whups_Block_Queuesummary', 'params' => false), 'height' => 1, 'width' => 1))))); } elseif (!@unserialize($prefs->getValue('mybugs_layout'))) { $prefs->setValue('mybugs_layout', serialize(array(array(array('app' => 'whups', 'params' => array('type2' => 'whups_Block_Mytickets', 'params' => false), 'height' => 1, 'width' => 1)), array(array('app' => 'whups', 'params' => array('type2' => 'whups_Block_Myrequests', 'params' => false), 'height' => 1, 'width' => 1)), array(array('app' => 'whups', 'params' => array('type2' => 'whups_Block_Myqueries', 'params' => false), 'height' => 1, 'width' => 1))))); } Whups::addFeedLink(); $layout = new Horde_Core_Block_Layout_View($injector->getInstance('Horde_Core_Factory_BlockCollection')->create(array('whups'), 'mybugs_layout')->getLayout(), Horde::url('mybugs_edit.php'), Horde::url('mybugs.php', true)); $layout_html = $layout->toHtml(); $menuBottom = '<div id="menuBottom"><a href="' . Horde::url('mybugs_edit.php') . '">' . _("Add Content") . '</a></div><div class="clear"> </div>'; $page_output->header(array('title' => sprintf(_("My %s"), $registry->get('name')))); $notification->notify(array('listeners' => 'status')); echo $layout_html; $page_output->footer();
// Update attributes. $whups_driver->setAttributes($info, $ticket); // Add attachment if one was uploaded. if (!empty($info['newattachment']['name'])) { $ticket->change('attachment', array('name' => $info['newattachment']['name'], 'tmp_name' => $info['newattachment']['tmp_name'])); } // If there was a new comment and permissions were specified // on it, set them. if (!empty($info['group'])) { $ticket->change('comment-perms', $info['group']); } try { $ticket->commit(); $notification->push(_("Ticket Updated"), 'horde.success'); $ticket->show(); } catch (Whups_Exception $e) { $notification->push($e, 'horde.error'); } } } $page_output->header(array('title' => $title)); $notification->notify(array('listeners' => 'status')); require WHUPS_TEMPLATES . '/prevnext.inc'; $tabs = Whups::getTicketTabs($vars, $id); echo $tabs->render('update'); $editform->renderActive($editform->getRenderer(), $vars, Horde::url('ticket/update.php'), 'post'); echo '<br class="spacer" />'; $form = new Whups_Form_TicketDetails($vars, $ticket, $title); $ticket->setDetails($vars); $form->renderInactive($form->getRenderer(), $vars); $page_output->footer();