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
3af4750e
Commit
3af4750e
authored
9 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
redactor: Hide image button if upload not supported
parent
e632f5f6
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/ajax.draft.php
+7
-7
7 additions, 7 deletions
include/ajax.draft.php
js/redactor-osticket.js
+23
-20
23 additions, 20 deletions
js/redactor-osticket.js
with
30 additions
and
27 deletions
include/ajax.draft.php
+
7
−
7
View file @
3af4750e
...
...
@@ -344,16 +344,16 @@ class DraftAjaxAPI extends AjaxController {
&&
(
$object
=
$thread
->
getObject
())
&&
(
$thisstaff
->
canAccess
(
$object
))
)
{
$union
=
' UNION SELECT f.id, a.`type` FROM '
.
THREAD_TABLE
.
' t
$union
=
' UNION SELECT f.id, a.`type`
, a.`name`
FROM '
.
THREAD_TABLE
.
' t
JOIN '
.
THREAD_ENTRY_TABLE
.
' th ON (th.thread_id = t.id)
JOIN '
.
ATTACHMENT_TABLE
.
' a ON (a.object_id = th.id AND a.`type` = \'H\')
JOIN '
.
FILE_TABLE
.
' f ON (a.file_id = f.id)
WHERE t.id='
.
db_input
(
$_GET
[
'threadId'
]);
WHERE
a.`inline` = 1 AND
t.id='
.
db_input
(
$_GET
[
'threadId'
]);
}
$sql
=
'SELECT distinct f.id, COALESCE(a.type, f.ft) FROM '
.
FILE_TABLE
$sql
=
'SELECT distinct f.id, COALESCE(a.type, f.ft)
, a.`name`
FROM '
.
FILE_TABLE
.
' f LEFT JOIN '
.
ATTACHMENT_TABLE
.
' a ON (a.file_id = f.id)
WHERE (a.`type` IN (\'C\', \'F\', \'T\', \'P\') OR f.ft = \'L\')'
WHERE
(
(a.`type` IN (\'C\', \'F\', \'T\', \'P\')
AND a.`inline` = 1)
OR f.ft = \'L\')'
.
' AND f.`type` LIKE \'image/%\''
;
if
(
!
(
$res
=
db_query
(
$sql
.
$union
)))
Http
::
response
(
500
,
'Unable to lookup files'
);
...
...
@@ -367,15 +367,15 @@ class DraftAjaxAPI extends AjaxController {
'P'
=>
__
(
'Pages'
),
'H'
=>
__
(
'This Thread'
),
);
while
(
list
(
$id
,
$type
)
=
db_fetch_row
(
$res
))
{
$f
=
AttachmentFile
::
lookup
(
$id
);
while
(
list
(
$id
,
$type
,
$name
)
=
db_fetch_row
(
$res
))
{
$f
=
AttachmentFile
::
lookup
(
(
int
)
$id
);
$url
=
$f
->
getDownloadUrl
();
$files
[]
=
array
(
// Don't send special sizing for thread items 'cause they
// should be cached already by the client
'thumb'
=>
$url
.
(
$type
!=
'H'
?
'&s=128'
:
''
),
'image'
=>
$url
,
'title'
=>
$f
->
getName
(),
'title'
=>
$name
?:
$f
->
getName
(),
'folder'
=>
$folders
[
$type
]
);
}
...
...
This diff is collapsed.
Click to expand it.
js/redactor-osticket.js
+
23
−
20
View file @
3af4750e
...
...
@@ -33,7 +33,7 @@ RedactorPlugins.draft = function() {
this
.
opts
.
imageUpload
=
'
ajax.php/draft/
'
+
this
.
opts
.
draftId
+
'
/attach
'
;
}
else
{
else
if
(
this
.
$textarea
.
hasClass
(
'
draft
'
))
{
// Just upload the file. A draft will be created automatically
// and will be configured locally in the afterUpateDraft()
this
.
opts
.
clipboardUploadUrl
=
...
...
@@ -43,23 +43,26 @@ RedactorPlugins.draft = function() {
if
(
autosave_url
)
this
.
autosave
.
enable
();
this
.
$draft_saved
=
$
(
'
<span>
'
)
.
addClass
(
"
pull-right draft-saved
"
)
.
hide
()
.
append
(
$
(
'
<span>
'
)
.
text
(
__
(
'
Draft Saved
'
)));
// Float the [Draft Saved] box with the toolbar
this
.
$toolbar
.
append
(
this
.
$draft_saved
);
// Add [Delete Draft] button to the toolbar
if
(
this
.
opts
.
draftDelete
)
{
var
trash
=
this
.
draft
.
deleteButton
=
this
.
button
.
add
(
'
deleteDraft
'
,
__
(
'
Delete Draft
'
))
this
.
button
.
addCallback
(
trash
,
this
.
draft
.
deleteDraft
);
this
.
button
.
setAwesome
(
'
deleteDraft
'
,
'
icon-trash
'
);
trash
.
parent
().
addClass
(
'
pull-right
'
);
trash
.
addClass
(
'
delete-draft
'
);
if
(
!
this
.
opts
.
draftId
)
trash
.
hide
();
if
(
this
.
$textarea
.
hasClass
(
'
draft
'
))
{
this
.
$draft_saved
=
$
(
'
<span>
'
)
.
addClass
(
"
pull-right draft-saved
"
)
.
hide
()
.
append
(
$
(
'
<span>
'
)
.
text
(
__
(
'
Draft Saved
'
)));
// Float the [Draft Saved] box with the toolbar
this
.
$toolbar
.
append
(
this
.
$draft_saved
);
// Add [Delete Draft] button to the toolbar
if
(
this
.
opts
.
draftDelete
)
{
var
trash
=
this
.
draft
.
deleteButton
=
this
.
button
.
add
(
'
deleteDraft
'
,
__
(
'
Delete Draft
'
))
this
.
button
.
addCallback
(
trash
,
this
.
draft
.
deleteDraft
);
this
.
button
.
setAwesome
(
'
deleteDraft
'
,
'
icon-trash
'
);
trash
.
parent
().
addClass
(
'
pull-right
'
);
trash
.
addClass
(
'
delete-draft
'
);
if
(
!
this
.
opts
.
draftId
)
trash
.
hide
();
}
}
if
(
this
.
code
.
get
())
this
.
$box
.
trigger
(
'
draft:recovered
'
);
...
...
@@ -247,7 +250,7 @@ $(function() {
var
options
=
$
.
extend
({
'
air
'
:
el
.
hasClass
(
'
no-bar
'
),
'
buttons
'
:
el
.
hasClass
(
'
no-bar
'
)
?
[
'
formatting
'
,
'
|
'
,
'
bold
'
,
'
italic
'
,
'
underline
'
,
'
deleted
'
,
'
|
'
,
'
unorderedlist
'
,
'
orderedlist
'
,
'
outdent
'
,
'
indent
'
,
'
|
'
,
'
image
'
]
?
[
'
formatting
'
,
'
|
'
,
'
bold
'
,
'
italic
'
,
'
underline
'
,
'
deleted
'
,
'
|
'
,
'
unorderedlist
'
,
'
orderedlist
'
,
'
outdent
'
,
'
indent
'
,
'
|
'
,
'
link
'
,
'
image
'
]
:
[
'
html
'
,
'
|
'
,
'
formatting
'
,
'
|
'
,
'
bold
'
,
'
italic
'
,
'
underline
'
,
'
deleted
'
,
'
|
'
,
'
unorderedlist
'
,
'
orderedlist
'
,
'
outdent
'
,
'
indent
'
,
'
|
'
,
'
image
'
,
'
video
'
,
...
...
@@ -261,7 +264,7 @@ $(function() {
'
plugins
'
:
el
.
hasClass
(
'
no-bar
'
)
?
[
'
imagemanager
'
,
'
definedlinks
'
]
:
[
'
imagemanager
'
,
'
imageannotate
'
,
'
table
'
,
'
video
'
,
'
definedlinks
'
,
'
autolock
'
],
'
imageUpload
'
:
'
tbd
'
,
'
imageUpload
'
:
el
.
hasClass
(
'
draft
'
)
,
'
imageManagerJson
'
:
'
ajax.php/draft/images/browse
'
,
'
syncBeforeCallback
'
:
captureImageSizes
,
'
linebreaks
'
:
true
,
...
...
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