1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: class Whups_Form_Admin_EditQueueStepTwo extends Horde_Form
15: {
16: public function __construct(&$vars)
17: {
18: global $whups_driver, $registry;
19:
20: parent::__construct($vars);
21:
22: $queue = $vars->get('queue');
23: try {
24: $info = $whups_driver->getQueue($queue);
25: } catch (Whups_Exception $e) {
26: $this->addVariable(
27: _("Invalid Queue"), 'invalid', 'invalid', true,
28: false, null, array(_("Invalid Queue")));
29: return;
30: }
31:
32: $this->setTitle(sprintf(_("Edit %s"), $info['name']));
33: $this->addHidden('', 'queue', 'int', true, true);
34:
35: $mname = &$this->addVariable(
36: _("Queue Name"), 'name', 'text', true, $info['readonly']);
37: $mname->setDefault($info['name']);
38:
39: $mdesc = &$this->addVariable(
40: _("Queue Description"), 'description', 'text', true, $info['readonly']);
41: $mdesc->setDefault($info['description']);
42:
43: $mslug = &$this->addVariable(
44: _("Queue Slug"), 'slug', 'text', false, $info['readonly']);
45: $mslug->setDefault($info['slug']);
46:
47: $memail = &$this->addVariable(
48: _("Queue Email"), 'email', 'email', false, $info['readonly']);
49: $memail->setDefault($info['email']);
50:
51: $types = $whups_driver->getAllTypes();
52: $mtypes = &$this->addVariable(
53: _("Ticket Types associated with this Queue"), 'types', 'set', true,
54: false, null, array($types));
55: $mtypes->setDefault(array_keys($whups_driver->getTypes($queue)));
56: $mdefaults = &$this->addVariable(
57: _("Default Ticket Type"), 'default', 'enum', false, false, null, array($types));
58: $mdefaults->setDefault($whups_driver->getDefaultType($queue));
59:
60:
61: $mversioned = &$this->addVariable(
62: _("Keep a set of versions for this queue?"), 'versioned',
63: 'boolean', false, $info['readonly']);
64: $mversioned->setDefault($info['versioned']);
65: if ($registry->hasMethod('tickets/listVersions') == $registry->getApp()) {
66: $versionlink = array(
67: 'text' => _("Edit the versions for this queue"),
68: 'url' => Horde_Util::addParameter(Horde::url('admin/?formname=whups_form_admin_editversionstepone'), 'queue', $queue));
69: $this->addVariable('', 'link', 'link', false, true, null, array($versionlink));
70: }
71:
72:
73: $users = $whups_driver->getQueueUsers($queue);
74: $f_users = array();
75: foreach ($users as $user) {
76: $f_users[$user] = Whups::formatUser($user);
77: }
78: asort($f_users);
79: $musers = &$this->addVariable(_("Users responsible for this Queue"),
80: 'users', 'set', false, true, null,
81: array($f_users));
82: $musers->setDefault($whups_driver->getQueueUsers($queue));
83: $userlink = array(
84: 'text' => _("Edit the users responsible for this queue"),
85: 'url' => Horde_Util::addParameter(Horde::url('admin/?formname=edituserform'), 'queue', $queue));
86: $this->addVariable('', 'link', 'link', false, true, null,
87: array($userlink));
88:
89:
90: if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => Horde_Perms::EDIT))) {
91: $permslink = array(
92: 'text' => _("Edit the permissions on this queue"),
93: 'url' => Horde::url('admin/perms/edit.php', false,
94: array('app' => 'horde'))
95: ->add(array('category' => 'whups:queues:' . $queue,
96: 'autocreate' => '1')));
97: $this->addVariable('', 'link', 'link', false, true, null,
98: array($permslink));
99: }
100: }
101:
102: }