Conf datas (not finished)

This commit is contained in:
Xavier Guimard 2009-12-30 17:02:23 +00:00
parent 1c1ea8fef0
commit 19ae0803ec
4 changed files with 50 additions and 4 deletions

View File

@ -113,6 +113,9 @@ function vhost(id){
display('none',lmtext(id)); display('none',lmtext(id));
$('#bdelvh').show(); $('#bdelvh').show();
} }
function cfgDatas(id){
display('cfgDatas');
}
function delvh(id){ function delvh(id){
if(confirm("Are you sure ?")){alert(id);$('#'+id).remove();} if(confirm("Are you sure ?")){alert(id);$('#'+id).remove();}
} }
@ -222,6 +225,8 @@ function uploadConf(f){
tmp=tmp.replace(/\d+/,data.result.cfgNum); tmp=tmp.replace(/\d+/,data.result.cfgNum);
setlmtext('li_cm9vdA2',tmp); setlmtext('li_cm9vdA2',tmp);
setlmdata('li_cm9vdA2',data.result.cfgNum); setlmdata('li_cm9vdA2',data.result.cfgNum);
$('#cfgNum').text(data.result.cfgNum);
setCfgAttributes(data.result.attributes);
} }
if(typeof(data.warnings)!='undefined'){ if(typeof(data.warnings)!='undefined'){
for(m in data.warnings){ for(m in data.warnings){
@ -236,6 +241,23 @@ function uploadConf(f){
} }
}); });
} }
var cfgAttrDone;
function getCfgAttributes() {
$.ajax({
type:"POST",
url:scriptname,
data:{cfgNum:lmdata('li_cm9vdA2'),attr:1},
dataType:'json',
success:function(data){
setCfgAttributes(data);
},
error:function(xhr, ajaxOptions, thrownError){
setCfgAttributes({cfgAuthor:'unknown',cfgAuthorIP:'unknown',cfgDate:'unknown'});
}
});
}
function setCfgAttributes(data){
}
/* Warning, it's not a real base64 */ /* Warning, it's not a real base64 */
function myB64(s) { function myB64(s) {
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

View File

@ -98,6 +98,16 @@ var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">';var imagepath='<TMPL_VAR NAME="DI
<lang en="No value" fr="Pas de valeur" /> <lang en="No value" fr="Pas de valeur" />
</div> </div>
<!-- Configuration datas -->
<div id="cfgDatas" class="hidden">
<ul>
<li><lang en="Configuration number" fr="Numéro de configuration"/>&nbsp;:<span id="cfgNum"><TMPL_VAR NAME="CFGNUM"></span></li>
<li><lang en="Author" fr="Auteur">&nbsp;:<span id="cfgAuthor"></span></li>
<li><lang en="IP Address" fr="Adresse IP">&nbsp;:<span id="cfgAuthorIP"></span></li>
<li><lang en="Date" fr="Date">&nbsp;:<span id="cfgDate"></span></li>
</ul>
</div>
<!-- Contextual text --> <!-- Contextual text -->
<div id="content_text" class="hidden"> <div id="content_text" class="hidden">
<input type="text" id="text" onchange="setlmdata(currentId,this.value)"/> <input type="text" id="text" onchange="setlmdata(currentId,this.value)"/>

View File

@ -57,6 +57,20 @@ sub new {
print $self->node($p); print $self->node($p);
$self->quit(); $self->quit();
} }
if ( $self->param('cfgAttr') ) {
my @buf;
foreach(qw(cfgAuthor cfgAuthorIP cfgDate)){
my $tmp = $self->conf()->{$_} || 'anonymous';
$tmp =~ s/'/\\'/g;
push @buf, "$_:'$tmp'";
}
$_ = '{'.join(',',@buf).'}';
print $self->header(
-type => 'application/json',
-Content_Length => length($_)
) . $_;
}
return $self; return $self;
} }
@ -70,7 +84,7 @@ sub menu {
'<ul class="simpleTree">' '<ul class="simpleTree">'
. $self->li( 'root', 'root' ) . $self->li( 'root', 'root' )
. $self->span( 'root', "Configuration $self->{cfgNum}", . $self->span( 'root', "Configuration $self->{cfgNum}",
$self->{cfgNum}, 'none' ) $self->{cfgNum}, 'cfgDatas' )
. '<ul>' . '<ul>'
. $self->node() . $self->node()
. '</ul></li></ul>'; . '</ul></li></ul>';

View File

@ -69,7 +69,7 @@ sub struct {
|| $self->defaultConf()->{userDB}; || $self->defaultConf()->{userDB};
$auth = lc($auth); $auth = lc($auth);
$udb = lc($udb); $udb = lc($udb);
my %res = qw(authentication 1 userDB 1 syslog 1); my %res = qw(authentication 1 userDB 1);
foreach my $mod ( ( $auth, ( $auth ne $udb ? $udb : () ) ) ) foreach my $mod ( ( $auth, ( $auth ne $udb ? $udb : () ) ) )
{ {
my $tmp = { my $tmp = {
@ -86,7 +86,6 @@ sub struct {
_help => 'authParams', _help => 'authParams',
authentication => 'text:/authentication:authParams:authParams', authentication => 'text:/authentication:authParams:authParams',
userDB => 'text:/userDB:authParams:authParams', userDB => 'text:/userDB:authParams:authParams',
syslog => 'text:/syslog',
ldapParams => { ldapParams => {
_nodes => [ _nodes => [
qw(ldapServer ldapPort ldapBase managerDn managerPassword) qw(ldapServer ldapPort ldapBase managerDn managerPassword)
@ -103,7 +102,8 @@ sub struct {
# LOGS PARAMETERS # LOGS PARAMETERS
logParams => { logParams => {
_nodes => [qw(useXForwardedForIP whatToTrace)], _nodes => [qw(syslog useXForwardedForIP whatToTrace)],
syslog => 'text:/syslog',
useXForwardedForIP => 'bool:/useXForwardedForIP', useXForwardedForIP => 'bool:/useXForwardedForIP',
whatToTrace => 'text:/whatToTrace:whatToTrace:text', whatToTrace => 'text:/whatToTrace:whatToTrace:text',
}, },