1 pièce(s) jointe(s)
	
	
		Export Excel Script non reconnu
	
	
		Bonjour, 
Je me permets de vous contacter concernant un export excel que j'essaie de faire. 
A partir de cette exemple : http://jsfiddle.net/RpKr8/
J'essaie de le tester sur ma page web et je constate qu'il me rejette le script. Voir ci joint l'image. 
Pour info je suis sous jquery 1.11 comme dans l'exemple. 
Parcontre le framework où je suis est chameleon template. 
Voici mon code : 
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 
 |  
<metal:main use-macro="load: layout.pt" >
<div metal:fill-slot="content">
 
    <div class="col-lg-10 col-lg-offset-1">
    <img class="img-responsive" src="${request.static_url('apisatellite:static/img/ban_ssi.png')}" alt="banniere ssi">
    </div>
 
<div class="col-lg-11 col-lg-offset-1">
    <div class="col-lg-11">
        <div class="panel panel-default">
            <div class="panel-body">
                <ul class="nav nav-tabs">
                     <li role="presentation"><a href="${request.route_url('systems_not_updated')}">Systems not updated</a></li>
					 <li role="presentation"><a href="${request.route_url('systems_deployed')}">Systems deployed</a></li>
                     <li role="presentation" class="active"><a href="${request.route_url('systems_with_rhsa')}">Systems with Critical Security Advisory</a></li>
                     <li role="presentation"><a href="${request.route_url('systems_with_pwd')}">Systems with password</a></li>
                     <li role="presentation"><a href="#">Systems no standards</a></li>
                </ul>
 
             <br />
 
				<div class="row">
					<div class="col-lg-12">
						<div class="panel panel-primary">
							<div class="panel-heading">List RHSA Critical with relevant systems:</div>
								<div class="panel-body">
 
										<button id="btnExport" name="btnExport" class="btn btn-primary">
											<span class="glyphicon glyphicon-export" aria-hidden="true"></span>
												Export to Excel
										</button>
										  <p>
							<div class="col-lg-8">			  
								 <div class="panel panel-primary">
									<div class="panel-heading">RHSA Critical over the last 6 months:</div>
										<div class="panel-body">
											<div id="list_erratum" class="col-md-12">	
												<table class="table table-bordered tablesorter tablesorter-blue" id="myTable">
													 <thead>
														<tr class="tablesorter-headerRow">
															<th>ID</th>
															<th>Errata Name</th>
															<th>Description</th>
															<th>Date</th>
														 </tr>
													 </thead>
													 <tbody>
                                                         <tr tal:repeat="erratum list_erratum_rhel">
															 <td><a href="${request.route_url('systems_with_rhsa_page', page=int(page), errata=erratum[2])}"> ${erratum[0]}</a></td>
															 <td><a href="${request.route_url('systems_with_rhsa_page', page=int(page), errata=erratum[2])}"> ${erratum[1]}</a></td>
															 <td><a href="${request.route_url('systems_with_rhsa_page', page=int(page), errata=erratum[2])}"> ${erratum[2]}</a></td>
															 <td><a href="${request.route_url('systems_with_rhsa_page', page=int(page), errata=erratum[2])}"> ${erratum[3]}</a></td>
														 </tr>
													 </tbody>                                            
												 </table>
											</div>
										</div>
								</div>
							</div>
 
 
									<div class="col-md-4">
										<div class="panel panel-primary">
											<div class="panel-heading">Systems involved</div>
												<div class="panel-body">
													<div id="relevant_system">
														<table class="table table-bordered tablesorter tablesorter-blue" id="myRelevantSyst">
															<thead>
																<tr class="tablesorter-headerRow">
																	 <th>System name</th>
																</tr>
															</thead>
															<tbody>
																 <tr tal:repeat="system systems">
																	 <td>${system['name']}</td>
																 </tr>
															</tbody>
														</table>
													</div>
												</div>
										</div>
									</div>
								</div>
						</div>
					</div>
				</div>
 
			</div>
		</div>
	</div>
</div>	
<script>
var tableToExcel = (function() {
  var uri = 'data:application/vnd.ms-excel;base64,'
    , ttemplate = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
  return function(table, name) {
    if (!table.nodeType) table = document.getElementById(table)
    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
    var blob = new Blob([format(template, ctx)]);
  var blobURL = window.URL.createObjectURL(blob);
    return blobURL;
  }
})()
 
$("#btnExport").click(function () {
    var todaysDate = moment().format('DD-MM-YYYY');
    var blobURL = tableToExcel('myTable', 'myRelevantSyst');
    $(this).attr('download',todaysDate+'.xls')
    $(this).attr('href',blobURL);
});
</script> 
 
</div>		                                                                                               
</metal:main> | 
 Est-ce possible?