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
e9d67a7a
Commit
e9d67a7a
authored
9 years ago
by
Jared Hancock
Committed by
Peter Rotich
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
queue: Implement decoration saving
parent
dedb2c97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class.queue.php
+20
-8
20 additions, 8 deletions
include/class.queue.php
include/staff/templates/queue-column.tmpl.php
+24
-10
24 additions, 10 deletions
include/staff/templates/queue-column.tmpl.php
with
44 additions
and
18 deletions
include/class.queue.php
+
20
−
8
View file @
e9d67a7a
...
...
@@ -159,7 +159,7 @@ abstract class QueueDecoration {
'b'
=>
'%2$s %1$s'
,
);
$pos
=
strtolower
(
$this
->
config
[
'p'
]
);
$pos
=
$this
->
getPosition
(
);
if
(
!
isset
(
$positions
[
$pos
]))
return
$text
;
...
...
@@ -206,7 +206,7 @@ extends QueueDecoration {
$threadcount
=
$row
[
static
::
$qname
];
if
(
$threadcount
>
1
)
{
return
sprintf
(
'<i class="icon-comments-alt"></i>
<small>
%s</small>'
,
'<
small class="faded-more"><
i class="icon-comments-alt"></i>
%s</small>'
,
$threadcount
);
}
...
...
@@ -249,9 +249,8 @@ extends QueueDecoration {
}
function
getDecoration
(
$row
,
$text
)
{
return
sprintf
(
'<span class="Icon overdueTicket">%s</span>'
,
$text
);
if
(
$row
[
'isoverdue'
])
return
'<span class="Icon overdueTicket"></span>'
;
}
}
...
...
@@ -265,9 +264,8 @@ extends QueueDecoration {
}
function
getDecoration
(
$row
,
$text
)
{
return
sprintf
(
'<span class="Icon %sTicket">%s</span>'
,
$row
[
'source'
],
$text
);
return
sprintf
(
'<span class="Icon %sTicket"></span>'
,
strtolower
(
$row
[
'source'
]));
}
}
...
...
@@ -628,6 +626,20 @@ extends VerySimpleModel {
$form
=
$this
->
getDataConfigForm
(
$vars
);
foreach
(
$form
->
getClean
()
as
$k
=>
$v
)
$this
->
set
(
$k
,
$v
);
// Do the decorations
$this
->
_decorations
=
$this
->
decorations
=
array
();
foreach
(
$vars
[
'decorations'
]
as
$i
=>
$class
)
{
if
(
!
class_exists
(
$class
)
||
!
is_subclass_of
(
$class
,
'QueueDecoration'
))
continue
;
if
(
$vars
[
'deco_column'
][
$i
]
!=
$this
->
id
)
continue
;
$json
=
array
(
'c'
=>
$class
,
'p'
=>
$vars
[
'deco_pos'
][
$i
]);
$this
->
_decorations
[]
=
QueueDecoration
::
fromJson
(
$json
);
$this
->
decorations
[]
=
$json
;
}
// Store as JSON array
$this
->
decorations
=
JsonDataEncoder
::
encode
(
$this
->
decorations
);
}
}
...
...
This diff is collapsed.
Click to expand it.
include/staff/templates/queue-column.tmpl.php
+
24
−
10
View file @
e9d67a7a
...
...
@@ -19,24 +19,33 @@ $data_form = $column->getDataConfigForm($_POST);
?>
</div>
<div
class=
"hidden tab_content"
id=
"
<?php
echo
$colid
;
?>
-decorations"
style=
"max-width: 400px"
>
<div
class=
"hidden tab_content"
data-col-id=
"
<?php
echo
$colid
;
?>
"
id=
"
<?php
echo
$colid
;
?>
-decorations"
style=
"max-width: 400px"
>
<div
class=
"empty placeholder"
style=
"margin-left: 20px"
>
<em>
<?php
echo
__
(
'No decorations for this field'
);
?>
</em>
</div>
<div
style=
"margin: 20px;"
>
<div
style=
"margin:
0
20px;"
>
<div
class=
"decoration clear template hidden"
>
<input
data-field=
"input"
data-name=
"decorations[]"
value=
""
type=
"hidden"
/>
<input
data-field=
"column"
data-name=
"deco_column[]"
value=
""
type=
"hidden"
/>
<i
data-field=
"icon"
></i>
<span
data-field=
"name"
></span>
<div
class=
"pull-right"
>
<select
data-field=
"position"
>
<select
data-field=
"position"
data-name=
"deco_pos[]"
>
<?php
foreach
(
QueueDecoration
::
getPositions
()
as
$key
=>
$desc
)
{
echo
sprintf
(
'<option value="%s">%s</option>'
,
$key
,
Format
::
htmlchars
(
$desc
));
}
?>
</select>
<a
href=
"#"
data-field=
"delete"
title=
"
<?php
echo
__
(
'Delete'
);
?>
"
onclick=
"javascript:
$(this).closest('.decoration').remove();
var tab = $(this).closest('.tab_content'),
decoration = $(this).closest('.decoration'),
klass = decoration.find('input[data-field=input]').val(),
select = $('select.add-decoration', tab);
select.find('option[value=' + klass + ']').prop('disabled', false);
decoration.remove();
if (tab.find('.decoration:not(.template)').length === 0)
tab.find('.empty.placeholder').show()
return false;"
><i
class=
"icon-trash"
></i></a>
</div>
</div>
...
...
@@ -54,22 +63,27 @@ $data_form = $column->getDataConfigForm($_POST);
<script>
$
(
function
()
{
var
addDecoration
=
function
(
type
,
icon
,
pos
)
{
var
addDecoration
=
function
(
type
,
desc
,
icon
,
pos
)
{
var
template
=
$
(
'
.decoration.template
'
,
'
#
<?php
echo
$colid
;
?>
-decorations
'
),
clone
=
template
.
clone
().
show
().
removeClass
(
'
template
'
).
insertBefore
(
template
),
input
=
clone
.
find
(
'
[data-field=input]
'
),
colid
=
clone
.
closest
(
'
.tab_content
'
).
data
(
'
colId
'
),
column
=
clone
.
find
(
'
[data-field=column]
'
),
name
=
clone
.
find
(
'
[data-field=name]
'
),
i
=
clone
.
find
(
'
[data-field=icon]
'
),
position
=
clone
.
find
(
'
[data-field=position]
'
);
input
.
attr
(
'
name
'
,
input
.
data
(
'
name
'
));
input
.
attr
(
'
name
'
,
input
.
data
(
'
name
'
)).
val
(
type
);
column
.
attr
(
'
name
'
,
column
.
data
(
'
name
'
)).
val
(
colid
);
i
.
addClass
(
'
icon-fixed-width icon-
'
+
icon
);
name
.
text
(
type
);
if
(
pos
)
position
.
val
(
pos
);
template
.
parent
().
find
(
'
.empty
'
).
hide
();
name
.
text
(
desc
);
position
.
attr
(
'
name
'
,
position
.
data
(
'
name
'
));
if
(
pos
)
position
.
val
(
pos
);
template
.
closest
(
'
.tab_content
'
).
find
(
'
.empty
'
).
hide
();
};
$
(
'
select.add-decoration
'
,
'
#
<?php
echo
$colid
;
?>
-decorations
'
).
change
(
function
()
{
var
selected
=
$
(
this
).
find
(
'
:selected
'
);
addDecoration
(
selected
.
text
(),
selected
.
data
(
'
icon
'
));
addDecoration
(
selected
.
val
(),
selected
.
text
(),
selected
.
data
(
'
icon
'
));
selected
.
prop
(
'
disabled
'
,
true
);
});
$
(
'
#
<?php
echo
$colid
;
?>
-decorations
'
).
click
(
'
a[data-field=delete]
'
,
...
...
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