From 2c707afc81245613e877bfa7291a3ae485a5061d Mon Sep 17 00:00:00 2001 From: Guillaume Rousse <guillaume.rousse@renater.fr> Date: Thu, 24 May 2018 12:25:11 +0200 Subject: [PATCH] get rid of jquery-steps --- lib/AccountManager/App.pm | 30 +-- lib/AccountManager/L10N/fr.pm | 2 + resources/Makefile.am | 1 - resources/css/style.css | 278 +++------------------- resources/jquery-steps-1.1.0.min.js | 6 - templates/Makefile.am | 1 - templates/web/complete_challenge.tt2.html | 36 ++- templates/web/index-nobanner.tt2.html | 3 - templates/web/index.tt2.html | 4 +- templates/web/select_email.tt2.html | 45 ++-- templates/web/select_sp.tt2.html | 149 +++--------- 11 files changed, 130 insertions(+), 425 deletions(-) delete mode 100644 resources/jquery-steps-1.1.0.min.js delete mode 100644 templates/web/index-nobanner.tt2.html diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm index 042d46e..7ffc24c 100644 --- a/lib/AccountManager/App.pm +++ b/lib/AccountManager/App.pm @@ -241,7 +241,7 @@ sub req_select_email { if (! $self->{in}->{entityid}) { $self->{logger}->error("Missing parameter: entityid"); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "missing_entityid" ] @@ -252,7 +252,7 @@ sub req_select_email { if ($self->{in}->{entityid} !~ $entity_id_pattern) { $self->{logger}->error("Incorrect parameter format: entityid"); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "format_entityid" ] @@ -280,7 +280,7 @@ sub req_select_email { if ($EVAL_ERROR) { $self->{logger}->error("Failed to load federation metadata: $EVAL_ERROR"); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "internal" ] @@ -294,7 +294,7 @@ sub req_select_email { "No such SP '%s' in metadata", $self->{in}->{entityid} ); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "no_such_entity" ] @@ -312,7 +312,7 @@ sub req_select_email { unless ($provider->save()) { $self->{logger}->error("Failed to save service provider object"); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "internal" ] @@ -337,7 +337,7 @@ sub req_select_email { } $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { provider => $provider, content => 'select_email.tt2.html' @@ -351,7 +351,7 @@ sub req_complete_challenge { unless ($self->{in}->{entityid}) { $self->{logger}->error("Missing parameter entityid"); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { errors => [ "missing_entityid" ] } @@ -361,7 +361,7 @@ sub req_complete_challenge { unless ($self->{in}->{email}) { $self->{logger}->error("Missing parameter email"); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "missing_email" ] @@ -377,7 +377,7 @@ sub req_complete_challenge { unless ($provider->load(speculative => 1)) { $self->{logger}->errorf("No such SP '%s' in database", $self->{in}->{entityid}); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "no_such_entity" ] @@ -409,7 +409,7 @@ sub req_complete_challenge { $self->{in}->{email} ); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "internal" ] @@ -431,7 +431,7 @@ sub req_complete_challenge { $old_token->id() ); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "internal" ] @@ -455,7 +455,7 @@ sub req_complete_challenge { unless ($token->save()) { $self->{logger}->error("Failed to save authentication token"); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "internal" ] @@ -471,7 +471,7 @@ sub req_complete_challenge { open(my $handle, '|-', "$sendmail -f $sender $recipient") or do { $self->{logger}->errorf("Unable to run sendmail executable: %s", $ERRNO); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "mail_notification_error" ] @@ -504,7 +504,7 @@ sub req_complete_challenge { unless ($tt2->process($template, $data, $handle)) { $self->{logger}->errorf("Mail notification error: %s", $tt2->error()); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { content => 'errors.tt2.html', errors => [ "mail_notification_failure" ] @@ -522,7 +522,7 @@ sub req_complete_challenge { ); $self->respond( - template => 'index-nobanner.tt2.html', + template => 'index.tt2.html', data => { email => $self->{in}->{email}, entityid => $self->{in}->{entityid}, diff --git a/lib/AccountManager/L10N/fr.pm b/lib/AccountManager/L10N/fr.pm index a22dc47..d8bce0f 100644 --- a/lib/AccountManager/L10N/fr.pm +++ b/lib/AccountManager/L10N/fr.pm @@ -70,6 +70,8 @@ our %Lexicon = ( "Validation token:" => "Code de validation:", "If the creation of test accounts was not initiated by you or a fellow administrator for the above Service Provider, please forward this email and contact [_1] to inform them about a potential abuse of the eduGAIN Access Check service." => "Si la création de comptes de test n'a pas été demandée par vous ou un autre administrateur du service mentionné plus haut, merci de transmettre ce message à [_1] afin d'informer d'une utilisation inappropriée de l'application eduGAIN Access Check.", "Best Regards" => "Cordialement", + "Next" => "Suivant", + "Previous" => "Précédent", ); 1; diff --git a/resources/Makefile.am b/resources/Makefile.am index 6a3317f..5983c67 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -15,7 +15,6 @@ nobase_www_DATA = \ images/favicon.png \ images/geant_logo_rgb_300dpi.jpg \ jquery-3.3.1.min.js \ - jquery-steps-1.1.0.min.js \ jquery-ui-1.12.1/images/ui-icons_444444_256x240.png \ jquery-ui-1.12.1/images/ui-icons_555555_256x240.png \ jquery-ui-1.12.1/images/ui-icons_777620_256x240.png \ diff --git a/resources/css/style.css b/resources/css/style.css index e481fda..eaa2358 100644 --- a/resources/css/style.css +++ b/resources/css/style.css @@ -64,143 +64,37 @@ main form { } /* wizard */ -.wizard, -.tabcontrol -{ - display: block; - width: 100%; - overflow: hidden; -} - -.wizard a, -.tabcontrol a -{ - outline: 0; -} - -.wizard ul, -.tabcontrol ul -{ - list-style: none !important; - padding: 0; - margin: 0; -} - -.wizard ul > li, -.tabcontrol ul > li -{ - display: block; - padding: 0; -} - -/* Accessibility */ -.wizard > .steps .current-info, -.tabcontrol > .steps .current-info -{ - position: absolute; - left: -999em; -} - -.wizard > .content > .title, -.tabcontrol > .content > .title -{ - position: absolute; - left: -999em; -} - - - -/* - Wizard -*/ .wizard { display: block; width: 100%; overflow: hidden; } -.wizard a { - outline: 0; -} -.wizard ul { - list-style: none !important; - padding: 0; - margin: 0; -} -.wizard ul > li { - display: block; - padding: 0; -} -.wizard > .steps .current-info { - position: absolute; - left: -999em; -} -.wizard > .content > .title { - position: absolute; - left: -999em; -} + .wizard > .steps { position: relative; - display: block; - width: 100%; -} -.wizard.vertical > .steps { display: inline; - float: left; width: 30%; -} -.wizard > .steps .number { - font-size: 1.429em; -} -.wizard > .steps > ul > li { - width: 25%; -} -.wizard > .steps > ul > li, -.wizard > .actions > ul > li { float: left; } -.wizard.vertical > .steps > ul > li { - float: none; - width: 100%; -} -.wizard > .steps a, -.wizard > .steps a:hover, -.wizard > .steps a:active { - display: block; - width: auto; +.wizard > .steps > ol > li { + list-style-position: inside; margin: 0 0.5em 0.5em; padding: 1em 1em; - text-decoration: none; border-radius: 10px; } - -.wizard > .steps .disabled a, -.wizard > .steps .disabled a:hover, -.wizard > .steps .disabled a:active { - background: #eee; - color: #aaa; - cursor: default; +.wizard > .steps > ol > li.current { + background: #214BB5; + color: #FFFFFF; } -.wizard > .steps .current a, -.wizard > .steps .current a:hover, -.wizard > .steps .current a:active { - background: none repeat scroll 0% 0% #214BB5; +.wizard > .steps > ol > li.done { + background: #9DC8E2; color: #FFFFFF; - cursor: default; - border-radius: 10px; } -.wizard > .steps .done a, -.wizard > .steps .done a:hover, -.wizard > .steps .done a:active { - background: #9dc8e2; - color: #ffffff; +.wizard > .steps > ol > li.disabled { + background: #eee; + color: #aaa; } -.wizard > .steps .error a, -.wizard > .steps .error a:hover, -.wizard > .steps .error a:active { - background: #ff3111; - color: #ffffff; -} .wizard > .content { background: none; display: block; @@ -213,117 +107,28 @@ main form { overflow: auto; overflow-x: hidden; } -.wizard > .content fieldset { - border: none; - margin-left: auto; - margin-right: auto; -} -.wizard > .content > .body { - float: left; - position: absolute; - width: 95%; - height: 95%; - padding: 2.5%; -} -.wizard > .content > .body ul { - list-style: disc !important; -} -.wizard > .content > .body ul > li { - display: list-item; -} -.wizard > .content > .body > iframe { - border: 0 none; - width: 100%; - height: 100%; -} -.wizard > .content > .body input { - display: block; - border: 1px solid #ccc; -} -.wizard > .content > .body input[type="checkbox"] { - display: inline-block; -} -.wizard > .content > .body input.error { - background: rgb(251, 227, 228); - border: 1px solid #fbc2c4; - color: #8a1f11; -} -.wizard > .content > .body label { - display: inline-block; - margin-bottom: 0.5em; -} -.wizard > .content > .body label.error { - color: #8a1f11; - display: inline-block; - margin-left: 1.5em; -} -.wizard > .actions { +.wizard > .content .custom-combobox { position: relative; - display: block; - text-align: right; - width: 100%; -} -.wizard.vertical > .actions { - display: inline; - float: right; - margin: 0 2.5%; - width: 95%; -} -.wizard > .actions > ul { display: inline-block; - text-align: right; -} -.wizard > .actions > ul > li { - margin: 0 0.5em; -} -.wizard.vertical > .actions > ul > li { - margin: 0 0 0 1em; -} -.wizard > .actions a, -.wizard > .actions a:hover, -.wizard > .actions a:active { - display: block; - padding: 0.5em 1em; - text-decoration: none; - font-weight: bold; - border: 2px solid #214BB5; - border-radius: 10px; -} -.wizard > .actions a, -.wizard > .actions a:active { - background: #214BB5; - color: #FFFFFF; -} -.wizard > .actions a:hover { - background: none; - color: #214BB5; -} -.wizard > .actions .disabled a, -.wizard > .actions .disabled a:hover, -.wizard > .actions .disabled a:active { - background: none repeat scroll 0% 0% #9DC8E2; - color: #FFFFFF; - border: 2px solid #9DC8E2; -} -.wizard > .content > .body label[for="sp_entityid"] { - display: block; - margin-bottom: 0; - font-weight: bold; -} -.wizard > .content > .body label.error { - color: #FFFFFF; - width: 100%; - margin-left: 0; - background: #f04124; - padding: 0.3rem 2rem ; - margin: 1rem auto; } -.wizard > .content > .body span.custom-combobox label.error { +.wizard > .content .custom-combobox-toggle { position: absolute; - margin: 3rem auto; + top: 0; + bottom: 0; + margin-left: -1px; + padding: 0; } -.wizard .content div.radio_inline input[type="radio"] { - display: inline; +.wizard > .content .custom-combobox-input { + margin: 0; + padding: 5px 10px; + width: 600px; + +} +.wizard > .content .ui-autocomplete { + max-height: 400px; + overflow-y: auto; + /* prevent horizontal scrollbar */ + overflow-x: hidden; } /* Accounts profile */ @@ -369,30 +174,3 @@ main form { .scrollable { overflow-y: scroll; } -fieldset.scrollable { - height: 75%; -} -.custom-combobox { - position: relative; - display: inline-block; -} -.custom-combobox-toggle { - position: absolute; - top: 0; - bottom: 0; - margin-left: -1px; - padding: 0; -} -.custom-combobox-input { - margin: 0; - padding: 5px 10px; - padding-left: 40px; - width: 600px; - -} -.ui-autocomplete { - max-height: 400px; - overflow-y: auto; - /* prevent horizontal scrollbar */ - overflow-x: hidden; -} diff --git a/resources/jquery-steps-1.1.0.min.js b/resources/jquery-steps-1.1.0.min.js deleted file mode 100644 index 755aedf..0000000 --- a/resources/jquery-steps-1.1.0.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * jQuery Steps v1.1.0 - 09/04/2014 - * Copyright (c) 2014 Rafael Staib (http://www.jquery-steps.com) - * Licensed under MIT http://www.opensource.org/licenses/MIT - */ -!function(a,b){function c(a,b){o(a).push(b)}function d(d,e,f){var g=d.children(e.headerTag),h=d.children(e.bodyTag);g.length>h.length?R(Z,"contents"):g.length<h.length&&R(Z,"titles");var i=e.startIndex;if(f.stepCount=g.length,e.saveState&&a.cookie){var j=a.cookie(U+q(d)),k=parseInt(j,0);!isNaN(k)&&k<f.stepCount&&(i=k)}f.currentIndex=i,g.each(function(e){var f=a(this),g=h.eq(e),i=g.data("mode"),j=null==i?$.html:r($,/^\s*$/.test(i)||isNaN(i)?i:parseInt(i,0)),k=j===$.html||g.data("url")===b?"":g.data("url"),l=j!==$.html&&"1"===g.data("loaded"),m=a.extend({},bb,{title:f.html(),content:j===$.html?g.html():"",contentUrl:k,contentMode:j,contentLoaded:l});c(d,m)})}function e(a){a.triggerHandler("canceled")}function f(a,b){return a.currentIndex-b}function g(b,c){var d=i(b);b.unbind(d).removeData("uid").removeData("options").removeData("state").removeData("steps").removeData("eventNamespace").find(".actions a").unbind(d),b.removeClass(c.clearFixCssClass+" vertical");var e=b.find(".content > *");e.removeData("loaded").removeData("mode").removeData("url"),e.removeAttr("id").removeAttr("role").removeAttr("tabindex").removeAttr("class").removeAttr("style")._removeAria("labelledby")._removeAria("hidden"),b.find(".content > [data-mode='async'],.content > [data-mode='iframe']").empty();var f=a('<{0} class="{1}"></{0}>'.format(b.get(0).tagName,b.attr("class"))),g=b._id();return null!=g&&""!==g&&f._id(g),f.html(b.find(".content").html()),b.after(f),b.remove(),f}function h(a,b){var c=a.find(".steps li").eq(b.currentIndex);a.triggerHandler("finishing",[b.currentIndex])?(c.addClass("done").removeClass("error"),a.triggerHandler("finished",[b.currentIndex])):c.addClass("error")}function i(a){var b=a.data("eventNamespace");return null==b&&(b="."+q(a),a.data("eventNamespace",b)),b}function j(a,b){var c=q(a);return a.find("#"+c+V+b)}function k(a,b){var c=q(a);return a.find("#"+c+W+b)}function l(a,b){var c=q(a);return a.find("#"+c+X+b)}function m(a){return a.data("options")}function n(a){return a.data("state")}function o(a){return a.data("steps")}function p(a,b){var c=o(a);return(0>b||b>=c.length)&&R(Y),c[b]}function q(a){var b=a.data("uid");return null==b&&(b=a._id(),null==b&&(b="steps-uid-".concat(T),a._id(b)),T++,a.data("uid",b)),b}function r(a,c){if(S("enumType",a),S("keyOrValue",c),"string"==typeof c){var d=a[c];return d===b&&R("The enum key '{0}' does not exist.",c),d}if("number"==typeof c){for(var e in a)if(a[e]===c)return c;R("Invalid enum value '{0}'.",c)}else R("Invalid key or value type.")}function s(a,b,c){return B(a,b,c,v(c,1))}function t(a,b,c){return B(a,b,c,f(c,1))}function u(a,b,c,d){if((0>d||d>=c.stepCount)&&R(Y),!(b.forceMoveForward&&d<c.currentIndex)){var e=c.currentIndex;return a.triggerHandler("stepChanging",[c.currentIndex,d])?(c.currentIndex=d,O(a,b,c),E(a,b,c,e),D(a,b,c),A(a,b,c),P(a,b,c,d,e,function(){a.triggerHandler("stepChanged",[d,e])})):a.find(".steps li").eq(e).addClass("error"),!0}}function v(a,b){return a.currentIndex+b}function w(b){var c=a.extend(!0,{},cb,b);return this.each(function(){var b=a(this),e={currentIndex:c.startIndex,currentStep:null,stepCount:0,transitionElement:null};b.data("options",c),b.data("state",e),b.data("steps",[]),d(b,c,e),J(b,c,e),G(b,c),c.autoFocus&&0===T&&j(b,c.startIndex).focus(),b.triggerHandler("init",[c.startIndex])})}function x(b,c,d,e,f){(0>e||e>d.stepCount)&&R(Y),f=a.extend({},bb,f),y(b,e,f),d.currentIndex!==d.stepCount&&d.currentIndex>=e&&(d.currentIndex++,O(b,c,d)),d.stepCount++;var g=b.find(".content"),h=a("<{0}>{1}</{0}>".format(c.headerTag,f.title)),i=a("<{0}></{0}>".format(c.bodyTag));return(null==f.contentMode||f.contentMode===$.html)&&i.html(f.content),0===e?g.prepend(i).prepend(h):k(b,e-1).after(i).after(h),K(b,d,i,e),N(b,c,d,h,e),F(b,c,d,e),e===d.currentIndex&&E(b,c,d),D(b,c,d),b}function y(a,b,c){o(a).splice(b,0,c)}function z(b){var c=a(this),d=m(c),e=n(c);if(d.suppressPaginationOnFocus&&c.find(":focus").is(":input"))return b.preventDefault(),!1;var f={left:37,right:39};b.keyCode===f.left?(b.preventDefault(),t(c,d,e)):b.keyCode===f.right&&(b.preventDefault(),s(c,d,e))}function A(b,c,d){if(d.stepCount>0){var e=d.currentIndex,f=p(b,e);if(!c.enableContentCache||!f.contentLoaded)switch(r($,f.contentMode)){case $.iframe:b.find(".content > .body").eq(d.currentIndex).empty().html('<iframe src="'+f.contentUrl+'" frameborder="0" scrolling="no" />').data("loaded","1");break;case $.async:var g=k(b,e)._aria("busy","true").empty().append(M(c.loadingTemplate,{text:c.labels.loading}));a.ajax({url:f.contentUrl,cache:!1}).done(function(a){g.empty().html(a)._aria("busy","false").data("loaded","1"),b.triggerHandler("contentLoaded",[e])})}}}function B(a,b,c,d){var e=c.currentIndex;if(d>=0&&d<c.stepCount&&!(b.forceMoveForward&&d<c.currentIndex)){var f=j(a,d),g=f.parent(),h=g.hasClass("disabled");return g._enableAria(),f.click(),e===c.currentIndex&&h?(g._enableAria(!1),!1):!0}return!1}function C(b){b.preventDefault();var c=a(this),d=c.parent().parent().parent().parent(),f=m(d),g=n(d),i=c.attr("href");switch(i.substring(i.lastIndexOf("#")+1)){case"cancel":e(d);break;case"finish":h(d,g);break;case"next":s(d,f,g);break;case"previous":t(d,f,g)}}function D(a,b,c){if(b.enablePagination){var d=a.find(".actions a[href$='#finish']").parent(),e=a.find(".actions a[href$='#next']").parent();if(!b.forceMoveForward){var f=a.find(".actions a[href$='#previous']").parent();f._enableAria(c.currentIndex>0)}b.enableFinishButton&&b.showFinishButtonAlways?(d._enableAria(c.stepCount>0),e._enableAria(c.stepCount>1&&c.stepCount>c.currentIndex+1)):(d._showAria(b.enableFinishButton&&c.stepCount===c.currentIndex+1),e._showAria(0===c.stepCount||c.stepCount>c.currentIndex+1)._enableAria(c.stepCount>c.currentIndex+1||!b.enableFinishButton))}}function E(b,c,d,e){var f=j(b,d.currentIndex),g=a('<span class="current-info audible">'+c.labels.current+" </span>"),h=b.find(".content > .title");if(null!=e){var i=j(b,e);i.parent().addClass("done").removeClass("error")._selectAria(!1),h.eq(e).removeClass("current").next(".body").removeClass("current"),g=i.find(".current-info"),f.focus()}f.prepend(g).parent()._selectAria().removeClass("done")._enableAria(),h.eq(d.currentIndex).addClass("current").next(".body").addClass("current")}function F(a,b,c,d){for(var e=q(a),f=d;f<c.stepCount;f++){var g=e+V+f,h=e+W+f,i=e+X+f,j=a.find(".title").eq(f)._id(i);a.find(".steps a").eq(f)._id(g)._aria("controls",h).attr("href","#"+i).html(M(b.titleTemplate,{index:f+1,title:j.html()})),a.find(".body").eq(f)._id(h)._aria("labelledby",i)}}function G(a,b){var c=i(a);a.bind("canceled"+c,b.onCanceled),a.bind("contentLoaded"+c,b.onContentLoaded),a.bind("finishing"+c,b.onFinishing),a.bind("finished"+c,b.onFinished),a.bind("init"+c,b.onInit),a.bind("stepChanging"+c,b.onStepChanging),a.bind("stepChanged"+c,b.onStepChanged),b.enableKeyNavigation&&a.bind("keyup"+c,z),a.find(".actions a").bind("click"+c,C)}function H(a,b,c,d){return 0>d||d>=c.stepCount||c.currentIndex===d?!1:(I(a,d),c.currentIndex>d&&(c.currentIndex--,O(a,b,c)),c.stepCount--,l(a,d).remove(),k(a,d).remove(),j(a,d).parent().remove(),0===d&&a.find(".steps li").first().addClass("first"),d===c.stepCount&&a.find(".steps li").eq(d).addClass("last"),F(a,b,c,d),D(a,b,c),!0)}function I(a,b){o(a).splice(b,1)}function J(b,c,d){var e='<{0} class="{1}">{2}</{0}>',f=r(_,c.stepsOrientation),g=f===_.vertical?" vertical":"",h=a(e.format(c.contentContainerTag,"content "+c.clearFixCssClass,b.html())),i=a(e.format(c.stepsContainerTag,"steps "+c.clearFixCssClass,'<ul role="tablist"></ul>')),j=h.children(c.headerTag),k=h.children(c.bodyTag);b.attr("role","application").empty().append(i).append(h).addClass(c.cssClass+" "+c.clearFixCssClass+g),k.each(function(c){K(b,d,a(this),c)}),j.each(function(e){N(b,c,d,a(this),e)}),E(b,c,d),L(b,c,d)}function K(a,b,c,d){var e=q(a),f=e+W+d,g=e+X+d;c._id(f).attr("role","tabpanel")._aria("labelledby",g).addClass("body")._showAria(b.currentIndex===d)}function L(a,b,c){if(b.enablePagination){var d='<{0} class="actions {1}"><ul role="menu" aria-label="{2}">{3}</ul></{0}>',e='<li><a href="#{0}" role="menuitem">{1}</a></li>',f="";b.forceMoveForward||(f+=e.format("previous",b.labels.previous)),f+=e.format("next",b.labels.next),b.enableFinishButton&&(f+=e.format("finish",b.labels.finish)),b.enableCancelButton&&(f+=e.format("cancel",b.labels.cancel)),a.append(d.format(b.actionContainerTag,b.clearFixCssClass,b.labels.pagination,f)),D(a,b,c),A(a,b,c)}}function M(a,c){for(var d=a.match(/#([a-z]*)#/gi),e=0;e<d.length;e++){var f=d[e],g=f.substring(1,f.length-1);c[g]===b&&R("The key '{0}' does not exist in the substitute collection!",g),a=a.replace(f,c[g])}return a}function N(b,c,d,e,f){var g=q(b),h=g+V+f,j=g+W+f,k=g+X+f,l=b.find(".steps > ul"),m=M(c.titleTemplate,{index:f+1,title:e.html()}),n=a('<li role="tab"><a id="'+h+'" href="#'+k+'" aria-controls="'+j+'">'+m+"</a></li>");n._enableAria(c.enableAllSteps||d.currentIndex>f),d.currentIndex>f&&n.addClass("done"),e._id(k).attr("tabindex","-1").addClass("title"),0===f?l.prepend(n):l.find("li").eq(f-1).after(n),0===f&&l.find("li").removeClass("first").eq(f).addClass("first"),f===d.stepCount-1&&l.find("li").removeClass("last").eq(f).addClass("last"),n.children("a").bind("click"+i(b),Q)}function O(b,c,d){c.saveState&&a.cookie&&a.cookie(U+q(b),d.currentIndex)}function P(b,c,d,e,f,g){var h=b.find(".content > .body"),i=r(ab,c.transitionEffect),j=c.transitionEffectSpeed,k=h.eq(e),l=h.eq(f);switch(i){case ab.fade:case ab.slide:var m=i===ab.fade?"fadeOut":"slideUp",o=i===ab.fade?"fadeIn":"slideDown";d.transitionElement=k,l[m](j,function(){var b=a(this)._showAria(!1).parent().parent(),c=n(b);c.transitionElement&&(c.transitionElement[o](j,function(){a(this)._showAria()}).promise().done(g),c.transitionElement=null)});break;case ab.slideLeft:var p=l.outerWidth(!0),q=e>f?-p:p,s=e>f?p:-p;a.when(l.animate({left:q},j,function(){a(this)._showAria(!1)}),k.css("left",s+"px")._showAria().animate({left:0},j)).done(g);break;default:a.when(l._showAria(!1),k._showAria()).done(g)}}function Q(b){b.preventDefault();var c=a(this),d=c.parent().parent().parent().parent(),e=m(d),f=n(d),g=f.currentIndex;if(c.parent().is(":not(.disabled):not(.current)")){var h=c.attr("href"),i=parseInt(h.substring(h.lastIndexOf("-")+1),0);u(d,e,f,i)}return g===f.currentIndex?(j(d,g).focus(),!1):void 0}function R(a){throw arguments.length>1&&(a=a.format(Array.prototype.slice.call(arguments,1))),new Error(a)}function S(a,b){null==b&&R("The argument '{0}' is null or undefined.",a)}a.fn.extend({_aria:function(a,b){return this.attr("aria-"+a,b)},_removeAria:function(a){return this.removeAttr("aria-"+a)},_enableAria:function(a){return null==a||a?this.removeClass("disabled")._aria("disabled","false"):this.addClass("disabled")._aria("disabled","true")},_showAria:function(a){return null==a||a?this.show()._aria("hidden","false"):this.hide()._aria("hidden","true")},_selectAria:function(a){return null==a||a?this.addClass("current")._aria("selected","true"):this.removeClass("current")._aria("selected","false")},_id:function(a){return a?this.attr("id",a):this.attr("id")}}),String.prototype.format||(String.prototype.format=function(){for(var b=1===arguments.length&&a.isArray(arguments[0])?arguments[0]:arguments,c=this,d=0;d<b.length;d++){var e=new RegExp("\\{"+d+"\\}","gm");c=c.replace(e,b[d])}return c});var T=0,U="jQu3ry_5teps_St@te_",V="-t-",W="-p-",X="-h-",Y="Index out of range.",Z="One or more corresponding step {0} are missing.";a.fn.steps=function(b){return a.fn.steps[b]?a.fn.steps[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?void a.error("Method "+b+" does not exist on jQuery.steps"):w.apply(this,arguments)},a.fn.steps.add=function(a){var b=n(this);return x(this,m(this),b,b.stepCount,a)},a.fn.steps.destroy=function(){return g(this,m(this))},a.fn.steps.finish=function(){h(this,n(this))},a.fn.steps.getCurrentIndex=function(){return n(this).currentIndex},a.fn.steps.getCurrentStep=function(){return p(this,n(this).currentIndex)},a.fn.steps.getStep=function(a){return p(this,a)},a.fn.steps.insert=function(a,b){return x(this,m(this),n(this),a,b)},a.fn.steps.next=function(){return s(this,m(this),n(this))},a.fn.steps.previous=function(){return t(this,m(this),n(this))},a.fn.steps.remove=function(a){return H(this,m(this),n(this),a)},a.fn.steps.setStep=function(){throw new Error("Not yet implemented!")},a.fn.steps.skip=function(){throw new Error("Not yet implemented!")};var $=a.fn.steps.contentMode={html:0,iframe:1,async:2},_=a.fn.steps.stepsOrientation={horizontal:0,vertical:1},ab=a.fn.steps.transitionEffect={none:0,fade:1,slide:2,slideLeft:3},bb=a.fn.steps.stepModel={title:"",content:"",contentUrl:"",contentMode:$.html,contentLoaded:!1},cb=a.fn.steps.defaults={headerTag:"h1",bodyTag:"div",contentContainerTag:"div",actionContainerTag:"div",stepsContainerTag:"div",cssClass:"wizard",clearFixCssClass:"clearfix",stepsOrientation:_.horizontal,titleTemplate:'<span class="number">#index#.</span> #title#',loadingTemplate:'<span class="spinner"></span> #text#',autoFocus:!1,enableAllSteps:!1,enableKeyNavigation:!0,enablePagination:!0,suppressPaginationOnFocus:!0,enableContentCache:!0,enableCancelButton:!1,enableFinishButton:!0,preloadContent:!1,showFinishButtonAlways:!1,forceMoveForward:!1,saveState:!1,startIndex:0,transitionEffect:ab.none,transitionEffectSpeed:200,onStepChanging:function(){return!0},onStepChanged:function(){},onCanceled:function(){},onFinishing:function(){return!0},onFinished:function(){},onContentLoaded:function(){},onInit:function(){},labels:{cancel:"Cancel",current:"current step:",pagination:"Pagination",finish:"Finish",next:"Next",previous:"Previous",loading:"Loading ..."}}}(jQuery); \ No newline at end of file diff --git a/templates/Makefile.am b/templates/Makefile.am index e1a743a..48ea358 100644 --- a/templates/Makefile.am +++ b/templates/Makefile.am @@ -4,7 +4,6 @@ nobase_templates_DATA = \ web/errors.tt2.html \ web/home.tt2.html \ web/index.tt2.html \ - web/index-nobanner.tt2.html \ web/select_sp.tt2.html \ web/select_email.tt2.html \ web/complete_challenge.tt2.html \ diff --git a/templates/web/complete_challenge.tt2.html b/templates/web/complete_challenge.tt2.html index a3d73c3..7f1bb34 100644 --- a/templates/web/complete_challenge.tt2.html +++ b/templates/web/complete_challenge.tt2.html @@ -1,13 +1,25 @@ -<h2>[% lh.maketext("Complete email challenge") %]</h2> -<p> - [% lh.maketext("An email challenge including a validation token has been emailed to you at [_1].", email) %] - [% lh.maketext("Please copy and paste the validation token in the form below to proof that you are administrator of this service.") %] -</p> - -<fieldset> - <label for="token">[% lh.maketext("Please provide the validation token here:") %]</label> - <input name="token" value="" id="token" type="text" class="required error"/> - <input type="hidden" name="entityid" value="[% entityid %]" id="entityid"/> - <input type="hidden" name="email" value="[% email %]" id="email"/> -</fieldset> +<div class="wizard clearfix vertical"> + <div class="steps clearfix"> + <ol> + <li class="done">[% lh.maketext("Select your service") %]</li> + <li class="done">[% lh.maketext("Select your email address") %]</li> + <li class="current">[% lh.maketext("Complete email challenge") %]</li> + </ol> + </div> + <div class="content clearfix"> + <h2>[% lh.maketext("Complete email challenge") %]</h2> + <p> + [% lh.maketext("An email challenge including a validation token has been emailed to you at [_1].", email) %] + [% lh.maketext("Please copy and paste the validation token in the form below to proof that you are administrator of this service.") %] + </p> + <form action="[% env.SCRIPT_NAME %]" method="get"> + <label for="token">[% lh.maketext("Please provide the validation token here:") %]</label> + <input name="token" value="" id="token" type="text" class="required error"/> + <input type="hidden" name="entityid" value="[% entityid %]"/> + <input type="hidden" name="email" value="[% email %]"/> + <button class="button" type="submit" name="action" value="select_email">[% lh.maketext("Previous") %]</button> + <button class="button" type="submit" name="action" value="create_accounts">[% lh.maketext("Next") %]</button> + </form> + </div> +</div> diff --git a/templates/web/index-nobanner.tt2.html b/templates/web/index-nobanner.tt2.html deleted file mode 100644 index 9539198..0000000 --- a/templates/web/index-nobanner.tt2.html +++ /dev/null @@ -1,3 +0,0 @@ -<DOCTYPE! html> - -[% INCLUDE $content %] diff --git a/templates/web/index.tt2.html b/templates/web/index.tt2.html index 3ff97cf..f0849f9 100644 --- a/templates/web/index.tt2.html +++ b/templates/web/index.tt2.html @@ -13,12 +13,10 @@ <link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="jquery-3.3.1.min.js"></script> - <script type="text/javascript" src="jquery-steps-1.1.0.min.js"></script> <script type="text/javascript" src="jquery-ui-1.12.1/jquery-ui.min.js"></script> <script type="text/javascript" src="jquery-validation-1.17.0.min.js"></script> <title>eduGAIN Access Check</title> - </head> <body> @@ -30,7 +28,7 @@ <h1><a href="[% app.url %]">eduGAIN Access Check</a></h1> </header> - <main> + <main class="row"> [% INCLUDE $content %] </main> diff --git a/templates/web/select_email.tt2.html b/templates/web/select_email.tt2.html index 144535a..0c8b32a 100644 --- a/templates/web/select_email.tt2.html +++ b/templates/web/select_email.tt2.html @@ -1,23 +1,34 @@ -<h2>[% lh.maketext("Select your email address") %]</h2> -<p>[% lh.maketext("Before you can create test accounts at this Identity Provider, we need to ensure you are a legitimate administrator of '[_1]'.", provider.displayname) %]</p> +<div class="wizard clearfix"> + <div class="steps clearfix"> + <ol> + <li class="done">[% lh.maketext("Select your service") %]</li> + <li class="current">[% lh.maketext("Select your email address") %]</li> + <li class="disabled">[% lh.maketext("Complete email challenge") %]</li> + </ol> + </div> + + <div class="content clearfix"> + <h2>[% lh.maketext("Select your email address") %]</h2> + <p>[% lh.maketext("Before you can create test accounts at this Identity Provider, we need to ensure you are a legitimate administrator of '[_1]'.", provider.displayname) %]</p> -<fieldset class="scrollable"> [% IF provider.contacts.defined %] - <p>[% lh.maketext("Select the email address where an email challenge can be sent to validate your identity:") %]</p> - <div class="radio_inline"> + <form action="[% env.SCRIPT_NAME %]" method="get"> + <p>[% lh.maketext("Select the email address where an email challenge can be sent to validate your identity:") %]</p> [% FOREACH email IN provider.contacts.sort %] - <input id="[% email %]" name="email" value="[% email %]" type="radio" class="required"/> - <label for="[% email %]">[% email %]</label> - <br/> + <input id="[% email %]" name="email" value="[% email %]" type="radio" class="required"/> + <label for="[% email %]">[% email %]</label> + <br/> [% END %] - <input type="hidden" name="entityid" value="[% provider.entityid %]" id="entityid"/> - </div> - <p>[% lh.maketext("Those email addresses have been extracted from your service metadata.") %]</p> - + <p>[% lh.maketext("Those email addresses have been extracted from your service metadata.") %]</p> + <input type="hidden" name="entityid" value="[% provider.entityid %]"/> + <button class="button" type="submit" name="action" value="select_sp">[% lh.maketext("Previous") %]</button> + <button class="button" type="submit" name="action" value="complete_challenge">[% lh.maketext("Next") %]</button> + </form> [% ELSE %] - <p> - [% lh.maketext("No ContactPerson element could be found in your service metadata, therefore we are unable to provide test accounts for this service.") %] - [% lh.maketext("Please contact your federation administrators to add needed information to the metadata.") %] - </p> + <p> + [% lh.maketext("No ContactPerson element could be found in your service metadata, therefore we are unable to provide test accounts for this service.") %] + [% lh.maketext("Please contact your federation administrators to add needed information to the metadata.") %] + </p> [% END %] -</fieldset> + </div> +</div> diff --git a/templates/web/select_sp.tt2.html b/templates/web/select_sp.tt2.html index d8decfa..551e602 100644 --- a/templates/web/select_sp.tt2.html +++ b/templates/web/select_sp.tt2.html @@ -1,85 +1,37 @@ -<script type="text/javascript"> -$( document ).ready(function() { - - var form = $("#create-account-form").show(); - - form.steps({ - headerTag: "h3", - bodyTag: "fieldset", - stepsOrientation: "vertical", - transitionEffect: "slideLeft", - onStepChanging: function (event, currentIndex, newIndex) - { - - // Trigger loading of the 'select_sp' with the selected SP entityid as parameter - // Result gets included in the next tab - if (currentIndex === 0 && newIndex === 1) - { - form.steps("remove", 1); - form.steps("insert", 1, { - title: "[% lh.maketext("Select your email address") %]", - contentMode: "async", - contentUrl: "[% app.url %]?action=select_email&entityid="+ - encodeURIComponent($('#entityid').val()) - }); - } - - // Trigger loading of the 'generate_token' with the selected SP entityid as parameter - // Result gets included in the next tab - if (currentIndex === 1 && newIndex === 2) - { - form.steps("remove", 2); - form.steps("insert", 2, { - title: "[% lh.maketext("Complete email challenge") %]", - contentMode: "async", - contentUrl: "[% app.url %]?action=complete_challenge&entityid="+ - encodeURIComponent($('#entityid').val())+"&email="+encodeURIComponent($("input:checked[name='email']").val()) - }); - } - - // Trigger loading of the 'validate_token' with the list of test accounts created - // Result gets included in the next tab - if (currentIndex === 2 && newIndex === 3) - { - window.location="[% app.url %]?action=create_accounts&entityid="+ - encodeURIComponent($('#entityid').val())+"&token="+encodeURIComponent($('#token').val()) + - "&email="+encodeURIComponent($('#email').val()); - } - - // Allways allow previous action even if the current form is not valid! - if (currentIndex > newIndex) - { - return true; - } - // Needed in some cases if the user went back (clean up) - if (currentIndex < newIndex) - { - // To remove error styles - form.find(".body:eq(" + newIndex + ") label.error").remove(); - form.find(".body:eq(" + newIndex + ") .error").removeClass("error"); - } - form.validate().settings.ignore = ":disabled,:hidden"; - return form.valid(); - - }, - onStepChanged: function (event, currentIndex, priorIndex) - { - }, - onFinishing: function (event, currentIndex) - { - form.validate().settings.ignore = ":disabled"; - return form.valid(); - }, - onFinished: function (event, currentIndex) - { - alert("Submitted!"); - } - }); +<div class="wizard clearfix"> + <div class="steps clearfix"> + <ol> + <li class="current">[% lh.maketext("Select your service") %]</li> + <li class="disabled">[% lh.maketext("Select your email address") %]</li> + <li class="disabled">[% lh.maketext("Complete email challenge") %]</li> + </ol> + </div> + + <div class="content clearfix"> + <h2>[% lh.maketext("Select your service") %]</h2> + <p> + [% lh.maketext("Please select the service that you want to test in the list below.") %] + [% lh.maketext("You must be an administrator of that service to continue afterwards.") %] + </p> - form.validate({ - errorPlacement: function errorPlacement(error, element) { element.before(error); }, - }); + <form action="[% env.SCRIPT_NAME %]" method="get"> + <label for="entityid">[% lh.maketext("Type the name or entityID of service to test:") %]</label> + <br> + <select id="entityid" name="entityid" class="required"> + <option value=""></option> + [% FOREACH entity IN metadata.sort('display_name') %] + <option value="[% entity.entityid %]">[% entity.display_name %]</option> + [% END %] + </select> + <p>[% lh.maketext("Only Service Providers included in eduGAIN metadata are included in the list.") %]</p> + <button type="submit" class="button disabled" name="action" value="">[% lh.maketext("Previous") %]</button> + <button type="submit" class="button" name="action" value="select_email">[% lh.maketext("Next") %]</button> + </form> + </div> +</div> +<script type="text/javascript"> +$( document ).ready(function() { $.widget( "custom.combobox", { _create: function() { this.wrapper = $( "<span>" ) @@ -211,40 +163,3 @@ $( document ).ready(function() { $( "#entityid" ).combobox(); }); </script> - - -<form id ="create-account-form" - action="[% env.SCRIPT_NAME %]" - method="POST"> - - <h3>[% lh.maketext("Select your service") %]</h3> - <fieldset> - <h2>[% lh.maketext("Select your service") %]</h2> - <p> - [% lh.maketext("Please select the service that you want to test in the list below.") %] - [% lh.maketext("You must be an administrator of that service to continue afterwards.") %] - </p> - - <label for="entityid">[% lh.maketext("Type the name or entityID of service to test:") %]</label> - <br> - <select id="entityid" name="entityid" class="required"> - <option value=""></option> - [% FOREACH entity IN metadata.sort('display_name') %] - <option value="[% entity.entityid %]">[% entity.display_name %]</option> - [% END %] - </select> - <p>[% lh.maketext("Only Service Providers included in eduGAIN metadata are included in the list.") %]</p> - </fieldset> - - <h3>[% lh.maketext("Select your email address") %]</h3> - <fieldset> - <div data-mode="async" data-url="/rest/service/0"></div> - </fieldset> - - <h3>[% lh.maketext("Complete email challenge") %]</h3> - <fieldset></fieldset> - - <h3>[% lh.maketext("Test accounts") %]</h3> - <fieldset></fieldset> - -</form> -- GitLab