Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
053a3231
Commit
053a3231
authored
10 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Add TicketState and TicketFlag fields
parent
e31408bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/class.forms.php
+108
-4
108 additions, 4 deletions
include/class.forms.php
with
108 additions
and
4 deletions
include/class.forms.php
+
108
−
4
View file @
053a3231
...
...
@@ -157,13 +157,16 @@ class FormField {
}
static
function
addFieldTypes
(
$group
,
$callable
)
{
static
::
$more_types
[
$group
]
=
$callable
;
static
::
$more_types
[
$group
]
[]
=
$callable
;
}
static
function
allTypes
()
{
if
(
static
::
$more_types
)
{
foreach
(
static
::
$more_types
as
$group
=>
$c
)
static
::
$types
[
$group
]
=
call_user_func
(
$c
);
foreach
(
static
::
$more_types
as
$group
=>
$entries
)
foreach
(
$entries
as
$c
)
static
::
$types
[
$group
]
=
array_merge
(
static
::
$types
[
$group
]
?:
array
(),
call_user_func
(
$c
));
static
::
$more_types
=
array
();
}
return
static
::
$types
;
...
...
@@ -992,12 +995,113 @@ class PriorityField extends ChoiceField {
);
}
}
FormField
::
addFieldTypes
(
'
Built-in List
s'
,
function
()
{
FormField
::
addFieldTypes
(
'
Dynamic Field
s'
,
function
()
{
return
array
(
'priority'
=>
array
(
'Priority Level'
,
PriorityField
),
);
});
class
TicketStateField
extends
ChoiceField
{
static
$_choices
=
array
(
'open'
=>
'Open'
,
'resolved'
=>
'Resolved'
,
'closed'
=>
'Closed'
,
'archived'
=>
'Archived'
,
'deleted'
=>
'Deleted'
);
function
hasIdValue
()
{
return
true
;
}
function
isChangeable
()
{
return
false
;
}
function
getChoices
()
{
$this
->
ht
[
'default'
]
=
''
;
return
static
::
$_choices
;
}
function
getConfigurationOptions
()
{
return
array
(
'prompt'
=>
new
TextboxField
(
array
(
'id'
=>
2
,
'label'
=>
'Prompt'
,
'required'
=>
false
,
'default'
=>
''
,
'hint'
=>
'Leading text shown before a value is selected'
,
'configuration'
=>
array
(
'size'
=>
40
,
'length'
=>
40
),
)),
);
}
}
FormField
::
addFieldTypes
(
'Dynamic Fields'
,
function
()
{
return
array
(
'state'
=>
array
(
'Ticket State'
,
TicketStateField
,
false
),
);
});
class
TicketFlagField
extends
ChoiceField
{
// Supported flags (TODO: move to configurable custom list)
static
$_flags
=
array
(
'onhold'
=>
array
(
'flag'
=>
1
,
'name'
=>
'Onhold'
,
'states'
=>
array
(
'open'
),
),
'overdue'
=>
array
(
'flag'
=>
2
,
'name'
=>
'Overdue'
,
'states'
=>
array
(
'open'
),
),
'answered'
=>
array
(
'flag'
=>
4
,
'name'
=>
'Answered'
,
'states'
=>
array
(
'open'
),
)
);
var
$_choices
;
function
hasIdValue
()
{
return
true
;
}
function
isChangeable
()
{
return
true
;
}
function
getChoices
()
{
$this
->
ht
[
'default'
]
=
''
;
if
(
!
$this
->
_choices
)
{
foreach
(
static
::
$_flags
as
$k
=>
$v
)
$this
->
_choices
[
$k
]
=
$v
[
'name'
];
}
return
$this
->
_choices
;
}
function
getConfigurationOptions
()
{
return
array
(
'prompt'
=>
new
TextboxField
(
array
(
'id'
=>
2
,
'label'
=>
'Prompt'
,
'required'
=>
false
,
'default'
=>
''
,
'hint'
=>
'Leading text shown before a value is selected'
,
'configuration'
=>
array
(
'size'
=>
40
,
'length'
=>
40
),
)),
);
}
}
FormField
::
addFieldTypes
(
'Dynamic Fields'
,
function
()
{
return
array
(
'flags'
=>
array
(
'Ticket Flags'
,
TicketFlagField
,
false
),
);
});
class
Widget
{
function
__construct
(
$field
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment