Remove onclick events (#1137)

This commit is contained in:
Xavier Guimard 2017-01-19 21:48:07 +00:00
parent 64a6cb6dbc
commit 942be4148b
20 changed files with 110 additions and 55 deletions

View File

@ -434,11 +434,10 @@ sub mkSessionArray {
$tmp .= '</tr>';
foreach my $session (@$sessions) {
$tmp .= "<tr>";
$tmp .= "<td>$session->{user}</td>" if ($displayUser);
$tmp .=
"<td><script type=\"text/javascript\">var _date=new Date($session->{_utime}*1000);document.write(_date.toLocaleString());</script></td>";
$tmp .= "<td>$session->{ipAddr}</td>";
$tmp .= "<tr>"
.($displayUser ? "<td>$session->{user}</td>" : '')
. qq'<td class="localeDate" val="$session->{_utime}"></td>'
. "<td>$session->{ipAddr}</td>";
$tmp .= "<td>" . ( $session->{$_} || "" ) . "</td>"
foreach ( keys %{ $self->conf->{sessionDataToRemember} } );
$tmp .= "<td>$session->{error}</td>" if ($displayError);

View File

@ -0,0 +1,21 @@
# Timer for confirmation page
i = 5
go = () ->
$("#form").submit()
timer = () ->
h = $('#timer').html()
i-- if i>0
h = h.replace /\d+/, i
$('#timer').html h
setTimeout timer, 1000
$(document).ready ->
setTimeout go, 5000
setTimeout timer, 1000
$(".idploop").on 'click', () ->
$("#idp").val $(this).attr("val")
$("#refuse").on 'click', () ->
$("#confirm").attr "value", $(this).attr("val")

View File

@ -23,3 +23,5 @@ $(document).ready ->
window.setTimeout timer, 1000
else
stop
$("#wait").on 'click', () ->
stop()

View File

@ -60,7 +60,7 @@ restoreOrder = ->
rebuild = []
for v in items
rebuild[v] = v
for itemID in IDs
if itemID in rebuild
@ -199,5 +199,10 @@ $(document).ready ->
# Ping if asked
if datas['pingInterval'] and datas['pingInterval'] > 0
window.setTimeout ping, datas['pingInterval']
# Set local dates (used to display history)
$(".localeDate").each ->
s = new Date($(this).attr("val")*1000)
$(this).text s.toLocaleString()
translatePage(lang)

View File

@ -1,22 +1,33 @@
/* Timer for confirmation page */
// Generated by CoffeeScript 1.10.0
(function() {
var go, i, timer;
var i = 5;
i = 5;
function go() {
$("#form").submit();
}
go = function() {
return $("#form").submit();
};
function timer() {
var h = $('#timer').html();
if (i > 0) {
i--;
}
h = h.replace(/\d+/, i);
$('#timer').html(h);
window.setTimeout(timer, 1000);
}
timer = function() {
var h;
h = $('#timer').html();
if (i > 0) {
i--;
}
h = h.replace(/\d+/, i);
$('#timer').html(h);
return setTimeout(timer, 1000);
};
$(document).ready(function() {
window.setTimeout(go, 5000);
window.setTimeout(timer, 1000);
});
$(document).ready(function() {
setTimeout(go, 5000);
setTimeout(timer, 1000);
$(".idploop").on('click', function() {
return $("#idp").val($(this).attr("val"));
});
return $("#refuse").on('click', function() {
return $("#confirm").attr("value", $(this).attr("val"));
});
});
}).call(this);

View File

@ -1 +1 @@
var i=5;function go(){$("#form").submit()}function timer(){var a=$("#timer").html();if(i>0){i--}a=a.replace(/\d+/,i);$("#timer").html(a);window.setTimeout(timer,1000)}$(document).ready(function(){window.setTimeout(go,5000);window.setTimeout(timer,1000)});
(function(){var b,a,c;a=5;b=function(){return $("#form").submit()};c=function(){var d;d=$("#timer").html();if(a>0){a--}d=d.replace(/\d+/,a);$("#timer").html(d);return setTimeout(c,1000)};$(document).ready(function(){setTimeout(b,5000);setTimeout(c,1000);$(".idploop").on("click",function(){return $("#idp").val($(this).attr("val"))});return $("#refuse").on("click",function(){return $("#confirm").attr("value",$(this).attr("val"))})})}).call(this);

View File

@ -31,10 +31,13 @@
$(document).ready(function() {
if (window.datas['activeTimer']) {
window.setTimeout(go, 10000);
return window.setTimeout(timer, 1000);
window.setTimeout(timer, 1000);
} else {
return stop;
stop;
}
return $("#wait").on('click', function() {
return stop();
});
});
}).call(this);

View File

@ -1 +1 @@
(function(){var a,d,c,b,e;c=30;a=1;b=function(){a=0;return $("#timer").html("...")};d=function(){if(a){return $("#form").submit()}};e=function(){var f;f=$("#timer").html();if(c>0){c--}f=f.replace(/\d+/,c);$("#timer").html(f);return window.setTimeout(e,1000)};$(document).ready(function(){if(window.datas.activeTimer){window.setTimeout(d,10000);return window.setTimeout(e,1000)}else{return b}})}).call(this);
(function(){var a,d,c,b,e;c=30;a=1;b=function(){a=0;return $("#timer").html("...")};d=function(){if(a){return $("#form").submit()}};e=function(){var f;f=$("#timer").html();if(c>0){c--}f=f.replace(/\d+/,c);$("#timer").html(f);return window.setTimeout(e,1000)};$(document).ready(function(){if(window.datas.activeTimer){window.setTimeout(d,10000);window.setTimeout(e,1000)}else{b}return $("#wait").on("click",function(){return b()})})}).call(this);

View File

@ -106,8 +106,7 @@ LemonLDAP::NG Portal jQuery scripts
if (data.auth) {
return setTimeout(ping, datas['pingInterval']);
} else {
console.log(data);
//return location.reload(true);
return location.reload(true);
}
}
});
@ -200,6 +199,11 @@ LemonLDAP::NG Portal jQuery scripts
if (datas['pingInterval'] && datas['pingInterval'] > 0) {
window.setTimeout(ping, datas['pingInterval']);
}
$(".localeDate").each(function() {
var s;
s = new Date($(this).attr("val") * 1000);
return $(this).text(s.toLocaleString());
});
return translatePage(lang);
});

