SAML: work on metadata download link for client
This commit is contained in:
parent
7da7106e5f
commit
e0843ccb98
|
@ -34,8 +34,6 @@ example/mrtg/mrtg.cfg.example
|
|||
example/scripts/lmConfigEditor
|
||||
example/sessions.pl
|
||||
example/skins/default/accordion.css
|
||||
example/skins/default/ajax-loader.gif
|
||||
example/skins/default/ajaxfileupload.js
|
||||
example/skins/default/application_side_list.png
|
||||
example/skins/default/application_side_tree.png
|
||||
example/skins/default/arrow_refresh.png
|
||||
|
|
|
@ -605,3 +605,13 @@ function myB64(s) {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
/* Function to download a file */
|
||||
function downloadFile(id,filename){
|
||||
content=lmdata(id).replace(/\n/g,'\\n').replace(/"/g,'\"');
|
||||
var inputs = '';
|
||||
inputs+='<input type="hidden" name="filename" value="'+filename+'" />';
|
||||
inputs+='<input type="textarea" style="display:none;" name="file" value="'+content+'" />';
|
||||
jQuery('<form action="'+ scriptname +'" method="post" enctype="multipart/form-data">'+inputs+'</form>')
|
||||
.appendTo('body').submit().remove();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<script src="<TMPL_VAR NAME="DIR">/jquery-1.3.2.min.js" type="text/JavaScript"></script>
|
||||
<script src="<TMPL_VAR NAME="DIR">/jquery-ui-1.7.2.custom.min.js" type="text/JavaScript"></script>
|
||||
<script src="<TMPL_VAR NAME="DIR">/jquery.cookie.js" type="text/JavaScript"></script>
|
||||
<script src="<TMPL_VAR NAME="DIR">/jquery.ajaxfileupload.js" type="text/JavaScript"></script>
|
||||
<script src="<TMPL_VAR NAME="DIR">/tree.js" type="text/JavaScript"></script>
|
||||
<script src="<TMPL_VAR NAME="DIR">/ajaxfileupload.js" type="text/JavaScript"></script>
|
||||
<script type="text/JavaScript">//<![CDATA[
|
||||
var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">';
|
||||
var imagepath='<TMPL_VAR NAME="DIR">/';
|
||||
|
@ -169,6 +169,11 @@
|
|||
<!-- File textarea -->
|
||||
<div id="content_filearea" class="hidden">
|
||||
<textarea readonly id="filearea" cols="80" rows="10"></textarea>
|
||||
<p>
|
||||
<button onclick="downloadFile(currentId,'metadata.xml');return false;" class="ui-state-default ui-corner-all">
|
||||
<lang en="Download this file" fr="Télécharger ce fichier" />
|
||||
</a>
|
||||
</p>
|
||||
<table class="filearea">
|
||||
<tr>
|
||||
<td><lang en="Load from a file" fr="Charger depuis un fichier" /> :</td>
|
||||
|
|
|
@ -65,19 +65,21 @@ sub new {
|
|||
$self->quit();
|
||||
}
|
||||
|
||||
# File upload
|
||||
# File upload/download
|
||||
elsif ( my $rfile = $self->rparam('file') ) {
|
||||
|
||||
require Lemonldap::NG::Manager::Uploader; #inherits
|
||||
$self->fileUpload('file');
|
||||
$self->quit();
|
||||
}
|
||||
|
||||
# URL upload
|
||||
elsif ( my $rurl = $self->rparam('url') ) {
|
||||
|
||||
require Lemonldap::NG::Manager::Uploader; #inherits
|
||||
$self->urlUpload('url');
|
||||
my $result = $self->fileUpload('file');
|
||||
my %headers = (
|
||||
-type => 'text/html',
|
||||
-Content_Length => length($result)
|
||||
);
|
||||
if ( my $rfilename = $self->rparam('filename') ) {
|
||||
$headers{-type} = 'application/octet-stream';
|
||||
$headers{-attachment} = ${$rfilename};
|
||||
$result =~ s/{.*"content":"(.*)"}$/$1/g;
|
||||
}
|
||||
print $self->header(%headers).$result;
|
||||
$self->quit();
|
||||
}
|
||||
|
||||
|
|
|
@ -291,13 +291,8 @@ sub fileUpload {
|
|||
my $json_content = $json->encode($content);
|
||||
my $buf = '{"status":"OK", "content":' . $json_content . '}';
|
||||
|
||||
# Send JSON response
|
||||
# text/html is recommended header for JSON data retrieved by JQuery.
|
||||
print $self->header(
|
||||
-type => 'text/html',
|
||||
-Content_Length => length($buf)
|
||||
) . $buf;
|
||||
$self->quit();
|
||||
# Do not send response
|
||||
return $buf;
|
||||
}
|
||||
|
||||
## @method public void fileUpload (fieldname)
|
||||
|
@ -313,7 +308,6 @@ sub urlUpload {
|
|||
my $url = ${$self->rparam($fieldname)};
|
||||
|
||||
# Get contents from URL
|
||||
print STDERR "---> " . $url . "\n";
|
||||
my $content = get $url;
|
||||
$content = '' unless(defined $content);
|
||||
$content =~ s!<!<!g;
|
||||
|
@ -326,13 +320,8 @@ sub urlUpload {
|
|||
my $json_content = $json->encode($content);
|
||||
my $buf = '{"status":"OK", "content":' . $json_content . '}';
|
||||
|
||||
# Send JSON response
|
||||
# text/html is recommended header for JSON data retrieved by JQuery.
|
||||
print $self->header(
|
||||
-type => 'text/html',
|
||||
-Content_Length => length($buf)
|
||||
) . $buf;
|
||||
$self->quit();
|
||||
# Do not send response
|
||||
return $buf;
|
||||
}
|
||||
|
||||
## @method protected array applyTest(void* test,string value)
|
||||
|
|
Loading…
Reference in New Issue
Block a user