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
7c631452
Commit
7c631452
authored
12 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Add ajax suppor to client interface - needed to fetch multifile config.
parent
87972399
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ajax.php
+34
-0
34 additions, 0 deletions
ajax.php
include/ajax.config.php
+15
-2
15 additions, 2 deletions
include/ajax.config.php
js/osticket.js
+55
-1
55 additions, 1 deletion
js/osticket.js
with
104 additions
and
3 deletions
ajax.php
0 → 100644
+
34
−
0
View file @
7c631452
<?php
/*********************************************************************
ajax.php
Ajax utils for client interface.
Peter Rotich <peter@osticket.com>
Copyright (c) 2006-2012 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
function
clientLoginPage
(
$msg
=
'Unauthorized'
)
{
Http
::
response
(
403
,
'Must login: '
.
Format
::
htmlchars
(
$msg
));
exit
;
}
require
(
'client.inc.php'
);
if
(
!
defined
(
'INCLUDE_DIR'
))
Http
::
response
(
500
,
'config error'
);
require_once
INCLUDE_DIR
.
'/class.dispatcher.php'
;
require_once
INCLUDE_DIR
.
'/class.ajax.php'
;
$dispatcher
=
patterns
(
''
,
url
(
'^/config/'
,
patterns
(
'ajax.config.php:ConfigAjaxAPI'
,
url_get
(
'^client'
,
'client'
)
))
);
print
$dispatcher
->
resolve
(
$_SERVER
[
'PATH_INFO'
]);
?>
This diff is collapsed.
Click to expand it.
include/ajax.config.php
+
15
−
2
View file @
7c631452
...
...
@@ -20,14 +20,27 @@ class ConfigAjaxAPI extends AjaxController {
//config info UI might need.
function
scp
()
{
global
$thisstaff
,
$cfg
;
global
$cfg
;
$config
=
array
(
'lock_time'
=>
(
$cfg
->
getLockTime
()
*
3600
),
$config
=
array
(
'lock_time'
=>
(
$cfg
->
getLockTime
()
*
3600
),
'file_types'
=>
$cfg
->
getAllowedFileTypes
(),
'max_file_size'
=>
(
int
)
$cfg
->
getMaxFileSize
(),
'max_file_uploads'
=>
(
int
)
$cfg
->
getStaffMaxFileUploads
()
);
return
$this
->
json_encode
(
$config
);
}
function
client
()
{
global
$cfg
;
$config
=
array
(
'file_types'
=>
$cfg
->
getAllowedFileTypes
(),
'max_file_size'
=>
(
int
)
$cfg
->
getMaxFileSize
(),
'max_file_uploads'
=>
(
int
)
$cfg
->
getClientMaxFileUploads
()
);
return
$this
->
json_encode
(
$config
);
}
}
?>
This diff is collapsed.
Click to expand it.
js/osticket.js
+
55
−
1
View file @
7c631452
//Nothing for now...
/*
osticket.js
Copyright (c) osTicket.com
*/
$
(
document
).
ready
(
function
(){
$
(
"
input:not(.dp):visible:enabled:first
"
).
focus
();
$
(
'
table.list tbody tr:odd
'
).
addClass
(
'
odd
'
);
$
(
"
form#save :input
"
).
change
(
function
()
{
var
fObj
=
$
(
this
).
closest
(
'
form
'
);
if
(
!
fObj
.
data
(
'
changed
'
)){
fObj
.
data
(
'
changed
'
,
true
);
$
(
'
input[type=submit]
'
,
fObj
).
css
(
'
color
'
,
'
red
'
);
$
(
window
).
bind
(
'
beforeunload
'
,
function
(
e
)
{
return
'
Are you sure you want to leave? Any changes or info you
\'
ve entered will be discarded!
'
;
});
}
});
$
(
"
form#save :input[type=reset]
"
).
click
(
function
()
{
var
fObj
=
$
(
this
).
closest
(
'
form
'
);
if
(
fObj
.
data
(
'
changed
'
)){
$
(
'
input[type=submit]
'
,
fObj
).
removeAttr
(
'
style
'
);
$
(
'
label
'
,
fObj
).
removeAttr
(
'
style
'
);
$
(
'
label
'
,
fObj
).
removeClass
(
'
strike
'
);
fObj
.
data
(
'
changed
'
,
false
);
$
(
window
).
unbind
(
'
beforeunload
'
);
}
});
$
(
'
form#save
'
).
submit
(
function
()
{
$
(
window
).
unbind
(
'
beforeunload
'
);
return
true
;
});
/* Get config settings from the backend */
var
$config
=
null
;
$
.
ajax
({
url
:
"
ajax.php/config/client
"
,
dataType
:
'
json
'
,
async
:
false
,
success
:
function
(
config
)
{
$config
=
config
;
}
});
/* Multifile uploads */
$
(
'
.multifile
'
).
multifile
({
container
:
'
.uploads
'
,
max_uploads
:
(
$config
&&
$config
.
max_file_uploads
)?
$config
.
max_file_uploads
:
1
,
file_types
:
(
$config
&&
$config
.
file_types
)?
$config
.
file_types
:
"
.*
"
});
});
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