<commit_before>﻿@*******************************************************************************************************
//  SelectTheme.cshtml - Gbtc
//
//  Copyright © 2016, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
//  file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://opensource.org/licenses/MIT
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  01/22/2016 - <NAME>
//       Generated original version of source code.
//
//*****************************************************************************************************@
@using System
@using System.Collections.Generic
@using System.Collections.Specialized
@using System.Linq
@using System.Net.Http
@using GSF
@using GSF.Configuration
@using GSF.IO
@using GSF.Web
@using GSF.Web.Hosting
@using openECAClient
@using openECAClient.Model
@using RazorEngine.Templating
@inherits TemplateBase<AppModel>
@{
    Layout = "Layout.cshtml";
    ViewBag.Title = "Select Theme";

    HttpRequestMessage request = ViewBag.Request;
    Dictionary<string, string> parameters = request.QueryParameters();

    string selectedTheme;
    parameters.TryGetValue("selectedTheme", out selectedTheme);

    string currentTheme = FilePath.GetFileName(Model.Global.BootstrapTheme).Trim();
    string[] fileList = FilePath.GetFileList(string.Format("{0}Content/bootstrap-theme-*.css", FilePath.AddPathSuffix(WebServer.Default.WebRootPath))).Select(fileName => FilePath.GetFileName(fileName).Trim()).ToArray();

    if (selectedTheme == null) {
        selectedTheme = currentTheme;
    }
    else {
        CategorizedSettingsElementCollection systemSettings = ConfigurationFile.Current.Settings["systemSettings"];
        systemSettings["BootstrapTheme"].Value = "Content/" + selectedTheme;
        Model.Global.BootstrapTheme = systemSettings["BootstrapTheme"].Value;
        ConfigurationFile.Current.Save();
    }
}
<div class="well">
    <form role="form">
        <div class="form-group">
            <label for="selectBootstrapTheme">Selected Bootstrap Theme:</label>
            <select class="form-control" id="selectBootstrapTheme" name="selectedTheme">
                <option value="bootstrap-theme.css"@(string.Compare(selectedTheme, "bootstrap-theme.css", StringComparison.OrdinalIgnoreCase) == 0 ? " selected" : "")>Default Bootstrap Theme</option>
                @foreach (string theme in fileList) {
                    <option value="@theme"@(string.Compare(selectedTheme, theme, StringComparison.OrdinalIgnoreCase) == 0 ? " selected" : "")>@(FilePath.GetFileNameWithoutExtension(theme).Substring(16).ToTitleCase())</option>
                }
            </select>
            <br />
            <button class="btn btn-primary pull-right" onclick="$.post('@ViewBag.Request.RequestUri.AbsolutePath', { 'selectedTheme': $('#selectBootstrapTheme option:selected').text() });">Apply</button>
            <br />
        </div><commit_msg>Fixed issue with select theme page<commit_after>﻿@*******************************************************************************************************
//  SelectTheme.cshtml - Gbtc
//
//  Copyright © 2016, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
//  file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://opensource.org/licenses/MIT
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  01/22/2016 - <NAME>
//       Generated original version of source code.
//
//*****************************************************************************************************@
@using System
@using System.Collections.Generic
@using System.Collections.Specialized
@using System.Linq
@using System.Net.Http
@using GSF
@using GSF.Configuration
@using GSF.IO
@using GSF.Web
@using GSF.Web.Hosting
@using openECAClient
@using openECAClient.Model
@using RazorEngine.Templating
@inherits TemplateBase<AppModel>
@{
    Layout = "Layout.cshtml";
    ViewBag.Title = "Select Theme";

    HttpRequestMessage request = ViewBag.Request;
    Dictionary<string, string> parameters = request.QueryParameters();

    string selectedTheme;
    parameters.TryGetValue("selectedTheme", out selectedTheme);

    string currentTheme = FilePath.GetFileName(Model.Global.BootstrapTheme).Trim();
    string[] fileList = FilePath.GetFileList(string.Format("{0}Content/bootstrap-theme-*.css", FilePath.AddPathSuffix(WebServer.Default.Options.WebRootPath))).Select(fileName => FilePath.GetFileName(fileName).Trim()).ToArray();

    if (selectedTheme == null) {
        selectedTheme = currentTheme;
    }
    else {
        CategorizedSettingsElementCollection systemSettings = ConfigurationFile.Current.Settings["systemSettings"];
        systemSettings["BootstrapTheme"].Value = "Content/" + selectedTheme;
        Model.Global.BootstrapTheme = systemSettings["BootstrapTheme"].Value;
        ConfigurationFile.Current.Save();
    }
}
<div class="well">
    <form role="form">
        <div class="form-group">
            <label for="selectBootstrapTheme">Selected Bootstrap Theme:</label>
            <select class="form-control" id="selectBootstrapTheme" name="selectedTheme">
                <option value="bootstrap-theme.css"@(string.Compare(selectedTheme, "bootstrap-theme.css", StringComparison.OrdinalIgnoreCase) == 0 ? " selected" : "")>Default Bootstrap Theme</option>
                @foreach (string theme in fileList) {
                    <option value="@theme"@(string.Compare(selectedTheme, theme, StringComparison.OrdinalIgnoreCase) == 0 ? " selected" : "")>@(FilePath.GetFileNameWithoutExtension(theme).Substring(16).ToTitleCase())</option>
                }
            </select>
            <br />
            <button class="btn btn-primary pull-right" onclick="$.post('@ViewBag.Request.RequestUri.AbsolutePath', { 'selectedTheme': $('#selectBootstrapTheme option:selected').text() });">Apply</button>
            <br />
        </div>
{'fraction_non_alphanumeric': 0.1936586032526992, 'fraction_numerical': 0.004646713133798005, 'mean_word_length': 3.5033846153846153, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4154446', 'n_tokens_mistral': 1829, 'n_tokens_neox': 1774, 'n_words': 492}