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
8aec31d2
Commit
8aec31d2
authored
9 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
Add context typeahead to access email templates
parent
e939f1be
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/ajax.content.php
+21
-9
21 additions, 9 deletions
include/ajax.content.php
include/class.page.php
+29
-0
29 additions, 0 deletions
include/class.page.php
include/staff/templates/content-manage.tmpl.php
+5
-3
5 additions, 3 deletions
include/staff/templates/content-manage.tmpl.php
with
55 additions
and
12 deletions
include/ajax.content.php
+
21
−
9
View file @
8aec31d2
...
...
@@ -209,13 +209,17 @@ class ContentAjaxAPI extends AjaxController {
Http
::
response
(
400
,
'`root` is required parameter'
);
switch
(
$_GET
[
'root'
])
{
case
'thank-you'
:
case
'cannedresponse'
:
$roots
=
array
(
'ticket'
);
break
;
default
:
// Get the template for this template
if
(
$info
=
Page
::
getContext
(
$_GET
[
'root'
]))
{
$roots
=
$info
;
break
;
}
// Get the context for an email template
$tpl_info
=
EmailTemplateGroup
::
getTemplateDescription
(
$_GET
[
'root'
]);
if
(
!
$tpl_info
)
Http
::
response
(
422
,
'No such context'
);
...
...
@@ -223,21 +227,29 @@ class ContentAjaxAPI extends AjaxController {
}
$contextTypes
=
array
(
'assignee'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
'Newly assigned agent'
),
'assigner'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
'Agent performing the assignment'
),
'comments'
=>
'Agent supplied comments'
,
'activity'
=>
__
(
'Type of recent activity'
),
'assignee'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
__
(
'Assigned agent/team'
)),
'assigner'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
__
(
'Agent performing the assignment'
)),
'comments'
=>
__
(
'Assign/transfer comments'
),
'link'
=>
__
(
'Access link'
),
'message'
=>
array
(
'class'
=>
'MessageThreadEntry'
,
'desc'
=>
'Message from the EndUser'
),
'note'
=>
array
(
'class'
=>
'NoteThreadEntry'
,
'desc'
=>
'Internal note'
),
'note'
=>
array
(
'class'
=>
'NoteThreadEntry'
,
'desc'
=>
__
(
'Internal note'
)
)
,
'poster'
=>
array
(
'class'
=>
'User'
,
'desc'
=>
'EndUser or Agent originating the message'
),
// XXX: This could be EndUser -or- Staff object
'recipient'
=>
array
(
'class'
=>
'TicketUser'
,
'desc'
=>
'Message recipient'
),
'response'
=>
array
(
'class'
=>
'ResponseThreadEntry'
,
'desc'
=>
'Agent reply'
),
'response'
=>
array
(
'class'
=>
'ResponseThreadEntry'
,
'desc'
=>
__
(
'Outgoing response'
)
),
'signature'
=>
'Selected staff or department signature'
,
'staff'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
'Agent originating the activity'
),
'ticket'
=>
array
(
'class'
=>
'Ticket'
,
'desc'
=>
'The ticket'
),
'user'
=>
array
(
'class'
=>
'User'
,
'desc'
=>
__
(
'Message recipient'
)),
);
$context
=
array
();
foreach
(
$roots
as
$C
)
{
$context
[
$C
]
=
$contextTypes
[
$C
];
foreach
(
$roots
as
$C
=>
$desc
)
{
// $desc may be either the root or the description array
if
(
is_array
(
$desc
))
$context
[
$C
]
=
$desc
;
else
$context
[
$desc
]
=
$contextTypes
[
$desc
];
}
$global
=
osTicket
::
getVarScope
();
$items
=
VariableReplacer
::
compileScope
(
$context
+
$global
);
...
...
This diff is collapsed.
Click to expand it.
include/class.page.php
+
29
−
0
View file @
8aec31d2
...
...
@@ -341,5 +341,34 @@ class Page extends VerySimpleModel {
}
return
true
;
}
static
function
getContext
(
$type
)
{
$context
=
array
(
'thank-you'
=>
array
(
'ticket'
),
'registration-staff'
=>
array
(
// 'token' => __('Special authentication token'),
'staff'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
__
(
'Message recipient'
)),
'recipient'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
__
(
'Message recipient'
)),
'link'
,
),
'pwreset-staff'
=>
array
(
'staff'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
__
(
'Message recipient'
)),
'recipient'
=>
array
(
'class'
=>
'Staff'
,
'desc'
=>
__
(
'Message recipient'
)),
'link'
,
),
'registration-client'
=>
array
(
// 'token' => __('Special authentication token'),
'recipient'
=>
array
(
'class'
=>
'User'
,
'desc'
=>
__
(
'Message recipient'
)),
'link'
,
'user'
,
),
'pwreset-client'
=>
array
(
'recipient'
=>
array
(
'class'
=>
'User'
,
'desc'
=>
__
(
'Message recipient'
)),
'link'
,
'user'
,
),
'access-link'
=>
array
(
'ticket'
,
'recipient'
),
);
return
$context
[
$type
];
}
}
?>
This diff is collapsed.
Click to expand it.
include/staff/templates/content-manage.tmpl.php
+
5
−
3
View file @
8aec31d2
...
...
@@ -30,9 +30,10 @@ if (count($langs) > 1) { ?>
echo
Format
::
htmlchars
(
$info
[
'title'
]);
?>
"
/>
<div
style=
"margin-top: 5px"
>
<div
class=
"error"
>
<?php
echo
$errors
[
'body'
];
?>
</div>
<textarea
class=
"richtext no-bar"
name=
"body"
>
<?php
echo
Format
::
htmlchars
(
Format
::
viewableImages
(
$info
[
'body'
]));
?>
</textarea>
<textarea
class=
"richtext no-bar"
name=
"body"
data-root-context=
"
<?php
echo
$content
->
getType
();
?>
"
>
<?php
echo
Format
::
htmlchars
(
Format
::
viewableImages
(
$info
[
'body'
]));
?>
</textarea>
</div>
</div>
...
...
@@ -48,6 +49,7 @@ if (count($langs) > 1) { ?>
placeholder=
"
<?php
echo
__
(
'Title'
);
?>
"
/>
<div
style=
"margin-top: 5px"
>
<textarea
class=
"richtext no-bar"
data-direction=
<?php
echo
$nfo
[
'direction'
];
?>
data-root-context="
<?php
echo
$content
->
getType
();
?>
"
placeholder=
"
<?php
echo
__
(
'Message content'
);
?>
"
name=
"trans[
<?php
echo
$tag
;
?>
][body]"
>
<?php
echo
Format
::
htmlchars
(
Format
::
viewableImages
(
$trans
[
'body'
]));
...
...
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