From 7601bc641537811c0eb52a60724fd329563e7c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Oudot?= Date: Thu, 30 Sep 2010 12:22:18 +0000 Subject: [PATCH] Configure POST form replay for each vhost in Manager (#174) --- .../Lemonldap/NG/Common/Conf/Serializer.pm | 2 +- .../example/skins/default/manager.js | 64 ++++++++++++++- .../example/skins/default/manager.tpl | 41 ++++++++++ .../lib/Lemonldap/NG/Manager/Downloader.pm | 82 ++++++++++++++++++- .../lib/Lemonldap/NG/Manager/Uploader.pm | 81 +++++++++++++++++- .../lib/Lemonldap/NG/Manager/_Struct.pm | 14 +++- .../lib/Lemonldap/NG/Manager/_i18n.pm | 2 + 7 files changed, 274 insertions(+), 12 deletions(-) diff --git a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm index 2e427bf94..df55e96ca 100644 --- a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm +++ b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm @@ -102,7 +102,7 @@ sub unserialize { # Manage hashes if ( $k =~ -/^(?:exportedVars|locationRules|groups|exportedHeaders|macros|globalStorageOptions|remoteGlobalStorageOptions|notificationStorageOptions|samlIDPMetaDataXML|samlIDPMetaDataExportedAttributes|samlIDPMetaDataOptions|samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions|samlStorageOptions|CAS_proxiedServices|logoutServices|authChoiceModules|applicationList)$/ +/^(?:exportedVars|locationRules|groups|exportedHeaders|macros|globalStorageOptions|remoteGlobalStorageOptions|notificationStorageOptions|samlIDPMetaDataXML|samlIDPMetaDataExportedAttributes|samlIDPMetaDataOptions|samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions|samlStorageOptions|CAS_proxiedServices|logoutServices|authChoiceModules|applicationList|post)$/ and $v ||= {} and not ref($v) ) { diff --git a/modules/lemonldap-ng-manager/example/skins/default/manager.js b/modules/lemonldap-ng-manager/example/skins/default/manager.js index de0c0d3c0..7b39224e2 100644 --- a/modules/lemonldap-ng-manager/example/skins/default/manager.js +++ b/modules/lemonldap-ng-manager/example/skins/default/manager.js @@ -152,23 +152,25 @@ function lmdata(id){ function lmparent(id){ return $('#'+id).parent().parent().attr('id'); } -function setlmtext(id,v){ +function setlmtext(id,v,prefixvalue){ + if(!prefixvalue){prefixvalue="";} if(v.length==0){ alert("Null value"); } else { - $('#text_'+id).attr('name',v); + $('#text_'+id).attr('name',prefixvalue+v); $('#text_'+id).text(v); } } -function setlminputtext(id,input){ +function setlminputtext(id,input,prefixvalue){ var inputname=$(input).attr('id'); var inputvalue=$(input).attr('value'); + if(!prefixvalue){prefixvalue="";} if(inputvalue.length==0){ alert('No '+inputname); return false; } - setlmtext(id,inputvalue); + setlmtext(id,inputvalue,prefixvalue); } function setlmdata(id,v){ $('#text_'+id).attr('value',escape(v)); @@ -288,6 +290,8 @@ function display(div,title) { $('#newchoicer,#newchoice,#delchoice').hide(); $('#newcategoryr,#delcategory').hide(); $('#newapplicationr,#delapplication').hide(); + $('#newpostr,#delpost').hide(); + $('#newpostdatar,#delpostdata').hide(); var height_cur=$('#buttons').height()+$('#edition').height()+$('#help').height(); var height_max=$('#menu').height(); if(height_cur > height_max || $('#help_content').is(':visible')==false){ @@ -1084,3 +1088,55 @@ function applicationListApplication(id){ $('#delapplication').show(); } +/* Post */ +function postRoot(id){ + currentId=id; + display('default',''); + $('#newpostr').show(); +} + +function newPostR(){ + var newIdValue=newId(currentId); + var newPostKey = 'none'; + simpleTreeCollection[0].addNode(newIdValue,newPostKey,function(d,s){ + $('>span',s).attr('onClick','post("'+newIdValue+'")').attr('name',newPostKey).attr('value','').attr('id','text_'+newIdValue); + post(newIdValue); + }); + return false; +} + +function newPostDataR(){ + var newIdValue=newId(currentId); + var newPostKey = 'login'; + simpleTreeCollection[0].addNode(newIdValue,newPostKey,function(d,s){ + $('>span',s).attr('onClick','postData("'+newIdValue+'")').attr('name','postdata:'+newPostKey).attr('value','$uid').attr('id','text_'+newIdValue); + postData(newIdValue); + }); + return false; +} + +function post(id){ + currentId=id; + $('#postKey').attr('value',lmtext(id)); + $('#postUrl').attr('value',lmdata(id)); + display('post',lmtext(lmparent(id))); + $('#delpost,#newpostdatar').show(); +} + +function postData(id){ + currentId=id; + var cleankey = lmtext(id).replace('postdata:',''); + $('#postDataKey').attr('value',cleankey); + $('#postDataValue').attr('value',lmdata(id)); + display('postdata',cleankey); + $('#delpostdata').show(); +} + +function delPost(){ + delKey(); +} + +function delPostData(){ + delKey(); +} + diff --git a/modules/lemonldap-ng-manager/example/skins/default/manager.tpl b/modules/lemonldap-ng-manager/example/skins/default/manager.tpl index a3a45a535..e083f08da 100644 --- a/modules/lemonldap-ng-manager/example/skins/default/manager.tpl +++ b/modules/lemonldap-ng-manager/example/skins/default/manager.tpl @@ -165,6 +165,21 @@ + + + + + + + @@ -518,6 +533,32 @@ + + + + + diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm index ebc411570..b1dab4199 100644 --- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm +++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm @@ -80,7 +80,7 @@ sub node { } # subnode points to a configuration node - elsif ( $flag =~ /^(n?hash|applicationlist)$/ ) { + elsif ( $flag =~ /^(n?hash|applicationlist|post)$/ ) { $res .= $self->confNode( $node, "$flag:$target", $help, $_j ); } @@ -261,8 +261,6 @@ sub confNode { if ( %{ $h->{$catid} } ) { $res .= '