Configure applications in categories in Manager - need tests (#29)
This commit is contained in:
parent
759776aae7
commit
6a870286b2
|
@ -64,7 +64,7 @@ $(document).ready(function(){
|
|||
simpleTreeToggleJqueryClasses();
|
||||
},
|
||||
animate:true,
|
||||
docToFolderConvert:false
|
||||
docToFolderConvert:true
|
||||
});
|
||||
if(treejquerycss){simpleTreeDefaultJqueryClasses();}
|
||||
|
||||
|
@ -1032,6 +1032,7 @@ function newCategoryR(){
|
|||
function delCategory(){
|
||||
delKey();
|
||||
}
|
||||
|
||||
function applicationListCategory(id){
|
||||
currentId=id;
|
||||
$('#applicationListCategoryKey').attr('value',lmtext(id));
|
||||
|
@ -1040,3 +1041,46 @@ function applicationListCategory(id){
|
|||
$('#delcategory,#newapplicationr').show();
|
||||
}
|
||||
|
||||
function newApplicationR(){
|
||||
var name = prompt(text4newApplication,'myapplication');
|
||||
if(!name){return false;}
|
||||
var newIdValue=newId(currentId);
|
||||
simpleTreeCollection[0].addNode(newIdValue,name,function(d,s){
|
||||
$('>span',s).attr('onClick','applicationListApplication("'+newIdValue+'")').attr('name',name).attr('value','My application|http://www.example.com|This is a nice application|logo.png|auto').attr('id','text_'+newIdValue);
|
||||
applicationListApplication(newIdValue);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function delApplication(){
|
||||
delKey();
|
||||
}
|
||||
|
||||
function setlmapplication(id){
|
||||
var key=$('#applicationListApplicationKey').attr('value');
|
||||
var name=$('#applicationListApplicationName').attr('value');
|
||||
var url=$('#applicationListApplicationURL').attr('value');
|
||||
var desc=$('#applicationListApplicationDescription').attr('value');
|
||||
var logo=$('#applicationListApplicationLogo').attr('value');
|
||||
var display=$('#applicationListApplicationDisplay').attr('value');
|
||||
setlmtext(id,key);
|
||||
setlmdata(id,name+'|'+url+'|'+desc+'|'+logo+'|'+display);
|
||||
}
|
||||
|
||||
function applicationListApplication(id){
|
||||
currentId=id;
|
||||
$('#applicationListApplicationKey').attr('value',lmtext(id));
|
||||
var t=lmdata(id).split('|');
|
||||
$('#applicationListApplicationName').attr('value',t[0]);
|
||||
$('#applicationListApplicationURL').attr('value',t[1]);
|
||||
$('#applicationListApplicationDescription').attr('value',t[2]);
|
||||
$('#applicationListApplicationLogo').attr('value',t[3]);
|
||||
formateSelect('applicationListApplicationDisplay',[
|
||||
'auto=Automatic',
|
||||
'on=On',
|
||||
'off=Off',
|
||||
],t[4]);
|
||||
display('applicationListApplication',lmtext(id));
|
||||
$('#delapplication').show();
|
||||
}
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<!-- applicationList -->
|
||||
<!-- applicationList Category-->
|
||||
<div id="content_applicationListCategory" class="hidden">
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -484,6 +484,40 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<!-- applicationList Application-->
|
||||
<div id="content_applicationListApplication" class="hidden">
|
||||
<table>
|
||||
<tr>
|
||||
<td><lang en="Key" fr="Nom de la clef"/></td>
|
||||
<td><input type="text" id="applicationListApplicationKey" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><lang en="Display name" fr="Nom à afficher"/></td>
|
||||
<td><input type="text" id="applicationListApplicationName" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><lang en="Adress" fr="Adresse"/></td>
|
||||
<td><input type="text" id="applicationListApplicationURL" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><lang en="Description" fr="Description"/></td>
|
||||
<td><textarea id="applicationListApplicationDescription" /></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><lang en="Logo (file name)" fr="Logo (nom du fichier)"/></td>
|
||||
<td><input type="text" id="applicationListApplicationLogo" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><lang en="Display mode" fr="Mode d'affichage"/></td>
|
||||
<td><select id="applicationListApplicationDisplay"></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<button onclick="setlmapplication(currentId);return false;" class="ui-state-default ui-corner-all">
|
||||
<lang en="Apply" fr="Appliquer" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
|
@ -233,26 +233,71 @@ sub confNode {
|
|||
}
|
||||
|
||||
# Loop on categories
|
||||
foreach ( sort keys %$h ) {
|
||||
foreach my $catid ( sort keys %$h ) {
|
||||
|
||||
# Build ID
|
||||
my $id = "$target/$_";
|
||||
my $id = "$target/$catid";
|
||||
$id =~ s/=*$//;
|
||||
|
||||
# Display menu item
|
||||
$self->lmLog( "Display menu item for category $_", 'debug' );
|
||||
$self->lmLog( "Display menu item for category $catid", 'debug' );
|
||||
|
||||
# Here, "notranslate" is set to true : hashvalues must not be
|
||||
# translated
|
||||
$res .= $self->li($id)
|
||||
. $self->span(
|
||||
id => $id,
|
||||
text => "$_",
|
||||
data => $h->{$_}->{catname},
|
||||
text => "$catid",
|
||||
data => $h->{$catid}->{catname},
|
||||
js => $js,
|
||||
help => $help,
|
||||
noT => 1
|
||||
);
|
||||
|
||||
delete $h->{$catid}->{type};
|
||||
delete $h->{$catid}->{catname};
|
||||
|
||||
# Loop on applications
|
||||
|
||||
if ( %{ $h->{$catid} } ) {
|
||||
$res .= '<ul>';
|
||||
|
||||
# $res .= '<li class="line"> </li>';
|
||||
}
|
||||
|
||||
foreach my $appid ( sort keys %{ $h->{$catid} } ) {
|
||||
|
||||
$id = "$target/$catid/$appid";
|
||||
$id =~ s/=*$//;
|
||||
|
||||
my $data =
|
||||
$h->{$catid}->{$appid}->{options}->{name} . "|"
|
||||
. $h->{$catid}->{$appid}->{options}->{uri} . "|"
|
||||
. $h->{$catid}->{$appid}->{options}->{description} . "|"
|
||||
. $h->{$catid}->{$appid}->{options}->{logo} . "|"
|
||||
. $h->{$catid}->{$appid}->{options}->{display};
|
||||
|
||||
# Display menu item
|
||||
$self->lmLog( "Display menu item for application $appid",
|
||||
'debug' );
|
||||
|
||||
$res .= $self->li($id)
|
||||
. $self->span(
|
||||
id => $id,
|
||||
text => "$appid",
|
||||
data => $data,
|
||||
js => "applicationListApplication",
|
||||
help => $help,
|
||||
noT => 1
|
||||
) . "</li>";
|
||||
|
||||
}
|
||||
|
||||
if ( %{ $h->{$catid} } ) {
|
||||
$res .= '</ul>';
|
||||
}
|
||||
|
||||
$res .= "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ sub confUpload {
|
|||
my $vhostname;
|
||||
my $idpname;
|
||||
my $spname;
|
||||
my $catid;
|
||||
|
||||
# 1. ANALYSE DATAS
|
||||
|
||||
|
@ -64,6 +63,10 @@ sub confUpload {
|
|||
$_->getAttribute('value')
|
||||
);
|
||||
|
||||
# For menu categories and applications
|
||||
my $catid = undef;
|
||||
my $appid = undef;
|
||||
|
||||
# Unescape value
|
||||
$value = uri_unescape($value);
|
||||
|
||||
|
@ -98,11 +101,17 @@ sub confUpload {
|
|||
$spname = $name;
|
||||
}
|
||||
|
||||
# Get menu category id
|
||||
if ( $id =~ /applicationList(\/[^\/]*)?$/ ) {
|
||||
# Get menu category and application id
|
||||
if ( $id =~ /applicationList/ ) {
|
||||
if ( $value =~ /^(.*)?\|(.*)?\|(.*)?\|(.*)?\|(.*?)$/ ) {
|
||||
$self->lmLog( "Entering application $name", 'debug' );
|
||||
$appid = $name;
|
||||
}
|
||||
else {
|
||||
$self->lmLog( "Entering category $name", 'debug' );
|
||||
$catid = $name;
|
||||
}
|
||||
}
|
||||
|
||||
# Manage new keys
|
||||
if ($NK) {
|
||||
|
@ -113,7 +122,7 @@ sub confUpload {
|
|||
|
||||
# Special case: avoid bug with node created from parent node
|
||||
if ( $id =~
|
||||
/^(virtualHosts|samlIDPMetaDataExportedAttributes|samlSPMetaDataExportedAttributes|generalParameters\/authParams\/choiceParams|generalParameters\/portalParams\/portalMenu\/applicationList|applicationList)/
|
||||
/^(virtualHosts|samlIDPMetaDataExportedAttributes|samlSPMetaDataExportedAttributes|generalParameters\/authParams\/choiceParams)/
|
||||
)
|
||||
{
|
||||
$self->lmLog( "Special trigger for $id (attribute $name)",
|
||||
|
@ -139,12 +148,11 @@ s/^samlSPMetaDataExportedAttributes\/([^\/]*)?.*/samlSPMetaDataExportedAttribute
|
|||
$id =~
|
||||
s/^generalParameters\/authParams\/choiceParams\/([^\/]*)?.*/authChoiceModules\/$name/;
|
||||
|
||||
# Applications list category
|
||||
$id =~
|
||||
s/^(generalParameters\/portalParams\/portalMenu\/)?applicationList$/applicationList\/$name/;
|
||||
|
||||
}
|
||||
|
||||
# Do nothing for applicationList (managed at stage 1.3.2)
|
||||
elsif ( $id =~ /applicationList/) {}
|
||||
|
||||
# Normal case
|
||||
else {
|
||||
$id =~ s/(?:\/[^\/]*)?$/\/$name/;
|
||||
|
@ -228,7 +236,7 @@ s/^(samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions)\/(
|
|||
|
||||
# 1.3.2 Store accepted parameter in $newConf
|
||||
|
||||
# Special trick for categories and applications
|
||||
# Menu category
|
||||
if ( defined $catid ) {
|
||||
$self->lmLog( "Register category $catid data", 'debug' );
|
||||
|
||||
|
@ -240,7 +248,32 @@ s/^(samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions)\/(
|
|||
$self->setKeyToH( $newConf, "applicationList/$catid/type",
|
||||
"category" );
|
||||
|
||||
$catid = undef;
|
||||
}
|
||||
|
||||
# Menu application
|
||||
elsif ( defined $appid ) {
|
||||
$self->lmLog( "Register application $appid data", 'debug' );
|
||||
($catid) = ( $id =~ /applicationList\/([^\/]+)?/ );
|
||||
|
||||
# Get options from splitted value
|
||||
my @t = split( /\|/, $value );
|
||||
|
||||
# Set applications options
|
||||
$self->setKeyToH( $newConf,
|
||||
"applicationList/$catid/$appid/options/name", $t[0] );
|
||||
$self->setKeyToH( $newConf,
|
||||
"applicationList/$catid/$appid/options/uri", $t[1] );
|
||||
$self->setKeyToH( $newConf,
|
||||
"applicationList/$catid/$appid/options/description", $t[2] );
|
||||
$self->setKeyToH( $newConf,
|
||||
"applicationList/$catid/$appid/options/logo", $t[3] );
|
||||
$self->setKeyToH( $newConf,
|
||||
"applicationList/$catid/$appid/options/display", $t[4] );
|
||||
|
||||
# Set type to application
|
||||
$self->setKeyToH( $newConf, "applicationList/$catid/$appid/type",
|
||||
"application" );
|
||||
|
||||
}
|
||||
else {
|
||||
$self->setKeyToH(
|
||||
|
|
Loading…
Reference in New Issue
Block a user