View File

@ -1 +1 @@
(function(){var e,i,d,a,j,h,f,b,k,c,g=[].indexOf||function(o){for(var n=0,m=this.length;n<m;n++){if(n in this&&this[n]===o){return n}}return -1};c={};k=function(l){return $.getJSON(window.staticPrefix+"languages/"+l+".json",function(m){c=m;$("[trspan]").each(function(){return $(this).text(b($(this).attr("trspan")))});return $("[trmsg]").each(function(){return $(this).text(b("PE"+($(this).attr("trmsg"))))})})};b=function(l){if(c[l]){return c[l]}else{return l}};d=function(){var l;l={};$("script[type='application/init']").each(function(){var q,n,m,p,o;try{o=JSON.parse($(this).text());p=[];for(m in o){p.push(l[m]=o[m])}return p}catch(n){q=n;console.log("Parsing error",q);return console.log("JSON",$(this).text())}});return l};f="#appslist";i=function(){return $.ajax({type:"POST",url:e.scriptname,data:{storeAppsListOrder:$(f).sortable("toArray").join()},dataType:"json"})};h=function(){var n,m,q,y,l,u,p,r,o,t,w,s,x;t=$(f);if(!((t!=null)&&e.appslistorder)){return null}n=e.appslistorder.split(",");u=t.sortable("toArray");w=[];for(q=0,r=u.length;q<r;q++){x=u[q];w[x]=x}for(p=0,o=n.length;p<o;p++){l=n[p];if(g.call(w,l)>=0){y=w[l];m=$(f+".ui-sortable").children("#"+y);s=$(f+".ui-sortable").children("#"+l);m.remove();$(f+".ui-sortable").filter(":first").append(s)}}return 1};a=function(l){return $("#lmhidden_"+l).length};j=function(){return $.ajax({type:"POST",url:e.scriptname,data:{ping:1},dataType:"json",success:function(l){if(l.auth){return setTimeout(j,e.pingInterval)}else{console.log(l)}}})};window.ping=j;e={};$(document).ready(function(){var x,w,z,v,A,y,C,t,s,B,r,q,u,o,m,n,l,p;e=d();window.datas=e;if(e.antiframe&&top!==self){top.location.href=location.href}$("#appslist").sortable({axis:"y",cursor:"move",opacity:0.5,revert:true,items:"> div.category",update:function(){return i()}});h();$("div.message").fadeIn("slow");$("input[name=timezone]").val(-(new Date().getTimezoneOffset()/60));o=$("#menu").tabs({active:0});u=$('#menu a[href="#'+e.displaytab+'"]').parent().index();if(u<0){u=0}o.tabs("option","active",u);z=$("#authMenu").tabs({active:0});if(e.choicetab){z.tabs("option","active",$('#authMenu a[href="#'+e.choicetab+'"]').parent().index())}if(e.login){$("input[type=password]:first").focus()}else{$("input[type!=hidden]:first").focus()}if(e.newwindow){$("#appslist a").attr("target","_blank")}if($("p.removeOther").length){x=$("form.login").attr("action");m=$("form.login").attr("method");v="";if(x.indexOf("?")!==-1){x.substring(0,x.indexOf("?"))+"?"}else{v=x+"?"}$("form.login input[type=hidden]").each(function(D){return v+="&"+$(this).attr("name")+"="+$(this).val()});q=$("p.removeOther a").attr("href")+"&method="+m+"&url="+btoa(v);$("p.removeOther a").attr("href",q)}if(navigator){t=[];s=[];l=[navigator.language];if(navigator.languages){l=navigator.languages}for(A=0,B=l.length;A<B;A++){n=l[A];p=window.availableLanguages;for(y=0,r=p.length;y<r;y++){w=p[y];if(w===n){t.push(w)}else{if(w.substring(0,1)===n.substring(0,1)){s.push(w)}}}}C=t[0]?t[0]:s[0]?s[0]:"en"}else{C="en"}if(e.pingInterval&&e.pingInterval>0){window.setTimeout(j,e.pingInterval)}return k(C)})}).call(this);
(function(){var e,i,d,a,j,h,f,b,k,c,g=[].indexOf||function(o){for(var n=0,m=this.length;n<m;n++){if(n in this&&this[n]===o){return n}}return -1};c={};k=function(l){return $.getJSON(window.staticPrefix+"languages/"+l+".json",function(m){c=m;$("[trspan]").each(function(){return $(this).text(b($(this).attr("trspan")))});return $("[trmsg]").each(function(){return $(this).text(b("PE"+($(this).attr("trmsg"))))})})};b=function(l){if(c[l]){return c[l]}else{return l}};d=function(){var l;l={};$("script[type='application/init']").each(function(){var q,n,m,p,o;try{o=JSON.parse($(this).text());p=[];for(m in o){p.push(l[m]=o[m])}return p}catch(n){q=n;console.log("Parsing error",q);return console.log("JSON",$(this).text())}});return l};f="#appslist";i=function(){return $.ajax({type:"POST",url:e.scriptname,data:{storeAppsListOrder:$(f).sortable("toArray").join()},dataType:"json"})};h=function(){var n,m,q,y,l,u,p,r,o,t,w,s,x;t=$(f);if(!((t!=null)&&e.appslistorder)){return null}n=e.appslistorder.split(",");u=t.sortable("toArray");w=[];for(q=0,r=u.length;q<r;q++){x=u[q];w[x]=x}for(p=0,o=n.length;p<o;p++){l=n[p];if(g.call(w,l)>=0){y=w[l];m=$(f+".ui-sortable").children("#"+y);s=$(f+".ui-sortable").children("#"+l);m.remove();$(f+".ui-sortable").filter(":first").append(s)}}return 1};a=function(l){return $("#lmhidden_"+l).length};j=function(){return $.ajax({type:"POST",url:e.scriptname,data:{ping:1},dataType:"json",success:function(l){if(l.auth){return setTimeout(j,e.pingInterval)}else{return location.reload(true)}}})};window.ping=j;e={};$(document).ready(function(){var x,w,z,v,A,y,C,t,s,B,r,q,u,o,m,n,l,p;e=d();window.datas=e;if(e.antiframe&&top!==self){top.location.href=location.href}$("#appslist").sortable({axis:"y",cursor:"move",opacity:0.5,revert:true,items:"> div.category",update:function(){return i()}});h();$("div.message").fadeIn("slow");$("input[name=timezone]").val(-(new Date().getTimezoneOffset()/60));o=$("#menu").tabs({active:0});u=$('#menu a[href="#'+e.displaytab+'"]').parent().index();if(u<0){u=0}o.tabs("option","active",u);z=$("#authMenu").tabs({active:0});if(e.choicetab){z.tabs("option","active",$('#authMenu a[href="#'+e.choicetab+'"]').parent().index())}if(e.login){$("input[type=password]:first").focus()}else{$("input[type!=hidden]:first").focus()}if(e.newwindow){$("#appslist a").attr("target","_blank")}if($("p.removeOther").length){x=$("form.login").attr("action");m=$("form.login").attr("method");v="";if(x.indexOf("?")!==-1){x.substring(0,x.indexOf("?"))+"?"}else{v=x+"?"}$("form.login input[type=hidden]").each(function(D){return v+="&"+$(this).attr("name")+"="+$(this).val()});q=$("p.removeOther a").attr("href")+"&method="+m+"&url="+btoa(v);$("p.removeOther a").attr("href",q)}if(navigator){t=[];s=[];l=[navigator.language];if(navigator.languages){l=navigator.languages}for(A=0,B=l.length;A<B;A++){n=l[A];p=window.availableLanguages;for(y=0,r=p.length;y<r;y++){w=p[y];if(w===n){t.push(w)}else{if(w.substring(0,1)===n.substring(0,1)){s.push(w)}}}}C=t[0]?t[0]:s[0]?s[0]:"en"}else{C="en"}if(e.pingInterval&&e.pingInterval>0){window.setTimeout(j,e.pingInterval)}$(".localeDate").each(function(){var D;D=new Date($(this).attr("val")*1000);return $(this).text(D.toLocaleString())});return k(C)})}).call(this);

View File

@ -36,7 +36,7 @@
<div class="row">
<TMPL_LOOP NAME="LIST">
<div class="col-sm-6 <TMPL_VAR NAME="class">">
<button type="submit" class="btn btn-info" onclick="$('#idp').val('<TMPL_VAR NAME="VAL">')">
<button type="submit" class="btn btn-info idploop" val="<TMPL_VAR NAME="VAL">">
<TMPL_IF NAME="icon">
<img src="<TMPL_VAR NAME="icon">" class="glyphicon" />
<TMPL_ELSE>
@ -77,7 +77,7 @@
<span class="glyphicon glyphicon-ok"></span>
<span trspan="accept">Accept</span>
</button>
<button type="submit" class="negative btn btn-danger" onclick="$('#confirm').attr('value','-<TMPL_VAR NAME="CONFIRMKEY">');">
<button id="refuse" type="submit" class="negative btn btn-danger" val="-<TMPL_VAR NAME="CONFIRMKEY">">
<span class="glyphicon glyphicon-stop"></span>
<span trspan="refuse">Refuse</span>
</button>

View File

@ -23,7 +23,7 @@
<span class="glyphicon glyphicon-ok"></span>
<span trspan="continue">Continue</span>
</button>
<button type="reset" class="negative btn btn-danger" onclick="stop();">
<button id="wait" type="reset" class="negative btn btn-danger">
<span class="glyphicon glyphicon-stop"></span>
<span trspan="wait">Wait</span>
</button>

View File

@ -42,7 +42,7 @@
<table class="margin0">
<TMPL_LOOP NAME="LIST">
<tr><td><div class="buttons">
<button type="submit" class="positive" class="maxw" onclick="$('#idp').val('<TMPL_VAR NAME="VAL">')">
<button type="submit" class="idploop positive maxw" val="<TMPL_VAR NAME="VAL">">
<TMPL_VAR NAME="NAME">
</button>
</div></td></tr>
@ -58,7 +58,7 @@
<table class="margin0">
<tr><td><div class="panel-buttons">
<button type="submit" class="negative" tabindex="4" onclick="$('#confirm').attr('value','-<TMPL_VAR NAME="CONFIRMKEY">');">
<button id="refuse" type="submit" class="negative" tabindex="4" val="-<TMPL_VAR NAME="CONFIRMKEY">">
<span trspan="refuse">Refuse</span>
</button>
<button type="submit" class="positive" tabindex="3">

View File

@ -25,12 +25,16 @@
</TMPL_IF>
</div>
<div class="panel-buttons">
<button type="button" class="positive" tabindex="1" onclick="location.href='<TMPL_VAR NAME="PORTAL_URL">';return false;">
<span trspan="goToPortal">Go to portal</span>
</button>
<button type="button" class="negative" tabindex="2" onclick="location.href='<TMPL_VAR NAME="LOGOUT_URL">';return false;">
<span trspan="logout">Logout</span>
</button>
<form>
<button type="button" class="positive" tabindex="1" formaction="<TMPL_VAR NAME="PORTAL_URL">">
<span trspan="goToPortal">Go to portal</span>
</button>
</form>
<form>
<button type="button" class="negative" tabindex="2" formaction="<TMPL_VAR NAME="LOGOUT_URL">">
<span trspan="logout">Logout</span>
</button>
</form>
</div>
</div>
</div>

