4485 lines · 209.6 KB · Text
RawDownload
@*******************************************************************************************************//  AddSynchrophasorDevice.cshtml - Gbtc////  Copyright © 2019, 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://  ----------------------------------------------------------------------------------------------------//  02/18/2019 - J. Ritchie Carroll//       Generated original version of source code.////******************************************************************************************************//  To use in ASP.NET project, include a AddSynchrophasorDevice.cshtml view with the following:////  @using GSF.Web//  @section StyleSheets{@Html.Raw(ViewBag.StyleSheetsSection?.ToString())}//  @Html.RenderResource("PhasorWebUI.Views.AddSynchrophasorDevice.cshtml")//  @section Scripts{@Html.Raw(ViewBag.ScriptsSection?.ToString())}////******************************************************************************************************//  To use in self-hosted web project, include a AddSynchrophasorDevice.cshtml view with the following:////  @using GSF.Web.Model//  @using <MyAppNameSpace>.Model//  @inherits ExtendedTemplateBase<AppModel>//  @section StyleSheets{@Html.Raw(ViewBag.StyleSheetsSection.ToString())}//  @{Layout = "Layout.cshtml";}//  @Html.RenderResource("PhasorWebUI.AddSynchrophasorDevice.cshtml")//  @section Scripts{@Html.Raw(ViewBag.ScriptsSection.ToString())}//*****************************************************************************************************@@* ReSharper disable UnknownCssClass *@@* ReSharper disable Html.PathError *@@* ReSharper disable InlineOutVariableDeclaration *@@* ReSharper disable ArrangeAccessorOwnerBody *@@using System@using System.Collections.Generic@using System.ComponentModel@using System.Net.Http@using System.Text.RegularExpressions@using System.Threading@using GSF.ComponentModel@using GSF.ComponentModel.DataAnnotations@using GSF.Identity@using GSF.Security@using GSF.Web@using GSF.Web.Model@using GSF.Web.Shared@inherits ExtendedTemplateBase@{    // Layout will depend on rendering environment, so do not specify one    ViewBag.HidePageTitle = true;    ViewBag.Title = "New Device Commissioning Wizard";     HttpRequestMessage request = ViewBag.Request;    Dictionary<string, string> parameters = request.QueryParameters();    string parameter;    int deviceID;     if (!parameters.TryGetValue("DeviceID", out parameter) || !int.TryParse(parameter, out deviceID)) {        deviceID = 0;    }     bool userIsEditor = UserIsEditor();}@section StyleSheets {    <link href="@Resources.Root/Shared/Content/jquery-ui.css" rel="stylesheet">    <link href="@Resources.Root/Shared/Content/select2.css" rel="stylesheet">    <link href="@Resources.Root/Shared/Content/select2-bootstrap.css" rel="stylesheet">    <style>        html, body {            height: 100%;        }                .tabs-nohdr {            padding: 0;            background: none;            border-width: 0;        }                 .tabs-nohdr .ui-tabs-nav {            padding: 0;            background: transparent;            border: none;        }         .tabs-nohdr .ui-tabs-panel {            border: none;            padding: 0;            margin: 0;        }         #tabs {            border: none;            padding: 0;        }         #tabs ul {            border: none;            background: none;        }         #tabs ul li {            outline: none;        }         #tabs ul li:nth-child(1) {            margin-left: -3px;        }         #tabs ul li a {            outline: none;            padding: 2px 8px;        }         .ui-tabs-nav li.ui-tabs-active,        .ui-tabs-nav li:hover {            background: #337ab7;        }         #tab1 {            padding: 10px 0px;        }         #tab2 {            padding: 5px 0px;        }         .input-group-btn button {            font-size: 14px;        }         span.table-cell-text {            display: table-cell;            vertical-align: middle;        }         span.org-label {            font-size: 9px;            display: block;            text-align: right;            margin-top: -5px;            margin-right: 2px;            margin-bottom: -1px;            color: darkgray;        }         span.tag-name-label {            font-size: 10.5px;            display: block;            text-align: left;            margin-top: -1px;            margin-left: 2px;            margin-bottom: -5px;            color: darkslategray;        }         span.tag-name {            font-size: 10px;            position: absolute;            margin-top: -9px;            margin-left: 52px;            white-space: nowrap;            color: darkslategray;            -webkit-text-stroke-width: thin;        }         span.sub-text {            font-size: x-small;            vertical-align: baseline;        }         div.save-button {            margin-top: -33px;            margin-right: 2px;            z-index: 10;        }         div.no-access {            margin-top: -33px;            z-index: 10;            width: 40%;            white-space: inherit;            position: relative;        }         div.panel-heading-condensed {            height: 30px;            padding-top: 5px;        }         div.include-phasor {            margin-top: 0;            margin-bottom: 0;        }         input[type='checkbox'].include-phasor {            margin-top: 10px;            cursor: pointer;        }         div.delete-phasor {            position: absolute;            margin-top: 32px;            margin-left: -20px;            cursor: pointer;        }         span.delete-phasor {            font-size: smaller;        }         tr.separator-top {            visibility: hidden;            border-bottom-width: 4px;            border-bottom-style: solid;            background-color: inherit;        }         tr.separator-bottom {            visibility: hidden;            background-color: inherit;        }         .input-label {            text-align: right;            vertical-align: top;            padding: 6px;            width: 160px;        }         .input-area {            width: 80%;            display: inline-table;            vertical-align: middle;        }         label.col-input {            padding-right: 0;            margin-right: -10px;            margin-left: 10px;            white-space: nowrap;        }         tr.top-border {            border-top-width: 2px;            border-top-style: solid;        }         div.error-margin {            padding-bottom: 10px;        }         .form-group {            padding-top: 5px;        }         .top-padding {            padding-top: 5px;        }         .top-margin {            margin-top: 5px;        }         .bottom-margin {            margin-bottom: 5px;        }         .connection-status {            background-color: black;            padding: 10px;            margin: 0;            overflow: auto;        }         .glyphicon-interpret-type {            color: darkgrey;            vertical-align: middle;            font-size: 15pt;            margin-right: -5px;            margin-left: -5px;        }         .glyphicon-interpret-result {            color: darkgrey;            vertical-align: middle;            font-size: 17pt;        }         .glyphicon-delete-sequence {            vertical-align: text-top;            color: red;            font-size: larger;        }         .glyphicon-action-button {            color: #606060;            vertical-align: text-top;        }         /* Collapsable button style */        .btn-collapsable.btn {            color: #606060;            font-family: "Glyphicons Halflings";            font-size: 8pt;            position: relative;            top: 0;            right: -10px;            padding: 0 2px 2px 2px;            height: 18px;            float: right !important;        }         /* Collapsable button icon when content is shown - arrow down */        .btn-collapsable.btn:after {            content: "\e114";        }         /* Collapsable button icon when content is hidden - arrow right */        .btn-collapsable.btn.collapsed:after {            content: "\e080";        }         #templateType:focus {            border-color: #66afe9;        }         @@media screen {            .page-logo {                margin-bottom: 2px;                margin-top: -38px;            }             .offset-width {                width: 10px            }        }         @@media screen and (min-width: 638px) {            .page-logo {                margin-bottom: 2px;                margin-top: -12px;            }             .offset-width {                width: 10px            }        }         @@media screen and (min-width: 868px) {            .page-logo {                margin-bottom: 2px;                margin-top: -12px;            }             .offset-width {                width: 10px            }        }         @@media screen and (min-width: 992px) {            .page-logo {                margin-bottom: -25px;                margin-top: -4px;            }             .offset-width {                width: 150px            }        }    </style>}@functions {    private static Dictionary<string, object> s_appModelGlobal;    private static Guid s_nodeID;    private static string s_companyAcronym;    private static double s_defaultCalculationLagTime;    private static double s_defaultCalculationLeadTime;    private static int s_nominalFrequency;    private static string s_systemName;     // Quasi-Static Properties    private Dictionary<string, object> AppModelGlobal    {        get        {            if (s_appModelGlobal != null)                return s_appModelGlobal;             s_appModelGlobal = new Dictionary<string, object>();            ExpressionEvaluator.ValueType global = ValueExpressionParser.DefaultTypeRegistry["Global"] as ExpressionEvaluator.ValueType;             if (global == null)                return s_appModelGlobal;             foreach (PropertyDescriptor propertyDescriptor in TypeDescriptor.GetProperties(global.Value))            {                s_appModelGlobal.Add(propertyDescriptor.Name, propertyDescriptor.GetValue(global.Value));            }             return s_appModelGlobal;        }    }     private Guid NodeID    {        get        {            return s_nodeID != default(Guid) ? s_nodeID : s_nodeID = (Guid)AppModelGlobal["NodeID"];        }    }     private string CompanyAcronym    {        get        {            return !string.IsNullOrWhiteSpace(s_companyAcronym) ? s_companyAcronym : s_companyAcronym = (string)AppModelGlobal["CompanyAcronym"];        }    }     private double DefaultCalculationLagTime    {        get        {            return s_defaultCalculationLagTime != default(double) ? s_defaultCalculationLagTime : s_defaultCalculationLagTime = (double)AppModelGlobal["DefaultCalculationLagTime"];        }    }     private double DefaultCalculationLeadTime    {        get        {            return s_defaultCalculationLeadTime != default(double) ? s_defaultCalculationLeadTime : s_defaultCalculationLeadTime = (double)AppModelGlobal["DefaultCalculationLeadTime"];        }    }     private int NominalFrequency    {        get        {            return s_nominalFrequency != default(int) ? s_nominalFrequency : s_nominalFrequency = (int)AppModelGlobal["NominalFrequency"];        }    }     private string SystemName    {        get        {            if (s_systemName == default(string))            {                object value;                 if (AppModelGlobal.TryGetValue("SystemName", out value))                {                    s_systemName = (string)value;                     if (s_systemName != null)                        s_systemName = Regex.Replace(s_systemName.Trim().ToUpperInvariant(), @"[^A-Z0-9\-!_\.@#\$]+", "_", RegexOptions.Compiled);                     if (!string.IsNullOrWhiteSpace(s_systemName))                        s_systemName = s_systemName + "!";                }                 if (s_systemName == null)                    s_systemName = "";            }             return s_systemName;        }    }     private string GetCurrentUserID()    {        if (Thread.CurrentPrincipal.Identity == null)            return UserInfo.CurrentUserID;         return Thread.CurrentPrincipal.Identity.Name;    }     // This function simply limits access to UI elements that the user does not have access to, server-side    // functions will further validate user rights even if UI restriction was somehow bypassed    private bool UserIsEditor()    {        SecurityPrincipal securityPrincipal = ViewBag.SecurityPrincipal as SecurityPrincipal;         if (securityPrincipal == null)            return false;         return securityPrincipal.IsInRole("Administrator") || securityPrincipal.IsInRole("Editor");    }

Lines 1–500 of 4485.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t