Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
352db45d
Commit
352db45d
authored
9 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Agents' Preferences
Support using global config table to store agent's preference.
parent
91b87a01
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class.config.php
+4
-1
4 additions, 1 deletion
include/class.config.php
include/class.staff.php
+42
-2
42 additions, 2 deletions
include/class.staff.php
with
46 additions
and
3 deletions
include/class.config.php
+
4
−
1
View file @
352db45d
...
@@ -29,13 +29,16 @@ class Config {
...
@@ -29,13 +29,16 @@ class Config {
# new settings and the corresponding default values.
# new settings and the corresponding default values.
var
$defaults
=
array
();
# List of default values
var
$defaults
=
array
();
# List of default values
function
Config
(
$section
=
null
)
{
function
Config
(
$section
=
null
,
$defaults
=
array
()
)
{
if
(
$section
)
if
(
$section
)
$this
->
section
=
$section
;
$this
->
section
=
$section
;
if
(
$this
->
section
===
null
)
if
(
$this
->
section
===
null
)
return
false
;
return
false
;
if
(
$defaults
)
$this
->
defaults
=
$defaults
;
if
(
isset
(
$_SESSION
[
'cfg:'
.
$this
->
section
]))
if
(
isset
(
$_SESSION
[
'cfg:'
.
$this
->
section
]))
$this
->
session
=
&
$_SESSION
[
'cfg:'
.
$this
->
section
];
$this
->
session
=
&
$_SESSION
[
'cfg:'
.
$this
->
section
];
$this
->
load
();
$this
->
load
();
...
...
This diff is collapsed.
Click to expand it.
include/class.staff.php
+
42
−
2
View file @
352db45d
...
@@ -51,6 +51,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
...
@@ -51,6 +51,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
var
$passwd_change
;
var
$passwd_change
;
var
$_roles
=
null
;
var
$_roles
=
null
;
var
$_teams
=
null
;
var
$_teams
=
null
;
var
$_config
=
null
;
var
$_perm
;
var
$_perm
;
function
__onload
()
{
function
__onload
()
{
...
@@ -66,6 +67,33 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
...
@@ -66,6 +67,33 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
$this
->
passwd_change
=
time
()
-
$time
;
//XXX: check timezone issues.
$this
->
passwd_change
=
time
()
-
$time
;
//XXX: check timezone issues.
}
}
function
get
(
$field
,
$default
=
false
)
{
// Autoload config if not loaded already
if
(
!
isset
(
$this
->
_config
))
$this
->
getConfig
();
if
(
isset
(
$this
->
_config
[
$field
]))
return
$this
->
_config
[
$field
];
return
parent
::
get
(
$field
,
$default
);
}
function
getConfig
()
{
if
(
!
isset
(
$this
->
_config
)
&&
$this
->
getId
())
{
$_config
=
new
Config
(
'staff.'
.
$this
->
getId
(),
// Defaults
array
(
'default_from_name'
=>
''
,
'datetime_format'
=>
''
,
));
$this
->
_config
=
$_config
->
getInfo
();
}
return
$this
->
_config
;
}
function
__toString
()
{
function
__toString
()
{
return
(
string
)
$this
->
getName
();
return
(
string
)
$this
->
getName
();
}
}
...
@@ -102,6 +130,10 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
...
@@ -102,6 +130,10 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
$base
=
$this
->
ht
;
$base
=
$this
->
ht
;
unset
(
$base
[
'teams'
]);
unset
(
$base
[
'teams'
]);
unset
(
$base
[
'dept_access'
]);
unset
(
$base
[
'dept_access'
]);
if
(
$this
->
getConfig
())
$base
+=
$this
->
getConfig
();
return
$base
;
return
$base
;
}
}
...
@@ -625,10 +657,9 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
...
@@ -625,10 +657,9 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
$this
->
max_page_size
=
$vars
[
'max_page_size'
];
$this
->
max_page_size
=
$vars
[
'max_page_size'
];
$this
->
auto_refresh_rate
=
$vars
[
'auto_refresh_rate'
];
$this
->
auto_refresh_rate
=
$vars
[
'auto_refresh_rate'
];
$this
->
default_signature_type
=
$vars
[
'default_signature_type'
];
$this
->
default_signature_type
=
$vars
[
'default_signature_type'
];
$this
->
default_from_name
=
$vars
[
'default_from_name'
];
$this
->
default_paper_size
=
$vars
[
'default_paper_size'
];
$this
->
default_paper_size
=
$vars
[
'default_paper_size'
];
$this
->
lang
=
$vars
[
'lang'
];
$this
->
lang
=
$vars
[
'lang'
];
$this
->
onvacation
=
isset
(
$vars
[
'onvacation'
])
?
1
:
0
;
$this
->
onvacation
=
isset
(
$vars
[
'onvacation'
])
?
1
:
0
;
if
(
isset
(
$vars
[
'avatar_code'
]))
if
(
isset
(
$vars
[
'avatar_code'
]))
$this
->
setExtraAttr
(
'avatar'
,
$vars
[
'avatar_code'
]);
$this
->
setExtraAttr
(
'avatar'
,
$vars
[
'avatar_code'
]);
...
@@ -639,6 +670,15 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
...
@@ -639,6 +670,15 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
$_SESSION
[
'::lang'
]
=
null
;
$_SESSION
[
'::lang'
]
=
null
;
TextDomain
::
configureForUser
(
$this
);
TextDomain
::
configureForUser
(
$this
);
// Update the config information
$_config
=
new
Config
(
'staff.'
.
$this
->
getId
());
$_config
->
updateAll
(
array
(
'datetime_format'
=>
$vars
[
'datetime_format'
],
'default_from_name'
=>
$vars
[
'default_from_name'
],
)
);
$this
->
_config
=
$_config
->
getInfo
();
return
$this
->
save
();
return
$this
->
save
();
}
}
...
...
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