Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Xavier Bachelot
lemonldap-ng
Commits
1c1ea8fe
Commit
1c1ea8fe
authored
Dec 30, 2009
by
Yadd
Browse files
"Delete virtual host" and "force" system to upload an old config
parent
78506944
Changes
7
Hide whitespace changes
Inline
Side-by-side
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm
View file @
1c1ea8fe
...
...
@@ -99,12 +99,14 @@ sub new {
sub
saveConf
{
my
(
$self
,
$conf
)
=
@_
;
my
$last
=
$self
->
lastCfg
;
# If configuration was modified, return an error
return
CONFIG_WAS_CHANGED
if
(
not
(
$self
->
{
force
}
)
and
(
$conf
->
{
cfgNum
}
!=
$self
->
lastCfg
or
$self
->
isLocked
)
);
$self
->
lock
or
return
DATABASE_LOCKED
;
$conf
->
{
cfgNum
}
++
unless
(
$self
->
{
cfgNumFixed
}
);
if
(
not
$self
->
{
force
}
)
{
return
CONFIG_WAS_CHANGED
if
(
$conf
->
{
cfgNum
}
!=
$last
);
return
DATABASE_LOCKED
if
(
$self
->
isLocked
or
not
$self
->
lock
);
}
$conf
->
{
cfgNum
}
=
$last
+
1
unless
(
$self
->
{
cfgNumFixed
}
);
$msg
=
"
Configuration
$conf
->{cfgNum} stored
";
return
$self
->
store
(
$conf
);
}
...
...
modules/lemonldap-ng-manager/example/skins/default/manager.js
View file @
1c1ea8fe
...
...
@@ -66,15 +66,15 @@ function display(div,title) {
$
(
'
#content_
'
+
div
).
removeClass
(
'
hidden
'
);
$
(
'
#content_
'
+
div
).
addClass
(
'
content
'
);
$
(
'
#content_title
'
).
html
(
title
);
$
(
'
#newkb,#newrb,#delkb,#newkbr,#newrbr
'
).
css
(
'
display
'
,
'
none
'
);
$
(
'
#newkb,#newrb,#delkb,#newkbr,#newrbr
,#bdelvh
'
).
hide
(
);
}
function
none
(
id
)
{
display
(
'
default
'
,
'
Lemonldap::NG Manager
'
);
display
(
'
default
'
,
''
);
}
function
hashRoot
(){
currentId
=
simpleTreeCollection
[
0
].
getSelected
().
attr
(
'
id
'
);
display
(
'
default
'
,
'
Lemonldap::NG Manager
'
);
$
(
'
#newkbr
'
).
css
(
'
display
'
,
''
);
display
(
'
default
'
,
''
);
$
(
'
#newkbr
'
).
show
(
);
}
function
authParams
(
id
)
{
currentId
=
id
;
...
...
@@ -85,8 +85,8 @@ function btext(id) {
currentId
=
id
;
$
(
'
#btextKey
'
).
attr
(
'
value
'
,
lmtext
(
id
));
$
(
'
#btextValue
'
).
attr
(
'
value
'
,
lmdata
(
id
));
display
(
'
btext
'
,
'
Clef
'
);
$
(
'
#newkb,#delkb
'
).
css
(
'
display
'
,
''
);
display
(
'
btext
'
,
lmtext
(
id
)
);
$
(
'
#newkb,#delkb
'
).
show
(
);
}
function
bool
(
id
)
{
currentId
=
id
;
...
...
@@ -108,6 +108,14 @@ function securedCookieValues(id){
$
(
'
#securedCookie
'
+
lmdata
(
id
)).
attr
(
'
checked
'
,
1
);
display
(
'
securedCookie
'
,
lmtext
(
id
));
}
function
vhost
(
id
){
currentId
=
id
;
display
(
'
none
'
,
lmtext
(
id
));
$
(
'
#bdelvh
'
).
show
();
}
function
delvh
(
id
){
if
(
confirm
(
"
Are you sure ?
"
)){
alert
(
id
);
$
(
'
#
'
+
id
).
remove
();}
}
function
rules
(
id
){
currentId
=
id
;
var
t
=
lmtext
(
id
);
...
...
@@ -117,14 +125,14 @@ function rules(id){
if
(
t
==
'
default
'
){
$
(
'
#rulKey
'
).
attr
(
'
readonly
'
,
'
readonly
'
)}
else
{
$
(
'
#rulKey
'
).
attr
(
'
readonly
'
,
''
);
$
(
'
#delkb
'
).
css
(
'
display
'
,
''
)
$
(
'
#delkb
'
).
show
();
}
$
(
'
#newrb
'
).
css
(
'
display
'
,
''
);
$
(
'
#newrb
'
).
show
(
);
}
function
rulesRoot
(
id
){
currentId
=
id
;
display
(
'
default
'
,
'
Lemonldap::NG Manager
'
);
$
(
'
#newrbr
'
).
css
(
'
display
'
,
'
block
'
);
display
(
'
default
'
,
''
);
$
(
'
#newrbr
'
).
show
(
);
}
function
reloadAuthParams
()
{
setlmdata
(
currentId
,
$
(
'
#authText
'
).
attr
(
'
value
'
));
...
...
@@ -193,11 +201,12 @@ function newVh(name){
$
(
'
>span
'
,
s
).
attr
(
'
name
'
,
name
).
attr
(
'
help
'
,
'
default
'
).
attr
(
'
id
'
,
'
text_
'
+
vhId
);
});
}
function
uploadConf
(){
function
uploadConf
(
f
){
if
(
!
(
f
==
1
))
f
=
0
;
$
.
ajax
({
type
:
"
POST
"
,
url
:
scriptname
,
data
:{
data
:
$
(
'
#li_cm9vdA2
'
).
html
()},
data
:{
data
:
$
(
'
#li_cm9vdA2
'
).
html
()
,
force
:
f
},
dataType
:
'
json
'
,
success
:
function
(
data
){
var
c
=
'
<h3>
'
+
data
.
result
.
msg
+
'
</h3><dl>
'
;
...
...
@@ -219,7 +228,7 @@ function uploadConf(){
c
+=
'
<dt>
'
+
m
+
'
</dt><dd>
'
+
data
.
warnings
[
m
]
+
'
</dd>
'
;
}
}
c
+=
'
</dl>
'
;
c
+=
'
</dl>
'
+
data
.
result
.
other
;
$
(
'
#help_content
'
).
html
(
c
);
},
error
:
function
(
xhr
,
ajaxOptions
,
thrownError
){
...
...
modules/lemonldap-ng-manager/example/skins/default/manager.tpl
View file @
1c1ea8fe
...
...
@@ -54,6 +54,10 @@ var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">';var imagepath='<TMPL_VAR NAME="DI
<lang
en=
"New virtual host"
fr=
"Nouvel hôte virtuel"
/>
</button>
<button
id=
"bdelvh"
style=
"display:none;"
onclick=
"delvh(currentId);"
class=
"ui-state-default ui-corner-all"
>
<lang
en=
"Delete virtual host"
fr=
"Supprimer l'hôte virtuel"
/>
</button>
<button
id=
"newkbr"
style=
"display:none;"
onclick=
"newKeyR();return false;"
class=
"ui-state-default ui-corner-all"
>
<lang
en=
"New key"
fr=
"Nouvelle clef"
/>
</button>
...
...
@@ -78,6 +82,7 @@ var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">';var imagepath='<TMPL_VAR NAME="DI
<div
id=
"edition"
class=
"ui-widget ui-corner-all"
>
<span
id=
"content_title"
>
</span>
<form
action=
"#"
onsubmit=
"return false"
>
...
...
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm
View file @
1c1ea8fe
...
...
@@ -340,13 +340,13 @@ sub ajaxNode {
$param
.=
"
&cfgNum=
$self
->{cfgNum}
";
return
$self
->
li
(
$id
)
.
$self
->
span
(
$id
,
$text
,
$data
,
undef
,
$help
,
$noT
)
.
$self
->
span
(
$id
,
$text
,
$data
,
$js
,
$help
,
$noT
)
.
"
<ul class=
\"
ajax
\"
>
"
.
$self
->
li
("
sub_
$id
")
.
"
.{url:
$ENV
{SCRIPT_NAME}?
$param
"
.
(
$js
?
"
,js:
$js
"
:
''
)
.
(
$
call
?
"
,
call:
$call
"
:
''
)
.
"
}</li></ul></li>
\n
";
#
. ( $
js
? ",
js:$js"
: '' )
.
(
$call
?
"
,call:
$call
"
:
''
)
.
"
}</li></ul></li>
\n
";
}
## @method protected string span(string id,string text,string param,string help,string js,string data,boolean noT)
...
...
@@ -368,13 +368,14 @@ sub span {
$js
||=
"
none
";
$id
=
"
li_
"
.
encode_base64
(
$id
,
''
);
$id
=~
s/(=*)$/length($1)/
e
;
$js
.=
"
('
$id
')
"
unless
(
$js
=~
/\(/
);
$data
=~
s/"/'/g
;
$tmp
=~
s/"/'/g
;
$text
=
join
'
',
map
{
$self
->
translate
(
$_
)
}
split
/\s+/
,
$text
unless
(
$noT
);
$text
=
$self
->
escapeHTML
(
$text
);
return
"
<span name=
\"
$tmp
\"
id=
\"
text_
$id
\"
onclick=
\"
$js
('
$id
')
\"
help=
\"
$help
\"
value=
\"
$data
\"
>
$text
</span>
"
<span name=
\"
$tmp
\"
id=
\"
text_
$id
\"
onclick=
\"
$js
\"
help=
\"
$help
\"
value=
\"
$data
\"
>
$text
</span>
";
}
...
...
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm
View file @
1c1ea8fe
...
...
@@ -131,20 +131,28 @@ sub confUpload {
$errors
->
{
result
}
->
{
msg
}
=
$self
->
translate
('
syntaxError
');
}
else
{
$self
->
confObj
->
{
force
}
=
1
if
(
$self
->
param
('
force
')
);
$errors
->
{
result
}
->
{
cfgNum
}
=
$self
->
confObj
->
saveConf
(
$newConf
);
$errors
->
{
result
}
->
{
other
}
=
'';
$errors
->
{
result
}
->
{
msg
}
=
(
$errors
->
{
result
}
->
{
cfgNum
}
>
0
?
$self
->
translate
('
confSaved
')
:
$self
->
translate
(
{
CONFIG_WAS_CHANGED
=>
'
confWasChanged
',
UNKNOWN_ERROR
=>
'
unknownError
',
DATABASE_LOCKED
=>
'
databaseLocked
',
UPLOAD_DENIED
=>
'
uploadDenied
',
SYNTAX_ERROR
=>
'
syntaxError
',
CONFIG_WAS_CHANGED
,
'
confWasChanged
',
UNKNOWN_ERROR
,
'
unknownError
',
DATABASE_LOCKED
,
'
databaseLocked
',
UPLOAD_DENIED
,
'
uploadDenied
',
SYNTAX_ERROR
,
'
syntaxError
',
}
->
{
$errors
->
{
result
}
->
{
cfgNum
}
}
)
);
if
(
$errors
->
{
result
}
->
{
cfgNum
}
==
CONFIG_WAS_CHANGED
or
$errors
->
{
result
}
->
{
cfgNum
}
==
DATABASE_LOCKED
)
{
$errors
->
{
result
}
->
{
other
}
=
'
<a href="javascript:uploadConf(1)">
'
.
$self
->
translate
('
clickHereToForce
')
.
'
</a>
';
}
}
my
$buf
=
'
{
';
my
$i
=
0
;
...
...
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm
View file @
1c1ea8fe
...
...
@@ -200,7 +200,7 @@ sub struct {
# VIRTUAL HOSTS #
#################
virtualHosts
=>
{
_nodes
=>
['
nhash:/locationRules:virtualHosts:
none
'],
_nodes
=>
['
nhash:/locationRules:virtualHosts:
vhost
'],
_upload
=>
['
/exportedHeaders
'],
_help
=>
'
default
',
_call
=>
'
$(
\'
#bnewvh
\'
).show();
',
...
...
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm
View file @
1c1ea8fe
...
...
@@ -50,6 +50,7 @@ sub en {
advancedParams => 'Advanced parameters',
authentication => 'Authentication module',
authParams => 'Authentication parameters',
clickHereToForce => 'Click here to force',
Configuration => 'Configuration',
confSaved => 'Configuration saved',
confWasChanged => 'Configuration has been changed',
...
...
@@ -114,6 +115,7 @@ sub fr {
advancedParams => 'Paramètres avancés',
authentication => "Module d'authentification",
authParams => "Paramètres d'authentification",
clickHereToForce => 'Clicker ici pour forcer',
Configuration => 'Configuration',
confSaved => 'Configuration sauvegardée',
confWasChanged => 'Configuration modifiée entre-temps',
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment