<commit_before>/*
 * Copyright (C) 2013 Vanderbilt University, All rights reserved.
 * 
 * Author: <NAME>
 */

"use strict";

define(['clientUtil',
    'js/Constants',
    'js/Utils/METAAspectHelper',
    'js/Utils/ExportManager',
    'js/Dialogs/Projects/ProjectsDialog',
    'js/Dialogs/Commit/CommitDialog',
    'js/Dialogs/ProjectRepository/ProjectRepositoryDialog'], function (util,
                                                 CONSTANTS,
                                                                       METAAspectHelper,
                                                                       ExportManager,
                                                                       ProjectsDialog,
                                                                       CommitDialog,
                                                                       ProjectRepositoryDialog) {

    var DefaultToolbar;

    DefaultToolbar = function (client) {
        this._client = client;

        this._initialize();
    };

    DefaultToolbar.prototype._initialize = function () {
        var toolbar = WebGMEGlobal.Toolbar,
            layoutToLoad = util.getURLParameterByName('layout'),
            _client = this._client,
            projectsButtonDisabledForLayouts = ['VehicleForgeLayout'];

        //#1: Projects
        if (projectsButtonDisabledForLayouts.indexOf(layoutToLoad) === -1) {
            toolbar.addButton({ "title": "Projects...",
                "icon": "icon-folder-open",
                "clickFn": function (/*data*/) {
                    var pd = new ProjectsDialog(_client);
                    pd.show();
                }});
        }

        //#2: Project repository...
        toolbar.addButton({ "title": "Project repository...",
            "icon": "icon-road",
            "clickFn": function (/*data*/) {
                var prd = new ProjectRepositoryDialog(_client);
                prd.show();
            } });

        toolbar.addButton({ "title": "Commit...",
            "icon": "icon-share-alt",
            "clickFn": function (/*data*/) {
                var cd = new CommitDialog(_client);
                cd.show();
            } });

        toolbar.addSeparator();

        //EXPORT & IMPORT

        toolbar.addButton({ "title": "Export project...",
            "icon": "icon-share",
            "clickFn": function (/*data*/) {
                ExportManager.export(CONSTANTS.PROJECT_ROOT_ID);
            } });

        toolbar.addSeparator();

        //META ASPECT helper parts
        toolbar.addButton({ "title": "Display META entries...",
            "icon": "icon-barcode",
            "clickFn": function (/*data*/) {
                alert('METAAspectTypes: \n' + JSON.stringify(METAAspectHelper.getMETAAspectTypesSorted(), undefined, 2));
            }});

        toolbar.addButton({ "title": "Download Domain's META javascript...",
            "icon": "icon-download-alt",
            "clickFn": function (/*data*/) {
                var meta = METAAspectHelper.generateMETAAspectJavaScript();

                if (meta && !_.isEmpty(meta)) {
                    var pom = document.createElement('a');
                    pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(meta.content));
                    pom.setAttribute('download', meta.fileName);
                    pom.click();
                } else {<commit_msg>add button to DOM otherwise will not work in FF<commit_after>/*
 * Copyright (C) 2013 Vanderbilt University, All rights reserved.
 * 
 * Author: <NAME>
 */

"use strict";

define(['clientUtil',
    'js/Constants',
    'js/Utils/METAAspectHelper',
    'js/Utils/ExportManager',
    'js/Dialogs/Projects/ProjectsDialog',
    'js/Dialogs/Commit/CommitDialog',
    'js/Dialogs/ProjectRepository/ProjectRepositoryDialog'], function (util,
                                                 CONSTANTS,
                                                                       METAAspectHelper,
                                                                       ExportManager,
                                                                       ProjectsDialog,
                                                                       CommitDialog,
                                                                       ProjectRepositoryDialog) {

    var DefaultToolbar;

    DefaultToolbar = function (client) {
        this._client = client;

        this._initialize();
    };

    DefaultToolbar.prototype._initialize = function () {
        var toolbar = WebGMEGlobal.Toolbar,
            layoutToLoad = util.getURLParameterByName('layout'),
            _client = this._client,
            projectsButtonDisabledForLayouts = ['VehicleForgeLayout'];

        //#1: Projects
        if (projectsButtonDisabledForLayouts.indexOf(layoutToLoad) === -1) {
            toolbar.addButton({ "title": "Projects...",
                "icon": "icon-folder-open",
                "clickFn": function (/*data*/) {
                    var pd = new ProjectsDialog(_client);
                    pd.show();
                }});
        }

        //#2: Project repository...
        toolbar.addButton({ "title": "Project repository...",
            "icon": "icon-road",
            "clickFn": function (/*data*/) {
                var prd = new ProjectRepositoryDialog(_client);
                prd.show();
            } });

        toolbar.addButton({ "title": "Commit...",
            "icon": "icon-share-alt",
            "clickFn": function (/*data*/) {
                var cd = new CommitDialog(_client);
                cd.show();
            } });

        toolbar.addSeparator();

        //EXPORT & IMPORT

        toolbar.addButton({ "title": "Export project...",
            "icon": "icon-share",
            "clickFn": function (/*data*/) {
                ExportManager.export(CONSTANTS.PROJECT_ROOT_ID);
            } });

        toolbar.addSeparator();

        //META ASPECT helper parts
        toolbar.addButton({ "title": "Display META entries...",
            "icon": "icon-barcode",
            "clickFn": function (/*data*/) {
                alert('METAAspectTypes: \n' + JSON.stringify(METAAspectHelper.getMETAAspectTypesSorted(), undefined, 2));
            }});

        toolbar.addButton({ "title": "Download Domain's META javascript...",
            "icon": "icon-download-alt",
            "clickFn": function (/*data*/) {
                var meta = METAAspectHelper.generateMETAAspectJavaScript();

                if (meta && !_.isEmpty(meta)) {
                    var pom = document.createElement('a');
                    pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(meta.content));
                    pom.setAttribute('download', meta.fileName);
                    $('body').append($(pom));
                    pom.click();
                    $(pom).remove();
                } else {
{'fraction_non_alphanumeric': 0.1286474054908725, 'fraction_numerical': 0.00258732212160414, 'mean_word_length': 1.4009661835748792, 'pattern_counts': {'":': 36, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 40, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5924497', 'n_tokens_mistral': 1739, 'n_tokens_neox': 1643, 'n_words': 321}