<commit_before>/*
 *  Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 *  WSO2 Inc. licenses this file to you under the Apache License,
 *  Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 *
 */
/**
 * The ui namespace cobtains methods which allow a generic page object to be created.
 * @namespace
 * @example 
 *     var ui = require('rxt').ui;
 *     var page = ui.buildPage(session,request);
 * @requires store
 */
var ui = {};
(function(ui, core, asset, app, constants) {
    var log = new Log('rxt.ui');
    var DEFAULT_TITLE = "Empty";
    /**
     * Returns a generic page object
     * @param  {Object} options The set of dynamic values a page object can start off with.
     * @return {Object}         A page object
     */
    var genericPage = function(options) {
        return {
            rxt: {},
            cuser: {
                username: options.username,
                isAnon: options.isAnon,
                tenantId:options.tenantId
            },
            assets: {},
            leftNav: [],
            ribbon: {},
            assetMeta: {},
            security: {},
            features: {},
            meta: {
                pageName: options.pageName,
                currentPage: options.currentPage,
                title: options.title,
                landingPage: options.landingPage,
                applicationTitle: options.applicationTitle
            }
        };
    };<commit_msg>Added tenant domain to the page object<commit_after>/*
 *  Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 *  WSO2 Inc. licenses this file to you under the Apache License,
 *  Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 *
 */
/**
 * The ui namespace cobtains methods which allow a generic page object to be created.
 * @namespace
 * @example 
 *     var ui = require('rxt').ui;
 *     var page = ui.buildPage(session,request);
 * @requires store
 */
var ui = {};
(function(ui, core, asset, app, constants) {
    var log = new Log('rxt.ui');
    var DEFAULT_TITLE = "Empty";

    var resolveTenantDomain = function(tenantId) {
        var server = require('carbon').server;
        var opts = {};
        opts.tenantId = tenantId ||  server.superTenant.tenantId;
        return server.tenantDomain(opts);
    };

    var resolveSuperTenantDomain = function(tenantId){
        var server = require('carbon').server;
        tenantId = tenantId || server.superTenant.tenantId;
        return (tenantId === server.superTenant.tenantId);
    };

    /**
     * Returns a generic page object
     * @param  {Object} options The set of dynamic values a page object can start off with.
     * @return {Object}         A page object
     */
    var genericPage = function(options) {
        var tenantDomain = resolveTenantDomain(options.tenantId);
        return {
            rxt: {},
            cuser: {
                username: options.username,
                isAnon: options.isAnon,
                tenantId:options.tenantId,
                tenantDomain:resolveTenantDomain(options.tenantId),
                isSuperTenant:resolveSuperTenantDomain(options.tenantId)
            },
            assets: {},
            leftNav: [],
            ribbon: {},
            assetMeta: {},
            security: {},
            features: {},
            meta: {
                pageName: options.pageName,
                currentPage: options.currentPage,
                title: options.title,
                landingPage: options.landingPage,
                applicationTitle: options.applicationTitle
            }
        };
    };
{'fraction_non_alphanumeric': 0.09943305713039687, 'fraction_numerical': 0.0065416484954208464, 'mean_word_length': 2.1098305084745763, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3943519', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1222, 'n_words': 406}