View File

@ -17,7 +17,7 @@
<TMPL_VAR NAME="MSG">
</div>
<div class="panel-buttons">
<button type="reset" class="negative" tabindex="4" onclick="stop();">
<button id="wait" type="reset" class="negative" tabindex="4">
<span trspan="wait">Wait</span>
</button>
<button type="submit" class="positive" tabindex="3">

View File

@ -128,9 +128,11 @@
</TMPL_IF>
<div class="panel-buttons">
<button type="button" class="positive" tabindex="1" onclick="location.href='<TMPL_VAR NAME="PORTAL_URL">?skin=<TMPL_VAR NAME="SKIN">';return false;">
<span trspan="goToPortal">Go to portal</span>
</button>
<form>
<button type="button" class="positive" tabindex="1" formaction="<TMPL_VAR NAME="PORTAL_URL">?skin=<TMPL_VAR NAME="SKIN">">
<span trspan="goToPortal">Go to portal</span>
</button>
</form>
</div>
</div>
</div>

View File

@ -177,9 +177,11 @@
<p class="text-label">
<span trspan="areYouSure">Are you sure?</span>
</p>
<button type="submit" class="positive" onclick="location.href='<TMPL_VAR NAME="LOGOUT_URL">';return false;">
<span trspan="imSure">I'm sure</span>
</button>
<form>
<button type="submit" class="positive" formaction="<TMPL_VAR NAME="LOGOUT_URL">">
<span trspan="imSure">I'm sure</span>
</button>
</form>
</div>
</TMPL_IF>

View File

@ -109,9 +109,11 @@
</TMPL_IF>
<div class="panel-buttons">
<button type="button" class="positive" tabindex="1" onclick="location.href='<TMPL_VAR NAME="PORTAL_URL">?skin=<TMPL_VAR NAME="SKIN">';return false;">
<span trspan="goToPortal">Go to portal</span>
</button>
<form>
<button type="button" class="positive" tabindex="1" formaction="<TMPL_VAR NAME="PORTAL_URL">?skin=<TMPL_VAR NAME="SKIN">">
<span trspan="goToPortal">Go to portal</span>
</button>
</form>
</div>
</div>
</div>

View File

@ -28,7 +28,7 @@
<table>
<TMPL_LOOP NAME="LIST">
<tr><td><div class="buttons">
<button type="submit" class="positive" class="maxw" onclick="$('#idp').val('<TMPL_VAR NAME="VAL">')">
<button type="submit" class="idploop positive maxw" val="<TMPL_VAR NAME="VAL">">
<TMPL_VAR NAME="NAME">
</button>
</div></td></tr>
@ -54,7 +54,7 @@
<img src="<TMPL_VAR NAME="STATIC_PREFIX">common/accept.png" alt="" />
<span trspan="accept">Accept</span>
</button>
<button type="submit" class="negative" onclick="$('#confirm').attr('value','-<TMPL_VAR NAME="CONFIRMKEY">');">
<button id="refuse" type="submit" class="negative" tabindex="4" val="-<TMPL_VAR NAME="CONFIRMKEY">">
<img src="<TMPL_VAR NAME="STATIC_PREFIX">common/cancel.png" alt="" />
<span trspan="refuse">Refuse</span>
</button>

View File

@ -19,7 +19,7 @@
<img src="<TMPL_VAR NAME="STATIC_PREFIX">common/accept.png" alt="" />
<span trspan="continue">Continue</span>
</button>
<button type="reset" class="negative" onclick="stop();">
<button id="wait" type="reset" class="negative">
<img src="<TMPL_VAR NAME="STATIC_PREFIX">common/cancel.png" alt="" />
<span trspan="wait">Wait</span>
</button>