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
033ac171
Commit
033ac171
authored
10 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
forms: Use new file upload widget for canned response designer
parent
04733190
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/staff/cannedresponse.inc.php
+12
-23
12 additions, 23 deletions
include/staff/cannedresponse.inc.php
scp/canned.php
+11
-2
11 additions, 2 deletions
scp/canned.php
scp/js/scp.js
+3
-2
3 additions, 2 deletions
scp/js/scp.js
scp/tickets.php
+1
-1
1 addition, 1 deletion
scp/tickets.php
with
27 additions
and
28 deletions
include/staff/cannedresponse.inc.php
+
12
−
23
View file @
033ac171
...
@@ -87,31 +87,20 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
...
@@ -87,31 +87,20 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
data-draft-object-id=
"
<?php
if
(
isset
(
$canned
))
echo
$canned
->
getId
();
?>
"
data-draft-object-id=
"
<?php
if
(
isset
(
$canned
))
echo
$canned
->
getId
();
?>
"
style=
"width:98%;"
class=
"richtext draft"
>
<?php
style=
"width:98%;"
class=
"richtext draft"
>
<?php
echo
$info
[
'response'
];
?>
</textarea>
echo
$info
[
'response'
];
?>
</textarea>
<br><br>
<div><h3>
<?php
echo
__
(
'Canned Attachments'
);
?>
<?php
echo
__
(
'(optional)'
);
?>
<div><b>
<?php
echo
__
(
'Canned Attachments'
);
?>
</b>
<?php
echo
__
(
'(optional)'
);
?>
<i
class=
"help-tip icon-question-sign"
href=
"#canned_attachments"
></i></h3>
<i
class=
"help-tip icon-question-sign"
href=
"#canned_attachments"
></i>
<div
class=
"error"
>
<?php
echo
$errors
[
'files'
];
?>
</div>
<font
class=
"error"
>
<?php
echo
$errors
[
'files'
];
?>
</font></div>
<?php
if
(
$canned
&&
(
$files
=
$canned
->
attachments
->
getSeparates
()))
{
echo
'<div id="canned_attachments"><span class="faded">'
.
__
(
'Uncheck to delete the attachment on submit'
)
.
'</span><br>'
;
foreach
(
$files
as
$file
)
{
$hash
=
$file
[
'key'
]
.
md5
(
$file
[
'id'
]
.
session_id
()
.
strtolower
(
$file
[
'key'
]));
echo
sprintf
(
'<label><input type="checkbox" name="files[]" id="f%d" value="%d" checked="checked">
<a href="file.php?h=%s">%s</a> </label> '
,
$file
[
'id'
],
$file
[
'id'
],
$hash
,
$file
[
'name'
]);
}
echo
'</div><br>'
;
}
//Hardcoded limit... TODO: add a setting on admin panel - what happens on tickets page??
if
(
count
(
$files
)
<
10
)
{
?>
<div>
<input
type=
"file"
name=
"attachments[]"
value=
""
/>
</div>
</div>
<?php
<?php
}
?>
if
(
$canned
&&
(
$files
=
$canned
->
attachments
->
getSeparates
()))
{
<div
class=
"faded"
>
<?php
echo
__
(
'You can upload up to 10 attachments per canned response.'
);
?>
</div>
$attachments
=
$canned_form
->
getField
(
'attachments'
);
$ids
=
array
();
foreach
(
$files
as
$f
)
$ids
[]
=
$f
[
'id'
];
$attachments
->
value
=
$ids
;
print
$attachments
->
render
();
}
?>
<br/>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
...
...
This diff is collapsed.
Click to expand it.
scp/canned.php
+
11
−
2
View file @
033ac171
...
@@ -28,6 +28,13 @@ $canned=null;
...
@@ -28,6 +28,13 @@ $canned=null;
if
(
$_REQUEST
[
'id'
]
&&
!
(
$canned
=
Canned
::
lookup
(
$_REQUEST
[
'id'
])))
if
(
$_REQUEST
[
'id'
]
&&
!
(
$canned
=
Canned
::
lookup
(
$_REQUEST
[
'id'
])))
$errors
[
'err'
]
=
sprintf
(
__
(
'%s: Unknown or invalid ID.'
),
__
(
'canned response'
));
$errors
[
'err'
]
=
sprintf
(
__
(
'%s: Unknown or invalid ID.'
),
__
(
'canned response'
));
$canned_form
=
new
Form
(
array
(
'attachments'
=>
new
FileUploadField
(
array
(
'id'
=>
'attach'
,
'configuration'
=>
array
(
'extensions'
=>
false
,
'size'
=>
$cfg
->
getMaxFileSize
())
)),
));
if
(
$_POST
&&
$thisstaff
->
canManageCannedResponses
())
{
if
(
$_POST
&&
$thisstaff
->
canManageCannedResponses
())
{
switch
(
strtolower
(
$_POST
[
'do'
]))
{
switch
(
strtolower
(
$_POST
[
'do'
]))
{
case
'update'
:
case
'update'
:
...
@@ -46,8 +53,9 @@ if($_POST && $thisstaff->canManageCannedResponses()) {
...
@@ -46,8 +53,9 @@ if($_POST && $thisstaff->canManageCannedResponses()) {
}
}
}
}
//Upload NEW attachments IF ANY - TODO: validate attachment types??
//Upload NEW attachments IF ANY - TODO: validate attachment types??
if
(
$_FILES
[
'attachments'
]
&&
(
$files
=
AttachmentFile
::
format
(
$_FILES
[
'attachments'
])))
$attachments
=
$canned_form
->
getField
(
'attachments'
)
->
getClean
();
$canned
->
attachments
->
upload
(
$files
);
if
(
$attachments
)
$canned
->
attachments
->
upload
(
$attachments
);
// Attach inline attachments from the editor
// Attach inline attachments from the editor
if
(
isset
(
$_POST
[
'draft_id'
])
if
(
isset
(
$_POST
[
'draft_id'
])
...
@@ -169,5 +177,6 @@ $ost->addExtraHeader('<meta name="tip-namespace" content="' . $tip_namespace . '
...
@@ -169,5 +177,6 @@ $ost->addExtraHeader('<meta name="tip-namespace" content="' . $tip_namespace . '
"$('#content').data('tipNamespace', '"
.
$tip_namespace
.
"');"
);
"$('#content').data('tipNamespace', '"
.
$tip_namespace
.
"');"
);
require
(
STAFFINC_DIR
.
'header.inc.php'
);
require
(
STAFFINC_DIR
.
'header.inc.php'
);
require
(
STAFFINC_DIR
.
$page
);
require
(
STAFFINC_DIR
.
$page
);
print
$canned_form
->
getMedia
();
include
(
STAFFINC_DIR
.
'footer.inc.php'
);
include
(
STAFFINC_DIR
.
'footer.inc.php'
);
?>
?>
This diff is collapsed.
Click to expand it.
scp/js/scp.js
+
3
−
2
View file @
033ac171
...
@@ -229,8 +229,9 @@ var scp_prep = function() {
...
@@ -229,8 +229,9 @@ var scp_prep = function() {
redactor
.
observeStart
();
redactor
.
observeStart
();
}
}
//Canned attachments.
//Canned attachments.
if
(
canned
.
files
&&
$
(
'
.canned_attachments
'
,
fObj
).
length
)
{
var
ca
=
$
(
'
.canned_attachments
'
,
fObj
);
var
fdb
=
$
(
'
#filedrop-attach .dropzone
'
).
data
(
'
dropbox
'
);
if
(
canned
.
files
&&
ca
.
length
)
{
var
fdb
=
ca
.
parent
().
find
(
'
.dropzone
'
).
data
(
'
dropbox
'
);
$
.
each
(
canned
.
files
,
function
(
i
,
j
)
{
$
.
each
(
canned
.
files
,
function
(
i
,
j
)
{
fdb
.
addNode
(
j
);
fdb
.
addNode
(
j
);
});
});
...
...
This diff is collapsed.
Click to expand it.
scp/tickets.php
+
1
−
1
View file @
033ac171
...
@@ -182,7 +182,7 @@ if($_POST && !$errors):
...
@@ -182,7 +182,7 @@ if($_POST && !$errors):
break
;
break
;
case
'postnote'
:
/* Post Internal Note */
case
'postnote'
:
/* Post Internal Note */
$vars
=
$_POST
;
$vars
=
$_POST
;
$attachments
=
$
respons
e_form
->
getField
(
'attachments'
)
->
getClean
();
$attachments
=
$
not
e_form
->
getField
(
'attachments'
)
->
getClean
();
$vars
[
'cannedattachments'
]
=
array_merge
(
$vars
[
'cannedattachments'
]
=
array_merge
(
$vars
[
'cannedattachments'
]
?:
array
(),
$attachments
);
$vars
[
'cannedattachments'
]
?:
array
(),
$attachments
);
...
...
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