Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
ed5218f1
Commit
ed5218f1
authored
13 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
finished jQuery port of ACL manager
parent
782d0c09
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/plugins/acl/script.js
+18
-40
18 additions, 40 deletions
lib/plugins/acl/script.js
with
18 additions
and
40 deletions
lib/plugins/acl/script.js
+
18
−
40
View file @
ed5218f1
...
...
@@ -6,24 +6,19 @@
acl
=
{
/**
* Initialize the object and attach the event handlers
*
* @todo move to jQuery
*/
init
:
function
(){
this
.
ctl
=
$
(
'
acl_manager
'
);
if
(
!
this
.
ctl
)
return
;
var
sel
=
$
(
'
acl__user
'
).
getElementsByTagName
(
'
select
'
)[
0
];
if
(
!
jQuery
(
'
#acl_manager
'
).
length
)
return
;
//FIXME only one underscore!!
addEvent
(
sel
,
'
change
'
,
acl
.
userselhandler
);
addEvent
(
$
(
'
acl__tree
'
)
,
'
click
'
,
acl
.
treehandler
);
addEvent
(
$
(
'
acl__user
'
).
getElementsByTagName
(
'
input
'
)[
1
],
'
click
'
,
acl
.
loadinfo
);
jQuery
(
'
#acl__user select
'
).
change
(
acl
.
userselhandler
);
jQuery
(
'
#
acl__tree
'
)
.
click
(
acl
.
treehandler
);
jQuery
(
'
#
acl__user
input[type=submit]
'
).
click
(
acl
.
loadinfo
);
},
/**
* Handle user dropdown
*
* Hides or shows the user/group entry box depending on wht was selected in the
* Hides or shows the user/group entry box depending on wh
a
t was selected in the
* dropdown element
*/
userselhandler
:
function
(
e
){
...
...
@@ -72,21 +67,6 @@ acl = {
return
attributes
;
},
/**
* htmlspecialchars equivalent
*
* @todo put in gloabl scripts lib?
*/
hsc
:
function
(
str
)
{
str
=
str
.
replace
(
/&/g
,
"
&
"
);
str
=
str
.
replace
(
/
\"
/g
,
"
"
"
);
str
=
str
.
replace
(
/
\'
/g
,
"
'
"
);
str
=
str
.
replace
(
/</g
,
"
<
"
);
str
=
str
.
replace
(
/>/g
,
"
>
"
);
return
str
;
},
/**
* Open or close a subtree using AJAX
*
...
...
@@ -130,31 +110,29 @@ acl = {
* Handles all clicks in the tree, dispatching the right action based on the
* clicked element
*
* @
todo move to jQuery
* @
param Event e The event object that caused the execution
*/
treehandler
:
function
(
e
){
if
(
e
.
target
.
src
){
// is it an image?
acl
.
treetoggle
(
e
.
target
);
}
else
if
(
e
.
target
.
href
){
// is it a link?
// remove highlighting
var
obj
=
getElementsByClass
(
'
cur
'
,
$
(
'
acl__tree
'
),
'
a
'
);
for
(
var
i
=
0
;
i
<
obj
.
length
;
i
++
){
obj
[
i
].
className
=
obj
[
i
].
className
.
replace
(
/ cur/
,
''
);
}
jQuery
(
'
#acl__tree a.cur
'
).
removeClass
(
'
cur
'
);
var
link
=
jQuery
(
e
.
target
);
// add new highlighting
e
.
target
.
className
+=
'
cur
'
;
link
.
addClass
(
'
cur
'
)
;
// set new page to detail form
var
frm
=
$
(
'
acl__detail
'
).
getElementsByTagName
(
'
form
'
)[
0
];
if
(
e
.
target
.
className
.
search
(
/
wikilink1
/
)
>
-
1
){
frm
.
elements
[
'
ns
'
].
value
=
''
;
frm
.
elements
[
'
id
'
].
value
=
acl
.
hsc
(
acl
.
parseatt
(
e
.
target
.
search
)[
'
id
'
]);
}
else
if
(
e
.
target
.
className
.
search
(
/idx_dir/
)
>
-
1
){
frm
.
elements
[
'
ns
'
].
value
=
acl
.
hsc
(
acl
.
parseatt
(
e
.
target
.
search
)[
'
ns
'
]);
frm
.
elements
[
'
id
'
].
value
=
''
;
var
frm
=
jQuery
(
'
#
acl__detail
form
'
)[
0
];
if
(
link
.
hasClass
(
'
wikilink1
'
)
){
jQuery
(
'
#acl__detail form input[name=ns]
'
).
val
(
''
)
;
jQuery
(
'
#acl__detail form input[name=id]
'
).
val
(
acl
.
parseatt
(
link
[
0
]
.
search
)[
'
id
'
]);
}
else
if
(
link
.
hasClass
(
'
idx_dir
'
)
){
jQuery
(
'
#acl__detail form input[name=ns]
'
).
val
(
acl
.
parseatt
(
link
[
0
]
.
search
)[
'
ns
'
]);
jQuery
(
'
#acl__detail form input[name=id]
'
).
val
(
''
)
;
}
acl
.
loadinfo
();
}
...
...
@@ -165,4 +143,4 @@ acl = {
};
addInitEvent
(
acl
.
init
);
jQuery
(
acl
.
init
);
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