/usr/share/horde/whups/lib/Form/Ticket/CreateStepThree.php is in php-horde-whups 3.0.0~beta1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | <?php
/**
* This file contains all Horde_Form classes to create a new ticket.
*
* Copyright 2001-2002 Robert E. Coyle <robertecoyle@hotmail.com>
* Copyright 2001-2013 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 Robert E. Coyle <robertecoyle@hotmail.com>
* @package Whups
*/
/**
* @package Whups
*/
class Whups_Form_Ticket_CreateStepThree extends Horde_Form
{
public function __construct(&$vars)
{
global $whups_driver, $conf;
parent::__construct($vars, _("Create Ticket - Step 3"));
$states = $whups_driver->getStates($vars->get('type'), 'unconfirmed');
$attributes = $whups_driver->getAttributesForType($vars->get('type'));
$queue = $vars->get('queue');
$info = $whups_driver->getQueue($queue);
if ($GLOBALS['registry']->getAuth()) {
$states2 = $whups_driver->getStates(
$vars->get('type'), array('new', 'assigned'));
if (is_array($states2)) {
$states = $states + $states2;
}
}
if (Whups::hasPermission($queue, 'queue', 'requester')) {
$test = $this->addVariable(
_("The Requester's Email Address"), 'user_email',
'whups:whupsemail', false);
} elseif (!$GLOBALS['registry']->getAuth()) {
$this->addVariable(
_("Your Email Address"), 'user_email', 'email', true);
if (!empty($conf['guests']['captcha'])) {
$this->addVariable(
_("Spam protection"), 'captcha', 'figlet', true, null, null,
array(
Whups::getCAPTCHA(!$this->isSubmitted()),
$conf['guests']['figlet_font']));
}
}
// Silently default the state if there is only one choice
if (count($states) == 1) {
$vars->set('state', reset(array_keys($states)));
$f_state = &$this->addHidden(
_("Ticket State"), 'state', 'enum', true, false, null, array($states));
} else {
$f_state = &$this->addVariable(
_("Ticket State"), 'state', 'enum', true, false, null, array($states));
$f_state->setDefault(
$whups_driver->getDefaultState($vars->get('type')));
}
$f_priority = &$this->addVariable(
_("Priority"), 'priority', 'enum', true, false, null,
array($whups_driver->getPriorities($vars->get('type'))));
$f_priority->setDefault(
$whups_driver->getDefaultPriority($vars->get('type')));
$this->addVariable(_("Due Date"), 'due', 'datetime', false, false);
$this->addVariable(_("Summary"), 'summary', 'text', true, false);
$this->addVariable(_("Attachment"), 'newattachment', 'file', false);
$this->addVariable(_("Description"), 'comment', 'longtext', true);
foreach ($attributes as $attribute_id => $attribute_value) {
$this->addVariable(
$attribute_value['human_name'],
'attributes[' . $attribute_id . ']',
$attribute_value['type'],
$attribute_value['required'],
$attribute_value['readonly'],
$attribute_value['desc'],
$attribute_value['params']);
}
/* Comment permissions. */
$groups = $GLOBALS['injector']->getInstance('Horde_Group');
$mygroups = $groups->listGroups($GLOBALS['registry']->getAuth());
if ($mygroups) {
$mygroups = array(0 => _("This comment is visible to everyone")) + $mygroups;
$v = $this->addVariable(
_("Make this comment visible only to members of a group?"), 'group',
'enum', false, false, null, array($mygroups));
$v->setDefault(0);
}
}
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(
'state', _("Spam protection"), 'captcha', 'figlet', true,
null, null,
array(Whups::getCAPTCHA(true),
$conf['guests']['figlet_font']));
}
return false;
}
return true;
}
}
|