main-authorize.js revision ce00815c8f51bf72def07cc039e415ac44ef1e2d
0N/A/**
2362N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0N/A *
0N/A * Copyright (c) 2014-2015 ForgeRock AS. All rights reserved.
0N/A *
0N/A * The contents of this file are subject to the terms
0N/A * of the Common Development and Distribution License
0N/A * (the License). You may not use this file except in
0N/A * compliance with the License.
0N/A *
0N/A * You can obtain a copy of the License at
0N/A * http://forgerock.org/license/CDDLv1.0.html
0N/A * See the License for the specific language governing
0N/A * permission and limitations under the License.
0N/A *
0N/A * When distributing Covered Code, include this CDDL
0N/A * Header Notice in each file and include the License file
0N/A * at http://forgerock.org/license/CDDLv1.0.html
2362N/A * If applicable, add the following below the CDDL Header,
2362N/A * with the fields enclosed by brackets [] replaced by
2362N/A * your own identifying information:
0N/A * "Portions Copyrighted [year] [name of copyright owner]"
0N/A */
0N/A
0N/Arequire.config({
0N/A
0N/A map: {
0N/A "*" : {
0N/A "ThemeManager" : "org/forgerock/openam/ui/common/util/ThemeManager",
0N/A // TODO: Remove this when there are no longer any references to the "underscore" dependency
0N/A "underscore" : "lodash"
0N/A }
0N/A },
0N/A
0N/A paths: {
0N/A "lodash": "libs/lodash-3.10.1-min",
0N/A "handlebars": "libs/handlebars-3.0.3-min",
0N/A "i18next": "libs/i18next-1.7.3-min",
0N/A "jquery": "libs/jquery-2.1.1-min",
0N/A "text": "libs/text"
0N/A },
0N/A
0N/A shim: {
0N/A "handlebars": {
0N/A exports: "handlebars"
0N/A },
0N/A "i18next": {
0N/A deps: ["jquery", "handlebars"],
0N/A exports: "i18next"
0N/A },
0N/A "underscore": {
0N/A exports: "_"
0N/A }
0N/A }
0N/A});
0N/A
0N/Arequire([
0N/A "jquery",
0N/A "underscore",
0N/A "handlebars",
0N/A "org/forgerock/commons/ui/common/main/Configuration",
0N/A "org/forgerock/openam/ui/common/util/Constants",
0N/A "text!templates/user/AuthorizeTemplate.html",
0N/A "text!templates/common/LoginBaseTemplate.html",
0N/A "text!templates/common/FooterTemplate.html",
0N/A "text!templates/common/LoginHeaderTemplate.html",
0N/A "org/forgerock/commons/ui/common/main/i18nManager",
0N/A "ThemeManager"
0N/A], function ($, _, HandleBars, Configuration, Constants, AuthorizeTemplate,
0N/A LoginBaseTemplate, FooterTemplate, LoginHeaderTemplate, i18nManager, ThemeManager) {
0N/A
0N/A // Helpers for the code that hasn't been properly migrated to require these as explicit dependencies:
0N/A window.$ = $;
0N/A window._ = _;
0N/A
0N/A var formTemplate,
0N/A baseTemplate,
0N/A footerTemplate,
0N/A loginHeaderTemplate,
0N/A data = window.pageData;
0N/A
0N/A i18nManager.init({
0N/A paramLang: {
0N/A locale: data.locale
0N/A },
0N/A defaultLang: Constants.DEFAULT_LANGUAGE,
0N/A nameSpace: "authorize"
0N/A });
0N/A
0N/A Configuration.globalData = { realm : data.realm };
0N/A
0N/A ThemeManager.getTheme().always(function (theme) {
0N/A data.theme = theme;
0N/A baseTemplate = HandleBars.compile(LoginBaseTemplate);
0N/A formTemplate = HandleBars.compile(AuthorizeTemplate);
0N/A footerTemplate = HandleBars.compile(FooterTemplate);
0N/A loginHeaderTemplate = HandleBars.compile(LoginHeaderTemplate);
0N/A
0N/A $("#wrapper").html(baseTemplate(data));
0N/A $("#footer").html(footerTemplate(data));
0N/A $("#loginBaseLogo").html(loginHeaderTemplate(data));
0N/A $("#content").html(formTemplate(data)).find(".panel-heading")
0N/A .click(function () {
0N/A $(this).toggleClass("expanded").next(".panel-collapse").slideToggle();
0N/A });
0N/A
0N/A });
0N/A
0N/A});
0N/A