text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
@******************************************************************************************************* // DeviceGroups.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: // ---------------------------------------------------------------------------------------------------- // 03/02/2020 - J. Ritchie Carroll // Generated original version of source code. // //*****************************************************************************************************@ @using System.Text @using GSF.Security @using GSF.Web.Model @using GSF.Web.Shared.Model @using openHistorian @using openHistorian.Model @inherits ExtendedTemplateBase<AppModel> @section StyleSheets { <style> html, body { height: 100%; } </style> } @{ if (ViewBag.PageControlScripts == null) { ViewBag.PageControlScripts = new StringBuilder(); } DataContext dataContext = ViewBag.DataContext; StringBuilder pageControlScripts = ViewBag.PageControlScripts; Layout = "Layout.cshtml"; ViewBag.Title = "Device Groups"; ViewBag.SubTitle = "Allows creation of groups of devices, e.g., for a region"; ViewBag.ShowSearchFilter = true; ViewBag.HeaderColumns = new[] { // { "Field", "Label", "Classes" } new[] { "Acronym", "Acronym", "text-left" }, new[] { "Name", "Name", "text-left" }, new[] { null, "Devices", "text-center" }, new[] { null, "Enabled", "text-center valign-middle" } }; ViewBag.BodyRows = BodyRows().ToString(); ViewBag.AddNewEditDialog = AddNewEditDialog(dataContext).ToString(); ViewBag.ParentKeys = Model.Global.NodeID.ToString(); // Prepend view model validation extension scripts to occur before normal model initialization pageControlScripts.Insert(0, ExtendModelValidation().ToString().TrimStart()); } @functions { public bool UserIsAdminOrEditor() { SecurityPrincipal securityPrincipal = ViewBag.SecurityPrincipal as SecurityPrincipal; return securityPrincipal != null && securityPrincipal.IsInRole("Administrator,Editor"); } } @helper BodyRows() { <td width="30%" class="text-left valign-middle"><button type="button" class="btn btn-link" data-bind="text: Acronym, click: $parent.viewPageRecord"></button></td> <td width="40%" class="text-left valign-middle" data-bind="text: Name"></td> <td width="20%" class="text-center valign-middle"><button type="button" class="btn btn-default btn-sm" data-bind="click: openDeviceSelector.bind($data)" hub-dependent><span data-bind="attr: {id: 'deviceMode' + ID}">Add</span>&nbsp;&nbsp;<span class="badge" data-bind="text: getDeviceCount(ID), attr: {id: 'deviceCount' + ID}">0</span></button></td> <td width="5%" class="text-center valign-middle"><input type="checkbox" data-bind="checked: Enabled, click: enabledStateChanged.bind($data)" /></td> <td width="5%" class="text-center valign-middle" nowrap> <button type="button" class="btn btn-xs" data-bind="click: $parent.editPageRecord, enable: $parent.dataHubIsConnected"><span class="glyphicon glyphicon-pencil"></span></button> <button type="button" class="btn btn-xs" data-bind="click: $parent.removePageRecord, enable: $parent.dataHubIsConnected"><span class="glyphicon glyphicon-remove"></span></button> </td> } @helper AddNewEditDialog(DataContext dataContext) { <div class="col-md-6"> @Raw(dataContext.AddInputField<DeviceGroup>("ID", customDataBinding: "disable: true", groupDataBinding: "visible: $root.recordMode() !== RecordMode.AddNew")) @Raw(dataContext.AddInputField<DeviceGroup>("UniqueID", customDataBinding: "disable: true", groupDataBinding: "visible: $root.recordMode() !== RecordMode.AddNew")) @Raw(dataContext.AddInputField<DeviceGroup>("Acronym", initialFocus: true)) @Raw(dataContext.AddInputField<DeviceGroup>("Name")) @Raw(dataContext.AddSelectField<DeviceGroup, Interconnection>("InterconnectionID", "ID", "Acronym")) </div> <div class="col-md-6"> @Raw(dataContext.AddInputField<DeviceGroup>("Longitude")) @Raw(dataContext.AddInputField<DeviceGroup>("Latitude")) @Raw(dataContext.AddSelectField<DeviceGroup, Company>("CompanyID", "ID", "Acronym")) @Raw(dataContext.AddInputField<DeviceGroup>("ContactList")) <div class="form-inline pull-right"> @Raw(dataContext.AddCheckBoxField<DeviceGroup>("Enabled")) </div> </div> } @helper ExtendModelValidation() { <script> var phasorHub, phasorHubClient; $(function () { // Connect to phasor hub phasorHub = $.connection.phasorHub.server; phasorHubClient = $.connection.phasorHub.client; // Create hub client functions for message control function encodeInfoMessage(message, timeout) { // Html encode message const encodedMessage = $("<div />").text(message).html(); showInfoMessage(encodedMessage, timeout, true); } function encodeErrorMessage(message, timeout) { // Html encode message const encodedMessage = $("<div />").text(message).html(); showErrorMessage(encodedMessage, timeout, true); } // Register info and error message handlers for hub client phasorHubClient.sendInfoMessage = encodeInfoMessage; phasorHubClient.sendErrorMessage = encodeErrorMessage; }); $(window).on("beforeApplyBindings", function () { // Define local rule that will check that device group acronym is unique in the database ko.validation.rules["deviceUniqueInDatabase"] = { async: true, validator: function (newVal, options, callback) { if (phasorHub) { // Lookup Device record by Acronym - this will return an empty record if not found phasorHub.queryDevice(newVal).done(function (device) { // Valid if device doesn't exist or is itself callback(device.ID === 0 || notNull(device.Acronym).toLowerCase() === notNull(options).toLowerCase()); }) .fail(function (error) { showErrorMessage(error); // Do not display validation failure message for connection issues callback(true); }); } else { callback(true); } }, message: "This device acronym already exists in the database. Acronyms must be unique." }; ko.bindingHandlers.selectOnError = { init: function (element, valueAccessor) { $(element).on("input", function(event) { setTimeout(function () { if (!valueAccessor().isValid()) element.select(); }, 1); }); } } // Enable knockout validation ko.validation.init({ registerExtenders: true, messagesOnModified: true, insertMessages: true, parseInputAttributes: true, allowHtmlMessages: true, messageTemplate: null, decorateElement: true, errorElementClass: "has-error", errorMessageClass: "help-block", grouping: { deep: true, observable: true, live: true } }, true); // Enable deferred updates for better performance ko.options.deferUpdates = true; }); </script> } @Html.RenderResource("GSF.Web.Model.Views.PagedViewModel.cshtml") <div id="editDevicesDialog" class="modal modal-wide fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal">&times;</button> <iframe style="border: none" id="editDevicesFrame"></iframe> <button type="button" class="btn btn-default pull-right popup-ok-button" data-dismiss="modal">OK</button> </div> </div> </div> </div> @section Scripts { <script> var modeledValidationParametersFunction; @Raw(dataContext.RenderViewModelConfiguration<DeviceGroup, DataHub>(ViewBag, "Acronym", null, Model.Global.NodeID)) function getDeviceCount(deviceGroupID) { if (viewModel.dataHubIsConnected()) { dataHub.queryDeviceGroup("@Model.Global.NodeID", deviceGroupID).done(function(deviceGroup) { if (notNull(deviceGroup.ConnectionString).length > 0) { const settings = deviceGroup.ConnectionString.parseKeyValuePairs(); const deviceIDs = notNull(settings.get("deviceIDs")); const count = deviceIDs.length > 0 ? deviceIDs.split(",").length : 0; $("#deviceMode" + deviceGroupID).text(count > 0 ? "Edit" : "Add"); $("#deviceCount" + deviceGroupID).text(count); } }); } return "0"; } $(window).resize(function() { $("#editDevicesFrame").attr("height", $("#contentWell").outerHeight(true) + "px"); }); function openDeviceSelector(record) { $("#editDevicesFrame").attr({ "src": "SelectGroupDevices.cshtml?ID=" + record.ID + "&Acronym=" + encodeURIComponent(record.Acronym) + "&timestamp=" + Date.now(), "height": $("#contentWell").outerHeight(true) + "px", "width": "100%" }); $("#editDevicesDialog").modal("show"); } $("#editDevicesDialog").on("hidden.bs.modal", function () { // Refresh page counts after editing tasks viewModel.queryPageRecords(); }); $(function() { $("#editDevicesDialog").modal({ show: false, backdrop: "static", keyboard: false }); modeledValidationParametersFunction = viewModel.applyValidationParameters; viewModel.setApplyValidationParameters(function () { modeledValidationParametersFunction(); viewModel.currentRecord().Acronym.extend({ required: true, deviceUniqueInDatabase: viewModel.currentRecord().Acronym() }); }); }); function refreshEnabledState(record) { if (!hubIsConnected) return; if (record.Enabled) serviceHub.sendCommand("Initialize " + record.Acronym); else serviceHub.sendCommand("ReloadConfig"); } function enabledStateChanged(record) { if (hubIsConnected) { record.Enable = !record.Enable; dataHub.updateDevice(record).done(function() { viewModel.queryPageRecords(); refreshEnabledState(record); }); } } $(viewModel).on("recordSaved", function(event, record, isNew) { refreshEnabledState(record); }); $(viewModel).on("recordDeleted", function(event, record) { if (hubIsConnected) serviceHub.sendCommand("ReloadConfig"); }); </script> }
the_stack
@using jQuery.Validation.Unobtrusive.Native.Demos.Models @model PersonModel @section metatags{ <meta name="Description" content="A demo of dynamically generated form elements being parsed and validated."> } @section scripts { @Scripts.Render("~/bundles/jquery-validation", "~/bundles/knockout") <script> // The equivalent of the PersonModel class function PersonModel(firstName, lastName) { this.FirstName = ko.observable(firstName); this.LastName = ko.observable(lastName); } // ViewModel for screen function ViewModel($) { var self = this; self.people = ko.observableArray([ new PersonModel("Bert", "Bertington"), new PersonModel("Charles", "Charlesforth"), new PersonModel("Denise", "Dentiste") ]); self.addPerson = function(viewModel, event) { self.people.push(new PersonModel("", "")); // Add a new person with no name }; self.removePerson = function(person, event) { self.people.remove(person); }; self.save = function(form) { alert("This is a valid form! These are the people: " + ko.toJSON(self.people)); }; $("form").validate({ submitHandler: self.save }); } ko.applyBindings(new ViewModel(jQuery)); </script> } <h3>@ViewBag.Title</h3> <p>Have you ever wanted to dynamically create form elements in your application? Given the trend for SPA's this is an increasingly common use case. As you may have learned from painful experience jquery.validate.unobtrusive.js does <strong>not</strong> support this by default. jQuery Validation <strong>does</strong>. Just add a new element to a form and it will be automatically parsed and subsequently validated.</p> <p>In this example we use <a href="http://knockoutjs.com/" target="_blank">Knockout</a> to dynamically add elements to a form. It should be noted this approach is not Knockout specific. Hopefully when I get more time I'll provide some other examples to illustrate.</p> <p>This demo is "inspired" by a <a href="http://knockoutjs.com/documentation/foreach-binding.html" target="_blank">demo on the Knockout site</a>. If you look closely at the View you'll see that the HTML elements in the header and in the <code>foreach</code> binding are driven from the View's Model, in this case the <code>PersonModel</code> class. We just make use of the <code>htmlAttributes</code> parameter to set up the KO databinding.</p> <ul class="nav nav-tabs" data-tabs="tabs"> <li class="active"><a data-toggle="tab" href="#demo">Demo</a></li> <li><a data-toggle="tab" href="#model">Model</a></li> <li><a data-toggle="tab" href="#view">View</a></li> <li><a data-toggle="tab" href="#html">HTML</a></li> <li><a data-toggle="tab" href="#javascript">JavaScript</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="demo"> @using (Html.BeginForm()) { <div class="row"> <table> <thead> <tr> <th>@Html.DisplayNameFor(x => x.FirstName)</th> <th>@Html.DisplayNameFor(x => x.LastName)</th> <th></th> </tr> </thead> <tbody data-bind="foreach: people"> <tr> <td>@Html.TextBoxFor(x => x.FirstName, true, htmlAttributes: new { data_bind = "value: FirstName, " + "attr: { name: 'FirstName' + $index(), id: 'FirstName' + $index() }" })</td> <td>@Html.TextBoxFor(x => x.LastName, true, htmlAttributes: new { data_bind = "value: LastName, " + "attr: { name: 'LastName' + $index(), id: 'LastName' + $index() }" })</td> <td><button type="button" class="btn btn-link" data-bind="click: $root.removePerson">Remove person</button></td> </tr> </tbody> </table> </div> <div class="row"> <button type="button" class="btn btn-primary" data-bind="click: addPerson">Add person</button> <button type="submit" class="btn btn-default">Submit</button> </div> } </div> <div class="tab-pane" id="model"> <p>Here's the model, note that the <code>Required</code> attribute decorates each property of the model:</p> <pre class="prettyprint cs"> using System.ComponentModel.DataAnnotations; namespace jQuery.Validation.Unobtrusive.Native.Demos.Models { public class PersonModel { [Display(Name = "First name"), Required] public string FirstName { get; set; } [Display(Name = "Last name"), Required] public string LastName { get; set; } } } </pre> </div> <div class="tab-pane" id="view"> <p>Here's the view (which uses the model):</p> <pre class="prettyprint cs"> @@model jQuery.Validation.Unobtrusive.Native.Demos.Models.RequiredModel @@using (Html.BeginForm()) { &lt;div class="row"&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;@@Html.DisplayNameFor(x =&gt; x.FirstName)&lt;/th&gt; &lt;th&gt;@@Html.DisplayNameFor(x =&gt; x.LastName)&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody data-bind="foreach: people"&gt; &lt;tr&gt; &lt;td&gt;@@Html.TextBoxFor(x =&gt; x.FirstName, true, htmlAttributes: new { data_bind = "value: FirstName, " + "attr: { name: 'FirstName' + $index(), id: 'FirstName' + $index() }" })&lt;/td&gt; &lt;td&gt;@@Html.TextBoxFor(x =&gt; x.LastName, true, htmlAttributes: new { data_bind = "value: LastName, " + "attr: { name: 'LastName' + $index(), id: 'LastName' + $index() }" })&lt;/td&gt; &lt;td&gt;&lt;button type="button" class="btn btn-link" data-bind="click: $root.removePerson"&gt; Remove person&lt;/button&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;button type="button" class="btn btn-primary" data-bind="click: addPerson"&gt;Add person&lt;/button&gt; &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt; &lt;/div&gt; } </pre> </div> <div class="tab-pane" id="html"> <p>Here's the HTML that the view generates:</p> <pre class="prettyprint html"> &lt;form action="/Demo/Dynamic" method="post"&gt; &lt;div class="row"&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;First name&lt;/th&gt; &lt;th&gt;Last name&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody data-bind="foreach: people"&gt; &lt;tr&gt; &lt;td&gt;&lt;input data-bind="value: FirstName, attr: { name: &#39;FirstName&#39; + $index(), id: &#39;FirstName&#39; + $index() }" data-msg-required="The First name field is required." data-rule-required="true" id="FirstName" name="FirstName" type="text" value="" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input data-bind="value: LastName, attr: { name: &#39;LastName&#39; + $index(), id: &#39;LastName&#39; + $index() }" data-msg-required="The Last name field is required." data-rule-required="true" id="LastName" name="LastName" type="text" value="" /&gt;&lt;/td&gt; &lt;td&gt;&lt;button type="button" class="btn btn-link" data-bind="click: $root.removePerson"&gt;Remove person&lt;/button&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;button type="button" class="btn btn-primary" data-bind="click: addPerson"&gt;Add person&lt;/button&gt; &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt; &lt;/div&gt; &lt;/form&gt; </pre> </div> <div class="tab-pane" id="javascript"> <pre class="prettyprint js"> // The equivalent of the PersonModel class function PersonModel(firstName, lastName) { this.FirstName = ko.observable(firstName); this.LastName = ko.observable(lastName); } // ViewModel for screen function ViewModel($) { var self = this; self.people = ko.observableArray([ new PersonModel("Bert", "Bertington"), new PersonModel("Charles", "Charlesforth"), new PersonModel("Denise", "Dentiste") ]); self.addPerson = function(viewModel, event) { self.people.push(new PersonModel("", "")); // Add a new person with no name }; self.removePerson = function(person, event) { self.people.remove(person); }; self.save = function(form) { alert("This is a valid form! These are the people: " + ko.toJSON(self.people)); }; $("form").validate({ submitHandler: self.save }); } ko.applyBindings(new ViewModel(jQuery)); </pre> </div> </div>
the_stack
 @{ Layout = "~/Views/Shared/_Index.cshtml"; } <link href="~/ui/plugins/select2/select2.min.css" rel="stylesheet"/> <link href="~/ui/plugins/select2/select2-bootstrap.css" rel="stylesheet" /> <div class="container-div"> <div class="ibox"> <div class="ibox-content"> <div class="nav-tabs-custom"> <ul class="nav nav-tabs"> <li class="active"> <a data-toggle="tab" href="#tab-1" aria-expanded="true">菜单</a> </li> <li class=""> <a data-toggle="tab" href="#tab-2" aria-expanded="false">操作</a> </li> </ul> <div class="tab-content"> <div id="tab-1" class="tab-pane active"> <div class="panel-body"> <form class="form form-horizontal" id="menuForm" autocomplete="off"> <input type="hidden" name="id" id="id" value="@(ViewBag.Id)"> <div class="form-group"> <label class="col-sm-3 control-label">父菜单:</label> <div class="col-sm-5"> @Html.DropDownList("parent_id", ViewBag.MenuSel as SelectList, new {@class="form-control m-b"}) </div> </div> <div class="form-group"> <label class="col-sm-3 control-label is-required">菜单名称:</label> <div class="col-sm-5"> <input type="text" name="menu_name" id="menu_name" class="form-control" data-rule="required"> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label is-required">请求地址:</label> <div class="col-sm-5"> <input type="text" name="menu_url" id="menu_url" class="form-control" value="#" data-rule="required"> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label is-required">权限标识:</label> <div class="col-sm-5"> <input type="text" class="form-control" name="role_tag" id="role_tag" value="#" data-rule="required"> <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 控制器中定义的权限标识,如:[RequirePermission("system:sysmenu:view")]</span> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label is-required">图标:</label> <div class="col-sm-5"> <div class="input-group"> <input type="text" name="menu_icon" id="menu_icon" class="form-control" value="fa fa-bookmark" data-rule="required"> <span class="input-group-addon"><i id="pickIcon" class="fa fa-bookmark"></i></span> <span class="input-group-btn"> <button type="button" class="btn btn-primary" onclick="showicon();"> 搜索图标 </button> </span> </div> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label is-required">排序:</label> <div class="col-sm-5"> <input type="number" name="menu_sort" id="menu_sort" value="1" class="form-control" data-rule="required"> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">备注:</label> <div class="col-sm-9"> <textarea name="remark" id="remark" cols="60" rows="4"></textarea> </div> </div> <input type="hidden" name="funcs" id="funcs" class="form-control"> </form> </div> </div> <div id="tab-2" class="tab-pane"> <div class="panel-body"> <form class="form form-horizontal" id="funcForm" autocomplete="off"> <table class="table table-bordered"> <thead> <tr> <th>名称</th> <th>权限标识</th> <th>排序</th> <th>操作</th> </tr> </thead> <tbody id="optbody"> <tr> <td> <input type="text" placeholder="名称" class="form-control" value="新增" data-rule="required"></td> <td> <input type="text" placeholder="权限标识" class="form-control" value="admin:sysmenu:add" data-rule="required"></td> <td width="100"> <input type="number" placeholder="排序" class="form-control" value="1" data-rule="required" min="1"></td> <td><button class="btn btn-danger " onclick="delrow(this)"><i class="fa fa-trash"></i></button></td> <td style="display:none;"><input type="hidden" value="0"></td> </tr> </tbody> <tfoot> <TR> <TD colspan="8"> <button class="btn btn-info " onclick="addrow(this)"><i class="fa fa-plus"></i></button> </TD> </TR> </tfoot> </table> </form> </div> </div> </div> <div class="footerbar"> <div class="col-sm-12 col-sm-offset-3"> <button class="btn btn-primary" type="button" onclick="save()"> <i class="fa fa-check"></i> 保存 </button> <button class="btn btn-danger" type="button" onclick="cancel()"> <i class="fa fa-reply-all"></i>关闭 </button> </div> </div> </div> </div> </div> </div> @section scripts { <script type="text/javascript" src="~/ui/plugins/select2/select2.min.js"></script> <script type="text/javascript"> var rowIndex = 3, menuform = false, funcstatus = false; $(function () { $("#parent_id").select2(); // $('#parentId').on('select2:select', function (e) { // // 处理自己的业务 // console.log(e); // console($(e).select2('val')); // }); $('#menuForm').validator({ stopOnError: false, timely: 2, theme: "yellow_right", valid: function (form) { menuform = true; }, invalid: function (form) { menuform = false; } }); $('#funcForm').validator({ stopOnError: false, timely: 2, theme: "yellow_right", valid: function (form) { funcstatus = true; }, invalid: function (form, errors) { funcstatus = false; // console.log(errors); } }); jutils.handleMessage(function (res) { //console.log(res); if (res.title == 'font_pick') { $('#menu_icon').val(res.data); $('#pickIcon').attr('class', res.data); } }); loadData(); }); function loadData() { const id = $("#id").val(); if (jutils.emptyId(id)) { return; } jutils.ajaxGet('/admin/sysmenu/GetModel', { id: id }, function (res) { const model = res.data.model; $('#menuForm').initFormData(model); $('#pickIcon').attr('class', model.menu_icon); $("#parent_id").select2("val", [model.parent_id]); const funcs = res.data.funcs; const flen = funcs.length; rowIndex = 0; let html = ''; if (flen > 0) { for (let i = 0; i < flen; i++) { let model = funcs[i]; rowIndex++; html += '<tr>'; html += '<td> <input type="text" placeholder="名称" class="form-control" value="' + model.title + '" data-rule="required"></td>'; html += '<td> <input type="text" placeholder="权限标识" class="form-control" value="' + model.roleTag + '" data-rule="required"></td>'; html += '<td width="100"> <input type="number" placeholder="排序" class="form-control" value="' + model.funcSort + '" data-rule="required" min="1"></td>'; html += '<td><button class="btn btn-danger " onclick="delrow(this)"><i class="fa fa-trash"></i></button></td>'; html += '<td style="display:none;"><input type="hidden" value="' + model.id + '"></td>'; html += ' </tr>'; } } $('#optbody').html(html); }); } function save() { $('#menuForm').trigger("validate"); if (!menuform) { jutils.error('菜单内容验证失败'); return; } var funcArry = []; var hasops = $('#optbody').find("tr").length; if (hasops > 0) { $('#funcForm').trigger("validate"); if (!funcstatus) { jutils.error('操作内容验证失败'); return; } $('#optbody').find("tr").each(function () { var func = { id: 0, title: '', roleTag: '', funcSort: 1 }; // var d = $(this).find('input'); //console.log($(this).find('input')); $(this).find('input').each(function (index, element) { var itext = $(this).val(); if (index === 0) { func.title = itext; } else if (index === 1) { func.roleTag = itext; } else if (index === 2) { func.funcSort = itext; } else if (index === 3) { func.id = itext; } }); funcArry.push(func); }); } // console.log(funcArry); //return; if (funcArry.length > 0) { const fjson = JSON.stringify(funcArry); $('#funcs').val(fjson); } jutils.ajaxPost('/admin/sysmenu/SaveData', $('#menuForm').serialize(), function (res) { cancel(); }); // console.log(funcArry); } function delrow(obj) { var id = $(obj).parent().next('td').find('input').val(); if (id !== '0') { jutils.confirm('删除当前操作,可能会影响系统权限,确认删除吗?', function () { jutils.ajaxGet('/admin/sysmenu/delfunc', { id: id }, function (res) { var $tr = $(obj).parent().parent('tr'); $tr.remove(); rowIndex--; }); }); } else { var $tr = $(obj).parent().parent('tr'); $tr.remove(); rowIndex--; } } function addrow() { rowIndex++; var html = '<tr>'; html += '<td> <input type="text" placeholder="名称" class="form-control" value="" data-rule="required"></td>'; html += '<td> <input type="text" placeholder="权限标识" class="form-control" value="system:roletag:new" data-rule="required"></td>'; html += '<td width="100"> <input type="number" placeholder="排序" class="form-control" value="0" data-rule="required" min="1"></td>'; html += '<td><button class="btn btn-danger " onclick="delrow(this)"><i class="fa fa-trash"></i></button></td>'; html += '<td style="display:none;"><input type="hidden" value="0"></td>'; html += ' </tr>'; $('#optbody').append(html); } function cancel() { // jutils.closeDialog(); jutils.postMessage('admin_sysmenu_form', "message from menu form hehe"); jutils.closeTab('admin_sysmenu_form'); } function showicon(rowIndex) { jutils.dialogTop('设置图标', '/ui/icon.html'); } </script> }
the_stack
#r "Newtonsoft.Json" #r "Microsoft.WindowsAzure.Storage" using System; using System.Net; using Newtonsoft.Json; using Microsoft.WindowsAzure.MediaServices.Client; using Microsoft.WindowsAzure.MediaServices.Client.ContentKeyAuthorization; using Microsoft.WindowsAzure.MediaServices.Client.DynamicEncryption; using Microsoft.WindowsAzure.MediaServices.Client.Widevine; using Microsoft.WindowsAzure.MediaServices.Client.FairPlay; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; using Microsoft.WindowsAzure.Storage.Auth; using System.Threading.Tasks; using Microsoft.IdentityModel.Clients.ActiveDirectory; private static CloudMediaContext _context = null; private static readonly string _amsAADTenantDomain = Environment.GetEnvironmentVariable("AMSAADTenantDomain"); private static readonly string _amsRestApiEndpoint = Environment.GetEnvironmentVariable("AMSRestApiEndpoint"); private static readonly string _amsClientId = Environment.GetEnvironmentVariable("AMSClientId"); private static readonly string _amsClientSecret = Environment.GetEnvironmentVariable("AMSClientSecret"); private static readonly string _amsStorageAccountName = Environment.GetEnvironmentVariable("AMSStorageAccountName"); private static readonly string _amsStorageAccountKey = Environment.GetEnvironmentVariable("AMSStorageAccountKey"); private static readonly bool _isTokenRestricted = false; private static readonly bool _isTokenTypeJWT = true; private static readonly Uri _sampleIssuer = new Uri("urn:test"); private static readonly Uri _sampleAudience = new Uri("urn:test"); private static readonly string _symmetricVerificationKey = "YmY0MjA1MDkxZGE5NTU0MDNkYWEyMDdlMDc2YzdhZTZjMWEzN2FlNGFiNjI3MDM3ODIyODU3N2IyODQ3NmI2NGEzNGRkNWY5OTU0ZTkyNzNhNjk5NjhlZGI0MGI0N2FlYTAyOWFjMjU5ODBkMjlkYWY5YmQzMWU2M2U4ODNhOGY="; private static readonly bool _enableKidClaim = false; public static async Task<object> Run(HttpRequestMessage req, TraceWriter log) { log.Info($"Webhook was triggered!"); string jsonContent = await req.Content.ReadAsStringAsync(); dynamic data = JsonConvert.DeserializeObject(jsonContent); log.Info("Request : " + jsonContent); // Validate input objects if (data.ContentKeyAuthorizationPolicyName == null) return req.CreateResponse(HttpStatusCode.BadRequest, new { error = "Please pass ContentKeyAuthorizationPolicyName in the input object" }); log.Info("Input - ContentKeyAuthorizationPolicyName : " + data.ContentKeyAuthorizationPolicyName); if (data.AssetDeliveryPolicyname == null) return req.CreateResponse(HttpStatusCode.BadRequest, new { error = "Please pass AssetDeliveryPolicyname in the input object" }); log.Info("Input - AssetDeliveryPolicyname : " + data.AssetDeliveryPolicyname); string contentKeyAuthorizationPolicyName = data.ContentKeyAuthorizationPolicyName; string assetDeliveryPolicyName = data.AssetDeliveryPolicyname; string contentKeyAuthorizationPolicyId = null; string assetDeliveryPolicyId = null; try { // Load AMS account context log.Info($"Using Azure Media Service Rest API Endpoint : {_amsRestApiEndpoint}"); AzureAdTokenCredentials tokenCredentials = new AzureAdTokenCredentials(_amsAADTenantDomain, new AzureAdClientSymmetricKey(_amsClientId, _amsClientSecret), AzureEnvironments.AzureCloudEnvironment); AzureAdTokenProvider tokenProvider = new AzureAdTokenProvider(tokenCredentials); // using new CloudMediaContext for applying dynamic encryption policies _context = new CloudMediaContext(new Uri(_amsRestApiEndpoint), tokenProvider); // Search ContentKeyAuthorizationPolicy with ContentKeyType.CommonEncryption IContentKeyAuthorizationPolicy apol = _context.ContentKeyAuthorizationPolicies.Where(p => p.Name == contentKeyAuthorizationPolicyName).FirstOrDefault(); if (apol != null) { log.Info("Already exist CENC Type Policy: Id = " + apol.Id + ", Name = " + apol.Name); contentKeyAuthorizationPolicyId = apol.Id; } else { apol = CreateAuthorizationPolicyCommonType(contentKeyAuthorizationPolicyName); log.Info("Created CENC Type Policy: Id = " + apol.Id + ", Name = " + apol.Name); contentKeyAuthorizationPolicyId = apol.Id; } // Search AssetDeliveryPolicy with ContentKeyType.CommonEncryption IAssetDeliveryPolicy dpol = _context.AssetDeliveryPolicies.Where(p => p.Name == assetDeliveryPolicyName).FirstOrDefault(); if (dpol != null) { log.Info("Already exist Asset Delivery CENC Type Policy: Id = " + dpol.Id + ", Name = " + dpol.Name); assetDeliveryPolicyId = dpol.Id; } else { dpol = CreateAssetDeliveryPolicyCenc(assetDeliveryPolicyName); log.Info("Created Asset Delivery CENC Type Policy: Id = " + dpol.Id + ", Name = " + dpol.Name); assetDeliveryPolicyId = dpol.Id; } } catch (Exception ex) { log.Info("Exception " + ex); return new HttpResponseMessage(HttpStatusCode.BadRequest); } return req.CreateResponse(HttpStatusCode.OK, new { ContentKeyAuthorizationPolicyId = contentKeyAuthorizationPolicyId, AssetDeliveryPolicyId = assetDeliveryPolicyId }); } static public IContentKeyAuthorizationPolicy CreateAuthorizationPolicyCommonType(string policyName) { List<ContentKeyAuthorizationPolicyRestriction> restrictions; string PlayReadyOptionName; string WidevineOptionName; if (_isTokenRestricted) { string tokenTemplateString = GenerateTokenRequirements(); restrictions = new List<ContentKeyAuthorizationPolicyRestriction> { new ContentKeyAuthorizationPolicyRestriction { Name = "Token Authorization Policy", KeyRestrictionType = (int)ContentKeyRestrictionType.TokenRestricted, Requirements = tokenTemplateString, } }; PlayReadyOptionName = "TokenRestricted PlayReady Option 1"; WidevineOptionName = "TokenRestricted Widevine Option 1"; } else { restrictions = new List<ContentKeyAuthorizationPolicyRestriction> { new ContentKeyAuthorizationPolicyRestriction { Name = "Open", KeyRestrictionType = (int)ContentKeyRestrictionType.Open, Requirements = null } }; PlayReadyOptionName = "Open PlayReady Option 1"; WidevineOptionName = "Open Widevine Option 1"; } // Configure PlayReady and Widevine license templates. string PlayReadyLicenseTemplate = ConfigurePlayReadyPolicyOptions(); string WidevineLicenseTemplate = ConfigureWidevinePolicyOptions(); IContentKeyAuthorizationPolicyOption PlayReadyPolicy = _context.ContentKeyAuthorizationPolicyOptions.Create(PlayReadyOptionName, ContentKeyDeliveryType.PlayReadyLicense, restrictions, PlayReadyLicenseTemplate); IContentKeyAuthorizationPolicyOption WidevinePolicy = _context.ContentKeyAuthorizationPolicyOptions.Create(WidevineOptionName, ContentKeyDeliveryType.Widevine, restrictions, WidevineLicenseTemplate); IContentKeyAuthorizationPolicy contentKeyAuthorizationPolicy = _context.ContentKeyAuthorizationPolicies.CreateAsync(policyName).Result; contentKeyAuthorizationPolicy.Options.Add(PlayReadyPolicy); contentKeyAuthorizationPolicy.Options.Add(WidevinePolicy); return contentKeyAuthorizationPolicy; } static public IAssetDeliveryPolicy CreateAssetDeliveryPolicyCenc(string assetDeliveryPolicyName) { Guid keyId = Guid.NewGuid(); byte[] contentKey = GetRandomBuffer(16); IContentKey key = _context.ContentKeys.Create(keyId, contentKey, "ContentKey CENC", ContentKeyType.CommonEncryption); // Get the PlayReady license service URL. Uri acquisitionUrl = key.GetKeyDeliveryUrl(ContentKeyDeliveryType.PlayReadyLicense); // GetKeyDeliveryUrl for Widevine attaches the KID to the URL. // For example: https://amsaccount1.keydelivery.mediaservices.windows.net/Widevine/?KID=268a6dcb-18c8-4648-8c95-f46429e4927c. // The WidevineBaseLicenseAcquisitionUrl (used below) also tells Dynamaic Encryption // to append /? KID =< keyId > to the end of the url when creating the manifest. // As a result Widevine license acquisition URL will have KID appended twice, // so we need to remove the KID that in the URL when we call GetKeyDeliveryUrl. Uri widevineUrl = key.GetKeyDeliveryUrl(ContentKeyDeliveryType.Widevine); UriBuilder uriBuilder = new UriBuilder(widevineUrl); uriBuilder.Query = String.Empty; widevineUrl = uriBuilder.Uri; Dictionary<AssetDeliveryPolicyConfigurationKey, string> assetDeliveryPolicyConfiguration = new Dictionary<AssetDeliveryPolicyConfigurationKey, string> { {AssetDeliveryPolicyConfigurationKey.PlayReadyLicenseAcquisitionUrl, acquisitionUrl.ToString()}, {AssetDeliveryPolicyConfigurationKey.WidevineBaseLicenseAcquisitionUrl, widevineUrl.ToString()} }; // In this case we only specify Dash streaming protocol in the delivery policy, // All other protocols will be blocked from streaming. var assetDeliveryPolicy = _context.AssetDeliveryPolicies.Create( assetDeliveryPolicyName, //"AssetDeliveryPolicy CommonEncryption (SmoothStreaming, Dash)", AssetDeliveryPolicyType.DynamicCommonEncryption, AssetDeliveryProtocol.Dash | AssetDeliveryProtocol.SmoothStreaming, assetDeliveryPolicyConfiguration); key.Delete(); //("Create AssetDeliveryPolicy: Id = {0}, Name = {1}", assetDeliveryPolicy.Id, assetDeliveryPolicy.Name); return assetDeliveryPolicy; } private static byte[] GetRandomBuffer(int length) { var returnValue = new byte[length]; using (var rng = new System.Security.Cryptography.RNGCryptoServiceProvider()) { rng.GetBytes(returnValue); } return returnValue; } private static string GenerateTokenRequirements() { TokenType tType = TokenType.SWT; if (_isTokenTypeJWT) tType = TokenType.JWT; TokenRestrictionTemplate template = new TokenRestrictionTemplate(tType); template.PrimaryVerificationKey = new SymmetricVerificationKey(Convert.FromBase64String(_symmetricVerificationKey)); //template.AlternateVerificationKeys.Add(new SymmetricVerificationKey()); template.Audience = _sampleAudience.ToString(); template.Issuer = _sampleIssuer.ToString(); if (_enableKidClaim) { template.RequiredClaims.Add(TokenClaim.ContentKeyIdentifierClaim); } return TokenRestrictionTemplateSerializer.Serialize(template); } private static string ConfigurePlayReadyPolicyOptions() { // The following code configures PlayReady License Template using .NET classes // and returns the XML string. //The PlayReadyLicenseResponseTemplate class represents the template for the response sent back to the end user. //It contains a field for a custom data string between the license server and the application //(may be useful for custom app logic) as well as a list of one or more license templates. PlayReadyLicenseResponseTemplate responseTemplate = new PlayReadyLicenseResponseTemplate(); // The PlayReadyLicenseTemplate class represents a license template for creating PlayReady licenses // to be returned to the end users. //It contains the data on the content key in the license and any rights or restrictions to be //enforced by the PlayReady DRM runtime when using the content key. PlayReadyLicenseTemplate licenseTemplate = new PlayReadyLicenseTemplate(); //Configure whether the license is persistent (saved in persistent storage on the client) //or non-persistent (only held in memory while the player is using the license). licenseTemplate.LicenseType = PlayReadyLicenseType.Nonpersistent; // AllowTestDevices controls whether test devices can use the license or not. // If true, the MinimumSecurityLevel property of the license // is set to 150. If false (the default), the MinimumSecurityLevel property of the license is set to 2000. licenseTemplate.AllowTestDevices = false; // You can also configure the Play Right in the PlayReady license by using the PlayReadyPlayRight class. // It grants the user the ability to playback the content subject to the zero or more restrictions // configured in the license and on the PlayRight itself (for playback specific policy). // Much of the policy on the PlayRight has to do with output restrictions // which control the types of outputs that the content can be played over and // any restrictions that must be put in place when using a given output. // For example, if the DigitalVideoOnlyContentRestriction is enabled, //then the DRM runtime will only allow the video to be displayed over digital outputs //(analog video outputs won’t be allowed to pass the content). //IMPORTANT: These types of restrictions can be very powerful but can also affect the consumer experience. // If the output protections are configured too restrictive, // the content might be unplayable on some clients. For more information, see the PlayReady Compliance Rules document. // For example: //licenseTemplate.PlayRight.AgcAndColorStripeRestriction = new AgcAndColorStripeRestriction(1); responseTemplate.LicenseTemplates.Add(licenseTemplate); return MediaServicesLicenseTemplateSerializer.Serialize(responseTemplate); } private static string ConfigureWidevinePolicyOptions() { var template = new WidevineMessage { allowed_track_types = AllowedTrackTypes.SD_HD, content_key_specs = new[] { new ContentKeySpecs { required_output_protection = new RequiredOutputProtection { hdcp = Hdcp.HDCP_NONE}, security_level = 1, track_type = "SD" } }, policy_overrides = new { can_play = true, can_persist = true, can_renew = false //renewal_server_url = keyDeliveryUrl.ToString(), } }; string configuration = JsonConvert.SerializeObject(template); return configuration; }
the_stack
 @{ ViewData["Title"] = "Flot"; } <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Flot Charts <small>preview sample</small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="#">Charts</a></li> <li class="active">Flot</li> </ol> </section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-xs-12"> <!-- interactive chart --> <div class="box box-primary"> <div class="box-header with-border"> <i class="fa fa-bar-chart-o"></i> <h3 class="box-title">Interactive Area Chart</h3> <div class="box-tools pull-right"> Real time <div class="btn-group" id="realtime" data-toggle="btn-toggle"> <button type="button" class="btn btn-default btn-xs active" data-toggle="on">On</button> <button type="button" class="btn btn-default btn-xs" data-toggle="off">Off</button> </div> </div> </div> <div class="box-body"> <div id="interactive" style="height: 300px;"></div> </div> <!-- /.box-body--> </div> <!-- /.box --> </div> <!-- /.col --> </div> <!-- /.row --> <div class="row"> <div class="col-md-6"> <!-- Line chart --> <div class="box box-primary"> <div class="box-header with-border"> <i class="fa fa-bar-chart-o"></i> <h3 class="box-title">Line Chart</h3> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse"> <i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body"> <div id="line-chart" style="height: 300px;"></div> </div> <!-- /.box-body--> </div> <!-- /.box --> <!-- Area chart --> <div class="box box-primary"> <div class="box-header with-border"> <i class="fa fa-bar-chart-o"></i> <h3 class="box-title">Full Width Area Chart</h3> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse"> <i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body"> <div id="area-chart" style="height: 338px;" class="full-width-chart"></div> </div> <!-- /.box-body--> </div> <!-- /.box --> </div> <!-- /.col --> <div class="col-md-6"> <!-- Bar chart --> <div class="box box-primary"> <div class="box-header with-border"> <i class="fa fa-bar-chart-o"></i> <h3 class="box-title">Bar Chart</h3> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse"> <i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body"> <div id="bar-chart" style="height: 300px;"></div> </div> <!-- /.box-body--> </div> <!-- /.box --> <!-- Donut chart --> <div class="box box-primary"> <div class="box-header with-border"> <i class="fa fa-bar-chart-o"></i> <h3 class="box-title">Donut Chart</h3> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse"> <i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body"> <div id="donut-chart" style="height: 300px;"></div> </div> <!-- /.box-body--> </div> <!-- /.box --> </div> <!-- /.col --> </div> <!-- /.row --> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> @section Styles{ <!-- Bootstrap 3.3.7 --> <link rel="stylesheet" href="~/adminlte/components/bootstrap/dist/css/bootstrap.min.css"> <!-- Font Awesome --> <link rel="stylesheet" href="~/adminlte/components/font-awesome/css/font-awesome.min.css"> <!-- Ionicons --> <link rel="stylesheet" href="~/adminlte/components/Ionicons/css/ionicons.min.css"> <!-- Theme style --> <link rel="stylesheet" href="~/adminlte/dist/css/AdminLTE.min.css"> <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. --> <link rel="stylesheet" href="~/adminlte/dist/css/skins/_all-skins.min.css"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> <!-- Google Font --> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic"> } @section Scripts{ <!-- jQuery 3 --> <script src="~/adminlte/components/jquery/dist/jquery.min.js"></script> <!-- Bootstrap 3.3.7 --> <script src="~/adminlte/components/bootstrap/dist/js/bootstrap.min.js"></script> <!-- FastClick --> <script src="~/adminlte/components/fastclick/lib/fastclick.js"></script> <!-- AdminLTE App --> <script src="~/adminlte/dist/js/adminlte.min.js"></script> <!-- AdminLTE for demo purposes --> <script src="~/adminlte/dist/js/demo.js"></script> <!-- FLOT CHARTS --> <script src="~/adminlte/components/Flot/jquery.flot.js"></script> <!-- FLOT RESIZE PLUGIN - allows the chart to redraw when the window is resized --> <script src="~/adminlte/components/Flot/jquery.flot.resize.js"></script> <!-- FLOT PIE PLUGIN - also used to draw donut charts --> <script src="~/adminlte/components/Flot/jquery.flot.pie.js"></script> <!-- FLOT CATEGORIES PLUGIN - Used to draw bar charts --> <script src="~/adminlte/components/Flot/jquery.flot.categories.js"></script> <!-- Page script --> <script> $(function () { /* * Flot Interactive Chart * ----------------------- */ // We use an inline data source in the example, usually data would // be fetched from a server var data = [], totalPoints = 100 function getRandomData() { if (data.length > 0) data = data.slice(1) // Do a random walk while (data.length < totalPoints) { var prev = data.length > 0 ? data[data.length - 1] : 50, y = prev + Math.random() * 10 - 5 if (y < 0) { y = 0 } else if (y > 100) { y = 100 } data.push(y) } // Zip the generated y values with the x values var res = [] for (var i = 0; i < data.length; ++i) { res.push([i, data[i]]) } return res } var interactive_plot = $.plot('#interactive', [getRandomData()], { grid : { borderColor: '#f3f3f3', borderWidth: 1, tickColor : '#f3f3f3' }, series: { shadowSize: 0, // Drawing is faster without shadows color : '#3c8dbc' }, lines : { fill : true, //Converts the line chart to area chart color: '#3c8dbc' }, yaxis : { min : 0, max : 100, show: true }, xaxis : { show: true } }) var updateInterval = 500 //Fetch data ever x milliseconds var realtime = 'on' //If == to on then fetch data every x seconds. else stop fetching function update() { interactive_plot.setData([getRandomData()]) // Since the axes don't change, we don't need to call plot.setupGrid() interactive_plot.draw() if (realtime === 'on') setTimeout(update, updateInterval) } //INITIALIZE REALTIME DATA FETCHING if (realtime === 'on') { update() } //REALTIME TOGGLE $('#realtime .btn').click(function () { if ($(this).data('toggle') === 'on') { realtime = 'on' } else { realtime = 'off' } update() }) /* * END INTERACTIVE CHART */ /* * LINE CHART * ---------- */ //LINE randomly generated data var sin = [], cos = [] for (var i = 0; i < 14; i += 0.5) { sin.push([i, Math.sin(i)]) cos.push([i, Math.cos(i)]) } var line_data1 = { data : sin, color: '#3c8dbc' } var line_data2 = { data : cos, color: '#00c0ef' } $.plot('#line-chart', [line_data1, line_data2], { grid : { hoverable : true, borderColor: '#f3f3f3', borderWidth: 1, tickColor : '#f3f3f3' }, series: { shadowSize: 0, lines : { show: true }, points : { show: true } }, lines : { fill : false, color: ['#3c8dbc', '#f56954'] }, yaxis : { show: true }, xaxis : { show: true } }) //Initialize tooltip on hover $('<div class="tooltip-inner" id="line-chart-tooltip"></div>').css({ position: 'absolute', display : 'none', opacity : 0.8 }).appendTo('body') $('#line-chart').bind('plothover', function (event, pos, item) { if (item) { var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2) $('#line-chart-tooltip').html(item.series.label + ' of ' + x + ' = ' + y) .css({ top: item.pageY + 5, left: item.pageX + 5 }) .fadeIn(200) } else { $('#line-chart-tooltip').hide() } }) /* END LINE CHART */ /* * FULL WIDTH STATIC AREA CHART * ----------------- */ var areaData = [[2, 88.0], [3, 93.3], [4, 102.0], [5, 108.5], [6, 115.7], [7, 115.6], [8, 124.6], [9, 130.3], [10, 134.3], [11, 141.4], [12, 146.5], [13, 151.7], [14, 159.9], [15, 165.4], [16, 167.8], [17, 168.7], [18, 169.5], [19, 168.0]] $.plot('#area-chart', [areaData], { grid : { borderWidth: 0 }, series: { shadowSize: 0, // Drawing is faster without shadows color : '#00c0ef' }, lines : { fill: true //Converts the line chart to area chart }, yaxis : { show: false }, xaxis : { show: false } }) /* END AREA CHART */ /* * BAR CHART * --------- */ var bar_data = { data : [['January', 10], ['February', 8], ['March', 4], ['April', 13], ['May', 17], ['June', 9]], color: '#3c8dbc' } $.plot('#bar-chart', [bar_data], { grid : { borderWidth: 1, borderColor: '#f3f3f3', tickColor : '#f3f3f3' }, series: { bars: { show : true, barWidth: 0.5, align : 'center' } }, xaxis : { mode : 'categories', tickLength: 0 } }) /* END BAR CHART */ /* * DONUT CHART * ----------- */ var donutData = [ { label: 'Series2', data: 30, color: '#3c8dbc' }, { label: 'Series3', data: 20, color: '#0073b7' }, { label: 'Series4', data: 50, color: '#00c0ef' } ] $.plot('#donut-chart', donutData, { series: { pie: { show : true, radius : 1, innerRadius: 0.5, label : { show : true, radius : 2 / 3, formatter: labelFormatter, threshold: 0.1 } } }, legend: { show: false } }) /* * END DONUT CHART */ }) /* * Custom Label formatter * ---------------------- */ function labelFormatter(label, series) { return '<div style="font-size:13px; text-align:center; padding:2px; color: #fff; font-weight: 600;">' + label + '<br>' + Math.round(series.percent) + '%</div>' }</script> }
the_stack
 @{ ViewData["Title"] = "Viper智能自由(Viper)"; } @*<script src="~/js/jquery.min.js"></script>*@ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script> <script src="~/js/base.js"></script> <!-- 先引入 Vue --> @*<script src="~/js/vue.min.js"></script>*@ <!-- 引入组件库 --> <!--<script src="~/js/element-ui-index.js"></script>--> <!-- 引入样式 --> <!--<link href="~/css/element-ui-index.css" rel="stylesheet" />--> <!-- 生产环境版本,优化了尺寸和速度 --> <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js"></script> <!-- 引入样式 --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.14.0/lib/theme-chalk/index.css"> <!-- 引入组件库 --> <script src="https://cdn.jsdelivr.net/npm/element-ui@2.14.0/lib/index.js"></script> <script src="~/js/httpVue/bluebird.min.js"></script> <script src="~/js/httpVue/httpVueLoader.min.js"></script> <div id="app" style="height:100%;display:none;"> <el-container> <el-container> <el-aside style="background-color: #545c64;" v-bind:style="{width:menumWidth}"> <div :class="{pc_menum:!isMobile,mobile_menum:isMobile}"> <el-menu :class="'el-menu'+menumWidth" :collapse="isCollapse" background-color="#001529" text-color="#fff" > <el-radio-group v-model="isCollapse" v-bind:style="{width:menumWidth}" style="height: 60px; background-color: #002140; text-align: center;"> <img src="~/img/logo.jpg" v-on:click="changeisCollapse" style="width: 48px; height: 48px; padding-top:6px; border: 2px; border-radius: 22.5px; -moz-border-radius: 25px; vertical-align: middle;" /> <span v-show="!isCollapse" style="font-size: 14px; color: white; font-weight: bold;margin-left: 3px; vertical-align: middle;">Viper&Anno</span> </el-radio-group> <el-submenu v-for="item,index in menuroot" :index="item.id"> <template slot="title"> <i :class="(item.icon==null||item.icon=='')?'el-icon-folder':item.icon"></i> <span slot="title">{{item.fname}}</span> </template> <el-menu-tree :item="item"></el-menu-tree> </el-submenu> </el-menu> </div> </el-aside> <el-main style="width: 100%; height: 100%; top: 0px; left: 0px;"> <el-header> <div v-on:click="changeisCollapse" style="width: 1px; float: left; cursor: pointer;"> <i :class="{'el-icon-s-fold':isCollapse==false,'el-icon-s-unfold':isCollapse}"></i> </div> <a v-show="(_isMobile&&isCollapse)||(!_isMobile)" style="cursor: pointer; text-decoration: underline; float:left;margin-left:40px;color:#3e3434;" target="_blank" href="https://duyanming.github.io/">官方文档</a> <div uInfo style="height: 60px; float: right; margin-right:10px;"> <el-avatar size="medium" style="vertical-align: middle;">{{profile.account}}</el-avatar> <el-dropdown trigger="click" @@command="handleCommand"> <span class="el-dropdown-link"> {{profile.name}}<i class="el-icon-caret-bottom el-icon--right"></i> </span> <el-dropdown-menu slot="dropdown"> <el-dropdown-item command="openUserCenter">个人中心</el-dropdown-item> <el-dropdown-item divided command="exitUser">退出</el-dropdown-item> </el-dropdown-menu> </el-dropdown> </div> </el-header> <el-container> <el-tabs v-model="activeName" @@tab-remove="removeTab" style="width:100%"> <el-tab-pane v-for="(item, index) in tabs" :key="item.name" :label="item.name" :name="item.name" :closable="item.closable"> <el-container v-loading="item.loading"> <iframe :id="item.id" @@load="tabOnLoad" frameborder="0" :src="item.src" style="width: 100%; height: calc(100% - 87px);"> </iframe> </el-container> </el-tab-pane> </el-tabs> </el-container> </el-main> </el-container> </el-container> </div> <script> if (anno.input.profile === undefined || localStorage.profile === undefined) { window.location.href = "/Home/Login"; } var _isCollapse = false, _isMobile = false, _menumWidth = "200px"; if (isMobile()) { _isCollapse = true; _isMobile = true; _menumWidth = "64px"; } Vue.config.productionTip = false; Vue.config.devtools = false; Vue.use(httpVueLoader); var vm = new Vue({ el: '#app', data: { activeName:"Dashboard", isCollapse: _isCollapse, isMobile: _isMobile, menumWidth: _menumWidth, profile: JSON.parse(localStorage.profile), menuroot: [], tabs: [ { id: "dashboard", name: "Dashboard", closable:false, src: "html/welcome.html?appName=@(Anno.Const.SettingService.AppName)", loading:false} ] }, created: function () {//用于数据初始化 var that = this; if (anno.input.profile === undefined || localStorage.profile === undefined) { window.location.href = "/Home/Login"; } var input = anno.getInput(); anno.ajaxpara.async = false; anno.process(input,"Anno.Plugs.Logic/Platform/GetUsrFc", function (data) { that.menuroot = data.outputData; that.getFunc(); }, function (data) { if (!data.status) { localStorage.clear(); window.location.href = "/Home/Login"; } }); anno.ajaxpara.async = true; $("#app").css("display", ""); }, methods: { handleCommand: function (command) { if (command === "openUserCenter") { this.openUserCenter(); } else if (command === "exitUser") { this.exitUser(); } }, removeTab: function (targetName) { var that = this; let tabs = that.tabs; let activeName = that.activeName; if (activeName === targetName) { for (var i = 0; i < tabs.length; i++) { var tab = tabs[i]; var index = i; if (tab.name === targetName) { let nextTab = tabs[index + 1] || tabs[index - 1]; if (nextTab) { activeName = nextTab.name; } } } } that.activeName = activeName; var _tabs = []; for (var i = 0; i < tabs.length; i++) { if (tabs[i].name !== targetName) { _tabs.push(tabs[i]); } } that.tabs = _tabs; if (that.tabs.length === 1) { that.tabs[0].closable = false; } else { for (var i = 0; i < that.tabs.length; i++) { that.tabs[i].closable = true; } } }, changeisCollapse: function () { var that = this; that.isCollapse = (that.isCollapse == false); if (that.isCollapse === true) { that.menumWidth = "64px"; } else { that.menumWidth = "200px"; } }, tabOnLoad: function (ev) { var id = ev.srcElement.id; var that = this; for (var i = 0; i < that.tabs.length; i++) { if (that.tabs[i].id === id) { that.tabs[i].loading = false; } } }, openMenuItem: function (item) { var that = this; var alreadyOpen = false; for (var i = 0; i < that.tabs.length; i++) { if (that.tabs[i].id === item.id) { alreadyOpen = true; } } if (alreadyOpen == true) { that.activeName = item.fname; return; } var tab = { id: "dashboard", name: "Dashboard", closable: true, src: "html/welcome.html?appName=@(Anno.Const.SettingService.AppName)", loading: true }; tab.id = item.id; tab.name = item.fname; tab.src = item.furl; that.tabs.push(tab); that.activeName = item.fname; if (that.tabs.length === 1) { that.tabs[0].closable = false; } else { for (var i = 0; i < that.tabs.length; i++) { that.tabs[i].closable = true; } } }, exitUser: function () { this.$confirm("确定退出?", "退出登录", { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(function () { localStorage.clear(); anno.input.profile = undefined; anno.input.uname = undefined; window.location.href = "/Home/Login"; }); }, openUserCenter: function () { this.openMenuItem({ id: "pcenter", fname: "个人中心", furl: "html/component.html?anno_component_name=anno-user-center"}); }, getFunc: function () { var that = this; var input = anno.getInput(); anno.ajaxpara.async = false; anno.process(input,"Anno.Plugs.Logic/Platform/GetFunc", function (data) { that.InitMenuRoot(data.outputData); }); }, InitMenuRoot: function (sub_menu) { var that = this; for (var mr in this.menuroot) { this.getChildren(that.menuroot[mr], sub_menu); } }, getChildren: function (mr, sub_menu) { var children = []; var childrenDir = []; for (var index in sub_menu) { let item = sub_menu[index]; if (item.pid == mr.id) { this.getChildren(item, sub_menu); if (item.children.length <= 0) { children.push(item); } else { childrenDir.push(item); } } } mr.children = children; mr.childrenDir = childrenDir; }, notify: function (msg) { var notifyMsg = '给我点点小星星吧,谢谢你的支持!<br/><iframe frameborder="0" src="http://ghbtns.com/github-btn.html?user=duyanming&repo=viper&type=watch&count=true" width="105" height="20"></iframe>' + '<iframe frameborder="0" src="http://ghbtns.com/github-btn.html?user=duyanming&repo=viper&type=fork&count=true" width="105" height="20" ></iframe>'; if (msg != undefined && msg != null && msg != "") { notifyMsg = msg; } this.$notify.info({ title: 'Hello, my friend', dangerouslyUseHTMLString: true, message: notifyMsg, position: 'bottom-right' }); } }, components: { 'el-menu-tree': httpVueLoader('/component/el-menu-tree.vue') } }); // 判断浏览器函数 function isMobile() { if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) { return true; // 移动端 } else { return false; // PC端 } } var inter; var count = 4; $(function () { setTimeout("notifysetInterval()", 1000); inter = self.setInterval("notifysetInterval()", 15000); }); function notifysetInterval() { try { vm.notify(); count--; if (count <= 0) { inter = window.clearInterval(inter); } } catch (ex) { console.log(ex); } } </script> <style> .pc_menum { height: 100%; position: relative; overflow: hidden; } .mobile_menum { height: 100%; position: relative; } .el-tabs__header { padding-left: 20px; } .el-tabs__content { height: calc(100% - 13px); } .el-tab-pane { height: 100%; } html, body { height: 100%; margin: 0px; padding: 0px; margin: 0px 0px; } div[uInfo] { margin-left: 10px; } .el-header { padding: 0 0px; background-color: #fff; color: #333; left: 20px; line-height: 60px; border-bottom: 1px solid #e6e6e6; /*box-shadow: 0px 5px 2px rgba(0,21,41,.35);*/ } .el-aside { background-color: #D3DCE6; color: #333; /*overflow: hidden;*/ /*width:200px;*/ /*box-shadow: 2px 0 6px rgba(0,21,41,.35);*/ } .el-submenu__icon-arrow { right: 40px; } .el-menu200px { border-right: solid 0px #e6e6e6; /*width: 220px;*/ height: 100%; position: absolute; overflow-x: hidden; overflow-y: scroll; } .el-menu64px { border-right: solid 0px #e6e6e6; /*width: 220px;*/ height: 100%; } .el-container { height: 100%; } .el-main { color: #333; text-align: center; padding: 0 0; overflow-y: hidden; /*margin-left: 8px;*/ } .el-tabs__header { margin: 0px; } </style>
the_stack
@model HomeAutio.Mqtt.GoogleHome.ViewModels.TraitViewModel @section Scripts { <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.8.8/beautify.js"></script> <script src="~/lib/codemirror/lib/codemirror.js"></script> <script src="~/lib/codemirror/mode/javascript/javascript.js"></script> <link rel="stylesheet" href="~/lib/codemirror/lib/codemirror.css" /> <script src="//rawgithub.com/zaach/jsonlint/79b553fb65c192add9066da64043458981b3972b/lib/jsonlint.js"></script> <script src="~/lib/codemirror/addon/lint/lint.js"></script> <script src="~/lib/codemirror/addon/lint/json-lint.js"></script> <link rel="stylesheet" href="~/lib/codemirror/addon/lint/lint.css" /> <script src="~/lib/codemirror/addon/fold/foldcode.js"></script> <script src="~/lib/codemirror/addon/fold/brace-fold.js"></script> <script src="~/lib/codemirror/addon/fold/foldgutter.js"></script> <link rel="stylesheet" href="~/lib/codemirror/addon/fold/foldgutter.css" /> <script src="~/lib/codemirror/addon/edit/closebrackets.js"></script> <script src="~/lib/codemirror/addon/edit/matchbrackets.js"></script> <script> var codemirrorOptions = { mode: "application/json", lineNumbers: true, foldGutter: true, gutters: ["CodeMirror-lint-markers", "CodeMirror-linenumbers", "CodeMirror-foldgutter"], lint: true, matchBrackets: true, autoCloseBrackets: true, }; var attributesEditor = CodeMirror.fromTextArea(document.getElementById("Attributes"), codemirrorOptions); var commandsEditor = CodeMirror.fromTextArea(document.getElementById("Commands"), codemirrorOptions); var stateEditor = CodeMirror.fromTextArea(document.getElementById("State"), codemirrorOptions); var attributeExamples = document.getElementById("attributeExamples"); var commandExamples = document.getElementById("commandExamples"); var stateExamples = document.getElementById("stateExamples"); // Create example accordion item var getCardCollapseNode = function(parentId, collapseId, comment, example) { var cardNode = document.createElement("div"); cardNode.className = "card"; // Header var cardHeaderNode = document.createElement("div"); cardHeaderNode.className = "card-header"; var cardHeaderButtonNode = document.createElement("button"); cardHeaderButtonNode.className = "btn btn-primary"; cardHeaderButtonNode.style = "width: 100%"; cardHeaderButtonNode.dataset.toggle = "collapse"; cardHeaderButtonNode.dataset.target = "#" + collapseId; cardHeaderButtonNode.innerHTML = comment; cardHeaderNode.appendChild(cardHeaderButtonNode); // Collapse var cardCollapseNode = document.createElement("div"); cardCollapseNode.id = collapseId; cardCollapseNode.className = "collapse"; cardCollapseNode.dataset.parent = "#" + parentId; $(cardCollapseNode).collapse({ parent: "#" + parentId, toggle: false }); // Card body var cardBodyNode = document.createElement("div"); cardBodyNode.className = "card-body"; var preformattedText = document.createElement("pre"); preformattedText.innerText = example; cardBodyNode.appendChild(preformattedText); cardCollapseNode.appendChild(cardBodyNode); cardNode.appendChild(cardHeaderNode); cardNode.appendChild(cardCollapseNode); return cardNode; } // Templates var loadTemplate = function () { var traitDropDown = document.getElementById("Trait"); var traitName = traitDropDown.options[traitDropDown.selectedIndex].text; if (traitName !== "Please select") { // Dispose any existing accordions $(attributeExamples.querySelectorAll(".collapse")).collapse("dispose"); attributeExamples.innerHTML = ""; $(commandExamples.querySelectorAll(".collapse")).collapse("dispose"); commandExamples.innerHTML = ""; $(stateExamples.querySelectorAll(".collapse")).collapse("dispose"); stateExamples.innerHTML = ""; // Make call to get examples for traitName $.get("Examples?traitId=" + traitName, function (examples) { // Add new accordions for (var i in examples.attributeExamples) { var parentId = "attributeExamples"; var childId = "attributeExample" + i; var comment = examples.attributeExamples[i].comment; var example = examples.attributeExamples[i].example; attributeExamples.appendChild(getCardCollapseNode(parentId, childId, comment, example)); } // Add new accordions for (var i in examples.commandExamples) { var parentId = "commandExamples"; var childId = "commandExample" + i; var comment = examples.commandExamples[i].comment; var example = examples.commandExamples[i].example; commandExamples.appendChild(getCardCollapseNode(parentId, childId, comment, example)); } // Add new accordions for (var i in examples.stateExamples) { var parentId = "stateExamples"; var childId = "stateExample" + i; var comment = examples.stateExamples[i].comment; var example = examples.stateExamples[i].example; stateExamples.appendChild(getCardCollapseNode(parentId, childId, comment, example)); } }); } }; var openDocumentation = function () { var traitDropDown = document.getElementById("Trait"); var traitName = traitDropDown.options[traitDropDown.selectedIndex].text; if (traitName !== "Please select") { window.open('https://developers.google.com/actions/smarthome/traits/' + traitName.toLowerCase()); } } var challengePinHideShow = function () { if ($("#ChallengeType").val() == '2') { $('#challengePin-form-group').show(); } else { $('#challengePin-form-group').hide(); } }; $(function () { loadTemplate(); challengePinHideShow(); $('#ChallengeType').change(challengePinHideShow); }); </script> <style> .CodeMirror { border: 1px solid #ccc; border-radius: 4px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); } </style> } <div class="device-page"> <div class="lead"> <h1>Create Trait</h1> </div> <partial name="_ValidationSummary" /> <div class="row"> <div class="col-sm-6"> <div class="card"> <div class="card-header"> <h2>Trait Information</h2> </div> <form method="post"> <div class="card-body"> <fieldset> <div class="form-group"> <label asp-for="Trait">Trait</label> <select class="form-control" asp-for="Trait" asp-items="@(Html.GetEnumSelectList<HomeAutio.Mqtt.GoogleHome.Models.TraitType>().Where(x => x.Text != "Unknown"))" onchange="loadTemplate()"> <option selected="selected" value="">Please select</option> </select> </div> <div class="form-group"> <label asp-for="ChallengeType">Challenge Type</label> <select class="form-control" asp-for="ChallengeType" asp-items="@Html.GetEnumSelectList<HomeAutio.Mqtt.GoogleHome.Models.State.Challenges.ChallengeType>()"></select> </div> <div class="form-group" id="challengePin-form-group"> <label asp-for="ChallengePin">Challenge Pin</label> <input class="form-control" placeholder="Challenge Pin" asp-for="ChallengePin"> </div> <div class="form-group"> <label asp-for="Attributes">Attributes</label> <textarea class="form-control" asp-for="Attributes"></textarea> </div> <div class="form-group"> <label asp-for="Commands">Commands</label> <textarea class="form-control" asp-for="Commands"></textarea> </div> <div class="form-group"> <label asp-for="State">State</label> <textarea class="form-control" asp-for="State"></textarea> </div> </fieldset> </div> <div class="card-footer"> <div class="form-group"> <button class="btn btn-primary" name="button" value="update">Create</button> <a asp-controller="GoogleDevice" asp-action="Edit" asp-route-deviceId="@(Context.Request.Query["deviceId"])" class="btn btn-default">Cancel</a> </div> </div> </form> </div> </div> <div class="col-sm-6"> <div class="card"> <div class="card-header"> <h2>Examples <button onclick="openDocumentation()" class="btn btn-warning">Trait documentation</button></h2> </div> <div class="card-body"> <h6>Attribute Examples</h6> <div id="attributeExamples"></div> <h6>Command Examples</h6> <div id="commandExamples"></div> <h6>State Examples</h6> <div id="stateExamples"></div> </div> </div> </div> </div> </div>
the_stack
@model ToPage @{ ViewBag.Title = "Create"; } @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="container"> <div class="row"> <h4>Create Room</h4> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) <div class="form-group"> <div class="col-md-4"> @Html.LabelFor(model => model.roomModel.region) @Html.EditorFor(model => model.roomModel.region, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.roomModel.region, "", new { @class = "text-danger" }) </div> <div class="col-md-4"> @Html.LabelFor(model => model.roomModel.area) @Html.EditorFor(model => model.roomModel.area, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.roomModel.area, "", new { @class = "text-danger" }) </div> <div class="col-md-4"> @Html.LabelFor(model => model.roomModel.areaId) @Html.EditorFor(model => model.roomModel.areaId, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.roomModel.areaId, "", new { @class = "text-danger" }) </div> </div> </div> <div class="row"> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.roomModel.title) @Html.EditorFor(model => model.roomModel.title, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.roomModel.title, "", new { @class = "text-danger" }) @Html.LabelFor(model => model.roomModel.description, htmlAttributes: new { @class = "control-label" }) @Html.TextAreaFor(model => model.roomModel.description, 10, 20, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.roomModel.description, "", new { @class = "text-danger" }) @Html.LabelFor(model => model.roomModel.terrain) @Html.EnumDropDownListFor(model => model.roomModel.terrain, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.roomModel.terrain, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> <div class="col-md-12"> <h2 class="page-header">Keywords</h2> <p>This is to describe objects in the room description so players can examine the ornament or smell the cookies etc. If an Item is important add it as an item so player can interact with it.</p> <a id="js-addKeyword-btn" href="javascript:void(0)" class="btn btn-sm btn-success">Add new keyword</a> <br /> <br /> <table class="table table-bordered"> <thead> <tr> <th>Name</th> <th>look</th> <th>examine</th> <th>smell</th> <th>taste</th> <th>touch</th> </tr> </thead> <tbody id="js-keyword-table"></tbody> </table> <div id="js-addKeyword" style="display: none;"> <div class="col-md-12"> @Html.LabelFor(model => model.roomKeywords.name) @Html.EditorFor(model => model.roomKeywords.name, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.roomKeywords.name, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.roomKeywords.look) @Html.TextAreaFor(model => model.roomKeywords.look, 10, 20, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.roomKeywords.look, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.roomKeywords.examine) @Html.TextAreaFor(model => model.roomKeywords.examine, 10, 20, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.roomKeywords.examine, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.roomKeywords.smell) @Html.TextAreaFor(model => model.roomKeywords.smell, 10, 20, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.roomKeywords.smell, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.roomKeywords.taste) @Html.TextAreaFor(model => model.roomKeywords.taste, 10, 20, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.roomKeywords.taste, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.roomKeywords.touch) @Html.TextAreaFor(model => model.roomKeywords.touch, 10, 20, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.roomKeywords.touch, "", new { @class = "text-danger" }) </div> <a id="js-addKeyword-save" href="javascript:void(0)" class="btn btn-success">Add keyword</a> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <h2 class="page-header">Exits</h2> <p>Exits must have a name and can only be North, East, South, West, Up and Down. Double Check Region and Area Spelling. AreaId should be generated dynamically.</p> <a id="js-addExit-btn" href="javascript:void(0)" class="btn btn-sm btn-success">Add new exit</a> <br /> <br /> <table class="table table-bordered"> <thead> <tr> <th>Name</th> <th>Region</th> <th>Area</th> <th>AreaId</th> </tr> </thead> <tbody id="js-exit-table"></tbody> </table> </div> </div> <div class="row"> <div id="js-addExit" style="display:none;"> <div class="form-group"> <div class="col-md-3"> @Html.LabelFor(model => model.exitModel.name) @Html.EditorFor(model => model.exitModel.name, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.exitModel.name, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.exitModel.region, htmlAttributes: new { @class = "control-label" }) @Html.EditorFor(model => model.exitModel.region, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.exitModel.region, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.exitModel.area) @Html.EditorFor(model => model.exitModel.area, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.exitModel.area, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.exitModel.areaId) @Html.EditorFor(model => model.exitModel.areaId, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.exitModel.areaId, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> <div class="col-md-6"> @Html.LabelFor(model => model.exitModel.locked) @Html.CheckBoxFor(model => model.exitModel.locked) @Html.ValidationMessageFor(model => model.exitModel.locked, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.exitModel.keyId) @Html.EditorFor(model => model.exitModel.keyId, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.exitModel.keyId, "", new { @class = "text-danger" }) </div> </div> <a id="js-addExit-save" href="javascript:void(0)" class="btn btn-success">Add exit</a> </div> </div> <div class="row"> <h2 class="page-header">Mobs</h2> <p>Here we add mobs</p> <table class="table table-bordered"> <thead> <tr> <th>Name</th> <th>Gender</th> <th>Race</th> <th>Class</th> <th>Stats</th> <th>Level</th> <th>Alignment</th> <th>HP</th> <th>Mana</th> <th>Movs</th> <th>Hit / Dam</th> <th>Status</th> <th>Gold</th> <th>Silver</th> <th>Copper</th> <th>Description</th> <th>Inventory</th> </tr> </thead> <tbody id="js-mob-table"></tbody> </table> <div id="js-toggle-mob" style="display: none;"> <div class="form-group"> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Name) @Html.EditorFor(model => model.mobModel.Name, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Name, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Gender) @Html.EditorFor(model => model.mobModel.Gender, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Gender, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Race) @Html.EditorFor(model => model.mobModel.Race, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Race, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.SelectedClass) @Html.EditorFor(model => model.mobModel.SelectedClass, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.SelectedClass, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Description) @Html.TextAreaFor(model => model.mobModel.Description, 10, 20, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.mobModel.Description, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.mobModel.Strength) @Html.EditorFor(model => model.mobModel.Strength, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Strength, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.mobModel.Dexterity) @Html.EditorFor(model => model.mobModel.Dexterity, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Dexterity, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.mobModel.Constitution) @Html.EditorFor(model => model.mobModel.Constitution, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Constitution, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.mobModel.Wisdom) @Html.EditorFor(model => model.mobModel.Wisdom, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Wisdom, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.mobModel.Intelligence) @Html.EditorFor(model => model.mobModel.Intelligence, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Intelligence, "", new { @class = "text-danger" }) </div> <div class="col-md-3"> @Html.LabelFor(model => model.mobModel.Charisma) @Html.EditorFor(model => model.mobModel.Charisma, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Charisma, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Level) @Html.EditorFor(model => model.mobModel.Level, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Level, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.AlignmentScore) @Html.EditorFor(model => model.mobModel.AlignmentScore, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.AlignmentScore, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.MaxHitPoints) @Html.EditorFor(model => model.mobModel.MaxHitPoints, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.MaxHitPoints, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.MaxManaPoints) @Html.EditorFor(model => model.mobModel.MaxManaPoints, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.MaxManaPoints, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.MaxMovePoints) @Html.EditorFor(model => model.mobModel.MaxMovePoints, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.MaxMovePoints, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.HitRoll) @Html.EditorFor(model => model.mobModel.HitRoll, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.HitRoll, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.DamRoll) @Html.EditorFor(model => model.mobModel.DamRoll, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.DamRoll, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Status) @Html.EnumDropDownListFor(model => model.mobModel.Status, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.mobModel.Status, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Gold) @Html.EditorFor(model => model.mobModel.Gold, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Gold, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Silver) @Html.EditorFor(model => model.mobModel.Silver, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Silver, "", new { @class = "text-danger" }) </div> <div class="col-md-6"> @Html.LabelFor(model => model.mobModel.Copper) @Html.EditorFor(model => model.mobModel.Copper, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.mobModel.Copper, "", new { @class = "text-danger" }) </div> </div> </div> <a id="js-addMob-btn" href="javascript:void(0)" class="btn btn-sm btn-success">Add new mob</a> <a href="javascript:void(0)" id="js-addMob-save">Add Mob</a> </div> <div class="row"> <!-- ITEM --> <h2 class="heading">Add Items</h2> <hr /> If you want an item to be in the room but hidden. check the don't display box. but remmeber to inlude the item in the description for observant players. for containers, select the container and add to container button instead of room. <br /> <div class="table-responsive"> <table class="table table-bordered"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Dam min</th> <th>Dam Max</th> <th>Dam Roll</th> <th>Attack Type</th> <th>Weapon Type</th> <th>EQ Slot</th> <th>Min Usage lvl</th> <th>Equipable</th> <th>Item Flags</th> <th>Dam Type</th> <th>Look</th> <th>Examine</th> <th>Room</th> <th>Taste</th> <th>Touch</th> <th>Smell</th> </tr> </thead> <tbody id="js-item-table"></tbody> </table> </div> <br /> <br /> <a href="javascript:void(0)" id="js-addItem-btn" class="btn btn-success">Add a new Item</a> </div> <div id="js-toggle-item" style="display: none;"> <!-- Select ITem--> <div class="form-group"> <div class="col-md-12"> <label for="listbox">Select Item</label> <select name="listbox" id="listbox" class="form-control"> <option>Select item to add</option> @foreach (var item in Model.itemSelect) { <option value="@item.name"> @item.name </option> } </select> <a href="javascript:void(0)">Add Item</a> </div> </div> <div class="row"> <!-- item name --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.name) @Html.EditorFor(model => model.itemModel.name, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.itemModel.name, "", new { @class = "text-danger" }) <!-- item type --> //Always an object @Html.LabelFor(model => model.itemModel.type) @Html.EnumDropDownListFor(model => model.itemModel.type, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.type, "", new { @class = "text-danger" }) </div> </div> </div> <!-- If weapon show --> <div class="row"> <!-- item dam min --> <div class="form-group"> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.stats.damMin) @Html.EditorFor(model => model.itemModel.stats.damMin, new { htmlAttributes = new { @class = "form-control", @value = 0 } }) @Html.ValidationMessageFor(model => model.itemModel.stats.damMin, "", new { @class = "text-danger" }) </div> <!-- item dam max --> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.stats.damMax) @Html.EditorFor(model => model.itemModel.stats.damMax, new { htmlAttributes = new { @class = "form-control", @value = 0 } }) @Html.ValidationMessageFor(model => model.itemModel.stats.damMax, "", new { @class = "text-danger" }) </div> <!-- item dam roll --> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.stats.damRoll) @Html.EditorFor(model => model.itemModel.stats.damRoll, new { htmlAttributes = new { @class = "form-control", @value = 0 } }) @Html.ValidationMessageFor(model => model.itemModel.stats.damRoll, "", new { @class = "text-danger" }) </div> </div> </div> <div class="row"> <!-- item attack type --> <div class="form-group"> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.attackType) @Html.EnumDropDownListFor(model => model.itemModel.attackType, "- Please select attack Type -", new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.attackType, "", new { @class = "text-danger" }) </div> <!-- item weapon type --> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.weaponType) @Html.EnumDropDownListFor(model => model.itemModel.weaponType, "- Please select attack Type -", new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.weaponType, "", new { @class = "text-danger" }) </div> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.slot) @Html.EnumDropDownListFor(model => model.itemModel.eqSlot, "- Please select equipment slot -", new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.slot, "", new { @class = "text-danger" }) </div> </div> </div> <!-- /If weapon show --> <div class="row"> <!-- item min usage level --> <div class="form-group"> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.stats.minUsageLevel) @Html.EditorFor(model => model.itemModel.stats.minUsageLevel, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.itemModel.stats.minUsageLevel, "", new { @class = "text-danger" }) </div> <!-- item Equipable --> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.equipable) @Html.CheckBoxFor(model => model.itemModel.equipable, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.itemModel.equipable, "", new { @class = "text-danger" }) </div> <div class="col-md-4"> @Html.LabelFor(model => model.itemModel.container) @Html.CheckBoxFor(model => model.itemModel.container, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.itemModel.container, "", new { @class = "text-danger" }) </div> </div> </div> <div class="row"> <!-- item flags --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.itemFlags) <hr /> <div class="row"> @{ foreach (var item in Model.itemModel.itemFlags) { <div class="col-xs-3"> <div class="checkbox"> <input class="js-itemFlags" type="checkbox" name="SelectedSources" value="@item">@item </div> </div> } } </div> </div> </div> </div> <div class="row"> <!-- item damage type --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.damageType) <hr /> <div class="row"> @{ foreach (var item in Model.itemModel.damageType) { <div class="col-xs-3"> <div class="checkbox"> <input id="stats_@item" class="js-damTypeFlags" type="checkbox" name="SelectedSources" value="@item">@item </div> </div> } } </div> </div> </div> </div> <!-- descriptions --> <!-- item description look --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.description.look) @Html.TextAreaFor(model => model.itemModel.description.look, 5, 5, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.description.look, "", new { @class = "text-danger" }) </div> </div> <!-- item description examine --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.description.exam) @Html.TextAreaFor(model => model.itemModel.description.exam, 5, 5, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.description.exam, "", new { @class = "text-danger" }) </div> </div> <!-- item description room --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.description.room) @Html.TextAreaFor(model => model.itemModel.description.room, 5, 5, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.description.room, "", new { @class = "text-danger" }) </div> </div> <!-- item description taste --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.description.taste) @Html.TextAreaFor(model => model.itemModel.description.taste, 5, 5, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.description.taste, "", new { @class = "text-danger" }) </div> </div> <!-- item description touch --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.description.touch) @Html.TextAreaFor(model => model.itemModel.description.touch, 5, 5, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.description.touch, "", new { @class = "text-danger" }) </div> </div> <!-- item description smell --> <div class="form-group"> <div class="col-md-12"> @Html.LabelFor(model => model.itemModel.description.smell) @Html.TextAreaFor(model => model.itemModel.description.smell, 5, 5, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.itemModel.description.smell, "", new { @class = "text-danger" }) </div> </div> Add Item to: <select id="js-add-item-to-where"> <option value="room">Room</option> <!-- mobs, corpses, containers --> </select> <a id="js-AddItem" href="javascript:void(0)">Add Item</a> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Create" class="btn btn-default" /> <a href="#" id="js-add-room" class="btn btn-success">Add Room</a> </div> </div> </div> @Html.ActionLink("Back to List", "Index") @section Scripts { @Scripts.Render("~/bundles/jqueryval") <script> $(function () { console.log("Loaded"); //Add a new exit $("#js-addKeyword-btn").click(function () { console.log("keyword add button click"); $("#js-addKeyword").toggle(); }); window.keywordArray = []; //add exit to array and to table $("#js-addKeyword-save").click(function () { var keywordData = { "name": $("#roomKeywords_name").val(), "look": $("#roomKeywords_look").val(), "examine": $("#roomKeywords_examine").val(), "smell": $("#roomKeywords_smell").val(), "taste": $("#roomKeywords_taste").val(), "touch": $("#roomKeywords_touch").val(), } keywordArray.push(keywordData); var keywordRow = '<tr class="js-exit-row">' + '<td class="js-exit-name">' + keywordData.name + '</td>' + '<td class="js-exit-Region">' + keywordData.look + '</td>' + '<td class="js-exit-Area">' + keywordData.examine + '</td>' + '<td class="js-exit-AreaId">' + keywordData.smell + '</td>' + '<td class="js-exit-Area">' + keywordData.taste + '</td>' + '<td class="js-exit-AreaId">' + keywordData.touch + '</td>' + '' + '</tr>'; $("#js-keyword-table").append(keywordRow); $("#js-addKeyword").hide(); //reset fields and hide Add exit section $("#roomKeywords_name").val(''); $("#roomKeywords_look").val(''); $("#roomKeywords_examine").val(''); $("#roomKeywords_smell").val(''); $("#roomKeywords_taste").val(''); $("#roomKeywords_touch").val(''); }); }); //add a </script> <script> $(function () { console.log("Loaded"); //Add a new exit $("#js-addMob-btn").click(function () { console.log("keyword add button click"); $("#js-toggle-mob").toggle(); }); window.mobArray = []; //add exit to array and to table $("#js-addMob-save").click(function () { var mobData = { "name": $("#mobModel_Name").val(), "gender": $("#mobModel_Gender").val(), "race": $("#mobModel_Race").val(), "class": $("#mobModel_SelectedClass").val(), "strength": $("#mobModel_Strength").val(), "dexterity": $("#mobModel_Dexterity").val(), "constitution": $("#mobModel_Constitution").val(), "wisdom": $("#mobModel_Wisdom").val(), "intelligence": $("#mobModel_Intelligence").val(), "charisma": $("#mobModel_Charisma").val(), "level": $("#mobModel_Level").val(), "alignment": $("#mobModel_AlignmentScore").val(), "hp": $("#mobModel_MaxHitPoints").val(), "mana": $("#mobModel_MaxManaPoints").val(), "moves": $("#mobModel_MaxMovePoints").val(), "hit": $("#mobModel_HitRoll").val(), "dam": $("#mobModel_DamRoll").val(), "status": $("#mobModel_Status").val(), "gold": $("#mobModel_Gold").val(), "silver": $("#mobModel_Silver").val(), "copper": $("#mobModel_Copper").val(), "inventory": [], "description":"" } $("#js-add-item-to-where").append($('<option/>', { value: mobData.name, text: mobData.name })); mobArray.push(mobData); var mobRow = '<tr>' + '<td class="">' + mobData.name + '</td>' + '<td class="">' + mobData.gender + '</td>' + '<td class="">' + mobData.race + '</td>' + '<td class="">' + mobData.class + '</td>' + '<td class="">' + "str: " + mobData.strength + " dex: " + mobData.dexterity + " con: " + mobData.constitution + " wis: " + mobData.wisdom + " int: " + mobData.intelligence + " cha: " + mobData.charisma + '</td>' + '<td class="">' + mobData.level + '</td>' + '<td class="">' + mobData.alignment + '</td>' + '<td class="">' + mobData.hp + '</td>' + '<td class="">' + mobData.mana + '</td>' + '<td class="">' + mobData.moves + '</td>' + '<td class="">' + mobData.hit +"/"+ mobData.dam + '</td>' + '<td class="">' + mobData.status + '</td>' + '<td class="">' + mobData.gold + '</td>' + '<td class="">' + mobData.silver + '</td>' + '<td class="">' + mobData.copper + '</td>' + '</tr>'; $("#js-mob-table").append(mobRow); $("#js-addMob").hide(); //reset fields and hide Add exit section $("#mobModel_Name").val(''), $("#mobModel_Gender").val(''); $("#mobModel_Race").val(''); $("#mobModel_SelectedClass").val(''); $("#mobModel_Strength").val(''); $("#mobModel_Dexterity").val(''); $("#mobModel_Constitution").val(''); $("#mobModel_Wisdom").val(''); $("#mobModel_Intelligence").val(''); $("#mobModel_Charisma").val(''); $("#mobModel_Level").val(''); $("#mobModel_AlignmentScore").val(''); $("#mobModel_MaxHitPoints").val(''); $("#mobModel_MaxManaPoints").val(''); $("#mobModel_MaxMovePoints").val(''); $("#mobModel_HitRoll").val(''); $("#mobModel_DamRoll").val(''); $("#mobModel_Status").val(''); $("#mobModel_Gold").val(''); $("#mobModel_Silver").val(''); $("#mobModel_Copper").val(''); }); }); </script> <script> $(function () { console.log("Loaded"); //Add a new exit $("#js-addExit-btn").click(function () { console.log("Exit add button click"); console.log("addExit is it visible: " + $('#js-addExit').is(":visible")); //Show / hide hidden Exit fields $("#js-addExit").toggle(); }); window.exitsArray = []; //add exit to array and to table $("#js-addExit-save").click(function () { var exitData = { "name": $("#exitModel_name").val(), "areaId": $("#exitModel_areaId").val(), "area": $("#exitModel_area").val(), "region": $("#exitModel_region").val(), "keywords": null, "locked": $("#exitModel_locked").val(), "keyValue": null, "hidden": false, "location": null, "equipable": false, "slot": null, "actions": null, "description": null, "stats": null, "keyId": $("#exitModel.keyId").val(), } exitsArray.push(exitData); var exitRow = '<tr class="js-exit-row"><td class="js-exit-name">' + exitData.name + '</td><td class="js-exit-Region">' + exitData.region + '</td><td class="js-exit-Area">' + exitData.area + '</td><td class="js-exit-AreaId">' + exitData.areaId + '</td></tr>'; $("#js-exit-table").append(exitRow); $("#js-addExit").hide(); //reset fields and hide Add exit section $("#exitModel_name").val(''); $("#exitModel_region").val(''); $("#exitModel_area").val(''); $("#exitModel_areaId").val(''); }); }); //add a </script> <script> //Add a new exit $("#js-addItem-btn").click(function () { console.log("Exit add button click"); console.log("addExit is it visible: " + $('#js-addExit').is(":visible")); //Show / hide hidden Exit fields $("#js-toggle-item").toggle(); }); //add a new item $("#js-AddItem").click(function () { var itemFlagValues = $('.js-itemFlags:checked').map(function () { return this.value; }).get(); var itemDamTypeValues = $('.js-damTypeFlags:checked').map(function () { return this.value; }).get(); window.item = []; var data = { type: $("#itemModel_type").val(), location: "room", equipable: $("#itemModel_equipable").val(), slot: $("#itemModel_eqSlot option:selected").val(), name: $("#itemModel_name").val(), container: $("#itemModel_container").val(), actions: { wield: "wield" }, description: { look: $("#itemModel_description_look").val(), exam: $("#itemModel_description_exam").val(), room: $("#itemModel_description_room").val(), taste: $("#itemModel_description_taste").val(), touch: $("#itemModel_description_touch").val(), smell: $("#itemModel_description_smell").val(), }, stats: { damMin: $("#itemModel_stats_damMin").val(), damMax: $("#itemModel_stats_damMax").val(), damRoll: $("#itemModel_stats_damRoll").val(), minUsageLevel: $("#itemModel_stats_minUsageLevel").val(), worth: 0 }, containerItems: null, itemFlags: itemFlagValues, damageType: itemDamTypeValues }; if (data.container == true) { $("#js-add-item-to-where").append($('<option/>', { value: data.name, text: data.name })); } //push item to container/ mob var addItemToWhere = $("#js-add-item-to-where"); if (addItemToWhere.val() === "room") { window.item.push(data); } else { var mobArrayLen = mobArray.length; var itemArrayLen = window.item.length; for (var i = 0; i < mobArrayLen; i++) { if (mobArray[i].name === addItemToWhere.val()) { data.location = "Inventory"; mobArray[i].inventory = data; return; } } } /* Push item data to an array and display under added Items */ $.ajax({ type: "POST", url: "/Room/addItem", content: "application/json; charset=utf-8", dataType: "json", data: data, success: function (d) { }, error: function (xhr, textStatus, errorThrown) { // TODO: Show error }, complete: function () { var itemRow = "<tr><td>" + data.name + "</td>" + "<td>" + data.type + "</td>" + "<td>" + data.stats.damMin + "</td>" + "<td>" + data.stats.damMax + "</td>" + "<td>" + $("#itemModel_stats_damRoll").val() + "</td>" + "<td>" + $("#itemModel_attackType option:selected").text() + "</td>" + "<td>" + $("#itemModel_weaponType option:selected").text() + "</td>" + "<td>" + $("#itemModel_eqSlot option:selected").text() + "</td>" + "<td>" + $("#itemModel_stats_minUsageLevel").val() + "</td>" + "<td>" + data.equipable + "</td>" + "<td>" + itemFlagValues + "</td>" + "<td>" + itemDamTypeValues + "</td>" + "<td>" + data.description.look + "</td>" + "<td>" + data.description.exam + "</td>" + "<td>" + data.description.room + "</td>" + "<td>" + data.description.taste + "</td>" + "<td>" + data.description.touch + "</td>" + "<td>" + data.description.smell + "</td></tr>"; $("#js-item-table").append(itemRow); } }); }); </script> <script> $("#js-add-room").click(function () { var roomModel = { "roomModel": { "region": $('#roomModel_region').val(), "area": $('#roomModel_area').val(), "areaId": $('#roomModel_areaId').val(), "clean": true, "modified": "", "title": $('#roomModel_title').val(), "description": $('#roomModel_description').val(), "terrain": $('#roomModel.terrain').val(), "keywords": keywordArray, "exits": window.exitsArray, "players": [], "fighting": [], "mobs": mobArray, "items": window.item, "corpses": [] } } console.log(roomModel) console.log(JSON.stringify(roomModel)) $.ajax({ type: "POST", url: "/Room/create", content: "application/json; charset=utf-8", dataType: "json", data: roomModel, success: function (d) { }, error: function (xhr, textStatus, errorThrown) { // TODO: Show error }, complete: function () { } }); }); </script> } }
the_stack
@using TextAdventures.Quest; @using WebEditor.Views.Edit; @model WebEditor.Models.Controls.EditorControl @{ IEditorControl ctl = Model.Control; bool isFirst = Model.IsFirst; string controlType = Model.ControlType; string caption = Model.Caption; object value; value = (ctl.Attribute == null) ? null : Model.EditorData.GetAttribute(ctl.Attribute); if (caption == null) { caption = ctl.Caption; } switch (controlType) { case "checkbox": @Html.CheckBox(ctl.Attribute, value as bool? == true, new { @class = "elementEditorCheckbox" }) @Html.Label(ctl.Attribute, caption) break; case "textbox": @Html.TextBox(ctl.Attribute, (string)value, new { style = "width: 100%", @class = "elementEditorTextbox" }) break; case "list": @Html.Action("EditStringList", new { id = Model.GameId, key = Model.Key, control = ctl }) break; case @"script": @Html.Action("EditScript", new { id = Model.GameId, key = Model.Key, control = ctl }) break; case "attributes": var data = (IEditorDataExtendedAttributeInfo) Model.EditorData; <div id="attributesListEditor"> <div id="attributesListScroller" style=""> <table> <thead> <tr class="ui-corner-tr ui-widget-header"> <th class="attributeName">Name</th> <th class="attributeValue">Value</th> <th class="attributeSource">Source</th> </tr> </thead> <tbody> @foreach (var attr in data.GetAttributeData()) { <tr id="attr__@(attr.AttributeName)" class="attributeRow"> <td class="attributeName">@Html.Raw(attr.AttributeName)</td> <td class="attributeValue">@Html.Raw(EditorUtility.GetDisplayString(data.GetAttribute(attr.AttributeName)))</td> <td class="attributeSource">@Html.Raw(attr.Source)</td> </tr> } </tbody> </table> </div> <div id="attributeRowEditor" style="display: none;"> </div> </div> break; case "label": <div class="elementEditorLabel"> @{ var href = ctl.GetString("href"); if (href == null) { @caption } else { <a href="@href" target="_blank">@caption</a> } } </div> break; case "title": string className = isFirst ? "elementEditorTitleTop" : "elementEditorTitle"; <div class="@className">@caption</div> break; case "dropdown": string selectedItem = value as string; IEnumerable<SelectListItem> valuesList = ControlHelpers.GetDropdownValues(ctl, selectedItem, Model.Controller); @Html.DropDownList(ctl.Attribute, valuesList, new { @class = "elementEditorDropdown" }) break; case "richtext": var richTextModel = new WebEditor.Models.Controls.RichTextControl { Control = ctl, // replace any <br/> tags with NewLine character Value = ((string)value).Replace("<br/>", Environment.NewLine).Replace("<br />", Environment.NewLine) }; ControlHelpers.PopulateRichTextControlModel(ctl, Model.Controller, richTextModel); Html.RenderPartial("Controls/RichTextControl", richTextModel); break; case "number": string minMax = string.Empty; int? min = ctl.GetInt("minimum"); int? max = ctl.GetInt("maximum"); if (min.HasValue) { minMax += string.Format("min={0}", min); } if (max.HasValue) { if (minMax.Length > 0) { minMax += " "; } minMax += string.Format("max={0}", max); } <input type="number" name="@ctl.Attribute" id="@ctl.Attribute" value="@Model.EditorData.GetAttribute(ctl.Attribute)" @minMax style="width: 50px" /> break; case "numberdouble": string doubleMinMax = string.Empty; double? dblMin = ctl.GetDouble("minimum"); double? dblMax = ctl.GetDouble("maximum"); if (dblMin.HasValue) { doubleMinMax += string.Format("min={0}", dblMin); } if (dblMax.HasValue) { if (doubleMinMax.Length > 0) { doubleMinMax += " "; } doubleMinMax += string.Format("max={0}", dblMax); } double? increment = ctl.GetDouble("increment"); string step = string.Empty; if (increment.HasValue) { step = string.Format("step={0}", increment); } <input type="number" name="@ctl.Attribute" id="@ctl.Attribute" value="@Model.EditorData.GetAttribute(ctl.Attribute)" @doubleMinMax @step style="width: 50px" /> break; case "multi": @RenderMultiControl(ctl, value) break; case "dropdowntypes": @Html.DropDownList("types-dropdown-" + ctl.Id, ControlHelpers.GetDropDownTypesControlItems(ctl, Model.Controller, Model.Key), new { @class = "types-dropdown", data_key = ctl.Id }) break; case "elementslist": @Html.Action("ElementsList", new { id = Model.GameId, key = Model.Key, control = ctl }) break; case "exits": @Html.Action("EditExits", new { id = Model.GameId, key = Model.Key, control = ctl }) break; case "objects": IEditableObjectReference objectRef = value as IEditableObjectReference; string selectedValue = null; if (objectRef != null) { selectedValue = objectRef.Reference; } List<SelectListItem> items = new List<SelectListItem>( ControlHelpers.GetObjectListNames(ctl, Model.Controller).OrderBy(s => s, StringComparer.CurrentCultureIgnoreCase) .Select(s => new SelectListItem { Text = s, Value = s, Selected = (selectedValue == s) }) ); // if ctl.Attribute is "key" (or any name that exists in the Model), ASP.NET MVC ignores Selected value @Html.DropDownList("dropdown-" + ctl.Attribute, items) break; case "verbs": @Html.Action("EditVerbs", new { id = Model.GameId, key = Model.Key, control = ctl }) break; case "file": string source = string.Join(";", ctl.GetString("source").Split(';').Select(s => s.Substring(1))); <div style="display: inline-block; height: auto; width: auto;"> <div style="float: left;"> @Html.TextBox(ctl.Attribute, (string) value, new { @readonly = "readonly", @class = "elementEditorFile" }) </div> @if (ctl.GetBool("preview") && value is string && !string.IsNullOrEmpty((string) value)) { <div style="float: left"> <button type="button" class="img-preview" data-key="@ctl.Attribute" data-extensions="@source"> <img src="/ImageProcessor.ashx?h=80&w=80&gameId=@Model.GameId&image=@value.ToString()" style="max-width: 80px; max-height: 80px;" /> </button> </div> } <div style="float: left;"> <button type="button" class="file-upload" data-key="@ctl.Attribute" data-extensions="@source">Choose file</button> </div> </div> break; case "scriptdictionary": @Html.Action("EditScriptDictionary", new { id = Model.GameId, key = Model.Key, control = ctl }) break; case "stringdictionary": @Html.Action("EditStringDictionary", new { id = Model.GameId, key = Model.Key, control = ctl }) break; case "gamebookoptions": @Html.Action("EditGameBookOptions", new { id = Model.GameId, key = Model.Key, control = ctl }) break; case "pattern": IEditableCommandPattern commandPattern = value as IEditableCommandPattern; string text = (commandPattern != null) ? commandPattern.Pattern : string.Empty; @Html.TextBox(ctl.Attribute, text, new { style = "width: 100%", @class = "elementEditorTextbox" }) break; case null: break; default: throw new ArgumentException(string.Format("Invalid control type: {0}", controlType)); } } @helper RenderMultiControl(IEditorControl ctl, object value) { var model = new WebEditor.Models.Controls.MultiControl { GameId = Model.GameId, Key = Model.Key, Controller = Model.Controller, EditorData = Model.EditorData, Control = ctl, Value = value }; Html.RenderPartial("Controls/MultiControl", model); }
the_stack
@model Xms.Web.Models.EntityLogsModel <div class="" id="gridview"> <div class="mb-2 toolbar"> @*<div class="panel-heading"> <div class="panel-title"> <strong>@app.PrivilegeTree?.LastOrDefault().DisplayName</strong> <div class="pull-right"> <a class="btn btn-info btn-xs" data-toggle="collapse" href="#collapseOne"> <span class="caret"></span> @app.T["search"] </a> </div> </div> </div>*@ <div class=""> <!--in--> <div class="panel-body"> @using (Html.BeginForm("entitylogs", "entity", FormMethod.Get, new { @id = "searchForm", @class = "form-horizontal", @role = "form" })) { @Html.HiddenFor(x => x.EntityId) <input type="hidden" name="loaddata" value="true" /> <div class="row"> <div class="col-sm-10 pl-0 pull-right"> <div class="input-group input-group-sm"> <span class="input-group-btn input-group-sm" style="width:190px;"> <input type="text" class="form-control input-sm hide" id="viewSelector" style="width:150px;" /> </span> <select class="form-control input-sm" name="OperationType"> <option>事件</option> <option value="create">@app.T["security_create"]</option> <option value="update">@app.T["security_update"]</option> <option value="delete">@app.T["security_delete"]</option> <option value="share">@app.T["security_share"]</option> <option value="assign">@app.T["security_assign"]</option> </select> <span class="input-group-btn "> <button type="submit" class="btn btn-primary btn-sm btn-block" style="border-radius:0;"><span class="glyphicon glyphicon-search"></span> @app.T["search"]</button> </span> <span class="input-group-btn"> <button type="button" class="btn btn-warning btn-sm btn-block" data-role="clearForm"><span class="glyphicon glyphicon-remove"></span> @app.T["clear"]</button> </span> </div> </div> </div> } @using (Html.BeginForm("clearentitylogs", "entity", FormMethod.Get, new { @id = "clearForm", @class = "form-horizontal", @role = "form" })) { } </div> </div> </div> <div class="table-responsive"> <div class="datagrid-view"></div> <table class="table table-striped table-hover table-condensed" id="datatable" data-pageurl="@app.Url" data-refresh="rebind()" data-ajax="true" data-ajaxcontainer="gridview" data-ajaxcallback="ajaxgrid_reset()" data-sortby="@Model.SortBy.ToLower()" data-sortdirection="@Model.SortDirection" data-dbclick="rebind()"> <tbody> </tbody> </table> </div> </div> @section Header { <link href="/content/js/bootstrap-datepicker-1.5.0/css/bootstrap-datepicker3.min.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet"> <link href="~/content/js/jquery-ui-1.10.3/themes/base/jquery.ui.all.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet"> <link href="~/content/js/grid/pqgrid.dev.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet"> <link id="themeLink" href="~/content/css/theme/@(app.Theme).css" rel="stylesheet" /> } @section Scripts { <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.button.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.mouse.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.autocomplete.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.draggable.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.resizable.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.tooltip.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="~/content/js/fetch.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="~/content/js/common/filters.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/grid/pqgrid.dev.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/grid/localize/pq-localize-zh.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/cdatagrid.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery.bootpag.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery.form.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/bootstrap-datepicker-1.5.0/js/bootstrap-datepicker.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/bootstrap-datepicker-1.5.0/locales/bootstrap-datepicker.zh-CN.min.js?v=@app.PlatformSettings.VersionNumber" charset="UTF-8"></script> <script src="~/content/js/xms.metadata.js?v=@app.PlatformSettings.VersionNumber"></script> <script> var pageUrl = ''; $(function () { $('#main').css('margin-bottom', 0); var theaders = { 'name': ' @app.T["entitylog_optype"]', 'default': ' @app.T["entitylog_updating"]', 'updataby':'>@app.T["entitylog_updatedby"]', 'statecode': '@app.T["entitylog_updated"]', 'createdon': '@app.T["operation_time"]', 'operation':'@app.T["operation"]' } //列数据配置数据 var columnConfigs = [ //从新配置复选框列的渲染方式, { title: "", dataIndx: "recordid", maxWidth: 48, minWidth: 48, align: "center", resizable: false, type: 'checkBoxSelection', cls: 'ui-state-default', sortable: false, editable: false, render: function (ui) { // console.log(ui) return '<input type="checkbox" value="' + ui.rowData.entitylogid + '" name="recordid" class="">' }, cb: { all: true, header: true } }, { title: "", dataIndx: "name", maxWidth: 30, minWidth: 30, align: "center", resizable: false, cls: 'ui-state-default', sortable: false, editable: false, hidden:true, render: function (ui) { // console.log(ui) return '<input type="hidden" value="' + ui.rowData.entitylogid + '" name="componenttypename" class="">' }, cb: { all: true, header: true } }, { "dataIndx": "operationtype", "title": theaders.name, editable: false, "dataType": "string", "width": 75, "isprimaryfield": false, "attributetypename": "string", render: function (ui, a, b) { var datas = ui.rowData; var dataIndx = ui.dataIndx; var column = ui.column; var recordid = datas[dataIndx]; var html = ''; if (recordid == 1) { html = '@app.T["security_create"]'; } else if (recordid == 2) { html = '@app.T["security_update"]'; } else if (recordid == 3) { html = '@app.T["security_delete"]'; } else if (recordid == 5) { html = '@app.T["security_assign"]'; } else if (recordid == 4) { html = '@app.T["security_share"]'; } return html; } }, { "dataIndx": "isdefault", "title": theaders.default, "dataType": "string", editable: false, "width": 300, sortable: false, "isprimaryfield": false, "attributetypename": "string" , render: function (ui, a, b) { var datas = ui.rowData; var dataIndx = ui.dataIndx; var column = ui.column; var recordid = datas['changedata']; var type = datas['operationtype']; var htmls = ['<table class="table table-condensed">'] if (recordid && recordid != '') { var records = JSON.parse(recordid); if (type == 2 || type == 5) { $.each(records,function (i,n) { var attrname = n.name; var attrdatas = $.queryBykeyValue(current_attributes, 'name', attrname); if (attrdatas.length > 0) { htmls.push(' <tr><td>' + (attrdatas[0].localizedname) + '</td><td>'+n.original+'</td></tr>'); } else { htmls.push(' <tr><td>' + (attrname) + '</td><td>'+n.original+'</td></tr>'); } }); } } htmls.push('</table>'); return htmls.join('') }}, { "dataIndx": "statecode", "title": theaders.statecode, editable: false, sortable: false, "dataType": "string", "width": 300, "isprimaryfield": false, "attributetypename": "string", render: function (ui, a, b) { var datas = ui.rowData; var dataIndx = ui.dataIndx; var column = ui.column; var recordid = datas['changedata']; var type = datas['operationtype']; var htmls = ['<table class="table table-condensed">'] if (recordid && recordid != '') { var records = JSON.parse(recordid); $.each(records,function (i,n) { var attrname = n.name; var attrdatas = $.queryBykeyValue(current_attributes, 'name', attrname); if (attrdatas.length > 0) { htmls.push(' <tr><td>' + (attrdatas[0].localizedname) + '</td><td>'+n.value+'</td></tr>'); } else { htmls.push(' <tr><td>' + (attrname) + '</td><td>'+n.value+'</td></tr>'); } }); } htmls.push('</table>'); return htmls.join('') } }, { "dataIndx": "createdon", "title": theaders.createdon, editable: false, "dataType": "string", "width": 100, "isprimaryfield": false, "attributetypename": "string" }, { title: "操作", editable: false, minWidth: 70,width:70, notHeaderFilter: true, editable: false, sortable: false, render: function (ui) { var datas = ui.rowData; var dataIndx = ui.dataIndx; var column = ui.column; var recordid = datas[dataIndx]; var html = '' return html } } ]; var current_attributes = []; var url = ORG_SERVERURL + '/entity/entitylogs'; $('#clearForm').attr('action',ORG_SERVERURL + '/entity/ClearEntityLogs') var $form = $('#searchForm'); var roles_filters = new XmsFilter(); var datagridconfig = { scrollModel: { autoFit: true }, baseUrl: url, method:'GET', columnConfigs: columnConfigs,//字段配置信息 context: $('#gridview'),//底部操作按钮方法触发 filters: roles_filters,//post提交时过滤条件 searchForm: $form//GET提交时查询的数据 , offsetHeight: -50, datasFilter: function (data) { console.log(data); current_attributes = data.attributes; } }; loadEntities(function () { $('#viewSelector').trigger('change'); setTimeout(function () { $('.datagrid-view').xmsDataTable(datagridconfig); }, 20) }); $('body').on('change', '#viewSelector', function () { $('#EntityId').val(Xms.Web.SelectedValue($(this))); //rebind(); //$('.collapse').removeClass('in'); }); pageUrl = $("#datatable").attr('data-pageurl'); $('.datepicker').datepicker({ autoclose: true , clearBtn: true , format: "yyyy-mm-dd" , language: "zh-CN" }); $('body').on('click', '[data-role="clearForm"]', function (e) { clearEntityLogs() }) loadEntitys($('#viewSelector')); //$("#datatable").ajaxTable(); //ajaxgrid_reset(); }); function loadEntitys($context,callback) { var entitySelect = $context; entitySelect.entitySelector({ rendered: function (self) { var _entityid = $('#EntityId').val(); if (_entityid) { var acli = self.listWrap.find('.xms-autoc-item[value="' + _entityid + '"]'); if (acli.length > 0) { self.box.val(_entityid); self.listWrap.hide(); self.vInput.val(acli.text()); self.value = acli.attr('value'); self.wrap.attr('data-isactive', false); self.filterData(); } } }, submithandler: function (self, $this) { $('#EntityId').val(self.value); }, removehandler: function () { $('#EntityId').val(self.value); }, inputPlaceHolder:'选择实体' }); } function clearEntityLogs() { var _entityid = $('#EntityId').val(); var _url = ORG_SERVERURL + '/entity/ClearEntityLogs?entityid=' + _entityid; Xms.Web.Confirm('确认', '是否清空当前实体的日志', function () { Xms.Ajax.Get(_url, {}, function (res) { Xms.Web.Toast(res.Content, res.IsSuccess); }, null); }) } function rebind() { $('.datagrid-view').cDatagrid('refreshDataAndView') // $('#searchForm').submit(); } function loadEntities(callback) { Xms.Schema.GetEntities({ 'GetAll': true }, function (data) { if (!data || data.length == 0) return; $(data).each(function (i, n) { $('#viewSelector').append('<option data-relationship="' + n.name + '" value="' + n.entityid + '">' + n.localizedname + '</option>'); }); var url = ORG_SERVERURL + '/entity/EntityLogs?EntityId=' + $(this).find('option:eq(0)').val(); // $("#gridview").ajaxLoad(url, "#gridview", function (response) { // ajaxgrid_reset(); // }); callback && callback(); }); } function getKeyValue() { $('.dataList').each(function (i, n) { $(n).each(function (ii, nn) { var KeyTarget = $(nn).find('.ChangeKey'); var ValTarget = $(nn).find('.ChangeValue'); var data = JSON.parse(decodeURI(KeyTarget.attr('data-json'))); for (var j = 0; j < data.length; j++) { var key = data[j].key; var val = data[j].value; KeyTarget.append('<span>' + key + '</span><br />'); ValTarget.append('<span>' + val + '</span><br />'); } var userid = $(n).find('.UserName').attr('data-id'); Xms.Web.GetJson(ORG_SERVERURL + '/api/data/Retrieve/ReferencedRecord/' + lookupid + '/' + value, null, function (response) { }); }); }); } function getUser() { } </script> }
the_stack
@using System.Globalization @using System.Web.Hosting @using jQuery.Validation.Unobtrusive.Native.Demos.Models @model GlobalizeModel @functions{ /// <summary> /// Identifies and returns the default locale to use by mapping as close as possible from ASP.Nets culture to Globalize's locales /// </summary> /// <returns>The default locale to use for the current culture; eg "de"</returns> public string GetDefaultLocale() { const string localePattern = "~/bower_components/cldr-data/main/{0}"; // where cldr-data lives on disk var currentCulture = CultureInfo.CurrentCulture; var cultureToUse = "en-GB"; //Default regionalisation to use //Try to pick a more appropriate regionalisation if (Directory.Exists(HostingEnvironment.MapPath(string.Format(localePattern, currentCulture.Name)))) //First try for a en-GB style directory cultureToUse = currentCulture.Name; else if (Directory.Exists(HostingEnvironment.MapPath(string.Format(localePattern, currentCulture.TwoLetterISOLanguageName)))) //That failed; now try for a en style directory cultureToUse = currentCulture.TwoLetterISOLanguageName; return cultureToUse; } } @{ var defaultLocale = GetDefaultLocale(); } @section metatags{ <meta name="Description" content="A demo of internationalized / locale-specific validation using Globalize."> } @section scripts { @Scripts.Render( "~/bundles/jquery-validation", "~/bower_components/cldrjs/dist/cldr.js", "~/bower_components/cldrjs/dist/cldr/event.js", "~/bower_components/cldrjs/dist/cldr/supplemental.js", "~/bower_components/globalize/dist/globalize.js", "~/bower_components/globalize/dist/globalize/number.js", "~/bower_components/globalize/dist/globalize/date.js", "~/Scripts/jquery.validate.globalize.js") <script> function getJsonFilenames(locale, loadedData) { return [ "supplemental/likelySubtags.json", "main/{locale}/numbers.json", "supplemental/numberingSystems.json", "main/{locale}/ca-gregorian.json", "main/{locale}/timeZoneNames.json", "supplemental/timeData.json", "supplemental/weekData.json", "main/{locale}/languages.json" ].filter(function (f) { var noDataLoaded = loadedData.length === 0; if (noDataLoaded) { return true; } var localeNotYetLoaded = loadedData.indexOf(locale) === -1; if (localeNotYetLoaded) { var fileIsCommonAndSoAlreadyLoaded = f.indexOf("supplemental/" !== -1); return fileIsCommonAndSoAlreadyLoaded; } return false; }).map(function (f) { return "../bower_components/cldr-data/" + f.replace("{locale}", locale); }); } function loadLocale(locale, loadedData) { var promise = $.Deferred(); var jsonToLoad = getJsonFilenames(locale, loadedData); if (jsonToLoad.length === 0) { Globalize.locale(locale); // Presumably already loaded promise.resolve(locale + " selected...") return promise; } return $.when.apply( this, jsonToLoad.map($.get) ).then(function () { // Normalize $.get results, we only need the JSON, not the request statuses. return [].slice.apply(arguments, [0]).map(function (result) { return result[0]; }); }).then(Globalize.load).then(function () { loadedData.push(locale); Globalize.locale(locale); return locale + " loaded and selected..." }); } var localesLoaded = [], originalLocale = $("#localeSelector").val(); $("form").validate({ submitHandler: function (form) { alert("This is a valid form!"); } }); $("#localeSelector").change(function () { var $this = $(this); var $exampleFormats = $("#exampleFormats"); var $loading = $("#loading"); $this.prop("disabled", true); $loading.show(); $exampleFormats.hide(); var localeToLoad = $this.val(); loadLocale(localeToLoad, localesLoaded) .then(function (result) { $this.prop("disabled", false); $loading.hide(); var languageName = Globalize.locale().main('localeDisplayNames/languages/' + localeToLoad); languageName = (languageName ? languageName + ' / ' + Globalize.locale(localeToLoad).main('localeDisplayNames/languages/' + localeToLoad) + ' : ' : ''); var exampleFormats = languageName + "A number may look like this: " + Globalize.numberFormatter()(11.7) + " and a date may look like this: " + Globalize.dateFormatter()(new Date()); $exampleFormats.text(exampleFormats).show(); }, function (error) { $exampleFormats.text("Problem loading locale: " + error).show(); $this.prop("disabled", false); $loading.hide(); }); }).change(); // Show warning if this is a static page if (window.location.href.toLowerCase().indexOf("globalize.html") !== -1) { $(".static-warning").show(); } </script> } <h3>@ViewBag.Title</h3> <p>If you want to patch the jQuery Validation date and number validation to be locale specific then you can using <code><a href="https://github.com/johnnyreilly/jquery-validation-globalize" target="_blank">jquery-validate-globalize.js</a></code>. This demo is not strictly related to jVUN - it's really more about Globalize and jquery-validation-globalize. It's built using jVUN but if you're here strictly for information about jquery-validation-globalize then just ignore the "Model", "View" and "ASP.Net and Globalize" tabs below. Everything else is just normal JavaScript and jQuery Validation code.</p> <p>jquery-validation-globalize is available on Bower. To install it you should first ensure you have a <code>.bowerrc</code> file in place which looks like this:</p> <pre class="prettyprint js"> { "scripts": { "preinstall": "npm install cldr-data-downloader@0.2.x", "postinstall": "node ./node_modules/cldr-data-downloader/bin/download.js -i bower_components/cldr-data/index.json -o bower_components/cldr-data/" } } </pre> <p>Then you can add the package as a dependency of your project with <code>bower install jquery-validation-globalize --save</code>.</p> <p>To find more information about this then you could have a read of my <a href="http://blog.icanmakethiswork.io/2012/09/globalize-and-jquery-validate.html" target="_blank">blogpost</a>. This library replaces the jQuery Validation date and number validation with an implementation that depends on <a href="http://github.com/jquery/globalize" target="_blank">Globalize</a>. (By the way, the post relates to when I first created <code><a href="https://github.com/johnnyreilly/jquery-validation-globalize" target="_blank">jquery-validate-globalize.js</a></code> and it depended on Globalize 0.1.x - it has now been migrated to Globalize 1.x which is very different.) </p> <p>Take a look at the demo below, do note that you can switch cultures as you wish.</p> <ul class="nav nav-tabs" data-tabs="tabs"> <li class="active"><a data-toggle="tab" href="#demo">Demo</a></li> <li><a data-toggle="tab" href="#model">Model</a></li> <li><a data-toggle="tab" href="#view">View</a></li> <li><a data-toggle="tab" href="#html">HTML</a></li> <li><a data-toggle="tab" href="#javascript">JavaScript</a></li> <li><a data-toggle="tab" href="#locale">ASP.Net and Globalize</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="demo"> @using (Html.BeginForm()) { <div class="row"> <label for="localeSelector">Current locale:</label> <select id="localeSelector"> @foreach(var localePath in Directory.EnumerateDirectories(HostingEnvironment.MapPath("~/bower_components/cldr-data/main/"))){ var localeDir = localePath.Substring(localePath.LastIndexOf('\\') + 1); <option selected="@(localeDir == defaultLocale)">@localeDir</option> } </select> <span id="exampleFormats"></span> <span id="loading">Loading...</span> </div> <div class="row"> @Html.LabelFor(x => x.Double, "Double") @Html.TextBoxFor(x => x.Double, true) </div> <div class="row"> @Html.LabelFor(x => x.DateTime, "DateTime") @Html.TextBoxFor(x => x.DateTime, true) </div> <div class="row"> <button type="submit" class="btn btn-default">Submit</button> <button type="reset" class="btn btn-info">Reset</button> </div> } </div> <div class="tab-pane" id="model"> <p>Here's the model, note that the <code>Range</code> attribute decorates the decimal property and a <code>Required</code> attribute decorates our nullable DateTime.:</p> <pre class="prettyprint cs"> using System.ComponentModel.DataAnnotations; namespace jQuery.Validation.Unobtrusive.Native.Demos.Models { public class GlobalizeModel { [Range(10.5D, 20.3D)] public decimal Double { get; set; } [Required] public DateTime? DateTime { get; set; } } } </pre> </div> <div class="tab-pane" id="view"> <p>Here's the view (which uses the model):</p> <pre class="prettyprint cs"> @@model jQuery.Validation.Unobtrusive.Native.Demos.Models.GlobalizeModel @@using (Html.BeginForm()) { &lt;div class="row"&gt; @@Html.LabelFor(x =&gt; x.Double, "Double") @@Html.TextBoxFor(x =&gt; x.Double, true) &lt;/div&gt; &lt;div class="row"&gt; @@Html.LabelFor(x =&gt; x.DateTime, "DateTime") @@Html.TextBoxFor(x =&gt; x.DateTime, true) &lt;/div&gt; &lt;div class="row"&gt; &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt; &lt;button type="reset" class="btn btn-info"&gt;Reset&lt;/button&gt; &lt;/div&gt; } </pre> </div> <div class="tab-pane" id="html"> <p>Here's the HTML that the view generates:</p> <pre class="prettyprint html"> &lt;form action="/AdvancedDemo/Globalize" method="post"&gt; &lt;div class="row"&gt; &lt;label for="Double"&gt;Double&lt;/label&gt; &lt;input data-msg-number="The field Double must be a number." data-msg-range="@string.Format("The field Double must be between {0} and {1}.",10.5D, 20.3D)" data-msg-required="The Double field is required." data-rule-number="true" data-rule-range="[10.5,20.3]" data-rule-required="true" id="Double" name="Double" type="text" value="0" /&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;label for="DateTime"&gt;DateTime&lt;/label&gt; &lt;input data-msg-date="The field DateTime must be a date." data-msg-required="The DateTime field is required." data-rule-date="true" data-rule-required="true" id="DateTime" name="DateTime" type="text" value="" /&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt; &lt;button type="reset" class="btn btn-info"&gt;Reset&lt;/button&gt; &lt;/div&gt; &lt;/form&gt; </pre> </div> <div class="tab-pane" id="javascript"> <p>Here's an example of the scripts that you might serve up if you wanted to use <code>jquery.validate.globalize.js</code>. Note that <code>jquery.validate.globalize.js</code> is last as it depends on both <code>jquery.validate.js</code> and <code>globalize.js</code>.</p> <pre class="prettyprint html"> &lt;script src="/Scripts/jquery.validate.js"&gt;&lt;/script&gt; &lt;!-- cldr scripts (needed for globalize) --&gt; &lt;script src="/bower_components/cldrjs/dist/cldr.js"&gt;&lt;/script&gt; &lt;script src="/bower_components/cldrjs/dist/cldr/event.js"&gt;&lt;/script&gt; &lt;script src="/bower_components/cldrjs/dist/cldr/supplemental.js"&gt;&lt;/script&gt; &lt;!-- globalize scripts --&gt; &lt;script src="/bower_components/globalize/dist/globalize.js"&gt;&lt;/script&gt; &lt;script src="/bower_components/globalize/dist/globalize/number.js"&gt;&lt;/script&gt; &lt;script src="/bower_components/globalize/dist/globalize/date.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/jquery.validate.globalize.js"&gt;&lt;/script&gt; </pre> <p>Here's the JavaScript that loads the required cldr data via AJAX and initialises the validation - notice it also initialises Globalize to your culture:</p> <pre class="prettyprint js"> $.when( $.get("/bower_components/cldr-data/supplemental/likelySubtags.json"), $.get("/bower_components/cldr-data/main/@defaultLocale/numbers.json"), $.get("/bower_components/cldr-data/supplemental/numberingSystems.json"), $.get("/bower_components/cldr-data/main/@defaultLocale/ca-gregorian.json"), $.get("/bower_components/cldr-data/main/@defaultLocale/timeZoneNames.json"), $.get("/bower_components/cldr-data/supplemental/timeData.json"), $.get("/bower_components/cldr-data/supplemental/weekData.json") ).then(function () { // Normalize $.get results, we only need the JSON, not the request statuses. return [].slice.apply(arguments, [0]).map(function (result) { return result[0]; }); }).then(Globalize.load).then(function () { // Initialise Globalize to the current UI culture Globalize.locale("@defaultLocale"); $("form").validate({ submitHandler: function (form) { alert("This is a valid form!"); } }); }); </pre> </div> <div class="tab-pane" id="locale"> <p>Globalize has locales (eg "en-GB", "de" etc). ASP.Net has cultures (eg "en-GB", "de-DE" etc). There is not a 1-to-1 relationship between Globalize's locales and ASP.Net's cultures but you can make a good approximation. How? Well this simple function will do the job for you:</p> <pre class="prettyprint cs"> /// &lt;summary&gt; /// Identifies and returns the default locale to use by mapping as close as possible from ASP.Nets culture to Globalize's locales /// &lt;/summary&gt; /// &lt;returns&gt;The default locale to use for the current culture; eg "de"&lt;/returns&gt; public string GetDefaultLocale() { const string localePattern = "~/bower_components/cldr-data/main/{0}"; // where cldr-data lives on disk var currentCulture = CultureInfo.CurrentCulture; var cultureToUse = "en-GB"; //Default regionalisation to use //Try to pick a more appropriate regionalisation if (Directory.Exists(HostingEnvironment.MapPath(string.Format(localePattern, currentCulture.Name)))) //First try for a en-GB style directory cultureToUse = currentCulture.Name; else if (Directory.Exists(HostingEnvironment.MapPath(string.Format(localePattern, currentCulture.TwoLetterISOLanguageName)))) //That failed; now try for a en style directory cultureToUse = currentCulture.TwoLetterISOLanguageName; return cultureToUse; } </pre> <p>This takes the current culture that ASP.Net is running as and then looks for a Globalize culture that is as close a match as possible (finally falling back to en-GB if it finds nothing suitable). You can use this to initialise your app to the most appropriate culture for your users. When this is running hosted in ASP.Net that's exactly how this demo page works. This page defaults to the <strong>@defaultLocale</strong> locale - that's right, *<strong>your</strong>* locale (or at least what ASP.Net thinks your locale ought to be). If you switch your browser to say, <strong>de-DE</strong> and reload this page then you'll see the app has switched to the closest Globalize appropriate locale it can find.</p> <div class="alert alert-danger alert-block static-warning" style="display: none;"> <h4>This demo is being served statically (i.e. not by ASP.Net) and so the default is fixed to the <strong>@defaultLocale</strong> locale</h4> <p>Hey people - it looks like you're viewing a static version of this page. (GitHub pages is all about the static content you see.) So what I just said about this being customised to your culture by default isn't true. Sorry about that. If you want to drive the initial culture from your user settings then try running hosting the jVUNDemo project somewhere. Then it's all goodness I promise.</p> </div> <p>Do note that this depends on the following settings in the <code>web.config</code>:</p> <pre class="prettyprint xml"> &lt;configuration&gt; &lt;system.web&gt; &lt;globalization culture="auto" uiCulture="auto" /&gt; &lt;!--- Other stuff.... --&gt; &lt;/system.web&gt; &lt;system.webServer&gt; &lt;staticContent&gt; &lt;remove fileExtension=".json" /&gt; &lt;mimeMap fileExtension=".json" mimeType="application/json" /&gt; &lt;/staticContent&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </pre> <p>The <code>globalization</code> settings activate ASP.Nets auto culture feature. This switches culture per user based on the user's setup - eg German users may be switched to the "de-DE" culture, Brits to "en-GB" etc. The <code>.json</code> setting ensures that the web server is happy to serve up JSON files (which the culture data is stored in). Surprisingly ASP.Net doesn't offer this by default.</p> </div> </div>
the_stack
// URLs for uploading packages private const string MYGET_PUSH_URL = "https://www.myget.org/F/testcentric/api/v2"; private const string NUGET_PUSH_URL = "https://api.nuget.org/v3/index.json"; private const string CHOCO_PUSH_URL = "https://push.chocolatey.org/"; // Environment Variable names holding API keys private const string MYGET_API_KEY = "MYGET_API_KEY"; private const string NUGET_API_KEY = "NUGET_API_KEY"; private const string CHOCO_API_KEY = "CHOCO_API_KEY"; private const string GITHUB_ACCESS_TOKEN = "GITHUB_ACCESS_TOKEN"; // Pre-release labels that we publish private static readonly string[] LABELS_WE_PUBLISH_ON_MYGET = { "dev", "pre" }; private static readonly string[] LABELS_WE_PUBLISH_ON_NUGET = { "alpha", "beta", "rc" }; private static readonly string[] LABELS_WE_PUBLISH_ON_CHOCOLATEY = { "alpha", "beta", "rc" }; private static readonly string[] LABELS_WE_RELEASE_ON_GITHUB = { "alpha", "beta", "rc" }; public class BuildParameters { private ISetupContext _context; private BuildSystem _buildSystem; public static BuildParameters Create(ISetupContext context) { var parameters = new BuildParameters(context); parameters.Validate(); return parameters; } private BuildParameters(ISetupContext context) { _context = context; _buildSystem = _context.BuildSystem(); Target = _context.TargetTask.Name; TasksToExecute = _context.TasksToExecute.Select(t => t.Name); Configuration = context.Argument("configuration", DEFAULT_CONFIGURATION); ProjectDirectory = context.Environment.WorkingDirectory.FullPath + "/"; MyGetApiKey = _context.EnvironmentVariable(MYGET_API_KEY); NuGetApiKey = _context.EnvironmentVariable(NUGET_API_KEY); ChocolateyApiKey = _context.EnvironmentVariable(CHOCO_API_KEY); GitHubAccessToken = _context.EnvironmentVariable(GITHUB_ACCESS_TOKEN); BuildVersion = new BuildVersion(context, this); if (context.HasArgument("testLevel")) PackageTestLevel = context.Argument("testLevel", 1); else if (!BuildVersion.IsPreRelease) PackageTestLevel = 3; else switch (BuildVersion.PreReleaseLabel) { case "pre": case "rc": case "alpha": case "beta": PackageTestLevel = 3; break; case "dev": case "pr": PackageTestLevel = 2; break; case "ci": default: PackageTestLevel = 1; break; } MSBuildSettings = new MSBuildSettings { Verbosity = Verbosity.Minimal, //ToolVersion = MSBuildToolVersion.Default,//The highest available MSBuild tool version//VS2017 Configuration = Configuration, PlatformTarget = PlatformTarget.MSIL, //MSBuildPlatform = MSBuildPlatform.Automatic, DetailedSummary = true, }; RestoreSettings = new NuGetRestoreSettings(); } public string Target { get; } public IEnumerable<string> TasksToExecute { get; } public ICakeContext Context => _context; public string Configuration { get; } public BuildVersion BuildVersion { get; } public string PackageVersion => BuildVersion.PackageVersion; public string AssemblyVersion => BuildVersion.AssemblyVersion; public string AssemblyFileVersion => BuildVersion.AssemblyFileVersion; public string AssemblyInformationalVersion => BuildVersion.AssemblyInformationalVersion; public int PackageTestLevel { get; } public bool IsLocalBuild => _buildSystem.IsLocalBuild; public bool IsRunningOnUnix => _context.IsRunningOnUnix(); public bool IsRunningOnWindows => _context.IsRunningOnWindows(); public bool IsRunningOnAppVeyor => _buildSystem.AppVeyor.IsRunningOnAppVeyor; public string ProjectDirectory { get; } public string SourceDirectory => ProjectDirectory + "src/"; public string OutputDirectory => ProjectDirectory + "bin/" + Configuration + "/"; public string ZipDirectory => ProjectDirectory + "zip/"; public string NuGetDirectory => ProjectDirectory + "nuget/"; public string ChocoDirectory => ProjectDirectory + "choco/"; public string PackageDirectory => ProjectDirectory + "package/"; public string ZipImageDirectory => PackageDirectory + "zipimage/"; public string TestDirectory => PackageDirectory + "test/"; public string ZipTestDirectory => TestDirectory + "zip/"; public string NuGetTestDirectory => TestDirectory + "nuget/"; public string ChocolateyTestDirectory => TestDirectory + "choco/"; public string WebDirectory => ProjectDirectory + "web/"; public string WebOutputDirectory => WebDirectory + "output/"; public string WebDeployDirectory => ProjectDirectory + "../testcentric-gui.deploy/"; public string ZipPackageName => PACKAGE_NAME + "-" + PackageVersion + ".zip"; public string NuGetPackageName => NUGET_PACKAGE_NAME + "." + PackageVersion + ".nupkg"; public string ChocolateyPackageName => PACKAGE_NAME + "." + PackageVersion + ".nupkg"; public FilePath ZipPackage => new FilePath(PackageDirectory + ZipPackageName); public FilePath NuGetPackage => new FilePath(PackageDirectory + NuGetPackageName); public FilePath ChocolateyPackage => new FilePath(PackageDirectory + ChocolateyPackageName); public string GitHubReleaseAssets => _context.IsRunningOnWindows() ? $"\"{ZipPackage},{NuGetPackage},{ChocolateyPackage}\"" : $"\"{ZipPackage},{NuGetPackage}\""; public string MyGetPushUrl => MYGET_PUSH_URL; public string NuGetPushUrl => NUGET_PUSH_URL; public string ChocolateyPushUrl => CHOCO_PUSH_URL; public string MyGetApiKey { get; } public string NuGetApiKey { get; } public string ChocolateyApiKey { get; } public string BranchName => BuildVersion.BranchName; public bool IsReleaseBranch => BuildVersion.IsReleaseBranch; public bool IsPreRelease => BuildVersion.IsPreRelease; public bool ShouldPublishToMyGet => !IsPreRelease || LABELS_WE_PUBLISH_ON_MYGET.Contains(BuildVersion.PreReleaseLabel); public bool ShouldPublishToNuGet => !IsPreRelease || LABELS_WE_PUBLISH_ON_NUGET.Contains(BuildVersion.PreReleaseLabel); public bool ShouldPublishToChocolatey => !IsPreRelease || LABELS_WE_PUBLISH_ON_CHOCOLATEY.Contains(BuildVersion.PreReleaseLabel); public bool IsProductionRelease => !IsPreRelease || LABELS_WE_RELEASE_ON_GITHUB.Contains(BuildVersion.PreReleaseLabel); public MSBuildSettings MSBuildSettings { get; } public NuGetRestoreSettings RestoreSettings { get; } public string[] SupportedEngineRuntimes => new string[] {"net40"}; public string ProjectUri => "https://github.com/TestCentric/testcentric-gui"; public string WebDeployBranch => "gh-pages"; public string GitHubUserId => "charliepoole"; public string GitHubUserEmail => "charliepoole@gmail.com"; public string GitHubPassword { get; } public string GitHubAccessToken { get; } private void Validate() { var validationErrors = new List<string>(); if (TasksToExecute.Contains("PublishPackages")) { if (ShouldPublishToMyGet && string.IsNullOrEmpty(MyGetApiKey)) validationErrors.Add("MyGet ApiKey was not set."); if (ShouldPublishToNuGet && string.IsNullOrEmpty(NuGetApiKey)) validationErrors.Add("NuGet ApiKey was not set."); if (ShouldPublishToChocolatey && string.IsNullOrEmpty(ChocolateyApiKey)) validationErrors.Add("Chocolatey ApiKey was not set."); } if (TasksToExecute.Contains("CreateDraftRelease") && (IsReleaseBranch || IsProductionRelease)) { if (string.IsNullOrEmpty(GitHubAccessToken)) validationErrors.Add("GitHub Access Token was not set."); } if (TasksToExecute.Contains("DeployWebsite")) { // We use a password rather than an access token for the website if (string.IsNullOrEmpty(GitHubPassword)) validationErrors.Add("GitHub password was not set"); } if (validationErrors.Count > 0) { DumpSettings(); var msg = new StringBuilder("Parameter validation failed! See settings above.\n\nErrors found:\n"); foreach (var error in validationErrors) msg.AppendLine(" " + error); throw new InvalidOperationException(msg.ToString()); } } public void DumpSettings() { Console.WriteLine("\nTASKS"); Console.WriteLine("Target: " + Target); Console.WriteLine("TasksToExecute: " + string.Join(", ", TasksToExecute)); Console.WriteLine("\nENVIRONMENT"); Console.WriteLine("IsLocalBuild: " + IsLocalBuild); Console.WriteLine("IsRunningOnWindows: " + IsRunningOnWindows); Console.WriteLine("IsRunningOnUnix: " + IsRunningOnUnix); Console.WriteLine("IsRunningOnAppVeyor: " + IsRunningOnAppVeyor); Console.WriteLine("\nVERSIONING"); Console.WriteLine("PackageVersion: " + PackageVersion); Console.WriteLine("AssemblyVersion: " + AssemblyVersion); Console.WriteLine("AssemblyFileVersion: " + AssemblyFileVersion); Console.WriteLine("AssemblyInformationalVersion: " + AssemblyInformationalVersion); Console.WriteLine("SemVer: " + BuildVersion.SemVer); Console.WriteLine("IsPreRelease: " + BuildVersion.IsPreRelease); Console.WriteLine("PreReleaseLabel: " + BuildVersion.PreReleaseLabel); Console.WriteLine("PreReleaseSuffix: " + BuildVersion.PreReleaseSuffix); Console.WriteLine("\nDIRECTORIES"); Console.WriteLine("Project: " + ProjectDirectory); Console.WriteLine("Output: " + OutputDirectory); Console.WriteLine("Source: " + SourceDirectory); Console.WriteLine("NuGet: " + NuGetDirectory); Console.WriteLine("Choco: " + ChocoDirectory); Console.WriteLine("Package: " + PackageDirectory); Console.WriteLine("ZipImage: " + ZipImageDirectory); Console.WriteLine("ZipTest: " + ZipTestDirectory); Console.WriteLine("NuGetTest: " + NuGetTestDirectory); Console.WriteLine("ChocoTest: " + ChocolateyTestDirectory); Console.WriteLine("\nBUILD"); Console.WriteLine("Configuration: " + Configuration); Console.WriteLine("Engine Runtimes: " + string.Join(", ", SupportedEngineRuntimes)); Console.WriteLine("\nPACKAGING"); Console.WriteLine("MyGetPushUrl: " + MyGetPushUrl); Console.WriteLine("NuGetPushUrl: " + NuGetPushUrl); Console.WriteLine("ChocolateyPushUrl: " + ChocolateyPushUrl); Console.WriteLine("MyGetApiKey: " + (!string.IsNullOrEmpty(MyGetApiKey) ? "AVAILABLE" : "NOT AVAILABLE")); Console.WriteLine("NuGetApiKey: " + (!string.IsNullOrEmpty(NuGetApiKey) ? "AVAILABLE" : "NOT AVAILABLE")); Console.WriteLine("ChocolateyApiKey: " + (!string.IsNullOrEmpty(ChocolateyApiKey) ? "AVAILABLE" : "NOT AVAILABLE")); Console.WriteLine("\nPUBLISHING"); Console.WriteLine("ShouldPublishToMyGet: " + ShouldPublishToMyGet); Console.WriteLine("ShouldPublishToNuGet: " + ShouldPublishToNuGet); Console.WriteLine("ShouldPublishToChocolatey: " + ShouldPublishToChocolatey); Console.WriteLine("\nRELEASING"); Console.WriteLine("BranchName: " + BranchName); Console.WriteLine("IsReleaseBranch: " + IsReleaseBranch); Console.WriteLine("IsProductionRelease: " + IsProductionRelease); } }
the_stack
@{ ViewBag.SubTitle = "购物车"; Layout = "~/Views/Shared/_LayoutBlank.cshtml"; } <style type="text/css"> body { /*margin-top: 1.5rem;*/ margin-top: 1.2rem; margin-bottom: 0.55rem; } #divTopTitleBar { position: fixed; left: 0rem; right: 0rem; /*top: 1rem;*/ top:0.7rem; height: 0.4rem; background-color: white; } #divFooter { background-color: white; position: fixed; bottom: 0px; left: 0px; right: 0px; height: 0.5rem; font-size: 0.13rem; text-align: center; } .divCommodityItem { box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; padding: 0.1rem 0.05rem; min-height: 0.8rem; width: 100%; color: #535353; margin-top: 0.05rem; } .imgPointCommodity { max-height: 0.8rem; max-width: 85%; vertical-align: middle; } </style> <script type="text/javascript"> var _pointCommodityList; $(document).ready(function () { loadData(); }); function getPointCommodity(id) { for (var i = 0; i < _pointCommodityList.length; i++) { if (_pointCommodityList[i].PointCommodity == id) return _pointCommodityList[i]; } } function loadData(targetPage) { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/PointCommodity/GetShoppingCartItemList/@ViewBag.Domain.Id", type: "POST", dataType: "json", success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; _pointCommodityList = resultObj.ItemList; //alert(JSON.stringify(resultObj)); var gettpl = document.getElementById('pointCommodityListTemplate').innerHTML; laytpl(gettpl).render(resultObj.ItemList, function (html) { document.getElementById('pointCommodityContainer').innerHTML += html; selectAll(); }); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function selectAll() { if ($("#checkboxAll").is(':checked')) { $("#pointCommodityContainer input[type='checkbox']").prop("checked", true); } else { $("#pointCommodityContainer input[type='checkbox']").removeAttr("checked"); } sum(); } function increment(pointCommoditId) { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); var args = new Object(); args.PointCommodity = pointCommoditId; args.Quantity = 1; $.ajax({ url: "/Api/PointCommodity/AddToCart/@ViewBag.Domain.Id", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { //var quantity = parseInt($("#" + pointCommoditId + "_quantity").val()); //if (isNaN(quantity)) { // quantity = 0; //} //quantity = quantity + 1; //$("#" + pointCommoditId + "_quantity").val(quantity); $("#" + pointCommoditId + "_quantity").val(data.Data.Data.Quantity); sum(); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function decrement(pointCommoditId) { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); var args = new Object(); args.PointCommodity = pointCommoditId; args.Quantity = 1; $.ajax({ url: "/Api/PointCommodity/RemoveFormCart/@ViewBag.Domain.Id", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; //var quantity = parseInt($("#" + pointCommoditId + "_quantity").val()); //if (isNaN(quantity)) { // quantity = 0; //} //quantity = quantity - 1; //if (quantity < 0) { // quantity = 0; //} //$("#" + pointCommoditId + "_quantity").val(quantity); if (resultObj.Reason == 0) { $("#" + pointCommoditId + "_quantity").val(resultObj.Data.Quantity); sum(); } } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function sum() { var allChecked = true; var allPrice = 0; var allPoint = 0; $(".divCommodityItem").each(function (index, element) { var pointCommodity = $(element).attr("pointcommodity"); var quantity = parseInt($(element).find("input[type='text']").val()); if (isNaN(quantity)) { quantity = 0; } var price = accDiv($(element).attr("price"),100); var point = $(element).attr("point"); var totalPrice = accMul(price, quantity); var totalPoint = point * quantity; $("#spanTotalPrice_" + pointCommodity).html(totalPrice); $("#spanTotalPoint_" + pointCommodity).html(totalPoint); if ($(element).find("input[type='checkbox']").is(':checked') == false) { allChecked = false; return; } allPrice = accAdd(allPrice, totalPrice); allPoint += totalPoint; }); $("#spanTotalPrice").html(allPrice); $("#spanTotalPoint").html(allPoint); if (allChecked) { $("#checkboxAll").prop("checked", true); } else { $("#checkboxAll").prop("checked", false); } } function order() { if (window.localStorage == false) { alert('This browser does NOT support localStorage'); } var checkout = new Object(); checkout.ItemList = new Array(); var arrayIndex = 0; $(".divCommodityItem").each(function (index, element) { if ($(element).find("input[type='checkbox']").is(':checked') == false) { return; } var pointCommodityId = $(element).attr("pointcommodity"); var quantity = parseInt($(element).find("input[type='text']").val()); if (isNaN(quantity)) { quantity = 0; } if (quantity <= 0) { return; } var pointCommodity = getPointCommodity(pointCommodityId); var price = pointCommodity.Price; var point = pointCommodity.Point; var checkoutPointCommodity = new Object(); checkoutPointCommodity.Id = pointCommodityId; checkoutPointCommodity.Quantity = quantity; checkoutPointCommodity.Price = price; checkoutPointCommodity.Point = point; checkoutPointCommodity.Name = pointCommodity.Name; checkoutPointCommodity.ImageUrl = pointCommodity.ImageUrl; checkout.ItemList[arrayIndex] = checkoutPointCommodity; arrayIndex++; }); if (checkout.ItemList.length == 0) { layerAlert("请钩选需要结算的商品,并留意数量必须大于0。"); return; } checkout.TotalPrice = parseFloat($("#spanTotalPrice").html()); checkout.TotalPoint = parseInt($("#spanTotalPoint").html()); // alert(JSON.stringify(checkout)); localStorage.checkout = JSON.stringify(checkout); window.location.href = "/PointCommodity/Checkout/@ViewBag.Domain.Id"; } </script> <script id="pointCommodityListTemplate" type="text/html"> {{# for(var i = 0, len = d.length; i < len; i=i+1){ }} <div class="divCommodityItem" style="" pointcommodity="{{ d[i].PointCommodity }}" price="{{ d[i].Price }}" point="{{ d[i].Point }}"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width:0.3rem;" valign="middle"> <input type="checkbox" style="margin-right:0.00rem;" onchange="sum()" /> </td> <td valign="middle" style="width:30%"> <img src="{{ d[i].ImageUrl }}" class="imgPointCommodity"> </td> <td valign="top"> <div class="defaultColor" style="font-size:0.14rem;">{{ d[i].Name }}</div> <div style="margin-top:0.05rem;"> <span id="spanTotalPrice_{{ d[i].PointCommodity }}"></span> 元 + <span id="spanTotalPoint_{{ d[i].PointCommodity }}"></span> 积分 </div> <div style="margin-top:0.05rem;"> <div style="float:right;width:0.2rem;text-align:center"> <input type="button" class="button" style="padding:0.03rem 0.1rem" value="+" onclick="increment('{{ d[i].PointCommodity }}')" /> </div> <div style="float:right;"> <input id="{{ d[i].PointCommodity }}_quantity" type="text" style="width:0.3rem;border:none;text-align:center;font-size:0.14rem;vertical-align:middle" value="{{ d[i].Quantity }}" onchange="sum()" readonly disabled /> </div> <div style="float:right;width:0.2rem;text-align:center"> <input type="button" class="button" style="padding:0.03rem 0.1rem" value="-" onclick="decrement('{{ d[i].PointCommodity }}')" /> </div> <div style="clear:both"></div> </div> </td> </tr> </table> </div> <div class="divDotLine" style="margin-top:0.05rem;"> </div> {{# } }} </script> @Helpers.HeaderArea(ViewBag, "headimg") <div id="divTopTitleBar"> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:100%"> <tr style="height:0.27rem;"> <td width="33%" align="center"><div onclick="goUrl('/PointCommodity/PointCommodity/@ViewBag.Domain.Id')">积分商城</div></td> <td width="33%" align="center"><div onclick="goUrl('/PointCommodity/ShoppingCart/@ViewBag.Domain.Id')">购物车</div></td> <td width="33%" align="center"><div onclick="goUrl('/PointCommodity/OrderList/@ViewBag.Domain.Id')">我的订单</div></td> </tr> <tr style="height:0.03rem;"> <td bgcolor="#E4E4E4"></td> <td class="defaultBgColor"></td> <td bgcolor="#E4E4E4"></td> </tr> </table> </div> <div class="divContent" style="margin-top:0.1rem;"> <div id="pointCommodityContainer"> </div> </div> <div id="divFooter"> <div style="height:1px;background-color:#F5F5F5"> </div> <div style="margin-left:0.1rem;margin-right:0.1rem;margin-top:0.05rem"> <table align="center" border="0" cellpadding="0" cellspacing="0" style="height:100%;width:100%;"> <tr> <td valign="middle" align="left" style="width:0.7rem;"> <div style=""> <input id="checkboxAll" type="checkbox" style="margin-right:0.05rem;vertical-align:middle" onchange="selectAll()" checked /><label for="checkboxAll">全选</label> </div> </td> <td align="left" style="font-size:0.14rem;"> <div><span id="spanTotalPrice">0</span> 元 + <span id="spanTotalPoint">0</span> 积分</div> </td> <td valign="middle" align="right" width="30%"> <input name="" type="button" class="button" value="结算" style="width:90%" onclick="order()"> </td> </tr> </table> </div> </div>
the_stack
@model SF.Module.Backend.ViewModels.HomeViewModel @{ ViewData["Title"] = "开发框架在线演示"; Layout = "~/Views/Shared/_Index.cshtml"; } <script type="text/javascript" charset="utf-8" src="~/lib/ueditor/ueditor.config.js"></script> <script type="text/javascript" charset="utf-8" src="~/lib/ueditor/ueditor.all.min.js"> </script> <!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败--> <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文--> <script type="text/javascript" charset="utf-8" src="~/lib/ueditor/lang/zh-cn/zh-cn.js"></script> <script type="text/javascript" src="~/lib/ueditor//third-party/SyntaxHighlighter/shCore.js"></script> <link rel="stylesheet" href="~/lib/ueditor//third-party/SyntaxHighlighter/shCoreDefault.css"> <section id="page-title"> <h1 class="title"> <div class="page-icon"> <i class="fa fa-exchange"></i> </div> 控制台 </h1> </section> <section id="page-content"> <div class="row"> <div class="col-md-12"> <div class="editor-area"> <div> <h2>写新文章</h2> <script id="editor" type="text/plain" style="height:500px;"> </script> </div> <div id="btns"> <div> <button onclick="getAllHtml()">获得整个html的内容</button> <button onclick="getContent()">获得内容</button> <button onclick="setContent()">写入内容</button> <button onclick="setContent(true)">追加内容</button> <button onclick="getContentTxt()">获得纯文本</button> <button onclick="getPlainTxt()">获得带格式的纯文本</button> <button onclick="hasContent()">判断是否有内容</button> <button onclick="setFocus()">使编辑器获得焦点</button> <button onmousedown="isFocus(event)">编辑器是否获得焦点</button> <button onmousedown="setblur(event)">编辑器失去焦点</button> </div> <div> <button onclick="getText()">获得当前选中的文本</button> <button onclick="insertHtml()">插入给定的内容</button> <button id="enable" onclick="setEnabled()">可以编辑</button> <button onclick="setDisabled()">不可编辑</button> <button onclick=" UE.getEditor('editor').setHide()">隐藏编辑器</button> <button onclick=" UE.getEditor('editor').setShow()">显示编辑器</button> <button onclick=" UE.getEditor('editor').setHeight(300)">设置高度为300默认关闭了自动长高</button> </div> <div> <button onclick="getLocalData()">获取草稿箱内容</button> <button onclick="clearLocalData()">清空草稿箱</button> </div> </div> <div> <button onclick="createEditor()">创建编辑器</button> <button onclick="deleteEditor()">删除编辑器</button> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="editor-area"> <h3>文件上传测试</h3> <div id="upload"> <a id="uploadButton" href="javascript:void(0);"> + <input type="file" name="file" id="file" /> </a> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="editor-area"> <h3>代码高亮</h3> <pre class="brush:c#;toolbar:false">using System.Collections.Generic; using System.Globalization; using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Localization; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Configuration; using System.Linq; using System.Reflection; using System; namespace SF.WebHost.Extensions { public static class ApplicationBuilderExtensions { /// &lt;summary&gt; /// 配置多语言信息 /// &lt;/summary&gt; /// &lt;param name=&quot;app&quot;&gt;&lt;/param&gt; /// &lt;returns&gt;&lt;/returns&gt; public static IApplicationBuilder UseCustomizedRequestLocalization(this IApplicationBuilder app) { var supportedCultures = new[] { new CultureInfo(&quot;zh&quot;), new CultureInfo(&quot;en&quot;), }; app.UseRequestLocalization(new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture(&quot;en&quot;, &quot;en&quot;), SupportedCultures = supportedCultures, SupportedUICultures = supportedCultures }); return app; } /// &lt;summary&gt; /// Hangfire配置 /// &lt;/summary&gt; /// &lt;param name=&quot;app&quot;&gt;&lt;/param&gt; /// &lt;param name=&quot;configuration&quot;&gt;&lt;/param&gt; /// &lt;returns&gt;&lt;/returns&gt; public static IApplicationBuilder UseCustomizedHangfire(this IApplicationBuilder app, IConfigurationRoot configuration) { // Hangfire.GlobalConfiguration.Configuration.UseSqlServerStorage(configuration.GetConnectionString(&quot;DefaultConnection&quot;)); //app.UseHangfireDashboard(); //app.UseHangfireServer(); // return app; } } }</pre> <p> <br /> </p> </div> </div> </div> </section> <script type="text/javascript"> //实例化编辑器 //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例 var ue = UE.getEditor('editor'); $(function () { SyntaxHighlighter.all(); $("#upload").on("click", "img", function () { $(this).remove(); UpdatePicture(); }); $("#file").change(function () { var fs = $("#file")[0].files; if (fs.length > 0) QiniuUpload(fs[0]); }); }); function isFocus(e) { alert(UE.getEditor('editor').isFocus()); UE.dom.domUtils.preventDefault(e) } function setblur(e) { UE.getEditor('editor').blur(); UE.dom.domUtils.preventDefault(e) } function insertHtml() { var value = prompt('插入html代码', ''); UE.getEditor('editor').execCommand('insertHtml', value) } function createEditor() { enableBtn(); UE.getEditor('editor'); } function getAllHtml() { alert(UE.getEditor('editor').getAllHtml()) } function getContent() { var arr = []; arr.push("使用editor.getContent()方法可以获得编辑器的内容"); arr.push("内容为:"); arr.push(UE.getEditor('editor').getContent()); alert(arr.join("\n")); } function getPlainTxt() { var arr = []; arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容"); arr.push("内容为:"); arr.push(UE.getEditor('editor').getPlainTxt()); alert(arr.join('\n')) } function setContent(isAppendTo) { var arr = []; arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容"); UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo); alert(arr.join("\n")); } function setDisabled() { UE.getEditor('editor').setDisabled('fullscreen'); disableBtn("enable"); } function setEnabled() { UE.getEditor('editor').setEnabled(); enableBtn(); } function getText() { //当你点击按钮时编辑区域已经失去了焦点,如果直接用getText将不会得到内容,所以要在选回来,然后取得内容 var range = UE.getEditor('editor').selection.getRange(); range.select(); var txt = UE.getEditor('editor').selection.getText(); alert(txt) } function getContentTxt() { var arr = []; arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容"); arr.push("编辑器的纯文本内容为:"); arr.push(UE.getEditor('editor').getContentTxt()); alert(arr.join("\n")); } function hasContent() { var arr = []; arr.push("使用editor.hasContents()方法判断编辑器里是否有内容"); arr.push("判断结果为:"); arr.push(UE.getEditor('editor').hasContents()); alert(arr.join("\n")); } function setFocus() { UE.getEditor('editor').focus(); } function deleteEditor() { disableBtn(); UE.getEditor('editor').destroy(); } function disableBtn(str) { var div = document.getElementById('btns'); var btns = UE.dom.domUtils.getElementsByTagName(div, "button"); for (var i = 0, btn; btn = btns[i++];) { if (btn.id == str) { UE.dom.domUtils.removeAttributes(btn, ["disabled"]); } else { btn.setAttribute("disabled", "true"); } } } function enableBtn() { var div = document.getElementById('btns'); var btns = UE.dom.domUtils.getElementsByTagName(div, "button"); for (var i = 0, btn; btn = btns[i++];) { UE.dom.domUtils.removeAttributes(btn, ["disabled"]); } } function getLocalData() { alert(UE.getEditor('editor').execCommand("getlocaldata")); } function clearLocalData() { UE.getEditor('editor').execCommand("clearlocaldata"); alert("已清空草稿箱") } function QiniuUpload(file) { var ext = file.name.split('.').pop().toLowerCase(); var allow = ["png", "jpg", "jpeg", "bmp", "gif"] if (allow.indexOf(ext) < 0) { alert("文件格式错误。"); return; } var formData = new FormData(); formData.append('key', key); formData.append('token', token); formData.append('file', file); var xhr = new XMLHttpRequest(); xhr.open('POST', upDomain, true); xhr.send(formData); xhr.onreadystatechange = function (response) { if (xhr.readyState == 4 && xhr.status == 200 && xhr.responseText != "") { var url = JSON.parse(xhr.responseText).key; $("#uploadButton").before("<img width='100' height='100' title='单击删除' src='" + fsDomain + "/" + url + suffix + "'/>"); UpdatePicture(); InitParams(); } else if (xhr.status != 200 && xhr.responseText) { alert(xhr.responseText); } }; } function UpdatePicture() { var urls = new Array(); $("#upload").children("img").each(function () { urls.push((this).src.replace(suffix, "")); }); if (urls.length > 0) { $("#Picture").val(urls.join(",")); } else { $("#Picture").val(""); } } function InitPicture() { var imgs = $("#Picture").val(); if (imgs.length > 0) { var arr = imgs.split(','); arr.forEach(function (item) { $("#uploadButton").before("<img width='100' height='100' title='单击删除' src='" + item + suffix + "'/>"); }); } } function InitParams() { $.ajax({ async: false, type: "get", url: "/Api/UEditor/getToken?filetype=image", dataType: 'json', success: function (data) { fsDomain = data.fsdomain; upDomain = data.updomain; key = data.filename; token = data.token; suffix = data.suffix; } }); } </script>
the_stack
@{ Layout = "~/Views/Shared/_LayoutBlank.cshtml"; } <style> body { /*margin-top: 1.5rem;*/ margin-top: 1.2rem; margin-bottom: 0.55rem; } #divTopTitleBar { position: fixed; left: 0rem; right: 0rem; /*top: 1rem;*/ top:0.7rem; height: 0.4rem; background-color: white; } .imgItem { max-height: 0.75rem; max-width: 0.9rem; vertical-align: middle; } .divItemDetailTitle { height: 0.35rem; line-height: 0.35rem; text-align: center; font-size: 0.16rem; font-weight: bold; color: #FFFFFF; } .divBorder { border: 1px solid #CCC; height: 0.3rem; font-size: 0.15rem; line-height: 0.3rem; } #divFooter { position: fixed; bottom: 0px; left: 0px; right: 0px; height: 0.4rem; font-size: 0.14rem; text-align: center; background-color: #F5F5F5; } </style> <script> var _cashAccount = @(ViewBag.Member.CashAccount / 100f); //要参与的商品SaleId var _saleId = ""; //当前页 var _currentPage = 1; var _totalPage = 1; $(document).ready(function () { loadData(); }); function loadData(targetPage) { if (targetPage > _totalPage) return; var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); var args = new Object(); args.Page = targetPage || 1; args.PageSize = 10; $.ajax({ url: "/Api/OneDollarBuying/GetForSaleCommodityList/@ViewBag.Domain.Id", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; //alert(JSON.stringify(resultObj)); var gettpl = document.getElementById('commodityListTemplate').innerHTML; laytpl(gettpl).render(resultObj.ItemList, function (html) { document.getElementById('divCommodityContainer').innerHTML += html; }); _currentPage = resultObj.Page; _totalPage = resultObj.TotalPage; if (_currentPage >= _totalPage) { $("#divPagingContainer").html("没有更多了"); } } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); // alert("Error: " + xmlHttpRequest.status); } }); } function showOrder(saleId,saleCommodityName) { _saleId = saleId; var gettpl = document.getElementById('orderTemplate').innerHTML; var pageii = layer.open({ type: 1, content: gettpl, style: 'position:fixed; left:0.1rem; top:0.1rem;right:0.1rem; border:none;', success: function (elem) { $("#orderTemplate_CommodityName").html(saleCommodityName); $("#txtOrderQuantity").focus(); setInputLocation(document.getElementById("txtOrderQuantity"), 1) } }); } function setOrderQuantity(quantity) { $("#txtOrderQuantity").val(quantity).focus(); setInputLocation(document.getElementById("txtOrderQuantity"), 10) } function order() { if($("#formInputForm").validate({ onfocusout: false, onkeyup: false, showErrors: hightlightValidationErrors, rules: { "txtOrderQuantity": { required: true, number: true, digits: true, range: [1, 10000] } }, messages: { "txtOrderQuantity": { required: "请输入要参与的人次;", number: "参与人次请输入有效整数字;", digits: "参与人次请输入有效整数字;", range: "参与人次请介于 1 到 10000 之间;" } } }).form() == false) return; var quantity = $("#txtOrderQuantity").val(); layer.closeAll(); if(quantity>_cashAccount){ layerAlert("您的账户余额不足,请充值。"); return; } var confirmLayerIndex = layer.open({ content: '您确认参与 ' + quantity + ' 人次?', btn: ['确认', '取消'], shadeClose: false, anim: false, yes: function () { layer.close(confirmLayerIndex); var loadLayerIndex = layer.open({ type: 2, shadeClose:false, content: '请稍候...' }); var args = new Object(); args.SaleId = _saleId; args.Quantity = quantity; $.ajax({ url: "/Api/OneDollarBuying/OrderOneDollarBuyingCommodity/@ViewBag.Domain.Id", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; if(resultObj.Success){ layerAlertBtn("参与成功!请留意揭晓结果~", function () { layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); window.location.reload(); }); }else{ switch (resultObj.Reason) { case 1: layerAlert("该商品本期已售罄,请继续参与新的一期。"); break; case 2: layerAlert("您的余额不足,请充值。"); break; case 3: layerAlert("无效商品。"); break; default: layerAlert("未知错误:" + resultObj.Reason); break; } } } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } }); } function commodityDetail(commodityId,saleId) { window.location.href = '/Campaign/OneDollarBuyingCommodityDetail/@ViewBag.Domain.Id?commodityId=' + commodityId + "&saleId=" + saleId; } function deposit() { window.location.href = '/Pay/Deposit/@ViewBag.Domain.Id'; } </script> <script id="commodityListTemplate" type="text/html"> {{# for(var i = 0, len = d.length; i < len; i++){ }} <div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width:1rem;" onclick="commodityDetail('{{ d[i].CommodityId }}','{{ d[i].Id }}')"> <img src="{{ d[i].ImageUrl }}" class="imgItem"> </td> <td> <div style="font-size:0.15rem;font-weight:bold" onclick="commodityDetail('{{ d[i].CommodityId }}','{{ d[i].Id }}')">{{ d[i].Name }}</div> <div style="margin-top:0.05rem; font-size:0.12rem;color:#555555;" onclick="commodityDetail('{{ d[i].CommodityId }}','{{ d[i].Id }}')">{{ d[i].Introduction }}</div> <div style="margin-top:0.1rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="font-size:0.12rem;color:#555555" onclick="commodityDetail('{{ d[i].CommodityId }}','{{ d[i].Id }}')"> <div> 总需:{{ d[i].TotalPart }} </div> <div style="margin-top:0.03rem;"> 剩余:<span class="font_red_b">{{ d[i].TotalPart - d[i].SoldPart }}</span> </div> </td> <td style="width:0.6rem;" align="right" valign="bottom"> <div class="divRectangle" style="" onclick="showOrder('{{ d[i].Id }}','{{ d[i].Name }}')"> 参与 </div> </td> </tr> </table> </div> </td> </tr> </table> </div> <div class="divDotLine" style="margin-top:0.13rem; margin-bottom:0.13rem; "> </div> {{# } }} </script> <script type="text/html" id="orderTemplate"> <form id="formInputForm"> @*<div class="defaultBgColor divItemDetailTitle"> 参与 </div>*@ <div style="font-size:0.18rem;padding:0.1rem;padding-bottom:0.2rem;"> <div style="font-size:0.15rem;font-weight:bold" id="orderTemplate_CommodityName"></div> <div style="margin-top:0.15rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width:1rem;">参与人次:</td> <td><input name="txtOrderQuantity" type="text" class="input_16" style="width:100%" id="txtOrderQuantity" maxlength="5" value="1" /></td> </tr> </table> </div> <div style="margin-top:0.15rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:0.3rem;"> <tr> <td width="20%" align="center"><div class="divBorder" onclick="setOrderQuantity(1)">1</div></td> <td width="20%" align="center"><div class="divBorder" onclick="setOrderQuantity(5)">5</div></td> <td width="20%" align="center"><div class="divBorder" onclick="setOrderQuantity(10)">10</div></td> <td width="20%" align="center"><div class="divBorder" onclick="setOrderQuantity(20)">20</div></td> <td width="20%" align="center"><div class="divBorder" onclick="setOrderQuantity(30)">30</div></td> </tr> </table> </div> <div style="margin-top:0.2rem;"> <div class="divRectangle" style="margin-left:0.4rem;margin-right:0.4rem;" onclick="order()"> 参与 </div> <div class="divRectangle_Gray" style="margin-top:0.1rem;margin-left:0.4rem;margin-right:0.4rem;" onclick="layer.closeAll()"> 取消 </div> </div> </div> </form> </script> @Helpers.OneDollarBuyingIntroduction() @Helpers.HeaderArea(ViewBag, "headimg") <div id="divTopTitleBar"> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:100%"> <tr style="height:0.27rem;"> <td width="33%" align="center"><div onclick="goUrl('/Campaign/OneDollarBuying/@ViewBag.Domain.Id')">正在进行</div></td> <td width="33%" align="center"><div onclick="goUrl('/Campaign/OneDollarBuyingLuckyList/@ViewBag.Domain.Id')">最新揭晓</div></td> <td width="33%" align="center"><div onclick="goUrl('/Campaign/OneDollarBuyingParticipatedList/@ViewBag.Domain.Id')">我的参与</div></td> </tr> <tr style="height:0.03rem;"> <td class="defaultBgColor"></td> <td bgcolor="#E4E4E4"></td> <td bgcolor="#E4E4E4"></td> </tr> </table> </div> <div class="divContent"> <div id="divCommodityContainer" style="padding-left: 0.1rem; padding-right: 0.1rem;margin-top:0.2rem;"> </div> <div id="divPagingContainer" class="divPagingContainer" style="margin-top: 0.2rem; text-align: center" onclick="loadData(_currentPage + 1)"> 查看更多 </div> </div> <div id="divFooter"> <table align="center" style="height:100%"> <tr> <td valign="middle" align="center"> <input type="button" class="button" value="玩法说明" style="width:1.5rem;" onclick="introduction()"> </td> </tr> </table> </div>
the_stack
@section styles{ <link rel="stylesheet" href="~/css/bootstrap-select.min.css" /> } <div class="content-wrapper"> <section class="content-header"> <h1> 仓库管理 <small>库存查询</small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li> <li><a href="#">仓库管理</a></li> <li class="active">库存查询</li> </ol> </section> <section class="content"> <div class="row" style="padding-bottom:1px;"> <div class="col-md-12"> <div class="box"> <div class="box-header with-border"> <h3 class="box-title">搜索条件</h3> <div class="box-tools pull-right"> <button type="button" id="test" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip"> <i class="fa fa-minus"></i> </button> </div> </div> <div class="box-body"> <div class="input-group"> <span class="input-group-addon">日期范围</span> <input type="text" ref="datemin" id="datemin" class="form-control" style="width:120px;"> <input type="text" ref="datemax" id="datemax" class="form-control" style="width:120px;margin-left:10px;"> <select class="form-control" v-model="StorageRackId" style="width:150px;margin-left:10px;"> <option value="">全部货架</option> @{ if (ViewBag.StorageRack != null || ViewBag.StorageRack.Count > 0) { foreach (var item in ViewBag.StorageRack) { <option value="@item.StorageRackId">@(item.StorageRackNo + "|" + item.StorageRackName)</option> } } } </select> <select size="1" id="MaterialId" style="width:150px;" v-model="MaterialId" class="selectpicker" data-live-search="true"></select> </div> <div class="input-group" style="margin-top:5px;margin-left:-10px"> <button name="search" v-on:click="searchL" type="submit" class="btn btn-success" style="margin-left:10px;"><i class="fa fa-search"></i> 搜库存</button> </div> </div> </div> </div> </div> <div class="row"> <div class="col-xs-12"> <div class="box"> <div class="box-body"> @*<div id="toolbar" class="btn-group"> <button id="btn_add" v-on:click="showL" type="button" class="btn btn-default"> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增 </button> <button id="btn_edit" v-on:click="editL" type="button" class="btn btn-default"> <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改 </button> <button id="btn_delete" v-on:click="deleteL" type="button" class="btn btn-default"> <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除 </button> </div>*@ <table id="bootstraptable" class="table table-bordered text-nowrap table-hover"></table> </div> </div> </div> </div> </section> </div> @section scripts{ <script src="~/js/bootstrap-select.min.js"></script> <script src="~/js/defaults-zh_CN.min.js"></script> <script type="text/javascript"> $(function () { $('#MaterialId').on('show.bs.select', function (e, clickedIndex, isSelected, previousValue) { var divdom = $("div[class='bs-searchbox']")[0].childNodes[0]; $(divdom).on("input propertychange", function () { var dom = $("li[class='no-results']"); var text = divdom.value; if (dom.length>0) { app.searchMaterial(text,2); } if (app.MaterialList.length<=0) { app.searchMaterial(text,2); } }); }); }); var app = new Vue({ el: '#app', data: { datemin: '', datemax: '', StorageRackId: '', MaterialId: '', MaterialList: [], url:'' }, mounted: function () { var _self = this; _self.$nextTick(function () { //显示active _self.$refs.Inventory.parentNode.parentNode.classList.add("active"); _self.$refs.Inventory.classList.add("active"); _self.$refs.datemin.value = _self.getCurrentMonthFirst(); _self.$refs.datemax.value = _self.getCurrentMonthLast(); //_self.datemin = _self.getCurrentMonthFirst(); //_self.datemax = _self.getCurrentMonthLast(); $('#datemin').datetimepicker({ format: 'yyyy-mm-dd', minView: 2, autoclose: true, language: "zh-CN" }); $('#datemax').datetimepicker({ format: 'yyyy-mm-dd', minView: 2, autoclose: true, language: "zh-CN" }); $("#MaterialId").selectpicker({ noneSelectedText: '请选择', }); _self.searchMaterial("",1); setTimeout(function () { _self.loadL(); yui.getDomById("test").click(); $("div[class='pull-right search']")[0].children[0].setAttribute("placeholder", "物料编号或名称"); }, 500); }); }, methods: { searchMaterial: function (val, type) { var _self = this; if (type === 1) { _self.url = "/Material/Search"; } else { _self.url = "/Material/Search?text=" + val; } yui.$axiosget(_self.url).then(function (res) { _self.MaterialList = res.data.rows; var html = "<option value=''>请选择</option>"; for (var item in _self.MaterialList) { html += "<option value='" + _self.MaterialList[item].MaterialId + "' " + "data-subtext='" + _self.MaterialList[item].MaterialNo + "'>" + _self.MaterialList[item].MaterialName + "</option>" } if (type !== 1) { $("#MaterialId").empty(); } $("#MaterialId").append(html) $('#MaterialId').selectpicker('refresh'); //$('#MaterialId').selectpicker('val', _self.MaterialId); }).catch(function (res) { }); }, loadL: function () { _self = this; var obj = [{ checkbox: true, //是否显示复选框 visible: true }, { field: 'InventoryId', title: 'Id', visible: false }, { field: 'MaterialNo', title: '物料编号', align: 'center', sortable: true }, { field: 'MaterialName', title: '物料名称', align: 'center', sortable: true }, { field: 'Qty', title: '库存容量', align: 'center', sortable: true, formatter: function (value, row, index) { if (value > row.SafeQty) { return '<span class="label label-success radius">' + value + '</span>'; } else { return '<span class="label label-danger radius">' + value + '</span>'; } } }, { field: 'SafeQty', title: '安全库存', align: 'center', sortable: true }, { field: 'StorageRackNo', title: '货架编号', align: 'center', sortable: true }, { field: 'StorageRackName', title: '货架名称', align: 'center', sortable: true }, { field: 'Remark', align: 'center', title: '备注' }, { field: 'CName', title: '创建人', align: 'center', sortable: true }, { field: 'CreateDate', align: 'center', title: '创建时间', sortable: true, formatter: function (value, row, index) { return _self.jsonDateFormat(value); } }, { field: 'UName', align: 'center', title: '修改人', sortable: true }, { field: 'ModifiedDate', title: '修改时间', align: 'center', sortable: true, formatter: function (value, row, index) { return _self.jsonDateFormat(value); } }]; var qParams = { StorageRackId: _self.StorageRackId, MaterialId: _self.MaterialId }; yui.table("bootstraptable", "/Inventory/List", obj, "POST", "InventoryId", true, qParams); }, searchL: function () { var qParams = { StorageRackId: _self.StorageRackId, MaterialId: _self.MaterialId }; var query = { silent: true, query: qParams }; $("#bootstraptable").bootstrapTable('refresh', query); }, } }); </script> }
the_stack
@{ Layout = "/Views/Shared/_Layout.cshtml"; } <body layadmin-themealias="default" style=""> <div class="layui-fluid"> <div class="layui-card"> <div class="layui-form layui-card-header layuiadmin-card-header-auto"> <div class="layui-form-item"> <div class="layui-inline"> <label class="layui-form-label">客户端编号</label> <div class="layui-input-block"> <input type="text" id="name" name="name" placeholder="请输入" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-inline"> <button id="search" class="layui-btn" data-type="reload"> <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> </button> </div> </div> </div> <div class="layui-card-body"> <div style="padding-bottom: 10px;"> <button id="add" class="layui-btn layuiadmin-btn-useradmin" data-type="add">添加webapi</button> <button id="add2" class="layui-btn layuiadmin-btn-useradmin" data-type="add2">添加mvc</button> </div> <table class="layui-hide" id="tableList" lay-filter="tableList"></table> <script> layui.use('table', function () { var table = layui.table; table.render({ elem: '#tableList', height: '600px' , url: '/Client/getlist' , request: { pageName: 'pageIndex' //页码的参数名称,默认:page , limitName: 'pageSize' //每页数据量的参数名,默认:limit } , response: { statusName: 'status' //规定数据状态的字段名称,默认:code , statusCode: 0 //规定成功的状态码,默认:0 , msgName: 'msg' //规定状态信息的字段名称,默认:msg , countName: 'total' //规定数据总数的字段名称,默认:count , dataName: 'data' //规定数据列表的字段名称,默认:data } , method: 'post' , title: '用户数据表' , cols: [[ //表头 { type: 'checkbox', fixed: 'left' }, { field: 'id', title: 'ID', minWidth: 80, sort: true, fixed: 'left' } , { field: 'clientId', title: '客户端编号', minWidth: 80, fixed: 'left' } , { field: 'description', title: '资源描述', minWidth: 80, fixed: 'left' } , { fixed: 'right', templet: '#Operating', minWidth: 210, align: 'center', title: '操作' } ]] , id: 'tableList' , limit: 20 , limits: [20, 30, 40, 50, 60, 80, 100] , page: true }); //var $ = layui.$, active = { // reload: function () { // var username = $('#username'); // var email = $('#email'); // var sex = $('#sex'); // //执行重载 // table.reload('testReload', { // page: { // curr: 1 //重新从第 1 页开始 // } // , where: { // key: { // UserName: username.val(), // Email: email.val(), // Sex: sex.val() // } // } // }); // } //}; //自定义事件 $('#add').on('click', function () { layer.open({ type: 2, area: ['650px', '600px'], fixed: false, //不固定 maxmin: true, content: '/client/create?Id=1', btn: ['确定', '取消'], yes: function (index, layero) { $("#form").length;//直接获取表单长度=0 $(layero).find("#form").length;//表单长度还是等于0 var submit = layero.find('iframe').contents().find("#layuiadmin-app-form-submit"); submit.click(); } }); }) $('#add2').on('click', function () { layer.open({ type: 2, area: ['650px', '600px'], fixed: false, //不固定 maxmin: true, content: '/client/create?Id=2', btn: ['确定', '取消'], yes: function (index, layero) { $("#form").length;//直接获取表单长度=0 $(layero).find("#form").length;//表单长度还是等于0 var submit = layero.find('iframe').contents().find("#layuiadmin-app-form-submit"); submit.click(); } }); }) $('#search').on('click', function () { var name = $('#name'); //执行重载 table.reload('tableList', { page: { curr: 1 //重新从第 1 页开始 } , where: { ClientId: name.val(), } }); //var type = $(this).data('type'); //active[type] ? active[type].call(this) : ''; }) //监听表格排序问题 table.on('sort(tableList)', function (obj) { //注:tool是工具条事件名,tableList是table原始容器的属性 lay-filter="对应的值" console.log(obj.field); //当前排序的字段名 console.log(obj.type); //当前排序类型:desc(降序)、asc(升序)、null(空对象,默认排序) console.log(this); //当前排序的 th 对象 //尽管我们的 table 自带排序功能,但并没有请求服务端。 //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如: table.reload('tableList', { //testTable是表格容器id initSort: obj //记录初始排序,如果不设的话,将无法标记表头的排序状态。 layui 2.1.1 新增参数 , where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式) sortKey: obj.field //排序字段 , sortType: obj.type == "desc" ? 1 : 0 //排序方式 } }); }); //头工具栏事件 table.on('toolbar(tableList)', function (obj) { var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { case 'getCheckData': var data = checkStatus.data; layer.alert(JSON.stringify(data)); break; case 'getCheckLength': var data = checkStatus.data; layer.msg('选中了:' + data.length + ' 个'); break; case 'isAll': layer.msg(checkStatus.isAll ? '全选' : '未全选'); break; }; }); //监听行工具事件 table.on('tool(tableList)', function (obj) { var data = obj.data; if (obj.event === 'del') { layer.confirm('确定删除么?', function (index) { var url = "/client/del"; var field = { Id: data.id }; $.post(url, field, function (data) { if (data.code == 200) { layui.table.reload('tableList'); //重载表格 layer.msg("操作成功!", { time: 1000, icon: 1, }); } else { layer.msg("操作失败!", { time: 1000, icon: 2, }); } }) }); } else if (obj.event === 'edit') { var url = "?Id=" + data.id; layui.use('layer', function () { var layer = layui.layer; layer.open({ type: 2, area: ['650px', '600px'], fixed: false, //不固定 maxmin: true, content: '/client/edit' + url, title: '编辑', btn: ['确定', '取消'], yes: function (index, layero) { $("#form").length;//直接获取表单长度=0 $(layero).find("#form").length;//表单长度还是等于0 var submit = layero.find('iframe').contents().find("#layuiadmin-app-form-edit"); submit.click(); } }); }); } }); }); function ValidateLog() { } //登录回调函数 function tips(data) { alert(data); } </script> <script type="text/html" id="Operating"> @*<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail"><i class="layui-icon layui-icon-read"></i>查看</a>*@ @*<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon"></i>编辑</a>*@ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i>删除</a> </script> </div> </div> </div> <div class="layui-layer-move" style="cursor: move; display: none;"></div> </body>
the_stack
@model Sheng.WeixinConstruction.Client.Shell.Models.DonationViewModel @{ ViewBag.SubTitle = "活动"; Layout = "~/Views/Shared/_LayoutBlank.cshtml"; } <style type="text/css"> body { margin-bottom: 0.55rem; } .campaignName { font-size: 0.14rem; font-weight: bold; } .campaignDescription { font-size: 0.13rem; color: #666; } #divMemberInfo { font-size: 0.14rem; line-height: 0.14rem; text-align: center; margin-top: 0.05rem; } #divShareMask { position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; width: 100%; height: 100%; background-color: black; text-align: right; filter: alpha(opacity=80); -moz-opacity: 0.8; -khtml-opacity: 0.8; opacity: 0.8; } .divLuckyTicketItem { text-align: center; font-size: 0.12rem; color: #FF7F00; background-image: url(/Content/Images/bg_star.jpg); background-repeat: repeat; padding-top: 0.05rem; padding-bottom: 0.05rem; margin-bottom: 0.05rem; } #divFooter { position: fixed; bottom: 0px; left: 0px; right: 0px; height: 0.4rem; font-size: 0.14rem; text-align: center; background-color: #F5F5F5; } </style> <script> var _currentPage = 1; var _totalPage = 1; var _status = @((int)Model.CampaignBundle.Campaign.Status); var _campaignId = getQueryString("campaignId"); var _validator; $(document).ready(function () { $(document).scroll(function () { $("#divShareMask").css("top", document.body.scrollTop); }); var jsApiConfigStr = "@Newtonsoft.Json.JsonConvert.SerializeObject(Model.JsApiConfig)"; jsApiConfigStr = jsApiConfigStr.replace(new RegExp("&quot;", "gm"), "\""); jsApiConfigStr = jsApiConfigStr.replace(new RegExp("\r\n", "gm"), ""); jsApiConfigStr = jsApiConfigStr.replace(new RegExp("\n", "gm"), ""); var jsApiConfig = eval('(' + jsApiConfigStr + ')'); wx.config(jsApiConfig); loadData(); _validator = $("#form").validate({ onfocusout: false, onkeyup: false, showErrors: showValidationErrors, rules: { "txtFee": { required: true, number: true, digits: true, range: [1, 1000000] }, }, messages: { "txtFee": { required: "请输入要充值的金额;", number: "充值金额请输入有效整数字;", digits: "充值金额请输入有效整数字;", range: "充值金额请介于 1 到 1000000 之间;" }, } }); $("#txtFee").focus(); }); wx.ready(function () { wx.onMenuShareTimeline({ title: '@Model.CampaignBundle.Campaign.ShareTimelineTitle', // 分享标题 link: '@Request.Url.Scheme://@Request.Url.Host/Campaign/LuckyTicketShare/@Model.CampaignBundle.Campaign.Domain?campaignId=@Model.CampaignBundle.Campaign.Id&memberId=@ViewBag.Member.Id', // 分享链接 imgUrl: '@Model.CampaignBundle.Campaign.ShareImageUrl', // 分享图标 success: function () { shareSuccess("ShareTimeline"); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); wx.onMenuShareAppMessage({ title: '@Model.CampaignBundle.Campaign.ShareAppMessageTitle', // 分享标题 desc: '@Model.CampaignBundle.Campaign.ShareAppMessageDescription', // 分享描述 link: '@Request.Url.Scheme://@Request.Url.Host/Campaign/LuckyTicketShare/@Model.CampaignBundle.Campaign.Domain?campaignId=@Model.CampaignBundle.Campaign.Id&memberId=@ViewBag.Member.Id', // 分享链接 imgUrl: '@Model.CampaignBundle.Campaign.ShareImageUrl', // 分享图标 type: 'link', // 分享类型,music、video或link,不填默认为link dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空 success: function () { shareSuccess("ShareAppMessage"); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); }); wx.error(function (res) { alert("error:" + res); }); function shareSuccess(type) { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/Campaign/" + type + "/@ViewBag.Domain.Id?campaignId=" + _campaignId, type: "POST", dataType: "json", success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; if (resultObj.Point == 0) return; var msg = ""; if (resultObj.Point > 0) { msg += "获得积分:" + resultObj.Point; } if (msg != "") { layerAlertBtn(msg); } } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function showCampaignDescription() { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/Campaign/GetCampaignDescription/@ViewBag.Domain.Id?id=" + _campaignId, type: "POST", dataType: "json", success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; var gettpl = document.getElementById('campaignDescription').innerHTML; laytpl(gettpl).render(resultObj, function (html) { var pageii = layer.open({ type: 1, content: html, shadeClose: false, style: 'position:fixed; left:0.1rem; top:0.1rem;right:0.1rem; bottom:0.1rem; border:none;' }); }); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function showShareMask() { $("#divShareMask").css("top", document.body.scrollTop); $("#divShareMask").show(); $("#divFooter").hide(); } function hideShareMask() { $("#divShareMask").hide(); $("#divFooter").show(); } function deposit() { @if (ViewBag.DomainContext.Pay == false) { <text> layerAlert(@(ViewBag.Authorizer.NickName) 未开通对接微信支付,请使用线下现金充值方式为您的账户充值。); return; </text> } if (_validator.form() == false) { return; } var fee = $("#txtFee").val(); var confirmLayerIndex = layer.open({ content: '确认捐款人民币 ' + fee + ' 元吗?', btn: ['确认', '取消'], shadeClose: false, anim: false, yes: function () { layer.close(confirmLayerIndex); var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); var args = new Object(); args.CampaignId = _campaignId; args.Fee = fee; args.Name = $("#txtName").val(); args.Contact = $("#txtContact").val(); args.Description = $("#txtDescription").val(); $.ajax({ url: "/Api/Campaign/DonationPay/@ViewBag.Domain.Id", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { if (data.Success) { // alert(JSON.stringify(data)); // window.location.href = "/Pay/PayOrderDetail/@ViewBag.Domain.Id?id=" + data.Data.PayOrderId; var currentUrl = encodeURI(window.location.href); window.location.href = '/Pay/PayOrderDetail/@ViewBag.Domain.Id?id=' + data.Data.Data.PayOrderId + "&action=1&returnUrl=" + currentUrl; } else { layer.close(loadLayerIndex); layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } }); } function loadData() { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); var args = new Object(); args.Page = 1; args.PageSize = 1000; args.CampaignId = _campaignId; $.ajax({ url: "/Api/Campaign/GetDonationLogList/@ViewBag.Domain.Id", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; _currentPage = resultObj.Page; _totalPage = resultObj.TotalPage; if(_currentPage==1) { document.getElementById('ticketNumberItemContainer').innerHTML = ""; } var gettpl = document.getElementById('ticketNumberItemTemplate').innerHTML; laytpl(gettpl).render(resultObj.ItemList, function (html) { document.getElementById('ticketNumberItemContainer').innerHTML += html; }); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function payOrder(payOrderId){ var currentUrl = encodeURI(window.location.href); window.location.href = '/Pay/PayOrderDetail/@ViewBag.Domain.Id?id=' + payOrderId ; } </script> <script type="text/html" id="campaignDescription"> <div style="position: fixed; top: 0.1rem; left: 0.1rem; right: 0.1rem; bottom: 0.45rem; overflow: auto;"> {{ d }} </div> <div style="position: fixed; bottom: 0.1rem; left: 0.1rem; right: 0.1rem;"> <div class="divRectangle_Gray" style="margin-top: 0.1rem; " onclick="layer.closeAll()"> 关 闭 </div> </div> </script> <script type="text/html" id="ticketNumberItemTemplate"> {{# for(var i = 0, len = d.length; i < len; i=i+1){ }} {{# var fee = accDiv(d[i].TotalFee,100) }} <div class="divLuckyTicketItem" onclick="payOrder('{{ d[i].PayOrder }}')"> {{ d[i].CreateTime }} 捐款 {{ fee }} 元 {{# if(d[i].Finish){ }} {{# } else{}} (未完成) {{# } }} </div> {{# } }} </script> <div id="divImageContainer"> <img src="@Model.CampaignBundle.Campaign.ImageUrl" name="img" id="img" style="width: 100%;"> </div> <div class="divContent"> <div style="margin-top: 0.06rem" class="campaignName"> @Model.CampaignBundle.Campaign.Name </div> <div style="margin-top: 0.06rem" class="campaignDescription"> @Html.Raw(Model.CampaignBundle.Campaign.Introduction) </div> @*<div style="text-align:center"> <div class="divVote" style="margin-top: 0.1rem;" onclick="showCampaignDescription()"> 查看活动详情 </div> </div>*@ @*<div style="text-align: center; margin-top: 0.1rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="33%" align="center"> 参与人数<br /> <span class="defaultColor" style="font-weight:bold">@Model.DataReport.MemberCount</span> </td> <td width="33%" align="center"> 总号码数<br /> <span class="defaultColor" style="font-weight:bold">@Model.DataReport.LuckyTicketCount</span> </td> <td width="33%" align="center"> 围观次数<br /> <span class="defaultColor" style="font-weight:bold">@Model.DataReport.PageVisitCount</span> </td> </tr> </table> </div>*@ <div class="divDotLine" style="margin-top:0.05rem; margin-bottom:0.1rem;"> </div> @*<div id="divMemberInfo" onclick="showShareMask()"> <table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="left" style="width:0.3rem"><img src="/Content/Images/shareTimeLine.jpg" style="width:0.2rem;"></td> <td align="left"><div style="line-height:0.2rem">点击这里分享本页试一试~</div></td> </tr> </table> </div>*@ <div class="divDotLine" style="margin-top:0.05rem; margin-bottom:0.1rem;"> </div> <form id="form"> <div style="font-size:0.14rem;"> 捐款金额(元): </div> <div style="margin-top:0.1rem;"> <input id="txtFee" name="txtFee" type="text" class="input_16" value="" maxlength="6"> </div> <div style="font-size:0.14rem;margin-top:0.2rem;"> 姓名: </div> <div style="margin-top:0.1rem;"> <input id="txtName" name="txtName" type="text" class="input_16" value="" maxlength="25"> </div> <div style="font-size:0.14rem;margin-top:0.2rem;"> 联系方式: </div> <div style="margin-top:0.1rem;"> <input id="txtContact" name="txtContact" type="text" class="input_16" value="" maxlength="50"> </div> <div style="font-size:0.14rem;margin-top:0.2rem;"> 爱心留言: </div> <div style="margin-top:0.1rem;"> <input id="txtDescription" name="txtDescription" type="text" class="input_16" value="" maxlength="250"> </div> <div style="margin-top:0.3rem; margin-left:auto; margin-right:auto;width:1.5rem;"> <input name="" type="button" class="button" value="确 认" style="width:100%" onclick="deposit()" @if (ViewBag.DomainContext.Pay == false) { @Html.Raw("disabled") }> </div> </form> @if (ViewBag.DomainContext.Pay == false) { <div style="margin-top:0.2rem;"> <span>@(ViewBag.Authorizer.NickName) 未开通对接微信支付。</span> </div> } <div class="divDotLine" style="margin-top:0.1rem; margin-bottom:0.1rem;"> </div> <div> 我的捐款记录: </div> <div style="margin-top:0.1rem;" id="ticketNumberItemContainer"> </div> <div style="margin-top:0.1rem;"> 华晶文化:做事争做奋斗者,做人要有情有义 </div> </div> <div id="divFooter"> <table align="center" border="0" style="height:100%;width:100%"> <tr> <td valign="middle" align="center" width="50%"> <input name="" type="button" class="button" value="活动说明" style="width:90%" onclick="showCampaignDescription()"> </td> @*<td valign="middle" align="center" width="50%"> <input name="" type="button" class="button" value="开奖信息" style="width:90%" onclick="showDrawResult()"> </td>*@ </tr> </table> </div> <div id="divShareMask" style="display:none" onclick="hideShareMask()"> <img src="/Content/Images/share.PNG" width="200" height="145"> </div>
the_stack
@page @model DatepickerModel @{ ViewData["Title"] = "Date Picker"; ViewData["PageName"] = "form_plugins_datepicker"; ViewData["Category1"] = "Form Plugins"; ViewData["Heading"] = "<i class='subheader-icon fal fa-credit-card-front'></i> Date Picker<sup class='badge badge-primary fw-500'>ADDON</sup>"; ViewData["PageDescription"] = "Bootstrap-datepicker provides a flexible datepicker widget in the Bootstrap style."; } @section HeadBlock { <link rel="stylesheet" media="screen, print" href="~/css/formplugins/bootstrap-datepicker/bootstrap-datepicker.css"> } <div class="alert alert-primary"> <div class="d-flex flex-start w-100"> <div class="mr-2 hidden-md-down"> <span class="icon-stack icon-stack-lg"> <i class="base base-6 icon-stack-3x opacity-100 color-primary-500"></i> <i class="base base-10 icon-stack-2x opacity-100 color-primary-300 fa-flip-vertical"></i> <i class="ni ni-blog-read icon-stack-1x opacity-100 color-white"></i> </span> </div> <div class="d-flex flex-fill"> <div class="flex-fill"> <span class="h5">About</span> <p>Bootstrap datepicker allows the user to enter a date by merely clicking on a date in the pop-up calendar as opposed to having to take their hand off the mouse to type in a date. The UI makes easy to select the date and keep the proper formatting</p> <p class="m-0"> Find in-depth, guidelines, tutorials and more on Bootstrap Datepicker's <a href="https://bootstrap-datepicker.readthedocs.io/en/stable/" target="_blank">Official Documentation</a> </p> </div> </div> </div> </div> <div class="row"> <div class="col-xl-12"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> Datepicker <span class="fw-300"><i>Examples</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Below you will find various date picker examples which you can use for your project </div> <div class="form-group row"> <label class="col-form-label col-12 col-lg-3 form-label text-lg-right">Minimum Setup</label> <div class="col-12 col-lg-6 "> <input type="text" class="form-control" id="datepicker-1" readonly placeholder="Select date"> </div> </div> <div class="form-group row"> <label class="col-form-label col-12 col-lg-3 form-label text-lg-right">Input Group Setup</label> <div class="col-12 col-lg-6"> <div class="input-group"> <input type="text" class="form-control " readonly placeholder="Select date" id="datepicker-2"> <div class="input-group-append"> <span class="input-group-text fs-xl"> <i class="@(Settings.Theme.IconPrefix) fa-calendar"></i> </span> </div> </div> </div> </div> <div class="form-group row"> <label class="col-form-label col-12 col-lg-3 form-label text-lg-right">Enable Helper Buttons</label> <div class="col-12 col-lg-6"> <div class="input-group" > <input type="text" class="form-control " readonly value="07/17/2020" id="datepicker-3"> <div class="input-group-append"> <span class="input-group-text fs-xl"> <i class="@(Settings.Theme.IconPrefix) fa-calendar-alt"></i> </span> </div> </div> <span class="help-block">Enable clear and today helper buttons</span> </div> </div> <div class="form-group row"> <label class="col-form-label col-12 col-lg-3 form-label text-lg-right">Orientation</label> <div class="col-12 col-lg-6 demo-v-spacing-sm"> <div class="input-group"> <input type="text" class="form-control " placeholder="Top left" id="datepicker-4-1"> <div class="input-group-append"> <span class="input-group-text fs-xl"> <i class="@(Settings.Theme.IconPrefix) fa-calendar-check"></i> </span> </div> </div> <div class="input-group"> <input type="text" class="form-control " placeholder="Top right" id="datepicker-4-2"> <div class="input-group-append"> <span class="input-group-text fs-xl"> <i class="@(Settings.Theme.IconPrefix) fa-calendar-times"></i> </span> </div> </div> <div class="input-group"> <input type="text" class="form-control " placeholder="Bottom left" id="datepicker-4-3"> <div class="input-group-append"> <span class="input-group-text fs-xl"> <i class="@(Settings.Theme.IconPrefix) fa-calendar-exclamation"></i> </span> </div> </div> <div class="input-group"> <input type="text" class="form-control " placeholder="Bottom right" id="datepicker-4-4"> <div class="input-group-append"> <span class="input-group-text fs-xl"> <i class="@(Settings.Theme.IconPrefix) fa-calendar-plus"></i> </span> </div> </div> </div> </div> <div class="form-group row"> <label class="col-form-label col-12 col-lg-3 form-label text-lg-right">Range Picker</label> <div class="col-12 col-lg-6"> <div class="input-daterange input-group" id="datepicker-5"> <input type="text" class="form-control" name="start"> <div class="input-group-append input-group-prepend"> <span class="input-group-text fs-xl"><i class="@(Settings.Theme.IconPrefix) fa-ellipsis-h"></i></span> </div> <input type="text" class="form-control" name="end"> </div> </div> </div> <div class="form-group row"> <label class="col-form-label col-12 col-lg-3 form-label text-lg-right">Inline Mode</label> <div class="col-12 col-lg-6"> <div class id="datepicker-6"></div> </div> </div> <div class="form-group row"> <label class="col-form-label col-12 col-lg-3 form-label text-lg-right">Modal Demos</label> <div class="col-12 col-lg-6"> <a href="" class="btn btn-primary" data-toggle="modal" data-target="#default-example-modal">Show inside datepicker</a> </div> </div> <div class="modal fade" id="default-example-modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title"> Date picker inside modal </h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true"><i class="@(Settings.Theme.IconPrefix) fa-times"></i></span> </button> </div> <div class="modal-body"> <div class="form-group"> <label class="form-label" for="datepicker-modal-2">Select a date</label> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text fs-xl"><i class="@(Settings.Theme.IconPrefix) fa-calendar"></i></span> </div> <input type="text" id="datepicker-modal-2" class="form-control" placeholder="Select a date" aria-label="date" aria-describedby="datepicker-modal-2"> </div> <span class="help-block">Some help content goes here</span> </div> <div class="form-group"> <label class="form-label" for="datepicker-modal-3">Datepicker with button</label> <div class="input-group"> <input type="text" id="datepicker-modal-3" class="form-control" placeholder="End date" aria-label="date" aria-describedby="datepicker-modal-3"> <div class="input-group-append"> <span class="input-group-text fs-xl"><i class="@(Settings.Theme.IconPrefix) fa-calendar-alt"></i></span> </div> </div> <span class="help-block">Some help content goes here</span> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div> </div> </div> </div> </div> </div> </div> @section ScriptsBlock { <script src="~/js/formplugins/bootstrap-datepicker/bootstrap-datepicker.js"></script> <script> // Class definition var controls = { leftArrow: '<i class="@(Settings.Theme.IconPrefix) fa-angle-left" style="font-size: 1.25rem"></i>', rightArrow: '<i class="@(Settings.Theme.IconPrefix) fa-angle-right" style="font-size: 1.25rem"></i>' } var runDatePicker = function () { // minimum setup $('#datepicker-1').datepicker({ todayHighlight: true, orientation: "bottom left", templates: controls }); // input group layout $('#datepicker-2').datepicker({ todayHighlight: true, orientation: "bottom left", templates: controls }); // input group layout for modal demo $('#datepicker-modal-2').datepicker({ todayHighlight: true, orientation: "bottom left", templates: controls }); // enable clear button $('#datepicker-3').datepicker({ todayBtn: "linked", clearBtn: true, todayHighlight: true, templates: controls }); // enable clear button for modal demo $('#datepicker-modal-3').datepicker({ todayBtn: "linked", clearBtn: true, todayHighlight: true, templates: controls }); // orientation $('#datepicker-4-1').datepicker({ orientation: "top left", todayHighlight: true, templates: controls }); $('#datepicker-4-2').datepicker({ orientation: "top right", todayHighlight: true, templates: controls }); $('#datepicker-4-3').datepicker({ orientation: "bottom left", todayHighlight: true, templates: controls }); $('#datepicker-4-4').datepicker({ orientation: "bottom right", todayHighlight: true, templates: controls }); // range picker $('#datepicker-5').datepicker({ todayHighlight: true, templates: controls }); // inline picker $('#datepicker-6').datepicker({ todayHighlight: true, templates: controls }); } $(document).ready(function () { runDatePicker(); }); </script> }
the_stack
@page @model ChartistModel @{ ViewData["Title"] = "Chartist.js"; ViewData["PageName"] = "statistics_chartist"; ViewData["Category1"] = "Statistics"; ViewData["Heading"] = "<i class='subheader-icon fal fa-chart-pie'></i> Chartist.js <sup class='badge badge-primary fw-500'>ADDON</sup>"; ViewData["PageDescription"] = "Simple responsive charts"; } @section HeadBlock { <link rel="stylesheet" media="screen, print" href="~/css/statistics/chartist/chartist.css"> } <div class="alert alert-primary"> <div class="d-flex flex-start w-100"> <div class="mr-2 hidden-md-down"> <span class="icon-stack icon-stack-lg"> <i class="base base-6 icon-stack-3x opacity-100 color-primary-500"></i> <i class="base base-10 icon-stack-2x opacity-100 color-primary-300 fa-flip-vertical"></i> <i class="ni ni-blog-read icon-stack-1x opacity-100 color-white"></i> </span> </div> <div class="d-flex flex-fill"> <div class="flex-fill"> <span class="h5">About</span> <p>Chartist's goal is to provide a simple, lightweight and unintrusive library to responsively craft charts on your website. Chartist leverages the power of browsers today and say good bye to the idea of solving all problems ourselves. </p> <p> Chartist works with inline-SVG and therefore leverages the power of the DOM to provide parts of its functionality. This also means that Chartist does not provide it's own event handling, labels, behaviors or anything else that can just be done with plain HTML, JavaScript and CSS. The single and only responsibility of Chartist is to help you drawing "Simple responsive Charts" using inline-SVG in the DOM, CSS to style and JavaScript to provide an API for configuring your charts.</p> <p class="m-0"> Find tutorials, guidelines and more on their <a href="https://gionkunz.github.io/chartist-js/getting-started.html" target="_blank">official documentation</a> </p> </div> </div> </div> </div> <div class="row"> <div class="col-xl-6"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> Area <span class="fw-300"><i>Chart</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Example of line area chart with a color filler </div> <div id="lineChartArea" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-2" class="panel"> <div class="panel-hdr"> <h2> Line <span class="fw-300"><i>Scattered</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> This advanced example uses a line chart to draw a scatter diagram. The data object is created with a functional style random mechanism. There is a mobile first responsive configuration using the responsive options to show less labels on small screens. </div> <div id="lineScattered" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-3" class="panel"> <div class="panel-hdr"> <h2> Using <span class="fw-300"><i>Events</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Chartist has fixed graphical representations that are chosen because of their flexibility and to provide a high level of separation of the concerns. However, sometimes you probably would like to use different shapes or even images for your charts. One way to achieve this is by using the draw events and replace or add custom SVG shapes. </div> <div id="usingEvents" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-4" class="panel"> <div class="panel-hdr"> <h2> Bipolar <span class="fw-300"><i>Line Chart</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> You can also only draw the area shapes of the line chart. Area shapes will always be constructed around their areaBase which also allows you to draw nice bi-polar areas. </div> <div id="bipolar" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-5" class="panel"> <div class="panel-hdr"> <h2> Advanced <span class="fw-300"><i>SMIL Animation</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Chartist provides simple API to animate the Chart elements using SMIL. You can do most animation with CSS but in some cases you'd like to animate SVG properties that are not available in CSS </div> <div id="smileAnimation" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-6" class="panel"> <div class="panel-hdr"> <h2> Horizontal <span class="fw-300"><i>Bar</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Guess what! Creating horizontal bar charts is as simple as it can get. There's no new chart type you need to learn, just passing an additional option is enough </div> <div id="horizontalBar" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-7" class="panel"> <div class="panel-hdr"> <h2> Peak <span class="fw-300"><i>Circles</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> With the help of draw events we are able to add a custom SVG shape to the peak of our bars. </div> <div id="peakCircles" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-8" class="panel"> <div class="panel-hdr"> <h2> Pie <span class="fw-300"><i>Chart</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Basic pie chart with label interpolation to show percentage instead of the actual data value </div> <div id="pieChart" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-9" class="panel"> <div class="panel-hdr"> <h2> Overlap <span class="fw-300"><i>Bar (Mobile)</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> This example makes use of label interpolation and the seriesBarDistance property that allows you to make bars overlap over each other. This then can be used to use the available space on mobile better. Resize your browser to see the effect of the responsive configuration. </div> <div id="overlapBarMobile" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-10" class="panel"> <div class="panel-hdr"> <h2> Extream <span class="fw-300"><i>Responsive</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Customized responsive configuration, you can create a chart that adopts to every media condition! </div> <div id="extreamResponsive" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-11" class="panel"> <div class="panel-hdr"> <h2> Gauge <span class="fw-300"><i>Chart</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> This pie chart uses donut, startAngle and total to draw a gauge chart. </div> <div id="gaugeChart" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> </div> <div class="col-xl-6"> <div id="panel-12" class="panel"> <div class="panel-hdr"> <h2> Line <span class="fw-300"><i>Interpolation</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> By default Chartist uses a cardinal spline algorithm to smooth the lines </div> <div id="lineInterpolation" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-13" class="panel"> <div class="panel-hdr"> <h2> Muti <span class="fw-300"><i>Labels</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Chartist will figure out if your browser supports foreignObject and it will use them to create labels that are based on regular HTML text elements. Multi-line and regular CSS styles are just two of many benefits while using foreignObjects! </div> <div id="multiLineLabels" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-14" class="panel"> <div class="panel-hdr"> <h2> Series <span class="fw-300"><i>Overrides</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> By naming your series using the series object notation with a name property, you can enable the individual configuration of series specific settings. <code>showLine</code>, <code>showPoint</code>, <code>showArea</code> and even the smoothing function can be overriden per series! And guess what? You can even override those series settings in the responsive configuration! </div> <div id="seriesOverrides" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-15" class="panel"> <div class="panel-hdr"> <h2> Stacked <span class="fw-300"><i>Bar</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> You can also set your bar chart to stack the series bars on top of each other easily by using the <code>stackBars</code> property in your configuration. </div> <div id="stackedBar" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-16" class="panel"> <div class="panel-hdr"> <h2> Path <span class="fw-300"><i>Animation</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Path animation is made easy with the SVG Path API. The API allows you to modify complex SVG paths and transform them for different animation morphing states. </div> <div id="pathAnimation" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-17" class="panel"> <div class="panel-hdr"> <h2> Label <span class="fw-300"><i>Placement</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> You can change the position of the labels on line and bar charts easily by using the <code>position</code> option inside of the axis configuration. </div> <div id="labelPlacement" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-18" class="panel"> <div class="panel-hdr"> <h2> Bar <span class="fw-300"><i>Chart</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> A simple barchart with default configuration </div> <div id="barChart" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-19" class="panel"> <div class="panel-hdr"> <h2> Pie <span class="fw-300"><i>Chart (labels)</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> This pie chart is configured with custom labels specified in the data object </div> <div id="pieChartLabels" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-20" class="panel"> <div class="panel-hdr"> <h2> Distributed <span class="fw-300"><i>Series</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Sometime it's desired to have bar charts that show one bar per series distributed along the x-axis. If this option is enabled, you need to make sure that you pass a single series array to Chartist that contains the series values. In this example you can see T-shirt sales of a store categorized by size. </div> <div id="distributedSeries" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-21" class="panel"> <div class="panel-hdr"> <h2> Donut <span class="fw-300"><i>Fill</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> This pie chart uses donut and donutSolid to draw a donut chart </div> <div id="donutFill" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> <div id="panel-22" class="panel"> <div class="panel-hdr"> <h2> Gauge <span class="fw-300"><i>Fill</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> This pie chart uses total, startAngle, donut and donutSolid to draw a gauge chart. </div> <div id="gaugeChartFill" class="ct-chart" style="width:100%; height:300px;"></div> </div> </div> </div> </div> </div> @section ScriptsBlock { <script src="~/js/statistics/chartist/chartist.js"></script> <script> /* line chart area */ var lineChartArea = function(){ new Chartist.Line('#lineChartArea', { labels: [1, 2, 3, 4, 5, 6, 7, 8], series: [ [5, 9, 7, 8, 5, 3, 5, 4,] ] }, { low: 0, showArea: true, fullWidth: true }); } /* line chart area -- end */ /* line scattered chart */ var lineScattered = function(){ var times = function (n) { return Array.apply(null, new Array(n)); }; var data = times(52).map(Math.random).reduce(function (data, rnd, index) { data.labels.push(index + 1); data.series.forEach(function (series) { series.push(Math.random() * 100) }); return data; }, { labels: [], series: times(4).map(function () { return new Array() }) }); var options = { showLine: false, axisX: { labelInterpolationFnc: function (value, index) { return index % 13 === 0 ? 'W' + value : null; } } }; var responsiveOptions = [ ['screen and (min-width: 640px)', { axisX: { labelInterpolationFnc: function (value, index) { return index % 4 === 0 ? 'W' + value : null; } } }] ]; new Chartist.Line('#lineScattered', data, options, responsiveOptions); } /* line scattered chart -- end */ /* using events */ var usingEvents = function(){ var chart = new Chartist.Line('#usingEvents', { labels: [1, 2, 3, 4, 5], series: [ [12, 9, 7, 8, 5] ] }); // Listening for draw events that get emitted by the Chartist chart chart.on('draw', function (data) { // If the draw event was triggered from drawing a point on the line chart if (data.type === 'point') { // We are creating a new path SVG element that draws a triangle around the point coordinates var triangle = new Chartist.Svg('path', { d: ['M', data.x, data.y - 15, 'L', data.x - 15, data.y + 8, 'L', data.x + 15, data.y + 8, 'z' ].join(' '), style: 'fill-opacity: 1' }, 'ct-area'); // With data.element we get the Chartist SVG wrapper and we can replace the original point drawn by Chartist with our newly created triangle data.element.replace(triangle); } }); } /* using events -- end */ /* bipolar */ var bipolar = function () { new Chartist.Line('#bipolar', { labels: [1, 2, 3, 4, 5, 6, 7, 8], series: [ [1, 2, 3, 1, -2, 0, 1, 0], [-2, -1, -2, -1, -2.5, -1, -2, -1], [0, 0, 0, 1, 2, 2.5, 2, 1], [2.5, 2, 1, 0.5, 1, 0.5, -1, -2.5] ] }, { high: 3, low: -3, showArea: true, showLine: false, showPoint: false, fullWidth: true, axisX: { showLabel: false, showGrid: false } }); } /* bipolar -- end */ /* smile animation */ var smileAnimation = function () { var chart = new Chartist.Line('#smileAnimation', { labels: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], series: [ [12, 9, 7, 8, 5, 4, 6, 2, 3, 3, 4, 6], [4, 5, 3, 7, 3, 5, 5, 3, 4, 4, 5, 5], [5, 3, 4, 5, 6, 3, 3, 4, 5, 6, 3, 4], [3, 4, 5, 6, 7, 6, 4, 5, 6, 7, 6, 3] ] }, { low: 0 }); // Let's put a sequence number aside so we can use it in the event callbacks var seq = 0, delays = 80, durations = 500; // Once the chart is fully created we reset the sequence chart.on('created', function () { seq = 0; }); // On each drawn element by Chartist we use the Chartist.Svg API to trigger SMIL animations chart.on('draw', function (data) { seq++; if (data.type === 'line') { // If the drawn element is a line we do a simple opacity fade in. This could also be achieved using CSS3 animations. data.element.animate({ opacity: { // The delay when we like to start the animation begin: seq * delays + 2000, // Duration of the animation dur: durations, // The value where the animation should start from: 0, // The value where it should end to: 1 } }); } else if (data.type === 'label' && data.axis === 'x') { data.element.animate({ y: { begin: seq * delays, dur: durations, from: data.y + 100, to: data.y, // We can specify an easing function from Chartist.Svg.Easing easing: 'easeOutQuart' } }); } else if (data.type === 'label' && data.axis === 'y') { data.element.animate({ x: { begin: seq * delays, dur: durations, from: data.x - 100, to: data.x, easing: 'easeOutQuart' } }); } else if (data.type === 'point') { data.element.animate({ x1: { begin: seq * delays, dur: durations, from: data.x - 10, to: data.x, easing: 'easeOutQuart' }, x2: { begin: seq * delays, dur: durations, from: data.x - 10, to: data.x, easing: 'easeOutQuart' }, opacity: { begin: seq * delays, dur: durations, from: 0, to: 1, easing: 'easeOutQuart' } }); } else if (data.type === 'grid') { // Using data.axis we get x or y which we can use to construct our animation definition objects var pos1Animation = { begin: seq * delays, dur: durations, from: data[data.axis.units.pos + '1'] - 30, to: data[data.axis.units.pos + '1'], easing: 'easeOutQuart' }; var pos2Animation = { begin: seq * delays, dur: durations, from: data[data.axis.units.pos + '2'] - 100, to: data[data.axis.units.pos + '2'], easing: 'easeOutQuart' }; var animations = {}; animations[data.axis.units.pos + '1'] = pos1Animation; animations[data.axis.units.pos + '2'] = pos2Animation; animations['opacity'] = { begin: seq * delays, dur: durations, from: 0, to: 1, easing: 'easeOutQuart' }; data.element.animate(animations); } }); // For the sake of the example we update the chart every time it's created with a delay of 10 seconds chart.on('created', function () { if (window.__exampleAnimateTimeout) { clearTimeout(window.__exampleAnimateTimeout); window.__exampleAnimateTimeout = null; } window.__exampleAnimateTimeout = setTimeout(chart.update.bind(chart), 12000); }); } /* smile animation -- end */ /* path animation */ var pathAnimation = function () { var chart = new Chartist.Line('#pathAnimation', { labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], series: [ [1, 5, 2, 5, 4, 3], [2, 3, 4, 8, 1, 2], [5, 4, 3, 2, 1, 0.5] ] }, { low: 0, showArea: true, showPoint: false, fullWidth: true }); chart.on('draw', function (data) { if (data.type === 'line' || data.type === 'area') { data.element.animate({ d: { begin: 2000 * data.index, dur: 2000, from: data.path.clone().scale(1, 0).translate(0, data.chartRect.height()).stringify(), to: data.path.clone().stringify(), easing: Chartist.Svg.Easing.easeOutQuint } }); } }); } /* path animation -- end */ /* line interpolation */ var lineInterpolation = function () { var chart = new Chartist.Line('#lineInterpolation', { labels: [1, 2, 3, 4, 5], series: [ [1, 5, 10, 0, 1], [10, 15, 0, 1, 2] ] }, { // Remove this configuration to see that chart rendered with cardinal spline interpolation // Sometimes, on large jumps in data values, it's better to use simple smoothing. lineSmooth: Chartist.Interpolation.simple({ divisor: 2 }), fullWidth: true, chartPadding: { right: 20 }, low: 0 }); } /* line interpolation -- end */ /* series overrides */ var seriesOverrides = function () { var chart = new Chartist.Line('#seriesOverrides', { labels: ['1', '2', '3', '4', '5', '6', '7', '8'], // Naming the series with the series object array notation series: [{ name: 'series-1', data: [5, 2, -4, 2, 0, -2, 5, -3] }, { name: 'series-2', data: [4, 3, 5, 3, 1, 3, 6, 4] }, { name: 'series-3', data: [2, 4, 3, 1, 4, 5, 3, 2] }] }, { fullWidth: true, // Within the series options you can use the series names // to specify configuration that will only be used for the // specific series. series: { 'series-1': { lineSmooth: Chartist.Interpolation.step() }, 'series-2': { lineSmooth: Chartist.Interpolation.simple(), showArea: true }, 'series-3': { showPoint: false } } }, [ // You can even use responsive configuration overrides to // customize your series configuration even further! ['screen and (max-width: 320px)', { series: { 'series-1': { lineSmooth: Chartist.Interpolation.none() }, 'series-2': { lineSmooth: Chartist.Interpolation.none(), showArea: false }, 'series-3': { lineSmooth: Chartist.Interpolation.none(), showPoint: true } } }] ]); } /* series overrides -- end */ /* bar chart */ var barChart = function () { var data = { labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'], series: [ [1, 2, 4, 8, 6, -2, -1, -4, -6, -2] ] }; var options = { high: 10, low: -10, axisX: { labelInterpolationFnc: function(value, index) { return index % 2 === 0 ? value : null; } } }; new Chartist.Bar('#barChart', data, options); } /* bar chart end */ /* overlap bar mobile */ var overlapBarMobile = function () { var data = { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], series: [ [5, 4, 3, 7, 5, 10, 3, 4, 8, 10, 6, 8], [3, 2, 9, 5, 4, 6, 4, 6, 7, 8, 7, 4] ] }; var options = { seriesBarDistance: 10 }; var responsiveOptions = [ ['screen and (max-width: 640px)', { seriesBarDistance: 5, axisX: { labelInterpolationFnc: function (value) { return value[0]; } } }] ]; new Chartist.Bar('#overlapBarMobile', data, options, responsiveOptions); } /* overlap bar mobile -- end */ /* peak circles */ var peakCircles = function () { // Create a simple bi-polar bar chart var chart = new Chartist.Bar('#peakCircles', { labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'], series: [ [1, 2, 4, 8, 6, -2, -1, -4, -6, -2] ] }, { high: 10, low: -10, axisX: { labelInterpolationFnc: function (value, index) { return index % 2 === 0 ? value : null; } } }); // Listen for draw events on the bar chart chart.on('draw', function (data) { // If this draw event is of type bar we can use the data to create additional content if (data.type === 'bar') { // We use the group element of the current series to append a simple circle with the bar peek coordinates and a circle radius that is depending on the value data.group.append(new Chartist.Svg('circle', { cx: data.x2, cy: data.y2, r: Math.abs(Chartist.getMultiValue(data.value)) * 2 + 5 }, 'ct-slice-pie')); } }); } /* peak circles -- end */ /* multi line labels */ var multiLineLabels = function () { new Chartist.Bar('#multiLineLabels', { labels: ['First quarter of the year', 'Second quarter of the year', 'Third quarter of the year', 'Fourth quarter of the year'], series: [ [60000, 40000, 80000, 70000], [40000, 30000, 70000, 65000], [8000, 3000, 10000, 6000] ] }, { seriesBarDistance: 10, axisX: { offset: 60 }, axisY: { offset: 80, labelInterpolationFnc: function (value) { return value + ' CHF' }, scaleMinSpace: 15 } }); } /* multi line labels -- end */ /* stacked bar */ var stackedBar = function () { new Chartist.Bar('#stackedBar', { labels: ['Q1', 'Q2', 'Q3', 'Q4'], series: [ [800000, 1200000, 1400000, 1300000], [200000, 400000, 500000, 300000], [100000, 200000, 400000, 600000] ] }, { stackBars: true, axisY: { labelInterpolationFnc: function (value) { return (value / 1000) + 'k'; } } }).on('draw', function (data) { if (data.type === 'bar') { data.element.attr({ style: 'stroke-width: 30px' }); } }); } /* stacked bar -- end */ /* horizontal bar */ var horizontalBar = function () { new Chartist.Bar('#horizontalBar', { labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'], series: [ [5, 4, 3, 7, 5, 10, 3], [3, 2, 9, 5, 4, 6, 4] ] }, { seriesBarDistance: 10, reverseData: true, horizontalBars: true, axisY: { offset: 70 } }); } /* horizontal bar -- end */ /* extream responsive */ var extreamResponsive = function () { new Chartist.Bar('#extreamResponsive', { labels: ['Quarter 1', 'Quarter 2', 'Quarter 3', 'Quarter 4'], series: [ [5, 4, 3, 7], [3, 2, 9, 5], [1, 5, 8, 4], [2, 3, 4, 6], [4, 1, 2, 1] ] }, { // Default mobile configuration stackBars: true, axisX: { labelInterpolationFnc: function (value) { return value.split(/\s+/).map(function (word) { return word[0]; }).join(''); } }, axisY: { offset: 20 } }, [ // Options override for media > 400px ['screen and (min-width: 400px)', { reverseData: true, horizontalBars: true, axisX: { labelInterpolationFnc: Chartist.noop }, axisY: { offset: 60 } }], // Options override for media > 800px ['screen and (min-width: 800px)', { stackBars: false, seriesBarDistance: 10 }], // Options override for media > 1000px ['screen and (min-width: 1000px)', { reverseData: false, horizontalBars: false, seriesBarDistance: 15 }] ]); } /* extream responsive -- end */ /* distributed series */ var distributedSeries = function () { new Chartist.Bar('#distributedSeries', { labels: ['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'], series: [20, 60, 120, 200, 180, 20, 10] }, { distributeSeries: true }); } /* distributed series -- end */ /* label palcement */ var labelPlacement = function () { new Chartist.Bar('#labelPlacement', { labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], series: [ [5, 4, 3, 7, 5, 10, 3], [3, 2, 9, 5, 4, 6, 4] ] }, { axisX: { // On the x-axis start means top and end means bottom position: 'start' }, axisY: { // On the y-axis start means left and end means right position: 'end' } }); } /* label palcement -- end */ /* pie chart */ var pieChart = function () { var data = { series: [5, 3, 4] }; var sum = function (a, b) { return a + b }; new Chartist.Pie('#pieChart', data, { labelInterpolationFnc: function (value) { return Math.round(value / data.series.reduce(sum) * 100) + '%'; } }); } /* pie chart -- end */ /* pie chart labels */ var pieChartLabels = function () { var data = { labels: ['Bananas', 'Apples', 'Grapes'], series: [20, 15, 40] }; var options = { labelInterpolationFnc: function (value) { return value[0] } }; var responsiveOptions = [ ['screen and (min-width: 640px)', { chartPadding: 30, labelOffset: 100, labelDirection: 'explode', labelInterpolationFnc: function (value) { return value; } }], ['screen and (min-width: 1024px)', { labelOffset: 80, chartPadding: 20 }] ]; new Chartist.Pie('#pieChartLabels', data, options, responsiveOptions); } /* pie chart labels -- end */ /* guage chart */ var gaugeChart = function () { new Chartist.Pie('#gaugeChart', { series: [20, 10, 30, 40] }, { donut: true, donutWidth: 60, startAngle: 270, total: 200, showLabel: false }); } /* guage chart -- end */ /* donut fill */ var donutFill = function () { new Chartist.Pie('#donutFill', { series: [20, 10, 30, 40] }, { donut: true, donutWidth: 60, donutSolid: true, startAngle: 270, showLabel: true }); } /* donut fill -- end */ /* guage chart fill */ var gaugeChartFill = function () { new Chartist.Pie('#gaugeChartFill', { series: [20, 10, 30, 40] }, { donut: true, donutWidth: 60, donutSolid: true, startAngle: 270, total: 200, showLabel: true }); } /* guage chart fill -- end */ /* initilize all charts on DOM ready */ $(document).ready(function() { lineChartArea(); lineScattered(); usingEvents(); bipolar(); smileAnimation(); pathAnimation(); lineInterpolation(); seriesOverrides(); barChart(); overlapBarMobile(); peakCircles(); multiLineLabels(); stackedBar(); horizontalBar(); extreamResponsive(); distributedSeries(); labelPlacement(); pieChart(); pieChartLabels(); gaugeChart(); donutFill(); gaugeChartFill(); }); </script> }
the_stack
#addin nuget:?package=Cake.FileHelpers&version=3.2.1 #addin nuget:?package=NuGet.Packaging&version=4.7.0&loaddependencies=true #addin nuget:?package=NuGet.Protocol&version=4.7.0&loaddependencies=true using System.Linq; using System.Xml; using System.Xml.Linq; using NuGet.Common; using NuGet.Frameworks; using NuGet.Packaging; using NuGet.Packaging.Core; using NuGet.Protocol; using NuGet.Protocol.Core.Types; using NuGet.Versioning; var target = Argument("target", "Default"); var localSource = Argument("localSource", ""); var keepLatestVersion = Argument("keepLatestVersion", false); var incrementVersion = Argument("incrementVersion", true); var packLatestOnly = Argument("packLatestOnly", false); var useExplicitVersion = Argument("useExplicitVersion", true); var prereleaseLabel = Argument("prereleaseLabel", (string)null); var packagesPath = (DirectoryPath)Argument("packagesPath", "externals/packages"); var workingPath = (DirectoryPath)Argument("workingPath", "working/packages"); var outputPath = (DirectoryPath)Argument("outputPath", "output/packages"); if (!string.IsNullOrEmpty(localSource)) { localSource = MakeAbsolute((DirectoryPath)localSource).FullPath; } var apiLevelVersion = new Dictionary<int, NuGetFramework> { // { 1, NuGetFramework.Parse("monoandroid1.0") }, // { 15, NuGetFramework.Parse("monoandroid4.0.3") }, // { 19, NuGetFramework.Parse("monoandroid4.4") }, // { 21, NuGetFramework.Parse("monoandroid5.0") }, // { 22, NuGetFramework.Parse("monoandroid5.1") }, { 23, NuGetFramework.Parse("monoandroid6.0") }, { 24, NuGetFramework.Parse("monoandroid7.0") }, { 25, NuGetFramework.Parse("monoandroid7.1") }, { 26, NuGetFramework.Parse("monoandroid8.0") }, { 27, NuGetFramework.Parse("monoandroid8.1") }, { 28, NuGetFramework.Parse("monoandroid9.0") }, }; var minimumVersion = new Dictionary<string, NuGetVersion> { { "xamarin.android.arch", new NuGetVersion(1, 0, 0) }, { "xamarin.android.support", new NuGetVersion(23, 4, 0) }, }; var blacklistIdPrefix = new List<string> { "xamarin.build.download", "xamarin.android.support.constraint.layout", "xamarin.google.guava", }; var seedPackages = new [] { "Xamarin.Android.Arch.Core.Common", "Xamarin.Android.Arch.Core.Runtime", "Xamarin.Android.Arch.Lifecycle.Common", "Xamarin.Android.Arch.Lifecycle.Extensions", "Xamarin.Android.Arch.Lifecycle.LiveData", "Xamarin.Android.Arch.Lifecycle.LiveData.Core", "Xamarin.Android.Arch.Lifecycle.Runtime", "Xamarin.Android.Arch.Lifecycle.ViewModel", "Xamarin.Android.Arch.Persistence.Db", "Xamarin.Android.Arch.Persistence.Db.Framework", "Xamarin.Android.Arch.Persistence.Room.Common", "Xamarin.Android.Arch.Persistence.Room.Runtime", "Xamarin.Android.Arch.Work.Runtime", "Xamarin.Android.Support.Animated.Vector.Drawable", "Xamarin.Android.Support.Annotations", "Xamarin.Android.Support.AsyncLayoutInflater", "Xamarin.Android.Support.Collections", "Xamarin.Android.Support.Compat", "Xamarin.Android.Support.CoordinatorLayout", "Xamarin.Android.Support.Core.UI", "Xamarin.Android.Support.Core.Utils", "Xamarin.Android.Support.CursorAdapter", "Xamarin.Android.Support.CustomTabs", "Xamarin.Android.Support.CustomView", "Xamarin.Android.Support.Design", "Xamarin.Android.Support.DocumentFile", "Xamarin.Android.Support.DrawerLayout", "Xamarin.Android.Support.Dynamic.Animation", "Xamarin.Android.Support.Emoji", "Xamarin.Android.Support.Emoji.AppCompat", "Xamarin.Android.Support.Emoji.Bundled", "Xamarin.Android.Support.Exif", "Xamarin.Android.Support.Fragment", "Xamarin.Android.Support.HeifWriter", "Xamarin.Android.Support.Interpolator", "Xamarin.Android.Support.Loader", "Xamarin.Android.Support.LocalBroadcastManager", "Xamarin.Android.Support.Media.Compat", "Xamarin.Android.Support.Percent", "Xamarin.Android.Support.Print", "Xamarin.Android.Support.Recommendation", "Xamarin.Android.Support.RecyclerView.Selection", "Xamarin.Android.Support.Slices.Builders", "Xamarin.Android.Support.Slices.Core", "Xamarin.Android.Support.Slices.View", "Xamarin.Android.Support.SlidingPaneLayout", "Xamarin.Android.Support.SwipeRefreshLayout", "Xamarin.Android.Support.Transition", "Xamarin.Android.Support.TV.Provider", "Xamarin.Android.Support.v13", "Xamarin.Android.Support.v14.Preference", "Xamarin.Android.Support.v17.Leanback", "Xamarin.Android.Support.v17.Preference.Leanback", "Xamarin.Android.Support.v4", "Xamarin.Android.Support.v7.AppCompat", "Xamarin.Android.Support.v7.CardView", "Xamarin.Android.Support.v7.GridLayout", "Xamarin.Android.Support.v7.MediaRouter", "Xamarin.Android.Support.v7.Palette", "Xamarin.Android.Support.v7.Preference", "Xamarin.Android.Support.v7.RecyclerView", "Xamarin.Android.Support.Vector.Drawable", "Xamarin.Android.Support.VersionedParcelable", "Xamarin.Android.Support.ViewPager", "Xamarin.Android.Support.Wear", "Xamarin.Android.Support.WebKit" }; bool IsBlacklisted(string id) { id = id.ToLower(); if (blacklistIdPrefix.Contains(id)) return true; if (blacklistIdPrefix.Any(p => id.StartsWith(p))) return true; return false; } NuGetVersion GetSupportVersion(FilePath nuspec) { var range = GetSupportVersionRange(nuspec); return range.MinVersion ?? range.MaxVersion; } VersionRange GetSupportVersionRange(FilePath nuspec) { var xdoc = XDocument.Load(nuspec.FullPath); var ns = xdoc.Root.Name.Namespace; var xmd = xdoc.Root.Element(ns + "metadata"); var xid = xmd.Element(ns + "id"); string version; if (xid.Value.ToLower().StartsWith("xamarin.android.arch")) { // search this nuget for a support version version = xmd .Descendants(ns + "dependency") .LastOrDefault(e => e.Attribute("id").Value.ToLower().StartsWith("xamarin.android.support")) ?.Attribute("version") ?.Value; // if none was found, look in the dependencies if (string.IsNullOrEmpty(version)) { foreach (var xdep in xmd.Descendants(ns + "dependency").Reverse()) { var id = xdep.Attribute("id").Value.ToLower(); var range = VersionRange.Parse(xdep.Attribute("version").Value); var depNuspec = $"{packagesPath}/{id}/{range.MinVersion ?? range.MaxVersion}/{id}.nuspec"; if (!FileExists(depNuspec)) continue; // if a support version was found, use it, otherwise continue looking var suppRange = GetSupportVersionRange(depNuspec); if (suppRange != null) return suppRange; } } } else { version = xmd.Element(ns + "version").Value; } return VersionRange.Parse(version); } NuGetVersion GetArchVersion(FilePath nuspec) { var range = GetArchVersionRange(nuspec); return range.MinVersion ?? range.MaxVersion; } VersionRange GetArchVersionRange(FilePath nuspec) { var xdoc = XDocument.Load(nuspec.FullPath); var ns = xdoc.Root.Name.Namespace; var xmd = xdoc.Root.Element(ns + "metadata"); var xid = xmd.Element(ns + "id"); string version; if (xid.Value.ToLower().StartsWith("xamarin.android.support")) { version = xmd .Descendants(ns + "dependency") .Last(e => e.Attribute("id").Value.ToLower().StartsWith("xamarin.android.arch")) .Attribute("version") .Value; } else { version = xmd.Element(ns + "version").Value; } return VersionRange.Parse(version); } NuGetVersion GetNewVersion(string id, string old) { return GetNewVersion(id, NuGetVersion.Parse(old)); } NuGetVersion GetNewVersion(string id, NuGetVersion old) { if (keepLatestVersion) { var latest = GetLatestVersion(id); if (old == latest) return old; } return new NuGetVersion( old.Major, old.Minor, old.Patch, incrementVersion ? 990 + old.Revision : old.Revision, prereleaseLabel ?? old.Release, (string)null); } NuGetVersion GetNewVersion(string id, VersionRange old) { return GetNewVersion(id, old.MinVersion ?? old.MaxVersion); } NuGetVersion GetLatestVersion(string id) { return GetDirectories($"{packagesPath}/{id}/*") .Select(d => NuGetVersion.Parse(d.GetDirectoryName())) .OrderByDescending(v => v) .FirstOrDefault(); } Task("DownloadNuGets") .Does(async () => { var nugetSources = new List<SourceRepository> { Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json") }; if (!string.IsNullOrEmpty(localSource)) { nugetSources.Add(Repository.Factory.GetCoreV3(localSource)); } var nugetCache = new SourceCacheContext(); var nugetLogger = NullLogger.Instance; var processedIds = new List<string>(); // download the bits from nuget.org and any local packages await DownloadNuGetsAsync(seedPackages); async Task DownloadNuGetsAsync(IEnumerable<string> ids) { EnsureDirectoryExists(packagesPath); foreach (var id in ids.Select(i => i.ToLower())) { // skip ids that have already been downloaded if (processedIds.Contains(id)) continue; // skip packages that we don't want if (IsBlacklisted(id)) continue; // mark this id as processed processedIds.Add(id); // get the versions for each nuget Information($"Making sure that all the versions of '{id}' are available for processing..."); foreach (var nugetSource in nugetSources) { var mdRes = await nugetSource.GetResourceAsync<MetadataResource>(); var includePrerelease = nugetSource.PackageSource.Source == localSource; var allVersions = await mdRes.GetVersions(id, includePrerelease, false, nugetCache, nugetLogger, default); // process the versions foreach (var version in allVersions) { // skip versions tht are lower than what we want to support var min = minimumVersion[minimumVersion.Keys.First(k => id.StartsWith(k))]; if (version < min) continue; var identity = new PackageIdentity(id, version); var dest = packagesPath.Combine(id).Combine(version.ToNormalizedString()); var destFile = dest.CombineWithFilePath($"{id}.{version.ToNormalizedString()}.nupkg"); // download the packages, if needed if (!FileExists(destFile)) { Information($" - Downloading '{identity}'..."); EnsureDirectoryExists(dest); var byIdRes = await nugetSource.GetResourceAsync<FindPackageByIdResource>(); using (var downloader = await byIdRes.GetPackageDownloaderAsync(identity, nugetCache, nugetLogger, default)) { await downloader.CopyNupkgFileToAsync(destFile.FullPath, default); } Unzip(destFile, dest); } // download dependencies var packageRes = await nugetSource.GetResourceAsync<PackageMetadataResource>(); var metadata = await packageRes.GetMetadataAsync(identity, nugetCache, nugetLogger, default); var deps = metadata.DependencySets.SelectMany(g => g.Packages).Select(p => p.Id); await DownloadNuGetsAsync(deps); } } } } }); Task("PrepareWorkingDirectory") .IsDependentOn("DownloadNuGets") .Does(() => { EnsureDirectoryExists(workingPath); CleanDirectories(workingPath.FullPath); // copy the downloaded files into the working directory Information($"Copying packages..."); foreach (var idDir in GetDirectories($"{packagesPath}/*")) { var id = idDir.GetDirectoryName(); // skip packages that don't want if (IsBlacklisted(id)) continue; Information($" - Copying all versions of '{id}'..."); // we only want to copy the latest of each major version var versions = GetFiles($"{idDir}/*/*.nuspec") .Select(n => new { Dir = n.GetDirectory().GetDirectoryName(), Ver = GetSupportVersion(n) }) .OrderByDescending(n => n.Ver) .GroupBy(n => n.Ver.Major, n => n.Dir) .Select(g => g.FirstOrDefault()); foreach (var version in versions) { CopyDirectory($"{packagesPath}/{id}/{version}", $"{workingPath}/{id}/{GetNewVersion(id, version)}"); } } // remove all the files we do not want in the nugets Information($"Removing junk..."); var junkFiles = GetFiles($"{workingPath}/*/*.json") + GetFiles($"{workingPath}/*/*/*.nupkg") + GetFiles($"{workingPath}/*/*/.signature.p7s") + GetFiles($"{workingPath}/*/*/*Content_Types*.xml"); foreach (var junk in junkFiles) { DeleteFile(junk); } var junkDirs = GetDirectories($"{workingPath}/*/*/_rels") + GetDirectories($"{workingPath}/*/*/package"); foreach (var junk in junkDirs) { DeleteDirectory(junk, new DeleteDirectorySettings { Force = true, Recursive = true }); } // put all the nuspecs and contents into a standard format for processing Information($"Normalizing packages..."); foreach (var idDir in GetDirectories($"{workingPath}/*")) { var id = idDir.GetDirectoryName(); // skip packages that don't want if (IsBlacklisted(id)) continue; Information($" - Normalizing all versions of '{id}'..."); var nuspecs = GetFiles($"{idDir}/*/*.nuspec"); foreach (var nuspec in nuspecs) { var targetFw = NormalizeNuspec(nuspec); NormalizeContents(nuspec.GetDirectory(), targetFw, "lib"); NormalizeContents(nuspec.GetDirectory(), targetFw, "build"); NormalizeContents(nuspec.GetDirectory(), targetFw, "proguard"); NormalizeContents(nuspec.GetDirectory(), targetFw, "aar"); // change the path to the proguard.txt files, nothing clever, just a replace var oldLink = @"..\..\proguard\"; var newLink = $@"..\..\proguard\{targetFw.GetShortFolderName()}\"; var targets = $"{nuspec.GetDirectory()}/build/{targetFw.GetShortFolderName()}/*.targets"; ReplaceTextInFiles(targets, oldLink, newLink); // same with the aar oldLink = @"..\..\aar\"; newLink = $@"..\..\aar\{targetFw.GetShortFolderName()}\"; targets = $"{nuspec.GetDirectory()}/build/{targetFw.GetShortFolderName()}/*.targets"; ReplaceTextInFiles(targets, oldLink, newLink); } } void NormalizeContents(DirectoryPath dir, NuGetFramework fw, string subdir) { if (!DirectoryExists($"{dir}/{subdir}")) return; // temp checks if (GetDirectories($"{dir}/{subdir}/*/*").Any()) throw new Exception($"'{dir}' contains sub directories."); // make sure the files are in the right folder: // - 0 means that this is a thin package // probably not the core build/lib folders (probably proguard) // - 1 means that this is a thin package // - 2+ more means this is already a fat package if (GetDirectories($"{dir}/{subdir}/*").Count() <= 1) { EnsureDirectoryExists(dir.Combine("temp")); MoveFiles($"{dir}/{subdir}/**/*", dir.Combine("temp")); CleanDirectories($"{dir}/{subdir}"); MoveDirectory(dir.Combine("temp"), dir.Combine(subdir).Combine(fw.GetShortFolderName())); } } NuGetFramework NormalizeNuspec(FilePath nuspec) { var supportVersion = GetSupportVersion(nuspec); var targetFw = apiLevelVersion[supportVersion.Major]; var xdoc = XDocument.Load(nuspec.FullPath); var ns = xdoc.Root.Name.Namespace; var xmd = xdoc.Root.Element(ns + "metadata"); // set the new version of the package var xv = xmd.Element(ns + "version"); var version = NuGetVersion.Parse(xv.Value); xv.Value = GetNewVersion(xmd.Element(ns + "id").Value, version).ToNormalizedString(); // make sure the <dependencies> element exists var xdeps = xmd.Element(ns + "dependencies"); if (xdeps == null) { xdeps = new XElement(ns + "dependencies"); xmd.Add(xdeps); } // move the loose dependencies into a group var xlooseDeps = xdeps.Elements(ns + "dependency"); if (xlooseDeps.Any()) { xdeps.Add(new XElement(ns + "group", new XAttribute("targetFramework", targetFw.GetShortFolderName()), xlooseDeps)); } // some packages have the wrong <group> targets, so recreate everything var xnewGroups = new Dictionary<int, XElement>(); foreach (var pair in apiLevelVersion) { if (pair.Key > supportVersion.Major) continue; xnewGroups.Add(pair.Key, new XElement(ns + "group", new XAttribute("targetFramework", pair.Value.GetShortFolderName()))); } // move the old dependencies into the new groups if they contain a support version // if not, then just use the version of the nuspec // only select the last group as the rest will be re-created var xoldGroup = xdeps.Elements(ns + "group").LastOrDefault(); if (xoldGroup != null) { var xgroupDeps = xoldGroup.Elements(ns + "dependency"); var firstSupportVersion = xgroupDeps .Where(x => x.Attribute("id").Value.ToLower().StartsWith("xamarin.android.support")) .Select(x => VersionRange.Parse(x.Attribute("version").Value)) .FirstOrDefault(); var minVersion = firstSupportVersion?.MinVersion ?? supportVersion; xnewGroups[minVersion.Major].Add(xgroupDeps); } // set the new versions of the dependencies foreach (var xdep in xnewGroups.Values.Elements(ns + "dependency")) { if (IsBlacklisted(xdep.Attribute("id").Value)) continue; var xdv = xdep.Attribute("version"); var range = VersionRange.Parse(xdv.Value); xdv.Value = GetNewVersion(xdep.Attribute("id").Value.ToLower(), range).ToNormalizedString(); if (useExplicitVersion) { xdv.Value = $"[{xdv.Value}]"; } } // swap out the old dependencies for the new ones xdeps.RemoveAll(); xdeps.Add(xnewGroups.Values); xdoc.Save(nuspec.FullPath); return targetFw; } }); Task("CreateFatNuGets") .IsDependentOn("PrepareWorkingDirectory") .Does(async () => { var idDirs = GetDirectories($"{workingPath}/*"); foreach (var idDir in idDirs) { var id = idDir.GetDirectoryName(); // skip packages that don't want if (IsBlacklisted(id)) continue; Information($"Processing all versions of '{id}'..."); var versions = GetDirectories($"{idDir}/*") .Select(d => d.GetDirectoryName()) .Select(v => NuGetVersion.Parse(v)) .OrderByDescending(v => v) .ToList(); // merge the older packages into the latest foreach (var cutoffVersion in versions) { Information($" - Processing version '{cutoffVersion}' of '{id}'..."); var includedVersions = versions.Where(v => v < cutoffVersion).ToArray(); MergeNuspecs(id, cutoffVersion, includedVersions); MergeContents(id, cutoffVersion, includedVersions, "lib"); MergeContents(id, cutoffVersion, includedVersions, "build"); MergeContents(id, cutoffVersion, includedVersions, "proguard"); CreateDummyLibs(id, cutoffVersion); } } void CreateDummyLibs(string id, NuGetVersion version) { var root = $"{workingPath}/{id}/{version.ToNormalizedString()}/lib"; foreach (var pair in apiLevelVersion) { var dir = $"{root}/{pair.Value.GetShortFolderName()}"; if (!DirectoryExists(dir)) { EnsureDirectoryExists(dir); FileWriteText($"{dir}/_._", ""); } else { // jump out as soon as we find a folder because we don't // want to add newer dummy folders break; } } } void MergeContents(string id, NuGetVersion version, NuGetVersion[] includedVersions, string subdir) { var dest = $"{workingPath}/{id}/{version.ToNormalizedString()}/{subdir}"; foreach (var included in includedVersions) { var src = $"{workingPath}/{id}/{included.ToNormalizedString()}/{subdir}"; if (DirectoryExists(src)) { CopyDirectory(src, dest); } } } void MergeNuspecs(string id, NuGetVersion version, NuGetVersion[] includedVersions) { var nuspec = $"{workingPath}/{id}/{version.ToNormalizedString()}/{id}.nuspec"; var xdoc = XDocument.Load(nuspec); var ns = xdoc.Root.Name.Namespace; var xmd = xdoc.Root.Element(ns + "metadata"); var xversion = xmd.Element(ns + "version"); var xdeps = xmd.Element(ns + "dependencies"); var xgroups = xdeps.Elements(ns + "group"); var isArch = id.ToLower().StartsWith("xamarin.android.arch"); foreach (var included in includedVersions) { var includedNuspec = $"{workingPath}/{id}/{included.ToNormalizedString()}/{id}.nuspec"; var xincluded = XDocument.Load(includedNuspec); var ins = xincluded.Root.Name.Namespace; var ixmd = xincluded.Root.Element(ins + "metadata"); var ixdeps = ixmd.Element(ins + "dependencies"); var ixgroups = ixdeps.Elements(ins + "group"); foreach (var ixgroup in ixgroups) { var xgroup = xgroups.FirstOrDefault(g => g.Attribute("targetFramework").Value == ixgroup.Attribute("targetFramework").Value); foreach (var ixdep in ixgroup.Elements(ins + "dependency")) { var includedArch = ixdep.Attribute("id").Value.ToLower().StartsWith("xamarin.android.arch"); string newVersion = null; if (isArch == includedArch) { // if both are arch, or both are support, use the current version newVersion = xversion.Value; } else if (isArch) { // if the main is arch, but this is support newVersion = GetSupportVersion(nuspec).ToNormalizedString(); } else { // if the main is support and this is arch newVersion = GetArchVersion(nuspec).ToNormalizedString(); } ixdep.SetAttributeValue("version", useExplicitVersion ? $"[{newVersion}]" : newVersion); } xgroup.Add(ixgroup.Elements()); } } xdoc.Save(nuspec); } }); Task("PackNuGets") .IsDependentOn("CreateFatNuGets") .Does(async () => { EnsureDirectoryExists(outputPath); CleanDirectories(outputPath.FullPath); var idDirs = GetDirectories($"{workingPath}/*"); foreach (var idDir in idDirs) { var id = idDir.GetDirectoryName(); // skip packages that don't want if (IsBlacklisted(id)) continue; var versions = GetDirectories($"{workingPath}/{id}/*") .Select(d => new { Dir = d, Ver = NuGetVersion.Parse(d.GetDirectoryName()) }) .OrderByDescending(v => v.Ver); foreach (var version in versions) { var nuspec = GetFiles($"{version.Dir}/*.nuspec").FirstOrDefault(); Information($"Packing {nuspec}..."); NuGetPack(nuspec, new NuGetPackSettings { BasePath = nuspec.GetDirectory(), OutputDirectory = outputPath, RequireLicenseAcceptance = true, // TODO: work around a bug: https://github.com/cake-build/cake/issues/2061 }); if (packLatestOnly) break; } } }); Task("Default") .IsDependentOn("DownloadNuGets") .IsDependentOn("PrepareWorkingDirectory") .IsDependentOn("CreateFatNuGets") .IsDependentOn("PackNuGets"); RunTarget(target);
the_stack
#tool "nuget:?package=GitVersion.CommandLine" #tool "nuget:?package=GitReleaseNotes" #addin "nuget:?package=Cake.Json" #addin nuget:?package=Newtonsoft.Json&version=9.0.1 // compile var compileConfig = Argument("configuration", "Release"); var slnFile = "./Rafty.sln"; // build artifacts var artifactsDir = Directory("artifacts"); // unit testing var artifactsForUnitTestsDir = artifactsDir + Directory("UnitTests"); var unitTestAssemblies = @"./test/Rafty.UnitTests/Rafty.UnitTests.csproj"; // acceptance testing var artifactsForAcceptanceTestsDir = artifactsDir + Directory("AcceptanceTests"); var acceptanceTestAssemblies = @"./test/Rafty.AcceptanceTests/Rafty.AcceptanceTests.csproj"; // integration testing var artifactsForIntegrationTestsDir = artifactsDir + Directory("IntegrationTests"); var integrationTestAssemblies = @"./test/Rafty.IntegrationTests/Rafty.IntegrationTests.csproj"; // benchmark testing var artifactsForBenchmarkTestsDir = artifactsDir + Directory("BenchmarkTests"); var benchmarkTestAssemblies = @"./test/Rafty.Benchmarks"; // packaging var packagesDir = artifactsDir + Directory("Packages"); var releaseNotesFile = packagesDir + File("releasenotes.md"); var artifactsFile = packagesDir + File("artifacts.txt"); // unstable releases var nugetFeedUnstableKey = EnvironmentVariable("nuget-apikey-unstable"); var nugetFeedUnstableUploadUrl = "https://www.nuget.org/api/v2/package"; var nugetFeedUnstableSymbolsUploadUrl = "https://www.nuget.org/api/v2/package"; // stable releases var tagsUrl = "https://api.github.com/repos/tompallister/rafty/releases/tags/"; var nugetFeedStableKey = EnvironmentVariable("nuget-apikey-stable"); var nugetFeedStableUploadUrl = "https://www.nuget.org/api/v2/package"; var nugetFeedStableSymbolsUploadUrl = "https://www.nuget.org/api/v2/package"; // internal build variables - don't change these. var releaseTag = ""; string committedVersion = "0.0.0-dev"; var buildVersion = committedVersion; GitVersion versioning = null; var nugetFeedUnstableBranchFilter = "^(develop)$|^(PullRequest/)"; var target = Argument("target", "Default"); Information("target is " +target); Information("Build configuration is " + compileConfig); Task("Default") .IsDependentOn("Build"); Task("Build") .IsDependentOn("RunTests") .IsDependentOn("CreatePackages"); Task("BuildAndReleaseUnstable") .IsDependentOn("Build") .IsDependentOn("ReleasePackagesToUnstableFeed"); Task("Clean") .Does(() => { if (DirectoryExists(artifactsDir)) { DeleteDirectory(artifactsDir, recursive:true); } CreateDirectory(artifactsDir); }); Task("Version") .Does(() => { versioning = GetNuGetVersionForCommit(); var nugetVersion = versioning.NuGetVersion; Information("SemVer version number: " + nugetVersion); if (AppVeyor.IsRunningOnAppVeyor) { Information("Persisting version number..."); PersistVersion(nugetVersion); buildVersion = nugetVersion; } else { Information("We are not running on build server, so we won't persist the version number."); } }); Task("Restore") .IsDependentOn("Clean") .IsDependentOn("Version") .Does(() => { DotNetCoreRestore(slnFile); }); Task("Compile") .IsDependentOn("Restore") .Does(() => { var settings = new DotNetCoreBuildSettings { Configuration = compileConfig, }; DotNetCoreBuild(slnFile, settings); }); Task("RunUnitTests") .IsDependentOn("Compile") .Does(() => { var settings = new DotNetCoreTestSettings { Configuration = compileConfig, }; EnsureDirectoryExists(artifactsForUnitTestsDir); DotNetCoreTest(unitTestAssemblies, settings); }); Task("RunAcceptanceTests") .IsDependentOn("Compile") .Does(() => { var settings = new DotNetCoreTestSettings { Configuration = compileConfig, }; EnsureDirectoryExists(artifactsForAcceptanceTestsDir); DotNetCoreTest(acceptanceTestAssemblies, settings); }); Task("RunIntegrationTests") .IsDependentOn("Compile") .Does(() => { var settings = new DotNetCoreTestSettings { Configuration = compileConfig, }; EnsureDirectoryExists(artifactsForIntegrationTestsDir); DotNetCoreTest(integrationTestAssemblies, settings); }); Task("RunTests") .IsDependentOn("RunUnitTests") .IsDependentOn("RunAcceptanceTests") .IsDependentOn("RunIntegrationTests"); Task("CreatePackages") .IsDependentOn("Compile") .Does(() => { EnsureDirectoryExists(packagesDir); CopyFiles("./src/**/Rafty.*.nupkg", packagesDir); //GenerateReleaseNotes(); System.IO.File.WriteAllLines(artifactsFile, new[]{ "nuget:Rafty." + buildVersion + ".nupkg", //"releaseNotes:releasenotes.md" }); if (AppVeyor.IsRunningOnAppVeyor) { var path = packagesDir.ToString() + @"/**/*"; foreach (var file in GetFiles(path)) { AppVeyor.UploadArtifact(file.FullPath); } } }); Task("ReleasePackagesToUnstableFeed") .IsDependentOn("CreatePackages") .Does(() => { if (ShouldPublishToUnstableFeed()) { PublishPackages(nugetFeedUnstableKey, nugetFeedUnstableUploadUrl, nugetFeedUnstableSymbolsUploadUrl); } }); Task("EnsureStableReleaseRequirements") .Does(() => { if (!AppVeyor.IsRunningOnAppVeyor) { throw new Exception("Stable release should happen via appveyor"); } var isTag = AppVeyor.Environment.Repository.Tag.IsTag && !string.IsNullOrWhiteSpace(AppVeyor.Environment.Repository.Tag.Name); if (!isTag) { throw new Exception("Stable release should happen from a published GitHub release"); } }); Task("UpdateVersionInfo") .IsDependentOn("EnsureStableReleaseRequirements") .Does(() => { releaseTag = AppVeyor.Environment.Repository.Tag.Name; AppVeyor.UpdateBuildVersion(releaseTag); }); Task("DownloadGitHubReleaseArtifacts") .IsDependentOn("UpdateVersionInfo") .Does(() => { try { Information("DownloadGitHubReleaseArtifacts"); EnsureDirectoryExists(packagesDir); Information("Directory exists..."); var releaseUrl = tagsUrl + releaseTag; Information("Release url " + releaseUrl); //var releaseJson = Newtonsoft.Json.Linq.JObject.Parse(GetResource(releaseUrl)); var assets_url = Newtonsoft.Json.Linq.JObject.Parse(GetResource(releaseUrl)) .GetValue("assets_url") .Value<string>(); Information("Assets url " + assets_url); var assets = GetResource(assets_url); Information("Assets " + assets_url); foreach(var asset in Newtonsoft.Json.JsonConvert.DeserializeObject<JArray>(assets)) { Information("In the loop.."); var file = packagesDir + File(asset.Value<string>("name")); Information("Downloading " + file); DownloadFile(asset.Value<string>("browser_download_url"), file); } Information("Out of the loop..."); } catch(Exception exception) { Information("There was an exception " + exception); throw; } }); Task("ReleasePackagesToStableFeed") .IsDependentOn("DownloadGitHubReleaseArtifacts") .Does(() => { PublishPackages(nugetFeedStableKey, nugetFeedStableUploadUrl, nugetFeedStableSymbolsUploadUrl); }); Task("Release") .IsDependentOn("ReleasePackagesToStableFeed"); RunTarget(target); /// Gets nuique nuget version for this commit private GitVersion GetNuGetVersionForCommit() { GitVersion(new GitVersionSettings{ UpdateAssemblyInfo = false, OutputType = GitVersionOutput.BuildServer }); return GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json }); } /// Updates project version in all of our projects private void PersistVersion(string version) { Information(string.Format("We'll search all csproj files for {0} and replace with {1}...", committedVersion, version)); var projectFiles = GetFiles("./**/*.csproj"); foreach(var projectFile in projectFiles) { var file = projectFile.ToString(); Information(string.Format("Updating {0}...", file)); var updatedProjectFile = System.IO.File.ReadAllText(file) .Replace(committedVersion, version); System.IO.File.WriteAllText(file, updatedProjectFile); } } /// generates release notes based on issues closed in GitHub since the last release private void GenerateReleaseNotes() { Information("Generating release notes at " + releaseNotesFile); var releaseNotesExitCode = StartProcess( @"./tools/GitReleaseNotes/tools/gitreleasenotes.exe", new ProcessSettings { Arguments = ". /o " + releaseNotesFile }); if (string.IsNullOrEmpty(System.IO.File.ReadAllText(releaseNotesFile))) { System.IO.File.WriteAllText(releaseNotesFile, "No issues closed since last release"); } if (releaseNotesExitCode != 0) { throw new Exception("Failed to generate release notes"); } } /// Publishes code and symbols packages to nuget feed, based on contents of artifacts file private void PublishPackages(string feedApiKey, string codeFeedUrl, string symbolFeedUrl) { var artifacts = System.IO.File .ReadAllLines(artifactsFile) .Select(l => l.Split(':')) .ToDictionary(v => v[0], v => v[1]); var codePackage = packagesDir + File(artifacts["nuget"]); NuGetPush( codePackage, new NuGetPushSettings { ApiKey = feedApiKey, Source = codeFeedUrl }); } /// gets the resource from the specified url private string GetResource(string url) { try { Information("Getting resource from " + url); var assetsRequest = System.Net.WebRequest.CreateHttp(url); assetsRequest.Method = "GET"; assetsRequest.Accept = "application/vnd.github.v3+json"; assetsRequest.UserAgent = "BuildScript"; using (var assetsResponse = assetsRequest.GetResponse()) { var assetsStream = assetsResponse.GetResponseStream(); var assetsReader = new StreamReader(assetsStream); var response = assetsReader.ReadToEnd(); Information("Response is " + response); return response; } } catch(Exception exception) { Information("There was an exception " + exception); throw; } } private bool ShouldPublishToUnstableFeed() { var regex = new System.Text.RegularExpressions.Regex(nugetFeedUnstableBranchFilter); var publish = regex.IsMatch(versioning.BranchName); if (publish) { Information("Branch " + versioning.BranchName + " will be published to the unstable feed"); } else { Information("Branch " + versioning.BranchName + " will not be published to the unstable feed"); } return publish; }
the_stack
@page @model AppcoreModel @{ ViewData["Title"] = "App.Core"; ViewData["PageName"] = "plugins_appcore"; ViewData["Category1"] = "Core Plugins"; ViewData["Heading"] = "<i class='subheader-icon fal fa-shield-alt'></i> App.core.js <sup class='badge badge-danger fw-500'>CORE</sup>"; ViewData["PageDescription"] = "The heart and soul of SmartAdmin - Responsive WebApp"; } @section HeadBlock { <link rel="stylesheet" media="screen, print" href="~/css/theme-demo.css"> } <div class="row"> <div class="col-xl-6"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> Debugging <span class="fw-300"><i>console.log</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> view the app.core.js debugger in realtime; assists in the detection and correction of errors </div> <div id="app-eventlog" class="alert alert-primary p-1 h-auto mb-3"></div> <div class="d-flex"> <div> <div class="custom-control d-flex custom-switch"> <input id="eventlog-switch" type="checkbox" class="custom-control-input" checked="checked"> <label class="custom-control-label fw-500" for="eventlog-switch">Debugger Active</label> </div> </div> <div class="flex-1 text-right"> <a href="#" class="btn btn-sm btn-outline-primary mr-1 ml-0" data-toggle="modal" data-target=".js-modal-settings"> Toggle Settings </a> <a href="#" class="btn btn-sm btn-outline-danger" onclick="clearlogText(); return false;"> Clear Log </a> </div> </div> </div> </div> </div> <div id="panel-2" class="panel"> <div class="panel-hdr"> <h2> App <span class="fw-300"><i>API</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Control options for the app API </div> <table class="table table-hover table-bordered m-0"> <thead class="thead-themed"> <tr> <th> Usage </th> <th> Returns </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.saveSettings()">initApp.saveSettings()</button> </td> <td> <i class="text-muted">null</i> </td> <td class="fs-sm"> Pushes selected classes from the <code>body</code> tag to localstorage/database </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.resetSettings()">initApp.resetSettings()</button> </td> <td> <i class="text-muted">-</i> </td> <td class="fs-sm"> Remove classes from <code>body</code> & saves to localstorage/database </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.factoryReset()">initApp.factoryReset()</button> </td> <td> <i class="text-muted">-</i> </td> <td class="fs-sm"> Clears your localStorage effectively removing all settings and panel configs </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.accessIndicator()">initApp.accessIndicator()</button> </td> <td> <i class="text-muted">-</i> </td> <td class="fs-sm"> Indicator for Save Settings (mostly aesthetics) </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.pushSettings()">initApp.pushSettings()</button> </td> <td> <i class="text-muted">-</i> </td> <td class="fs-sm"> Push array to <code>body</code> tag. See <a href="/settings/savingdb">saving to database</a> for more details </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.getSettings()">initApp.getSettings()</button> </td> <td> <i class="fw-500 text-primary">string</i> </td> <td class="fs-sm"> Fetch class names from <code>body</code> and convert them to JSON string. See <a href="/settings/savingdb">saving to database</a> for more details </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.detectBrowserType()">initApp.detectBrowserType()</button> </td> <td> <i class="fw-500 text-primary">string</i> </td> <td class="fs-sm"> Detects webkit and chrome browsers </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.addDeviceType()">initApp.addDeviceType()</button> </td> <td> <i class="fw-500 text-primary">string</i> </td> <td class="fs-sm"> Detects whether device is desktop or mobile </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.windowScrollEvents()">initApp.windowScrollEvents()</button> </td> <td> <i class="text-muted">-</i> </td> <td class="fs-sm"> Saves app settings to localstorage </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.checkNavigationOrientation()">initApp.checkNavigationOrientation()</button> </td> <td> <i class="text-muted">-</i> </td> <td class="fs-sm"> Saves app settings to localstorage </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.buildNavigation(id)">initApp.buildNavigation(id)</button> </td> <td> <i class="fw-500 text-primary">string</i> </td> <td class="fs-sm"> Saves app settings to localstorage </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.mobileCheckActivation()">initApp.mobileCheckActivation()</button> </td> <td> <i class="fw-500 text-danger">bool</i> </td> <td class="fs-sm"> Saves app settings to localstorage </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.toggleVisibility()">initApp.toggleVisibility()</button> </td> <td> <i class="text-muted">-</i> </td> <td class="fs-sm"> Saves app settings to localstorage </td> </tr> <tr> <td> <button class="btn btn-outline-dark btn-sm mr-2" onclick="initApp.domReadyMisc()">initApp.domReadyMisc()</button> </td> <td> <i class="text-muted">-</i> </td> <td class="fs-sm"> Fires a series of events, see "Initialization shell" to your left, for more details. </td> </tr> </tbody> </table> </div> </div> </div> <div id="panel-3" class="panel"> <div class="panel-hdr"> <h2> Action <span class="fw-300"><i>buttons</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Allows you to add action to any HTML element on 'mouseUp' event </div> <table class="table table-hover table-bordered m-0"> <thead class="thead-themed"> <tr> <th style="width:150px"> Action Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <code>toggle</code> </td> <td class="fs-sm"> Push data-class to <code>body</code> element <br> <code>data-action="toggle" data-class="class-a class-b" data-target="#ID"</code> </td> </tr> <tr> <td> <code>toggle-swap</code> </td> <td class="fs-sm"> <code>data-action="toggle-swap" data-class="class-a class-b" data-target="#ID"</code> </td> </tr> <tr> <td> <code>toggle-replace</code> </td> <td class="fs-sm"> <code>data-action="toggle-replace" data-replaceclass="classesToReplace" data-class="replaceWithClass" data-target="body"</code> </td> </tr> <tr> <td> <code>data-panel-*</code> </td> <td class="fs-sm"> Push array to <code>body</code> tag. See <a href="/settings/savingdb">saving to database</a> for more details </td> </tr> <tr> <td> <code>theme-update</code> </td> <td class="fs-sm"> <code>data-action="theme-update" data-theme="path_to_css/css.css"</code> </td> </tr> <tr> <td> <code>app-reset</code> </td> <td class="fs-sm"> <code>data-action="app-reset"</code> </td> </tr> <tr> <td> <code>factory-reset</code> </td> <td class="fs-sm"> <code>data-action="factory-reset"</code> </td> </tr> <tr> <td> <code>app-print</code> </td> <td class="fs-sm"> Print page (similar to pressing CTRL/CMD + P) <code>data-action="app-print"</code> </td> </tr> <tr> <td> <code>app-fullscreen</code> </td> <td class="fs-sm"> Activates broswer's fullscreen command (may not work in all browsers) <code>data-action="app-fullscreen"</code> </td> </tr> <tr> <td> <code>app-loadscript</code> </td> <td class="fs-sm"> Load scripts on demand <code>data-action="app-fullscreen" data-loadurl="script.js" data-loadfunction="functionName()"</code> or you can also use <code>initApp.loadScript("js/my_lovely_script.js", myFunction)</code> </td> </tr> <tr> <td> <code>playsound</code> </td> <td class="fs-sm"> Play sounds using <code>data-action="playsound" data-soundpath="media/sound/" data-soundfile="filename" (no file extensions)</code> </td> </tr> </tbody> </table> </div> </div> </div> </div> <div class="col-xl-6"> <div id="panel-4" class="panel"> <div class="panel-hdr"> <h2> Config <span class="fw-300"><i>settings</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Define preferred application behaviors or configuration options; can modify some functionality of the app </div> <pre class="prettyprint mb-0"> var myapp_config = { root_: $('body'), root_logo: $('.page-sidebar > .page-logo') throttleDelay: 450, filterDelay: 150, thisDevice: null, isMobile: (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())), mobileMenuTrigger: null, mobileResolutionTrigger: 992, isWebkit: ((!!window.chrome && !!window.chrome.webstore) === true || Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 === true), isChrome: (/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())), isIE: ( (window.navigator.userAgent.indexOf('Trident/') ) > 0 === true ), debugState: true, rippleEffect: true, mythemeAnchor: '#mytheme', navAnchor: '#js-primary-nav', navHooks: '#js-primary-nav > ul.navigation' navClosedSign: 'ni ni-chevron-down', navOpenedSign: 'ni ni-chevron-up', navAccordion: true, navInitalized: 'js-nav-built', navFilterInput: $('#nav_filter_input'), navHorizontalWrapperId: 'js-nav-menu-wrapper', navSpeed: 500, navClosedSign: 'fal fa-angle-down', navOpenedSign: 'fal fa-angle-up', appDateHook: $('.js-get-date'), storeLocally: true, jsArray : [] };</pre> </div> </div> </div> <div id="panel-5" class="panel"> <div class="panel-hdr"> <h2> Initilization <span class="fw-300"><i>shell</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Showcasing app JS skeleton </div> <pre class="prettyprint mb-0"> /* App initialize */ var initApp = (function(app) { app.saveSettings = function () { ... } app.resetSettings = function () { ... } app.accessIndicator = function () { ... } app.pushSettings = function (DB_string) { ... } app.getSettings = function () { ... } app.detectBrowserType = function () { ... } app.addDeviceType = function() { ... } app.windowScrollEvents = function () { ... } app.checkNavigationOrientation = function() { ... } app.buildNavigation = function() { ... } app.mobileCheckActivation = function(){ ... } app.toggleVisibility = function (id) { ... } app.domReadyMisc = function() { /* get app date */ /* activate last tab used */ /* activate/destroy slimscroll */ /* activates tooltip */ /* activates image lazyload mechanic */ /* enable dropdown */ /* enable ripple effect */ /* attach action buttons */ /* menu tap actions (for mobile) */ /* initialize windows mobile 8 fix for BS4 */ ... } return app; })({}); /* Bind the throttled handler to the resize event */ $(window).resize( $.throttle( myapp_config.throttleDelay, function (e) { /* (1a) ADD CLASS WHEN BELOW CERTAIN WIDTH (MOBILE MENU) */ initApp.mobileCheckActivation(); }) ); /* Bind the throttled handler to the scroll event */ $(window).scroll( $.throttle( myapp_config.throttleDelay, function (e) { /* EVENTS */ ... }) ); /* Initiate scroll events */ $(window).on('scroll', initApp.windowScrollEvents); /* Document loaded event */ jQuery(document).ready(function() { /* detect desktop or mobile */ initApp.addDeviceType(); /* detect Webkit Browser */ initApp.detectBrowserType(); /* a. check for mobile view width and add class .mobile-view-activated */ initApp.mobileCheckActivation(); /* b. build navigation */ initApp.buildNavigation(myapp_config.navHooks); /* c. run DOM misc functions */ initApp.domReadyMisc(); });</pre> </div> </div> </div> </div> </div> @section ScriptsBlock { <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> <script> /* state debug state for debug msg */ myapp_config.debugState = true; /* variables */ var lastMsg = "", repeatCount = 0, /* get new time date on page load */ getTime = function () { var dt = new Date(), time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds(); return time; }; /* define type */ if (typeof console != "undefined") if (typeof console.log != 'undefined') { console.nglog = console.log; } else { console.nglog = function() {}; } /* push console messages to #div */ console.log = function(message) { console.nglog(message); if (lastMsg != message) { $('#app-eventlog').append('<div class="highlight p-1"><span class="d-flex align-items-center">' + '<span class="badge badge-primary mr-2 p-1 width-6">' + getTime() + '</span>' + message + '</span></div>'); lastMsg = message; repeatCount = 0; $('#app-eventlog').animate({ scrollTop: $('#app-eventlog').prop("scrollHeight")}, 200); } else { lastMsg = message; repeatCount = repeatCount + 1; $('#app-eventlog >:last-child').remove(); $('#app-eventlog').append('<div class="highlight p-1"><span class="d-flex align-items-center">'+ '<span class="badge badge-primary mr-2 p-1 width-6">' + getTime() + '</span>' + '<span class="badge badge-success mr-1">' + repeatCount + '</span>' + message + '</span></div>'); $('#app-eventlog').animate({ scrollTop: $('#app-eventlog').prop("scrollHeight")}, 200); } }; /* compile messages to one log */ console.error = console.debug = console.info = console.log $('#eventlog-switch').click(function(){ if ($('input[type=checkbox]').prop('checked')) { console.log("debugState ON") myapp_config.debugState = true; } else { console.log("debugState OFF"); myapp_config.debugState = false; } }); var clearlogText = function (){ $('#app-eventlog').empty(); }; </script> }
the_stack
@page @model InteractiveModel @using System.Security.Claims @using SmartAdmin.WebUI.Data @using SmartAdmin.WebUI.Pages @inject ApplicationDbContext DbContext @{ ViewData["Title"] = "Interactive Instructions"; ViewData["PageName"] = "aspnetcore_interactive"; ViewData["Heading"] = "<i class='fal fa-tools'></i> Interactive: <span class='fw-300'>Modifying the Project</span>"; var roleName = User.FindFirst(ClaimTypes.Role)?.Value ?? "Guest"; var returnUrl = new Dictionary<string, string> { { "returnUrl", Url.Action("Interactive", "AspNetCore") } }; var dbVersion = DbContext.Database.ProviderName; } @section HeadBlock { <!-- // Note if you wish to use Blazor in other pages of this Project then please move the base element to the _Layout.cshtml file. --> <base href="~/" /> } <div class="row"> <div class="col-xl-12"> <div class="panel"> <div class="panel-container show"> <div class="panel-content"> The instructions below are <strong>interactive</strong>, this means that they are built with coding logic enabled that responds to the purpose of the instruction. We hope this approach can assist you with ensuring that the instruction has been carried out correctly and therefor acts as a confirmation when you followed the lesson correctly! So please give them a try! </div> </div> </div> </div> </div> <div class="row"> <div class="col-xl-12"> <div class="panel"> <div class="panel-hdr"> <h2>Enable Authorization on the Navigation Menu</h2> </div> <div class="panel-container show"> <div class="panel-content"> <section> <ol class="list-spaced"> <li> Navigate to the folder containing the extracted project package and double-click the <code>SmartAdminCore.sln</code> file </li> <li> Once the solution has finished loading open the <code>nav.json</code> file in the root of the project </li> <li> Scroll down to about <code>Line 141</code> to find the <strong>Tools & Components</strong> menu item </li> <li> You should see a new property that was added in this release to the menu item called <code>roles</code>: <pre class="prettyprint lang-js mb-0 mt-2">&quot;roles&quot;: [ &quot;Administrator&quot; ]</pre> </li> <li>As you can see we have added an extra instruction that this menu item should only be visible for <strong>Administrators</strong></li> <li> So let's check this now, it seems that you are currently logged in as the <code>@roleName</code> role @if (User.IsInRole("Administrator")) { <div class="alert alert-success mb-0 mt-1 p-1"> Hurray! You already have the correct role! Did you want to test it as <strong>Guest</strong> first? You can logout by clicking here: <a asp-area="Identity" asp-page="/account/logout" asp-all-route-data="returnUrl">Logout</a> </div> } else { <div class="alert alert-warning mb-0 mt-1 p-1"> This means you are currently not logged in! Let's fix that by clicking here: <a asp-area="Identity" asp-page="/account/login" asp-all-route-data="returnUrl">Login</a> </div> } <div class="alert alert-info mb-0 mt-1 p-1"> As you might have noticed, the menu on the left may not have changed at all by logging in or viewing it as a <strong>Guest</strong>! This is because by default the Navigation is not enabled to be role aware, so let's change that! </div> </li> <li>Open the <code>Default.cshtml</code> file in the <strong>Views/Shared/Components/Navigation</strong> folder of your project</li> <li> With the file open goto around <code>Line 6</code> and you should see the following line of code: <pre class="prettyprint lang-csharp mb-0 mt-2">@@foreach (var group in menu.Lists)</pre> </li> <li> Change or Replace this line of code with the following line of code: <pre class="prettyprint lang-csharp mb-0 mt-2">@@foreach (var group in menu.Lists.AuthorizeFor(User))</pre> <div class="alert alert-success mb-0 mt-1 p-1"> Authorization is now enabled and the <code>AuthorizeFor</code> extension method will verify the user role with that of the menu item. If the menu item has no roles available it will be shown regardless of role. </div> </li> <li>Now refresh this page and/or <a asp-area="Identity" asp-page="/account/login" asp-all-route-data="returnUrl">Login</a> and you should see the menu change!</li> </ol> </section> </div> </div> </div> </div> </div> <div class="row"> <div class="col-xl-12"> <div class="panel"> <div class="panel-hdr"> <h2>Changing the default database from SQLite to SQL Server</h2> </div> <div class="panel-container show"> <div class="panel-content"> <section> <ol class="list-spaced"> <li> Navigate to the folder containing the extracted project package and double-click the <code>SmartAdminCore.sln</code> file </li> <li> Once the solution has finished loading open the <code>Startup.cs</code> file in the root of the project </li> <li> With the file open goto around <code>Line 35</code> and you should see the following line of code: <pre class="prettyprint lang-csharp mb-0 mt-2">services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt; options.UseSqlite(Configuration.GetConnectionString(&quot;DefaultConnection&quot;)));</pre> </li> <li> Change or Replace this line of code with the following line of code: <pre class="prettyprint lang-csharp mb-0 mt-2">services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString(&quot;DefaultConnection&quot;)));</pre> </li> <li> This will instruct Entity Framework to connect to a Microsoft SQL Server Database. <div class="alert alert-warning mb-0 mt-1 p-1"> <strong>Note:</strong> You might get a warning or an error stating that <code>UseSqlServer</code> is not recognized, this means we will need to add a reference to the <strong>SqlServer</strong> NuGet package for Entity Framework Core </div> </li> <li>Right click the <strong>SmartAdmin.WebUI</strong> project and choose the option: <code>Edit Project File</code></li> <li> With the file open goto around <code>Line 17</code> and you should see the following line of code: <pre class="prettyprint lang-xml mb-0 mt-2">&lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Sqlite&quot; Version=&quot;3.1.2&quot; /&gt;</pre> </li> <li> Change or Replace this line of code with the following line of code: <pre class="prettyprint lang-xml mb-0 mt-2">&lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.SqlServer&quot; Version=&quot;3.1.2&quot; /&gt;</pre> <div class="alert alert-info mb-0 mt-1 p-1"> <strong>Note:</strong> You can also change the NuGet packages of your project by right-clicking the <strong>SmartAdminCore</strong> solution and choosing the option: <code>Manage NuGet Packages for Solution..</code> </div> </li> <li>Last but not least we will need to modify the <strong>ConnectionString</strong> of the application to connect to your SQL Server instance</li> <li>Open the <code>appsettings.json</code>file in the root of your project</li> <li> With the file open goto around <code>Line 3</code> and you should see the following line of code: <pre class="prettyprint lang-js mb-0 mt-2">&quot;DefaultConnection&quot;: &quot;DataSource=app.db&quot;</pre> </li> <li> Change or Replace this line of code with the following line of code: <pre class="prettyprint lang-js mb-0 mt-2">&quot;DefaultConnection&quot;: &quot;Data Source=YourServerAddress;Initial Catalog=YourDatabase;User ID=YourUser;Password=YourPassword;Connect Timeout=20;ApplicationIntent=ReadWrite;MultipleActiveResultSets=true&quot;</pre> <div class="alert alert-danger mb-0 mt-1 p-1"> <strong>Note:</strong> Be sure to replace the <code>YourXxxx</code> values with the actual values of your SQL Server instance and credentials! </div> </li> <li> In order to re-create the database schema in your new targeted database we will have to remove the <strong>Migrations</strong> folder from the project. Once this has been done you can re-apply the new schema by typing the following: <pre class="prettyprint lang-js mb-0 mt-2">Add-Migration InitialCreate</pre> Followed by updating your targeted database, by typing the following: <pre class="prettyprint lang-js mb-0 mt-2">Update-Database</pre> </li> <li> Phew! That was quite the effort, so let's check the result: You are currently using <code>@dbVersion</code> as your data store. @if (dbVersion.Contains("Sqlite")) { <div class="alert alert-warning mb-0 mt-1 p-1"> It seems you are (still) using SQLite.<br/> Please follow the instructions above and refresh this page to see the result! </div> } else { <div class="alert alert-success mb-0 mt-1 p-1"> Hurray! You have switched to SQL Server successfully! </div> } </li> </ol> </section> </div> </div> </div> </div> </div> <div class="row"> <div class="col-xl-12"> <div class="panel"> <div class="panel-hdr"> <h2>Adding support for Blazor to the Project</h2> </div> <div class="panel-container show"> <div class="panel-content"> <section> <ol class="list-spaced"> <li> Navigate to the folder containing the extracted project package and double-click the <code>SmartAdminCore.sln</code> file </li> <li> Once the solution has finished loading open the <code>Startup.cs</code> file in the root of the project </li> <li> With the file open goto around <code>Line 48</code> and you should see the following line of code: <pre class="prettyprint lang-csharp mb-0 mt-2">services.AddRazorPages();</pre> </li> <li> Add the following line of code directly beneath: <pre class="prettyprint lang-csharp mb-0 mt-2">services.AddServerSideBlazor();</pre> </li> <li> Now goto around <code>Line 85</code> and you should see the following line of code: <pre class="prettyprint lang-csharp mb-0 mt-2">endpoints.MapRazorPages();</pre> </li> <li> Add the following line of code directly beneath: <pre class="prettyprint lang-csharp mb-0 mt-2">endpoints.MapBlazorHub();</pre> </li> <li> This will instruct .NET to setup the Blazor Hub and establish a connection upon startup. <div class="alert alert-warning mb-0 mt-1 p-1"> <strong>Note:</strong> You might get a warning or an error stating that <code>No connection could be established</code>, this means that a plugin might be interfering with the definition of <strong>WebSocket</strong>. </div> </li> <li> Let's fix that error right-away! Open the <code>_ScriptBasePlugins.cshtml</code> file in the <strong>Views/Shared</strong> folder of the project </li> <li> With the file open goto around <code>Line 2</code> and you should see the following line of code: <pre class="prettyprint lang-csharp mb-0 mt-2">&lt;script src=&quot;~/js/app.bundle.js&quot;&gt;&lt;/script&gt;</pre> </li> <li> Add the following lines of code directly beneath: <pre class="prettyprint lang-csharp mb-0 mt-2"> &lt;script&gt; // this call is required to remap WebSocket as this is overridden by Pace.js plugin ! :-( Object.defineProperty(WebSocket, &#39;OPEN&#39;, { value: 1 }); &lt;/script&gt; &lt;script src=&quot;~/_framework/blazor.server.js&quot;&gt;&lt;/script&gt;</pre> </li> <li> This will enable the listener framework to be setup as such that the pages can "communicate" with your code. <div class="alert alert-info mb-0 mt-1 p-1"> <strong>Note:</strong> The <code>blazor.server.js</code> file is generated at <strong>runtime</strong>, as such it is not available on disk or in your project. </div> </li> <li> Now rebuild your project and launch it! If everything went well then the item below should show you the rendered contents of the <code>HelloWorld.razor</code> file located in the <strong>Pages</strong> folder in the root of your Project; Blazor support should now be available in SmartAdmin! </li> <component type="typeof(HelloWorld)" render-mode="ServerPrerendered" /> </ol> </section> </div> </div> </div> </div> </div> @section ScriptsBlock { <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> }
the_stack
@******************************************************************************************************* // Devices.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/15/2016 - J. Ritchie Carroll // Generated original version of source code. // //*****************************************************************************************************@ @using System.Text @using GSF.Security @using GSF.Web.Model @using GSF.Web.Shared.Model @using openPDC @using openPDC.Model @inherits ExtendedTemplateBase<AppModel> @section StyleSheets { <style> html, body { height: 100%; } </style> } @{ if (ViewBag.PageControlScripts == null) { ViewBag.PageControlScripts = new StringBuilder(); } DataContext dataContext = ViewBag.DataContext; StringBuilder pageControlScripts = ViewBag.PageControlScripts; Layout = "Layout.cshtml"; ViewBag.Title = "Devices"; ViewBag.ShowSearchFilter = true; ViewBag.HeaderColumns = new[] { // { "Field", "Label", "Classes" } new[] { "Acronym", "Acronym", "text-left" }, new[] { "Name", "Name", "text-left" }, new[] { "ConnectionString", "Connection String", "text-left" }, new[] { null, "Enabled", "text-center valign-middle" } }; ViewBag.BodyRows = BodyRows().ToString(); ViewBag.AddNewEditDialog = AddNewEditDialog(dataContext).ToString(); ViewBag.ParentKeys = Model.Global.NodeID.ToString(); // Prepend view model validation extension scripts to occur before normal model initialization pageControlScripts.Insert(0, ExtendModelValidation().ToString().TrimStart()); } @functions { public bool UserIsAdminOrEditor() { SecurityPrincipal securityPrincipal = ViewBag.SecurityPrincipal as SecurityPrincipal; if ((object)securityPrincipal == null) return false; return securityPrincipal.IsInRole("Administrator,Editor"); } } @helper BodyRows() { <td width="25%" class="text-left valign-middle"><button type="button" class="btn btn-link" data-bind="text: Acronym, click: navigateToDeviceScreen.bind($data)"></button></td> <td width="30%" class="text-left valign-middle" data-bind="text: Name"></td> <td width="35%" class="text-left table-cell-hard-wrap"><div data-bind="text: notNull(ConnectionString).truncate(30), attr: { title: notNull(ConnectionString) }"></div></td> <td width="5%" class="text-center valign-middle"><input type="checkbox" data-bind="checked: Enabled, click: enabledStateChanged.bind($data)" /></td> <td width="5%" class="text-center valign-middle" nowrap> <button type="button" class="btn btn-xs" data-bind="click: openDeviceStatus, enable: $parent.dataHubIsConnected"><span class="glyphicon glyphicon-scale"></span></button> <button type="button" class="btn btn-xs" data-bind="click: showEditScreen.bind($data, @(UserIsAdminOrEditor().ToString().ToLower())), enable: $parent.dataHubIsConnected"><span class="glyphicon glyphicon-pencil"></span></button> <button type="button" class="btn btn-xs" data-bind="click: $parent.removePageRecord, enable: $parent.dataHubIsConnected"><span class="glyphicon glyphicon-remove"></span></button> </td> } @helper AddNewEditDialog(DataContext dataContext) { <div class="col-md-6"> @Raw(dataContext.AddInputField<Device>("ID", customDataBinding: "disable: true", groupDataBinding: "visible: $root.recordMode() !== RecordMode.AddNew")) @Raw(dataContext.AddInputField<Device>("UniqueID", customDataBinding: "disable: true", groupDataBinding: "visible: $root.recordMode() !== RecordMode.AddNew")) @Raw(dataContext.AddInputField<Device>("Acronym", initialFocus: true)) @Raw(dataContext.AddInputField<Device>("Name")) @Raw(dataContext.AddSelectField<Device, Protocol>("ProtocolID", "ID", "Acronym", allowUnset: true)) @Raw(dataContext.AddSelectField<Device, Historian>("HistorianID", "ID", "Acronym", allowUnset: true, addEmptyRow: true)) @Raw(dataContext.AddInputField<Device>("AccessID")) @Raw(dataContext.AddInputField<Device>("FramesPerSecond")) @Raw(dataContext.AddSelectField<Device, VendorDevice>("VendorDeviceID", "ID", "Name", allowUnset: true)) </div> <div class="col-md-6"> @Raw(dataContext.AddTextAreaField<Device>("ConnectionString", 4)) @Raw(dataContext.AddInputField<Device>("Longitude")) @Raw(dataContext.AddInputField<Device>("Latitude")) @Raw(dataContext.AddSelectField<Device, Interconnection>("InterconnectionID", "ID", "Acronym")) @Raw(dataContext.AddSelectField<Device, Company>("CompanyID", "ID", "Acronym")) @Raw(dataContext.AddInputField<Device>("ContactList")) <div class="form-inline pull-right"> @Raw(dataContext.AddCheckBoxField<Device>("ConnectOnDemand"))&nbsp; @Raw(dataContext.AddCheckBoxField<Device>("IsConcentrator"))&nbsp; @Raw(dataContext.AddCheckBoxField<Device>("Enabled")) </div> <div class="form-inline pull-right" style="width: 100%"> <br/> <a role="button" class="btn btn-sm btn-default pull-right" id="exportDevicePhasorsCSVButton" data-bind="visible: $root.recordMode()!==RecordMode.AddNew, enable: $parent.dataHubIsConnected" hub-dependent> <span class="glyphicon glyphicon-download"></span>&nbsp;&nbsp;Export&nbsp;Phasor&nbsp;CSV </a> <a id="exportDevicePhasorsCSVLink" download hidden></a> </div> </div> } @helper ExtendModelValidation() { <script> var phasorHub, phasorHubClient; $(function () { // Connect to phasor hub phasorHub = $.connection.phasorHub.server; phasorHubClient = $.connection.phasorHub.client; // Create hub client functions for message control function encodeInfoMessage(message, timeout) { // Html encode message const encodedMessage = $("<div />").text(message).html(); showInfoMessage(encodedMessage, timeout, true); } function encodeErrorMessage(message, timeout) { // Html encode message const encodedMessage = $("<div />").text(message).html(); showErrorMessage(encodedMessage, timeout, true); } // Register info and error message handlers for hub client phasorHubClient.sendInfoMessage = encodeInfoMessage; phasorHubClient.sendErrorMessage = encodeErrorMessage; }); $(window).on("beforeApplyBindings", function () { // Define local rule that will check that device group acronym is unique in the database ko.validation.rules["deviceUniqueInDatabase"] = { async: true, validator: function (newVal, options, callback) { if (phasorHub) { // Lookup Device record by Acronym - this will return an empty record if not found phasorHub.queryDevice(newVal).done(function (device) { // Valid if device doesn't exist or is itself callback(device.ID === 0 || notNull(device.Acronym).toLowerCase() === notNull(options).toLowerCase()); }) .fail(function (error) { showErrorMessage(error); // Do not display validation failure message for connection issues callback(true); }); } else { callback(true); } }, message: "This device acronym already exists in the database. Acronyms must be unique." }; ko.bindingHandlers.selectOnError = { init: function (element, valueAccessor) { $(element).on("input", function(event) { setTimeout(function () { if (!valueAccessor().isValid()) element.select(); }, 1); }); } } // Enable knockout validation ko.validation.init({ registerExtenders: true, messagesOnModified: true, insertMessages: true, parseInputAttributes: true, allowHtmlMessages: true, messageTemplate: null, decorateElement: true, errorElementClass: "has-error", errorMessageClass: "help-block", grouping: { deep: true, observable: true, live: true } }, true); // Enable deferred updates for better performance ko.options.deferUpdates = true; }); </script> } @Html.RenderResource("GSF.Web.Model.Views.PagedViewModel.cshtml") @section Scripts { <script> var modeledValidationParametersFunction; var modbusProtocolID = 0; @Raw(dataContext.RenderViewModelConfiguration<Device, DataHub>(ViewBag, "Acronym", null, Model.Global.NodeID)) $(window).on("hubConnected", function() { if (modbusProtocolID === 0) { dataHub.getModbusProtocolID().done(function(protocolID) { modbusProtocolID = protocolID; }); } }); function navigateToDeviceScreen(record) { @if (UserIsAdminOrEditor()) { <text> if (record.ProtocolID === modbusProtocolID) { window.location.href = "ModbusConfig.cshtml?DeviceID=" + record.ID; } else { if (hubIsConnected) { dataHub.getProtocolCategory(record.ProtocolID).done(function(category) { category = notNull(category).toLowerCase().trim(); if (category === "phasor" || category === "gateway") window.location.href = "AddSynchrophasorDevice.cshtml?DeviceID=" + record.ID; else viewModel.viewPageRecord(record); }) .fail(function() { viewModel.viewPageRecord(record); }); } else { viewModel.viewPageRecord(record); } } </text> } else { <text> viewModel.viewPageRecord(record); </text> } } $(function() { modeledValidationParametersFunction = viewModel.applyValidationParameters; viewModel.setApplyValidationParameters(function () { modeledValidationParametersFunction(); viewModel.currentRecord().Acronym.extend({ required: true, deviceUniqueInDatabase: viewModel.currentRecord().Acronym() }); }); $("<a role='button' class='btn btn-sm btn-default pull-right' id='exportAllPhasorsCSVButton' data-bind='visible: $root.recordMode()!==RecordMode.AddNew, enable: $parent.dataHubIsConnected' hub-dependent><span class='glyphicon glyphicon-download'></span>&nbsp;&nbsp;Phasor&nbsp;Export&nbsp;CSV</a>").insertAfter("#exportCSVButton"); $("<a id='exportAllPhasorsCSVLink' download hidden></a>").insertAfter("#exportAllPhasorsCSVButton"); $("#exportCSVButton").html("<span class='glyphicon glyphicon-download'></span>&nbsp;&nbsp;Device&nbsp;Export&nbsp;CSV"); $("#exportAllPhasorsCSVButton").click(function() { if (!hubIsConnected) return; dataHub.getConnectionID().done(function (connectionID) { $("#exportAllPhasorsCSVLink").attr("href", "/@@GSF/Web/Model/Handlers/CsvDownloadHandler.ashx" + "?ModelName=" + encodeURIComponent("@typeof(PhasorDetail).FullName") + "&HubName=" + encodeURIComponent("@typeof(DataHub).FullName") + "&ConnectionID=" + encodeURIComponent(connectionID) + "&FilterText=&SortField=DeviceID" + "&SortAscending=true&ShowDeleted=false" + "&ExportName=PhasorExport.csv&ParentKeys=0"); $("#exportAllPhasorsCSVLink")[0].click(); }). fail(function(error) { showErrorMessage(error); }); }); }); $("#addNewEditDialog").on("shown.bs.modal", function () { $("#exportDevicePhasorsCSVButton").click(function() { if (!hubIsConnected) return; dataHub.getConnectionID().done(function (connectionID) { const currentRecord = viewModel.currentRecord(); $("#exportDevicePhasorsCSVLink").attr("href", "/@@GSF/Web/Model/Handlers/CsvDownloadHandler.ashx" + "?ModelName=" + encodeURIComponent("@typeof(PhasorDetail).FullName") + "&HubName=" + encodeURIComponent("@typeof(DataHub).FullName") + "&ConnectionID=" + encodeURIComponent(connectionID) + "&FilterText=&SortField=SourceIndex" + "&SortAscending=true&ShowDeleted=false" + "&ExportName=" + encodeURIComponent(currentRecord.Acronym() + "-PhasorExport.csv") + "&ParentKeys=" + encodeURIComponent(currentRecord.ID())); $("#exportDevicePhasorsCSVLink")[0].click(); }). fail(function(error) { showErrorMessage(error); }); }); }); function showEditScreen(editable, record) { if (editable) viewModel.editPageRecord(record); else viewModel.viewPageRecord(record); } function refreshEnabledState(record) { if (!hubIsConnected) return; if (record.Enabled) serviceHub.sendCommand("initialize " + record.Acronym); else serviceHub.sendCommand("reloadconfig"); } function enabledStateChanged(record) { if (hubIsConnected) { record.Enable = !record.Enable; dataHub.updateDevice(record).done(function() { viewModel.queryPageRecords(); refreshEnabledState(record); }); } } function openDeviceStatus(row, event, id) { if (row.IsConcentrator === 0 || notNull(row.ParentID)) window.open("/DeviceStatus.cshtml?DeviceID=" + row.ID); else window.open("/ParentStatus.cshtml?DeviceID=" + row.ID); } $(viewModel).on("recordSaved", function(event, record, isNew) { refreshEnabledState(record); }); $(viewModel).on("recordDeleted", function(event, record) { if (hubIsConnected) serviceHub.sendCommand("reloadconfig"); }); </script> }
the_stack
 <!-- MAIN CONTENT --> <div id="content"> <!-- row --> <div class="row"> <!-- col --> <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4"> <h1 class="page-title txt-color-blueDark"> <!-- PAGE HEADER --> <i class="fa-fw fa fa-home"></i> Page Header <span> > Subtitle </span> </h1> </div> <!-- end col --> <!-- right side of the page with the sparkline graphs --> <!-- col --> <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8"> <!-- sparks --> <ul id="sparks"> <li class="sparks-info"> <h5> My Income <span class="txt-color-blue">$47,171</span></h5> <div class="sparkline txt-color-blue hidden-mobile hidden-md hidden-sm"> 1300, 1877, 2500, 2577, 2000, 2100, 3000, 2700, 3631, 2471, 2700, 3631, 2471 </div> </li> <li class="sparks-info"> <h5> Site Traffic <span class="txt-color-purple"><i class="fa fa-arrow-circle-up" data-rel="bootstrap-tooltip" title="Increased"></i>&nbsp;45%</span></h5> <div class="sparkline txt-color-purple hidden-mobile hidden-md hidden-sm"> 110,150,300,130,400,240,220,310,220,300, 270, 210 </div> </li> <li class="sparks-info"> <h5> Site Orders <span class="txt-color-greenDark"><i class="fa fa-shopping-cart"></i>&nbsp;2447</span></h5> <div class="sparkline txt-color-greenDark hidden-mobile hidden-md hidden-sm"> 110,150,300,130,400,240,220,310,220,300, 270, 210 </div> </li> </ul> <!-- end sparks --> </div> <!-- end col --> </div> <!-- end row --> <!-- The ID "widget-grid" will start to initialize all widgets below You do not need to use widgets if you dont want to. Simply remove the <section></section> and you can use wells or panels instead --> <!-- widget grid --> <section id="widget-grid" class=""> <!-- row --> <div class="row"> <!-- NEW WIDGET ROW START --> <div class="col-sm-6"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-0" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-deletebutton="false" data-widget-sortable="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <h2>#movieForm </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form id="movieForm" method="post"> <fieldset> <legend> Default Form Elements </legend> <div class="form-group"> <div class="row"> <div class="col-md-8"> <label class="control-label">Movie title</label> <input type="text" class="form-control" name="title" /> </div> <div class="col-md-4 selectContainer"> <label class="control-label">Genre</label> <select class="form-control" name="genre"> <option value="">Choose a genre</option> <option value="action">Action</option> <option value="comedy">Comedy</option> <option value="horror">Horror</option> <option value="romance">Romance</option> </select> </div> </div> </div> </fieldset> <fieldset> <div class="form-group"> <div class="row"> <div class="col-sm-12 col-md-4"> <label class="control-label">Director</label> <input type="text" class="form-control" name="director" /> </div> <div class="col-sm-12 col-md-4"> <label class="control-label">Writer</label> <input type="text" class="form-control" name="writer" /> </div> <div class="col-sm-12 col-md-4"> <label class="control-label">Producer</label> <input type="text" class="form-control" name="producer" /> </div> </div> </div> </fieldset> <fieldset> <div class="form-group"> <div class="row"> <div class="col-sm-12 col-md-6"> <label class="control-label">Website</label> <input type="text" class="form-control" name="website" /> </div> <div class="col-sm-12 col-md-6"> <label class="control-label">Youtube trailer</label> <input type="text" class="form-control" name="trailer" /> </div> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="control-label">Review</label> <textarea class="form-control" name="review" rows="8"></textarea> </div> </fieldset> <fieldset> <div class="form-group"> <div class="row"> <div class="col-sm-12 col-md-12"> <label class="control-label">Rating</label> </div> <div class="col-sm-12 col-md-10"> <label class="radio radio-inline no-margin"> <input type="radio" name="rating" value="terrible" class="radiobox style-2" /> <span>Terrible</span> </label> <label class="radio radio-inline"> <input type="radio" name="rating" value="watchable" class="radiobox style-2" /> <span>Watchable</span> </label> <label class="radio radio-inline"> <input type="radio" name="rating" value="best" class="radiobox style-2" /> <span>Best ever</span> </label> </div> </div> </div> </fieldset> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> <i class="fa fa-eye"></i> Validate </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-2" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-deletebutton="false" data-widget-sortable="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <h2>#togglingForm </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form id="togglingForm" method="post" class="form-horizontal"> <fieldset> <legend> Default Form Elements </legend> <div class="form-group"> <label class="col-lg-3 control-label">Full name <sup>*</sup></label> <div class="col-lg-4"> <input type="text" class="form-control" name="firstName" placeholder="First name" /> </div> <div class="col-lg-4"> <input type="text" class="form-control" name="lastName" placeholder="Last name" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Company <sup>*</sup></label> <div class="col-lg-5"> <input type="text" class="form-control" name="company" required data-bv-notempty-message="The company name is required" /> </div> <div class="col-lg-2"> <button type="button" class="btn btn-info btn-sm" data-toggle="#jobInfo"> Add more info </button> </div> </div> </fieldset> <!-- These fields will not be validated as long as they are not visible --> <div id="jobInfo" style="display: none;"> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Job title <sup>*</sup></label> <div class="col-lg-5"> <input type="text" class="form-control" name="job" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Department <sup>*</sup></label> <div class="col-lg-5"> <input type="text" class="form-control" name="department" /> </div> </div> </fieldset> </div> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Mobile phone <sup>*</sup></label> <div class="col-lg-5"> <input type="text" class="form-control" name="mobilePhone" /> </div> <div class="col-lg-2"> <button type="button" class="btn btn-info btn-sm" data-toggle="#phoneInfo"> Add more phone numbers </button> </div> </div> </fieldset> <!-- These fields will not be validated as long as they are not visible --> <div id="phoneInfo" style="display: none;"> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Home phone</label> <div class="col-lg-5"> <input type="text" class="form-control" name="homePhone" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Office phone</label> <div class="col-lg-5"> <input type="text" class="form-control" name="officePhone" /> </div> </div> </fieldset> </div> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> <i class="fa fa-eye"></i> Validate </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-4" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-deletebutton="false" data-widget-sortable="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <h2>#attributeForm </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form id="attributeForm" class="form-horizontal" data-bv-message="This value is not valid" data-bv-feedbackicons-valid="glyphicon glyphicon-ok" data-bv-feedbackicons-invalid="glyphicon glyphicon-remove" data-bv-feedbackicons-validating="glyphicon glyphicon-refresh"> <fieldset> <legend> Set validator options via HTML attributes </legend> <div class="alert alert-warning"> <code> < input data-bv-validatorname data-bv-validatorname-validatoroption="..." / > </code> <br> <br> More validator options can be found here: <a href="http://bootstrapvalidator.com/validators/" target="_blank">http://bootstrapvalidator.com/validators/</a> </div> <div class="form-group"> <label class="col-lg-3 control-label">Full name</label> <div class="col-lg-4"> <input type="text" class="form-control" name="firstName" placeholder="First name" data-bv-notempty="true" data-bv-notempty-message="The first name is required and cannot be empty" /> </div> <div class="col-lg-4"> <input type="text" class="form-control" name="lastName" placeholder="Last name" data-bv-notempty="true" data-bv-notempty-message="The last name is required and cannot be empty" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Username</label> <div class="col-lg-5"> <input type="text" class="form-control" name="username" data-bv-message="The username is not valid" data-bv-notempty="true" data-bv-notempty-message="The username is required and cannot be empty" data-bv-regexp="true" data-bv-regexp-regexp="^[a-zA-Z0-9_\.]+$" data-bv-regexp-message="The username can only consist of alphabetical, number, dot and underscore" data-bv-stringlength="true" data-bv-stringlength-min="6" data-bv-stringlength-max="30" data-bv-stringlength-message="The username must be more than 6 and less than 30 characters long" data-bv-different="true" data-bv-different-field="password" data-bv-different-message="The username and password cannot be the same as each other" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Email address</label> <div class="col-lg-5"> <input class="form-control" name="email" type="email" data-bv-emailaddress="true" data-bv-emailaddress-message="The input is not a valid email address" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Password</label> <div class="col-lg-5"> <input type="password" class="form-control" name="password" data-bv-notempty="true" data-bv-notempty-message="The password is required and cannot be empty" data-bv-identical="true" data-bv-identical-field="confirmPassword" data-bv-identical-message="The password and its confirm are not the same" data-bv-different="true" data-bv-different-field="username" data-bv-different-message="The password cannot be the same as username" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Retype password</label> <div class="col-lg-5"> <input type="password" class="form-control" name="confirmPassword" data-bv-notempty="true" data-bv-notempty-message="The confirm password is required and cannot be empty" data-bv-identical="true" data-bv-identical-field="password" data-bv-identical-message="The password and its confirm are not the same" data-bv-different="true" data-bv-different-field="username" data-bv-different-message="The password cannot be the same as username" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Languages</label> <div class="col-lg-5"> <div class="checkbox"> <label> <input type="checkbox" name="languages[]" value="english" data-bv-message="Please specify at least one language you can speak" data-bv-notempty="true" /> English </label> </div> <div class="checkbox"> <label> <input type="checkbox" name="languages[]" value="french" /> French </label> </div> <div class="checkbox"> <label> <input type="checkbox" name="languages[]" value="german" /> German </label> </div> <div class="checkbox"> <label> <input type="checkbox" name="languages[]" value="russian" /> Russian </label> </div> <div class="checkbox"> <label> <input type="checkbox" name="languages[]" value="other" /> Other </label> </div> </div> </div> </fieldset> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> <i class="fa fa-eye"></i> Validate </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </div> <!-- WIDGET ROW END --> <!-- NEW WIDGET ROW START --> <div class="col-sm-6"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-1" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-deletebutton="false" data-widget-sortable="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <h2>#buttonGroupForm </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form id="buttonGroupForm" method="post" class="form-horizontal"> <fieldset> <legend> Default Form Elements </legend> <div class="form-group"> <label class="col-lg-3 control-label">Gender</label> <div class="col-lg-9"> <div class="btn-group" data-toggle="buttons"> <label class="btn btn-default"> <input type="radio" name="gender" value="male" /> Male </label> <label class="btn btn-default"> <input type="radio" name="gender" value="female" /> Female </label> <label class="btn btn-default"> <input type="radio" name="gender" value="other" /> Other </label> </div> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Languages</label> <div class="col-lg-9"> <div class="btn-group" data-toggle="buttons"> <label class="btn btn-default"> <input type="checkbox" name="languages[]" value="english" /> English </label> <label class="btn btn-default"> <input type="checkbox" name="languages[]" value="german" /> German </label> <label class="btn btn-default"> <input type="checkbox" name="languages[]" value="french" /> French </label> <label class="btn btn-default"> <input type="checkbox" name="languages[]" value="russian" /> Russian </label> <label class="btn btn-default"> <input type="checkbox" name="languages[]" value="italian"> Italian </label> </div> </div> </div> </fieldset> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> <i class="fa fa-eye"></i> Validate </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-3" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-deletebutton="false" data-widget-sortable="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <h2>#productForm </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form id="productForm" class="form-horizontal"> <fieldset> <legend> Default Form Elements </legend> <div class="form-group"> <label class="col-xs-2 col-lg-3 control-label">Price</label> <div class="col-xs-9 col-lg-6 inputGroupContainer"> <div class="input-group"> <input type="text" class="form-control" name="price" /> <span class="input-group-addon">$</span> </div> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-xs-2 col-lg-3 control-label">Amount</label> <div class="col-xs-9 col-lg-6 inputGroupContainer"> <div class="input-group"> <span class="input-group-addon">&#8364;</span> <input type="text" class="form-control" name="amount" /> </div> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-xs-2 col-lg-3 control-label">Color</label> <div class="col-xs-9 col-lg-6 selectContainer"> <select class="form-control" name="color"> <option value="">Choose a color</option> <option value="blue">Blue</option> <option value="green">Green</option> <option value="red">Red</option> <option value="yellow">Yellow</option> <option value="white">White</option> </select> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-xs-2 col-lg-3 control-label">Size</label> <div class="col-xs-9 col-lg-6 selectContainer"> <select class="form-control" name="size"> <option value="">Choose a size</option> <option value="S">S</option> <option value="M">M</option> <option value="L">L</option> <option value="XL">XL</option> </select> </div> </div> </fieldset> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> <i class="fa fa-eye"></i> Validate </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-5" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-deletebutton="false" data-widget-sortable="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <h2>#profileForm </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form id="profileForm"> <fieldset> <legend> Default Form Elements </legend> <div class="form-group"> <label>Email address</label> <input type="text" class="form-control" name="email" /> </div> </fieldset> <fieldset> <div class="form-group"> <label>Password</label> <input type="password" class="form-control" name="password" /> </div> </fieldset> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> <i class="fa fa-eye"></i> Validate </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-7" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-deletebutton="false" data-widget-sortable="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <h2>#contactForm </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form id="contactForm" method="post" class="form-horizontal"> <fieldset> <legend>Showing messages in custom area</legend> <div class="form-group"> <label class="col-md-3 control-label">Full name</label> <div class="col-md-6"> <input type="text" class="form-control" name="fullName" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-md-3 control-label">Email</label> <div class="col-md-6"> <input type="text" class="form-control" name="email" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-md-3 control-label">Title</label> <div class="col-md-6"> <input type="text" class="form-control" name="title" /> </div> </div> </fieldset> <fieldset> <div class="form-group"> <label class="col-md-3 control-label">Content</label> <div class="col-md-6"> <textarea class="form-control" name="content" rows="5"></textarea> </div> </div> </fieldset> <fieldset> <!-- #messages is where the messages are placed inside --> <div class="form-group"> <div class="col-md-9 col-md-offset-3"> <div id="messages"></div> </div> </div> </fieldset> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> <i class="fa fa-eye"></i> Validate </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </div> <!-- WIDGET ROW END --> </div> <!-- end row --> </section> <!-- end widget grid --> </div> <!-- END MAIN CONTENT --> @section pagespecific { <script src="/Scripts/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script> <script type="text/javascript"> $(document).ready(function() { /* DO NOT REMOVE : GLOBAL FUNCTIONS! * * pageSetUp(); WILL CALL THE FOLLOWING FUNCTIONS * * // activate tooltips * $("[rel=tooltip]").tooltip(); * * // activate popovers * $("[rel=popover]").popover(); * * // activate popovers with hover states * $("[rel=popover-hover]").popover({ trigger: "hover" }); * * // activate inline charts * runAllCharts(); * * // setup widgets * setup_widgets_desktop(); * * // run form elements * runAllForms(); * ******************************** * * pageSetUp() is needed whenever you load a page. * It initializes and checks for all basic elements of the page * and makes rendering easier. * */ //pageSetUp(); /* * ALL PAGE RELATED SCRIPTS CAN GO BELOW HERE * eg alert("my home function"); * * var pagefunction = function() { * ... * } * loadScript("js/plugin/_PLUGIN_NAME_.js", pagefunction); * * TO LOAD A SCRIPT: * var pagefunction = function (){ * loadScript(".../plugin.js", run_after_loaded); * } * * OR * * loadScript(".../plugin.js", run_after_loaded); */ // pagefunction // clears the variable if left blank // movie form $('#movieForm').bootstrapValidator({ feedbackIcons : { valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : { title : { group : '.col-md-8', validators : { notEmpty : { message : 'The title is required' }, stringLength : { max : 200, message : 'The title must be less than 200 characters long' } } }, genre : { group : '.col-md-4', validators : { notEmpty : { message : 'The genre is required' } } }, director : { group : '.col-md-4', validators : { notEmpty : { message : 'The director name is required' }, stringLength : { max : 80, message : 'The director name must be less than 80 characters long' } } }, writer : { group : '.col-md-4', validators : { notEmpty : { message : 'The writer name is required' }, stringLength : { max : 80, message : 'The writer name must be less than 80 characters long' } } }, producer : { group : '.col-md-4', validators : { notEmpty : { message : 'The producer name is required' }, stringLength : { max : 80, message : 'The producer name must be less than 80 characters long' } } }, website : { group : '.col-md-6', validators : { notEmpty : { message : 'The website address is required' }, uri : { message : 'The website address is not valid' } } }, trailer : { group : '.col-md-6', validators : { notEmpty : { message : 'The trailer link is required' }, uri : { message : 'The trailer link is not valid' } } }, review : { // The group will be set as default (.form-group) validators : { stringLength : { max : 500, message : 'The review must be less than 500 characters long' } } }, rating : { // The group will be set as default (.form-group) validators : { notEmpty : { message : 'The rating is required' } } } } }); // end movie form // toggle form $('#togglingForm').bootstrapValidator({ feedbackIcons : { valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : { firstName : { validators : { notEmpty : { message : 'The first name is required' } } }, lastName : { validators : { notEmpty : { message : 'The last name is required' } } }, company : { validators : { notEmpty : { message : 'The company name is required' } } }, // These fields will be validated when being visible job : { validators : { notEmpty : { message : 'The job title is required' } } }, department : { validators : { notEmpty : { message : 'The department name is required' } } }, mobilePhone : { validators : { notEmpty : { message : 'The mobile phone number is required' }, digits : { message : 'The mobile phone number is not valid' } } }, // These fields will be validated when being visible homePhone : { validators : { digits : { message : 'The home phone number is not valid' } } }, officePhone : { validators : { digits : { message : 'The office phone number is not valid' } } } } }).find('button[data-toggle]').on('click', function() { var $target = $($(this).attr('data-toggle')); // Show or hide the additional fields // They will or will not be validated based on their visibilities $target.toggle(); if (!$target.is(':visible')) { // Enable the submit buttons in case additional fields are not valid $('#togglingForm').data('bootstrapValidator').disableSubmitButtons(false); } }); // end toggle form // button group form $('#buttonGroupForm').bootstrapValidator({ excluded : ':disabled', feedbackIcons : { valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : { gender : { validators : { notEmpty : { message : 'The gender is required' } } }, 'languages[]' : { validators : { choice : { min : 1, max : 2, message : 'Please choose 1 - 2 languages you can speak' } } } } }); // end button group form // product form $('#productForm').bootstrapValidator({ feedbackIcons : { valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : { price : { validators : { notEmpty : { message : 'The price is required' }, numeric : { message : 'The price must be a number' } } }, amount : { validators : { notEmpty : { message : 'The amount is required' }, numeric : { message : 'The amount must be a number' } } }, color : { validators : { notEmpty : { message : 'The color is required' } } }, size : { validators : { notEmpty : { message : 'The size is required' } } } } }); // end product form // profile form $('#profileForm').bootstrapValidator({ feedbackIcons : { valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : { email : { validators : { notEmpty : { message : 'The email address is required' }, emailAddress : { message : 'The email address is not valid' } } }, password : { validators : { notEmpty : { message : 'The password is required' } } } } }); // end profile form //attributeForm $('#attributeForm').bootstrapValidator(); // end attributeForm // contactForm $('#contactForm').bootstrapValidator({ container : '#messages', feedbackIcons : { valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : { fullName : { validators : { notEmpty : { message : 'The full name is required and cannot be empty' } } }, email : { validators : { notEmpty : { message : 'The email address is required and cannot be empty' }, emailAddress : { message : 'The email address is not valid' } } }, title : { validators : { notEmpty : { message : 'The title is required and cannot be empty' }, stringLength : { max : 100, message : 'The title must be less than 100 characters long' } } }, content : { validators : { notEmpty : { message : 'The content is required and cannot be empty' }, stringLength : { max : 500, message : 'The content must be less than 500 characters long' } } } } }); // end contactForm }) </script> }
the_stack
@{ ViewData["Title"] = "区域管理-列表"; Layout = "~/Views/Shared/_Index.cshtml"; } <section id="page-title"> <h1 class="title pull-left"> <div class="page-icon"> <i class="fa fa-users"></i> </div> 区域管理 </h1> <ul class="breadcrumb pull-left"> <li><a href="/User"><i class="fa fa-home"></i> 首页</a></li> <li class="active">区域</li> </ul> <div class="clearfix"></div> </section> <section id="page-content"> <!-- Ajax Error --> <div class="alert alert-danger ajax-error" style="display:none"> <p><strong>错误</strong></p> <span class="ajax-error-message"></span> </div> <div class="row"> <div class="col-md-2"> @*<div id="zone-feature" class="zone-instance can-configure"> <div class="zone-content"> <div class="block-content"> <div class="panel panel-block"> <div class="panel-heading"> <div id="upGroupType"> <input type="hidden" name="fRootGroupId" id="hfRootGroupId" /> <input type="hidden" name="fInitialGroupParentIds" id="hfInitialGroupParentIds" /> <input type="hidden" name="fSelectedGroupId" id="hfSelectedGroupId" value="0" /> <div class="treeview js-grouptreeview"> <div class="treeview-scroll scroll-container scroll-container-horizontal"> <div class="viewport"> <div class="overview"> <div class="panel-body treeview-frame"> <div id="pnlTreeviewContent"> </div> </div> </div> </div> <div class="scrollbar"> <div class="track"> <div class="thumb"> <div class="end"></div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div>*@ <div class="west-Panel"> <div class="panel-Title">目录信息</div> <div id="itemTree"></div> </div> </div> <div class="col-md-10"> <div id="zone-feature" class="zone-instance can-configure"> <div class="zone-content"> <div class="block-content"> <div class="panel panel-block"> <div class="panel-heading"> <div class="pull-left"> <table> <tr> <td style="padding-left: 2px;"> <input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;" /> </td> <td style="padding-left: 5px;"> <a id="btn_Search" class="btn btn-primary"><i class="fa fa-search"></i>&nbsp;查询</a> </td> </tr> </table> </div> <div class="grid-actions pull-right"> <a title="刷新" class="btn btn-default" onclick="SF.utility.reload();"><i class="fa fa-refresh"></i></a> <a title="新增" class="btn-add btn btn-default btn-sm" onclick="btn_add()"><i class="fa fa-plus-circle"></i></a> <a title="编辑" class="btn-add btn btn-default btn-sm" onclick="btn_edit()"><i class="fa fa-edit"></i></a> <a title="删除" class="btn btn-default" onclick="btn_delete()"><i class="fa fa-trash-o"></i></a> <a title="详细" class="btn btn-default" onclick="btn_detail()"><i class="fa fa-list-alt"></i></a> </div> </div> <div class="panel-body"> <div class="grid grid-panel"> <div class="table-responsive"> <div class="gridPanel"> <table id="gridTable"></table> <div id="gridPager"></div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </section> <script> //加载树 var AreaCode = 0; var FixedHeight = 130.5; var FixedGridHeight = 180.5; $(function () { InitialPage(); GetGrid(); GetTree(); }); //初始化页面 function InitialPage() { //resize重设(表格、树形)宽高 $(window).resize(function (e) { window.setTimeout(function () { $('#gridTable').setGridWidth(($('.gridPanel').width())); $("#gridTable").setGridHeight($(window).height() -FixedGridHeight); }, 200); e.stopPropagation(); }); } function LoadTree() { var scrollbCategory = $('#pnlTreeviewContent').closest('.treeview-scroll'); scrollbCategory.tinyscrollbar({ sizethumb: 10, size: $(window).height() - FixedHeight+40 }); var $selectedId = $('#hfSelectedGroupId'), $expandedIds = $('#hfInitialGroupParentIds'); $('#pnlTreeviewContent') .on('sfTree:selected', function (e, id) { AreaCode = id; //已选的字典分类名称 //$("#titleinfo").html(_itemName + "(" + _itemId + ")"); $("#txt_Keyword").val(""); $('#btn_Search').trigger("click"); }) .on('sfTree:rendered', function () { // update viewport height SF.utility.resizeScrollbarWithWinHeight(scrollbCategory, $(window).height() - FixedHeight); }) .sfTree({ restUrl: '/Api/Area/GetChildren/', restParams: '?rootAreaId=' + ($('#hfRootGroupId').val() || 0), multiSelect: false, selectedIds: $selectedId.val() ? $selectedId.val().split(',') : null, expandedIds: $expandedIds.val() ? $expandedIds.val().split(',') : null }); $(window).resize(function (e) { SF.utility.resizeScrollbarWithWinHeight(scrollbCategory, $(window).height() - FixedHeight); }); } function GetTree() { var item = { height: $(window).height() - 52, url: "/Api/Area/GetTreeJson", onnodeclick: function (item) { AreaCode = item.id; //展开下级 $(".bbit-tree-selected").children('.bbit-tree-ec-icon').trigger("click"); $('#btn_Search').trigger("click"); }, }; //初始化 $("#itemTree").treeview(item); } //加载表格 function GetGrid() { var selectedRowIndex = 0; var $gridTable = $("#gridTable"); $gridTable.jqGrid({ url: "/Api/Area/GetListJson", datatype: "json", height: $(window).height() -FixedGridHeight, autowidth: true, colModel: [ { label: '主键', name: 'Id', hidden: true }, { label: '编号', name: 'AreaCode', index: 'AreaCode', width: 100, align: 'left' }, { label: '名称', name: 'AreaName', index: 'AreaName', width: 300, align: 'left' }, { label: '简拼', name: 'SimpleSpelling', index: 'SimpleSpelling', width: 100, align: 'left' }, { label: '级', name: 'Layer', index: 'Layer', width: 50, align: 'center' }, { label: "有效", name: "EnabledMark", index: "EnabledMark", width: 50, align: "center", formatter: function (cellvalue, options, rowObject) { return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>"; } }, { label: "备注", name: "Description", index: "Description", width: 200, align: "left" } ], rowNum: "10000", rownumbers: true, onSelectRow: function () { selectedRowIndex = $("#" + this.id).getGridParam('selrow'); }, gridComplete: function () { $("#" + this.id).setSelection(selectedRowIndex, false); } }); //查询事件 $("#btn_Search").click(function () { $gridTable.jqGrid('setGridParam', { postData: { value: AreaCode, keyword: $("#txt_Keyword").val() }, }).trigger('reloadGrid'); }); } //新增 function btn_add() { var AreaId = AreaCode; SF.utility.dialogOpen({ id: "Form", title: '添加区域', url: '/Area/Form?parentId=' + AreaId, width: "800px", height: "500px", callBack: function (iframeId) { top.frames[iframeId].AcceptClick("POST"); } }); }; //编辑 function btn_edit() { var keyValue = $("#gridTable").jqGridRowValue("Id"); if (SF.utility.checkedRow(keyValue)) { SF.utility.dialogOpen({ id: "Form", title: '编辑区域', url: '/Area/Form?keyValue=' + keyValue, width: "800px", height: "500px", callBack: function (iframeId) { top.frames[iframeId].AcceptClick("PUT"); } }); } } //删除 function btn_delete() { var keyValue = $("#gridTable").jqGridRowValue("Id"); if (keyValue) { SF.utility.removeForm({ type: "DELETE", url: "/Api/Area/" + keyValue, success: function (data) { $("#gridTable").resetSelection(); $("#gridTable").trigger("reloadGrid"); } }) } else { SF.utility.dialogMsg('请选择需要删除的区域!', 0); } } //详细 function btn_detail() { var keyValue = $("#gridTable").jqGridRowValue("Id"); if (SF.utility.checkedRow(keyValue)) { SF.utility.dialogOpen({ id: "Detail", title: '区域信息', url: '/Area/Detail?keyValue=' + keyValue, width: "800px", height: "500px", btn: null }); } } </script>
the_stack
@model SmartAdmin.Domain.Models.Customer @{ ViewData["Title"] = "客户信息"; ViewData["PageName"] = "customers_index"; ViewData["Heading"] = "<i class='fal fa-window text-primary'></i> 客户信息"; ViewData["Category1"] = "组织架构"; ViewData["PageDescription"] = ""; } <div class="row"> <div class="col-lg-12 col-xl-12"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> 客户信息 </h2> <div class="panel-toolbar"> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"><i class="fal fa-window-minimize"></i></button> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"><i class="fal fa-expand"></i></button> </div> </div> <div class="panel-container enable-loader show"> <div class="loader"><i class="fal fa-spinner-third fa-spin-4x fs-xxl"></i></div> <div class="panel-content py-2 rounded-bottom border-faded border-left-0 border-right-0 text-muted bg-subtlelight-fade "> <div class="row no-gutters align-items-center"> <div class="col"> <!-- 开启授权控制请参考 @@if (Html.IsAuthorize("Create") --> <div class="btn-group btn-group-sm"> <button onclick="appendItem()" class="btn btn-default"> <span class="fal fa-plus mr-1"></span> 新增 </button> </div> <div class="btn-group btn-group-sm"> <button name="deletebutton" disabled onclick="removeItem()" class="btn btn-default"> <span class="fal fa-times mr-1"></span> 删除 </button> </div> <div class="btn-group btn-group-sm"> <button name="savebutton" disabled onclick="acceptChanges()" class="btn btn-default"> <span class="fal fa-save mr-1"></span> 保存 </button> </div> <div class="btn-group btn-group-sm"> <button name="cancelbutton" disabled onclick="rejectChanges()" class="btn btn-default"> <span class="fal fa-ban mr-1"></span> 取消 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="reload()" class="btn btn-default"> <span class="fal fa-search mr-1"></span> 查询 </button> <button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="sr-only">Toggle Dropdown</span> </button> <div class="dropdown-menu dropdown-menu-animated"> <a class="dropdown-item js-waves-on" href="javascript:void()"> 我的记录 </a> <div class="dropdown-divider"></div> <a class="dropdown-item js-waves-on" href="javascript:void()"> 自定义查询 </a> </div> </div> <div class="btn-group btn-group-sm hidden-xs"> <button type="button" onclick="importExcel.upload()" class="btn btn-default"><span class="fal fa-cloud-upload mr-1"></span> 导入 </button> <button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split waves-effect waves-themed" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="sr-only">Toggle Dropdown</span> </button> <div class="dropdown-menu dropdown-menu-animated"> <a class="dropdown-item js-waves-on" href="javascript:importExcel.downloadtemplate()"> <span class="fal fa-download"></span> 下载模板 </a> </div> </div> <div class="btn-group btn-group-sm hidden-xs"> <button onclick="exportExcel()" class="btn btn-default"> <span class="fal fa-file-export mr-1"></span> 导出 </button> </div> </div> </div> </div> <div class="panel-content"> <div class="table-responsive"> <table id="customers_datagrid"> </table> </div> </div> </div> </div> </div> </div> <!--Customer Edit Modal --> <div class="modal fade" id="customer-modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title"> Customer Information <small class="m-0 text-muted"> </small> </h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true"><i class="fal fa-times"></i></span> </button> </div> <div class="modal-body"> <div class="panel-container show"> <div class="panel-content"> <partial name="AddOrEdit" /> </div> </div> </div> </div> </div> </div> @await Component.InvokeAsync("ImportExcel", new ImportExcelOptions { entity = "Customer", folder = "Customers", url = "/Customers", tpl = "Customer.xlsx" }) @section HeadBlock { <link href="~/css/formplugins/bootstrap-daterangepicker/bootstrap-daterangepicker.css" rel="stylesheet" asp-append-version="true" /> <link href="~/js/easyui/themes/insdep/easyui.css" rel="stylesheet" asp-append-version="true" /> } @section ScriptsBlock { <script src="~/js/plugin/jquery.validation/jquery.validate.js" asp-append-version="true"></script> <script src="~/js/plugin/jquery.validation/jquery.validate.unobtrusive.js" asp-append-version="true"></script> <script src="~/js/plugin/jquery.form.binding/jquery-json-form-binding.js" asp-append-version="true"></script> <script src="~/js/dependency/numeral/numeral.min.js" asp-append-version="true"></script> <script src="~/js/dependency/moment/moment.js" asp-append-version="true"></script> <script src="~/js/formplugins/bootstrap-daterangepicker/bootstrap-daterangepicker.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.min.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/datagrid-filter.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/columns-ext.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/columns-reset.js" asp-append-version="true"></script> <script src="~/js/easyui/locale/easyui-lang-zh_CN.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.component.js" asp-append-version="true"></script> <script src="~/js/plugin/filesaver/FileSaver.js" asp-append-version="true"></script> <script src="~/js/plugin/jquery.serializejson/jquery.serializejson.js" asp-append-version="true"></script> <script src="~/js/jquery.custom.extend.js" asp-append-version="true"></script> <script src="~/js/jquery.extend.formatter.js" asp-append-version="true"></script> <script> //全屏事件 document.addEventListener('panel.onfullscreen', () => { $dg.treegrid('resize'); }); var $dg = $('#customers_datagrid'); var EDITINLINE = false; var customer = null; var editIndex = undefined; //下载Excel导入模板 //执行导出下载Excel function exportExcel() { const filterRules = JSON.stringify($dg.datagrid('options').filterRules); console.log(filterRules); $.messager.progress({ title: '请等待', msg: '正在执行导出...' }); let formData = new FormData(); formData.append('filterRules', filterRules); formData.append('sort', 'Id'); formData.append('order', 'asc'); $.postDownload('/Customers/ExportExcel', formData).then(res => { $.messager.progress('close'); toastr.success('导出成功!'); }).catch(err => { //console.log(err); $.messager.progress('close'); $.messager.alert('导出失败', err.statusText, 'error'); }); } //弹出明细信息 function showDetailsWindow(id, index) { const customer = $dg.datagrid('getRows')[index]; openCustomerDetailWindow(customer, 'Modified'); } function reload() { $dg.datagrid('uncheckAll'); $dg.datagrid('reload'); } //新增记录 function appendItem() { customer = { Id:null, Name: '', PhoneNumber:'', Contect:'', Address: '-' }; if (!EDITINLINE) { //弹出新增窗口 openCustomerDetailWindow(customer, 'Added'); } else { if (endEditing()) { //对必填字段进行默认值初始化 $dg.datagrid('insertRow', { index: 0, row: customer }); editIndex = 0; $dg.datagrid('selectRow', editIndex) .datagrid('beginEdit', editIndex); hook = true; } } } //删除编辑的行 function removeItem() { if (this.$dg.datagrid('getChecked').length <= 0 && EDITINLINE) { if (editIndex !== undefined) { const delindex = editIndex; $dg.datagrid('cancelEdit', delindex) .datagrid('deleteRow', delindex); hook = true; $("button[name*='savebutton']").prop('disabled', false); $("button[name*='cancelbutton']").prop('disabled', false); } else { const rows = $dg.datagrid('getChecked'); rows.slice().reverse().forEach(row => { const rowindex = $dg.datagrid('getRowIndex', row); $dg.datagrid('deleteRow', rowindex); hook = true; }); } } else { deleteChecked(); } } //删除选中的行 function deleteChecked() { const checked = $dg.datagrid('getChecked').filter(item => item.Id != null && item.Id > 0).map(item => { return item.Id; });; if (checked.length > 0) { deleteRows(checked); } else { $.messager.alert('提示', '请先选择要删除的记录!', 'question'); } } //执行删除 function deleteRows(selected) { $.messager.confirm('确认', `你确定要删除这 <span class='badge badge-icon position-relative'>${selected.length} </span> 行记录?`, result => { if (result) { $.post('/Customers/DeleteChecked', { id: selected }) .done(response => { if (response.success) { toastr.error(`成功删除 [${selected.length}] 行记录`); reload(); } else { $.messager.alert('错误', response.err, 'error'); } }) .fail((jqXHR, textStatus, errorThrown) => { $.messager.alert('异常', `${jqXHR.status}: ${jqXHR.statusText} `, 'error'); }); } }); } //开启编辑状态 function onClickCell(index, field) { customer = $dg.datagrid('getRows')[index]; const _actions = ['action', 'ck']; if (!EDITINLINE || $.inArray(field, _actions) >= 0) { return; } if (editIndex !== index) { if (endEditing()) { $dg.datagrid('selectRow', index) .datagrid('beginEdit', index); hook = true; editIndex = index; const ed = $dg.datagrid('getEditor', { index: index, field: field }); if (ed) { ($(ed.target).data('textbox') ? $(ed.target).textbox('textbox') : $(ed.target)).focus(); } } else { $dg.datagrid('selectRow', editIndex); } } } //关闭编辑状态 function endEditing() { if (editIndex === undefined) { return true; } if (this.$dg.datagrid('validateRow', editIndex)) { $dg.datagrid('endEdit', editIndex); return true; } else { const invalidinput = $('input.validatebox-invalid', $dg.datagrid('getPanel')); const fieldnames = invalidinput.map((index, item) => { return $(item).attr('placeholder') || $(item).attr('id'); }); $.messager.alert('提示', `${Array.from(fieldnames)} 输入有误.`, 'error'); return false; } } //提交保存后台数据库 function acceptChanges() { if (endEditing()) { if ($dg.datagrid('getChanges').length > 0) { const inserted = $dg.datagrid('getChanges', 'inserted').map(item => { item.TrackingState = 1; return item; }); const updated = $dg.datagrid('getChanges', 'updated').map(item => { item.TrackingState = 2 return item; }); const deleted = $dg.datagrid('getChanges', 'deleted').map(item => { item.TrackingState = 3 return item; }); //过滤已删除的重复项 const changed = inserted.concat(updated.filter(item => { return !deleted.includes(item); })).concat(deleted); //$.messager.progress({ title: '请等待', msg: '正在保存数据...', interval: 200 }); $.post('/Customers/AcceptChanges', { customers: changed }) .done(response => { //$.messager.progress('close'); //console.log(response); if (response.success) { toastr.success('保存成功'); $dg.datagrid('acceptChanges'); reload(); hook = false; } else { $.messager.alert('错误', response.err, 'error'); } }) .fail((jqXHR, textStatus, errorThrown) => { //$.messager.progress('close'); $.messager.alert('异常', `${jqXHR.status}: ${jqXHR.statusText} `, 'error'); }); } } } function rejectChanges() { $dg.datagrid('rejectChanges'); editIndex = undefined; hook = false; } $(document).ready(function () { //定义datagrid结构 $dg.datagrid({ rownumbers: true, checkOnSelect: false, selectOnCheck: false, idField: 'Id', sortName: 'Id', sortOrder: 'desc', remoteFilter: true, singleSelect: true, method: 'post', onClickCell: onClickCell, clientPaging: false, pagination: true, striped: true, height: 670, pageSize: 15, pageList: [15, 20, 50, 100, 500, 2000], filterRules: [], onBeforeLoad: function () { $('.enable-loader').removeClass('enable-loader') }, onLoadSuccess: function (data) { editIndex = undefined; $("button[name*='deletebutton']").prop('disabled', true); $("button[name*='savebutton']").prop('disabled', true); $("button[name*='cancelbutton']").prop('disabled', true); }, onCheckAll: function (rows) { if (rows.length > 0) { $("button[name*='deletebutton']").prop('disabled', false); } }, onUncheckAll: function () { $("button[name*='deletebutton']").prop('disabled', true); }, onCheck: function () { $("button[name*='deletebutton']").prop('disabled', false); }, onUncheck: function () { const checked = $(this).datagrid('getChecked').length > 0; $("button[name*='deletebutton']").prop('disabled', !checked); }, onSelect: function (index, row) { customer = row; }, onBeginEdit: function (index, row) { //const editors = $(this).datagrid('getEditors', index); }, onEndEdit: function (index, row) { editIndex = undefined; }, onBeforeEdit: function (index, row) { editIndex = index; row.editing = true; $("button[name*='deletebutton']").prop('disabled', false); $("button[name*='cancelbutton']").prop('disabled', false); $("button[name*='savebutton']").prop('disabled', false); $(this).datagrid('refreshRow', index); }, onAfterEdit: function (index, row) { row.editing = false; editIndex = undefined; $(this).datagrid('refreshRow', index); }, onCancelEdit: function (index, row) { row.editing = false; editIndex = undefined; $("button[name*='deletebutton']").prop('disabled', true); $("button[name*='savebutton']").prop('disabled', true); $("button[name*='cancelbutton']").prop('disabled', true); $(this).datagrid('refreshRow', index); }, frozenColumns: [[ /*开启CheckBox选择功能*/ { field: 'ck', checkbox: true }, { field: 'action', title: '操作', width: 85, sortable: false, resizable: true, formatter: function showdetailsformatter(value, row, index) { if (!row.editing) { return `<div class="btn-group">\ <button onclick="showDetailsWindow('${row.Id}', ${index})" class="btn btn-primary btn-sm btn-icon waves-effect waves-themed" title="查看明细" ><i class="fal fa-edit"></i> </button>\ <button onclick="deleteRows(['${row.Id}'],${index})" class="btn btn-primary btn-sm btn-icon waves-effect waves-themed" title="删除记录" ><i class="fal fa-times"></i> </button>\ </div>`; } else { return `<button class="btn btn-primary btn-sm btn-icon waves-effect waves-themed" disabled title="查看明细" ><i class="fal fa-edit"></i> </button>`; } } } ]], columns: [[ { /*名称*/ field: 'Name', title: '@Html.DisplayNameFor(model => model.Name)', width: 200, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.Name)', required: true, validType: 'length[0,128]' } }, sortable: true, resizable: true }, { /*联系人*/ field: 'Contect', title: '@Html.DisplayNameFor(model => model.Contect)', width: 120, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.Contect)', required: true, validType: 'length[0,12]' } }, sortable: true, resizable: true }, { /*电话*/ field: 'PhoneNumber', title: '@Html.DisplayNameFor(model => model.PhoneNumber)', width: 200, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.PhoneNumber)', required: false, validType: 'length[0,20]' } }, sortable: true, resizable: true }, { /*地址*/ field: 'Address', title: '@Html.DisplayNameFor(model => model.Address)', width: 120, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.Address)', required: false, validType: 'length[0,50]'} }, sortable: true, resizable: true, } ]] }) .datagrid('enableFilter', [ ]) .datagrid('load', '/Customers/GetData'); } ); function openCustomerDetailWindow(data) { const customerid = (data.Id || 0); console.log(data); $('#customer-modal').modal('toggle'); $('#customer-form').jsonToForm(data) } </script> }
the_stack
@using System.Text.RegularExpressions @using OJS.Common.Extensions @using OJS.Web.Areas.Contests.Controllers @using OJS.Workers.Common.Models @using Resource = Resources.Areas.Contests.Views.SubmissionsView @using AdministrationResource = Resources.Areas.Administration.AdministrationGeneral @model OJS.Web.Areas.Contests.ViewModels.Submissions.SubmissionDetailsViewModel @{ const string serverPathsRegexPattern = @"C:\\[^\s:]+\\"; var hrefToProblemSubmitPage = $"{Url.Action<CompeteController>(c => c.Index(Model.ContestId, Model.IsContestActive, null))}#{Model.ProblemIndexInContest}"; ViewBag.Title = string.Format(Resource.Title, Model.Id, Model.UserName); } @section styles { @Styles.Render("~/Content/CodeMirror/codemirror") @Styles.Render("~/Content/CodeMirror/codemirrormerge") } @section scripts { @Scripts.Render("~/bundles/codemirror") @Scripts.Render("~/bundles/codemirrormerge") <script type="text/javascript"> $(function () { var textEditor = document.getElementById('code'); if (textEditor) { var editor = new CodeMirror.fromTextArea(textEditor, { mode: "text/x-csharp", lineNumbers: true, matchBrackets: true, theme: "the-matrix", showCursorWhenSelecting: true, undoDepth: 100, lineWrapping: true, readOnly: true, autofocus: false }); editor.setSize('100%', '100%'); } }); </script> } <ol class="breadcrumb"> <li><a href="/">@Resource.Home</a></li> <li><a href="/Submissions">@Resource.Submissions</a></li> <li class="active">@Model.Id</li> </ol> <h2>@ViewBag.Title <a href="@hrefToProblemSubmitPage">@Model.ProblemName</a></h2> <div class="row'"> <a class="btn btn-sm btn-primary" href="#SourceCode">@Resource.View_code</a> @if (Model.UserHasAdminPermission) { @Html.ActionLink(Resource.Update, "Update", "Submissions", new { area = "Administration", id = Model.Id }, new { @class = "btn btn-sm btn-primary right-buffer-sm" }) @Html.ActionLink(Resource.Delete, "Delete", "Submissions", new { area = "Administration", id = Model.Id }, new { @class = "btn btn-sm btn-primary right-buffer-sm" }) @Html.ActionLink(Resource.Tests, "Problem", "Tests", new { area = "Administration", id = Model.ProblemId }, new { @class = "btn btn-sm btn-primary right-buffer-sm" }) @Html.ActionLink(Resource.Authors_profile, "Index", "Profile", new { area = "Users", id = Model.UserName }, new { @class = "btn btn-sm btn-primary right-buffer-sm" }) using (Html.BeginForm("Retest", "Submissions", new { area = "Administration" }, FormMethod.Post, new { @class = "inline-form", role = "form" })) { @Html.AntiForgeryToken() @Html.HiddenFor(m => m.Id) <input type="submit" class="btn btn-sm btn-primary" value=@Resource.Retest /> } } </div> @if (Model.UserHasAdminPermission) { <div class="clearfix"></div> if (!string.IsNullOrWhiteSpace(Model.ProcessingComment)) { <h2>@Resource.Execution_result:</h2> <pre>@Model.ProcessingComment</pre> } } @if (Model.IsDeleted) { <div class="alert alert-danger top-buffer">@Resource.Submission_is_deleted</div> } @if (!Model.Processed) { <div class="alert alert-info top-buffer">@Resource.Submission_in_queue</div> } else { if (!Model.IsCompiledSuccessfully) { <div class="alert alert-danger top-buffer">@Resource.Compile_time_error_occured</div> if (!string.IsNullOrWhiteSpace(Model.CompilerComment)) { <h2>@Resource.Compilation_result:</h2> var compilerComment = Model.UserHasAdminPermission ? Model.CompilerComment : Regex.Replace(Model.CompilerComment, serverPathsRegexPattern, "...\\"); <pre>@compilerComment</pre> } } else if (!Model.ShowResults) // Inform user that compilation is successful when not showing him all the test runs { <h2 class="text-success top-buffer">@Resource.Compiled_successfully</h2> } if (!Model.HasTestRuns && Model.IsCompiledSuccessfully && string.IsNullOrEmpty(Model.ProcessingComment) && Model.TotalTests > 0) { var message = @Html.Raw(string.Format(@Resource.User_retest_prompt, Model.Points, Model.MaxPoints)); <div class="alert alert-warning top-buffer"> <p>@message</p> </div> using (Html.BeginForm("Retest", "Submissions", new { area = "Administration" }, FormMethod.Post, new { @class = "inline-form", role = "form" })) { @Html.AntiForgeryToken() @Html.HiddenFor(m => m.Id) <input type="submit" class="btn btn-sm btn-primary" value=@Resource.Retest /> } } } @if (Model.Processed && (Model.ShowResults || Model.UserHasAdminPermission)) { foreach (var testResult in Model.TestRuns.OrderByDescending(x => x.IsTrialTest).ThenBy(x => x.Order)) { var className = string.Empty; var testResultText = string.Empty; if (testResult.ResultType == TestRunResultType.CorrectAnswer) { className = "text-success"; testResultText = Resource.Answer_correct; } else if (testResult.ResultType == TestRunResultType.WrongAnswer) { className = "text-danger"; testResultText = Resource.Answer_incorrect; } else if (testResult.ResultType == TestRunResultType.MemoryLimit) { className = "text-danger"; testResultText = Resource.Memory_limit; } else if (testResult.ResultType == TestRunResultType.TimeLimit) { className = "text-danger"; testResultText = Resource.Time_limit; } else if (testResult.ResultType == TestRunResultType.RunTimeError) { className = "text-danger"; testResultText = Resource.Runtime_error; } <h3 class="@className"> @if (testResult.IsTrialTest) { @($"{Resource.Zero_test}{testResult.Order}") } else { @($"{Resource.Test}{testResult.Order}") } (@testResultText) @if (Model.UserHasAdminPermission) { <small>@($"{Resource.Run}{testResult.Id}")</small> <small><a href="/Administration/Tests/Details/@testResult.TestId">@($"{Resource.Test}{testResult.TestId}")</a></small> } </h3> if (testResult.IsTrialTest) { <div>@Resource.Zero_tests_not_included_in_result</div> } var displayShowInputButton = Model.UserHasAdminPermission || (!testResult.HideInput && (testResult.IsTrialTest || testResult.IsOpenTest || Model.ShowDetailedFeedback)); var displayExecutionComment = !string.IsNullOrWhiteSpace(testResult.ExecutionComment) && (testResult.IsTrialTest || Model.UserHasAdminPermission || Model.ShowDetailedFeedback || testResult.IsOpenTest); var displayTryToSubmitAgainMessage = testResult.ResultType == TestRunResultType.WrongAnswer && string.IsNullOrEmpty(testResult.UserOutputFragment) && string.IsNullOrEmpty(testResult.ExecutionComment); if (displayTryToSubmitAgainMessage) { <div> <pre>@Resource.Try_submit_again_message_when_no_output</pre> </div> } if (displayExecutionComment) { var executionComment = testResult.ExecutionComment; var truncateFeedbackMessage = !Model.UserHasAdminPermission && !testResult.IsTrialTest && !Model.ShowDetailedFeedback && !testResult.IsOpenTest; if (truncateFeedbackMessage) { if (Model.SubmissionType.CompilerType == CompilerType.CSharp) { // The following code will hide the exception message from user when the code is written in C# var errorParts = executionComment.Split(':'); if (errorParts.Length >= 2) { executionComment = errorParts[0] + ":" + errorParts[1]; } else { executionComment = executionComment.MaxLengthWithEllipsis(37); } } else // Other language { executionComment = executionComment.MaxLengthWithEllipsis(64); } } <div class="diff"> @if (displayShowInputButton) { @(Ajax.ActionLink( Resource.Show_input_text, nameof(TestsController.GetInputData), "Tests", new { testId = testResult.TestId, submissionId = Model.Id }, new AjaxOptions { HttpMethod = "Get", InsertionMode = InsertionMode.Replace, UpdateTargetId = $"test-{testResult.TestId}-input-data", OnSuccess = "onTestInputDataSuccess", OnBegin = "preventDefaultIfLoadedOnce" }, new { id = $"test-{testResult.TestId}-input-data-btn", @class = "btn btn-primary btn-sm", data_test_id = testResult.TestId })) <div id="test-@(testResult.TestId)-input-data"></div> } <pre>@executionComment</pre> </div> } var displayCheckerComment = !string.IsNullOrWhiteSpace(testResult.CheckerComment) || testResult.ExpectedOutputFragment != null || testResult.UserOutputFragment != null; if (displayCheckerComment) { if (displayShowInputButton) { <div class="diff"> @if (!string.IsNullOrWhiteSpace(testResult.CheckerComment)) { <pre>@testResult.CheckerComment</pre> } @(Ajax.ActionLink( Resource.Show_input_text, nameof(TestsController.GetInputData), "Tests", new { testId = testResult.TestId, submissionId = Model.Id }, new AjaxOptions { HttpMethod = "Get", InsertionMode = InsertionMode.Replace, UpdateTargetId = $"test-{testResult.TestId}-input-data", OnSuccess = "onTestInputDataSuccess", OnBegin = "preventDefaultIfLoadedOnce" }, new { id = $"test-{testResult.TestId}-input-data-btn", @class = "btn btn-primary btn-sm", data_test_id = testResult.TestId })) <div id="test-@(testResult.TestId)-input-data"></div> @if (testResult.ExpectedOutputFragment != null || testResult.UserOutputFragment != null) { <div class="row top-buffer"> <div class="col-md-6">@Resource.Expected_output</div> <div class="col-md-6">@Resource.Your_output</div> </div> <div id="diff-@testResult.Id"></div> <script> $(function () { var diffContainer = document.getElementById('diff-@testResult.Id'); var mergeView = CodeMirror.MergeView(diffContainer, { origLeft: @Html.Raw(Json.Encode(testResult.ExpectedOutputFragment)) || '', value: @Html.Raw(Json.Encode(testResult.UserOutputFragment)) || '', mode: 'text/x-diff', lineNumbers: true, lockScroll: true, connect: 'align', theme: 'the-matrix', highlightDifferences: true, revertButtons: false, allowEditingOriginals: false, lineWrapping: true, collapseIdentical: false, readOnly: true, autofocus: false }); mergeView.left.gap.innerText = ''; }); </script> } </div> } } <div>@Resource.Time_used: @($"{testResult.TimeUsed / 1000.0:0.000}") s</div> <div>@Resource.Memory_used: @($"{testResult.MemoryUsed / 1024.0 / 1024.0:0.00}") MB</div> } } <h3 id="SourceCode">@Resource.Source_code</h3> @if (Model.IsBinaryFile) { <a class="btn btn-default" href="/Contests/Submissions/Download/@Model.Id">@Resource.Download_binary_file</a> } else { <textarea id="code">@Model.ContentAsString</textarea> } <p class="top-buffer">@AdministrationResource.Created_on: @Model.CreatedOn</p> @if (Model.UserHasAdminPermission) { <p>@AdministrationResource.Modified_on: @Model.ModifiedOn</p> } <script> function onTestInputDataSuccess() { $(this).text('@Resource.Hide_input_text'); $(this)[0].attributes['data-loaded'] = true; attachInputButtonEventHandlers(this); } function preventDefaultIfLoadedOnce(ev) { if ($(this)[0].attributes['data-loaded']) { ev.abort(); } } function attachInputButtonEventHandlers(button) { $(button).on('click', function(ev) { ev.preventDefault(); var testId = $(button)[0].attributes['data-test-id'].value; var $container = $($('#test-' + testId + '-input-data div:first-of-type')[0]); if ($container.hasClass('hidden')) { $container.removeClass('hidden'); $(button).text('@Resource.Hide_input_text'); } else { $container.addClass('hidden'); $(button).text('@Resource.Show_input_text'); } }); } </script>
the_stack
@model Xms.Web.Customize.Models.EditOptionSetModel <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-toggle="collapse" href="#collapseTwo"> <strong>@app.PrivilegeTree?.LastOrDefault().DisplayName</strong> </a> </h3> </div> <div id="collapseTwo" class="panel-collapse collapse in"> <div class="panel-body"> <form action="/@app.OrganizationUniqueName/customize/@app.ControllerName/@app.ActionName" method="post" id="editform" class="form-horizontal" role="form" data-autoreset="true"> @Html.AntiForgeryToken() @Html.ValidationSummary() @Html.HiddenFor(x => x.SolutionId) @Html.HiddenFor(x => x.OptionSetId) <div class="form-group col-sm-12"> @Html.LabelFor(x => x.Name, app.T["name"], new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> @Html.TextBoxFor(x => x.Name, new { @class = "form-control required" }) </div> </div> <div class="form-group col-sm-12"> <label class="col-sm-2 control-label" for="optionset-picklist">@app.T["option"]</label> <div class="col-sm-10"> <div class="btn-group btn-group-xs"> <button type="button" class="btn btn-primary" onclick="addOption('optionset-picklist')"> <span class="glyphicon glyphicon-plus-sign"></span> @app.T["add"] </button> <button type="button" class="btn btn-warning" onclick="clearOption('optionset-picklist')"> <span class="glyphicon glyphicon-trash"></span> @app.T["clear"] </button> </div> <div id="optionset-area"> <table id="optionset-picklist" class="table"> <thead> <tr> <th width="20"></th> <th>@app.T["displayname"]</th> <th>@app.T["value"]</th> <th>@app.T["selected_default"]</th> <th>@app.T["operation"]</th> </tr> </thead> <tbody> @foreach (var item in Model.Details) { <tr class="draggable-ui optionsetItems"> <td valign="middle"><span class="glyphicon glyphicon-hand-up draggable-icon" title="可拖动排序"></span></td> <td> <input onblur="CheckRepeat('optionsetname')" type="text" class="form-control input-sm required optionsetname" name="optionsetname" value="@item.Name" maxlength="50" /> <input type="hidden" name="detailid" data-type="guid" value="@item.OptionSetDetailId" /> </td> <td><input onblur="CheckRepeat('optionsetvalue')" type="text" class="form-control input-sm required optionsetvalue" name="optionsetvalue" data-type="int" value="@item.Value" /></td> <td> <input type="checkbox" onclick="$(this).next().val($(this).prop('checked'))" @(item.IsSelected ? "checked" : "") /> <input name="isselectedoption" type="hidden" value="@(item.IsSelected.ToString())" /> </td> <td> <button type="button" class="btn btn-warning btn-xs" onclick="removeOption('optionset-picklist', this)"> <span class="glyphicon glyphicon-trash"></span> </button> <button type="button" class="btn btn-info btn-xs" onclick="moveOption('optionset-picklist', this, true)"> <span class="glyphicon glyphicon-arrow-up"></span> </button> <button type="button" class="btn btn-info btn-xs" onclick="moveOption('optionset-picklist', this, false)"> <span class="glyphicon glyphicon-arrow-down"></span> </button> </td> </tr> } </tbody> </table> </div> </div> </div> <div class="form-group col-sm-12 text-center" id="form-buttons"> <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-saved"></span> 保存</button> <button type="reset" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> 重置</button> </div> </form> </div> </div> </div> @section Scripts { <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.core.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.widget.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.mouse.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.sortable.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery.form.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-validate/jquery.validate.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-validate/localization/messages_zh.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script> $(function () { Xms.Web.fullByContext($(window), $('#renderBody'), -80) Xms.Web.fullByContext($(window),$('#optionset-area'),-270,0,'max-height') //表单验证 Xms.Web.Form($("#editform"), null, null, function () { var nameCheck = CheckRepeat('optionsetname'); var valueCheck = CheckRepeat('optionsetvalue'); if (!nameCheck || !valueCheck) { return false; } }); //选项集 Xms.Web.SingleCheckbox('#optionset-picklist', 'input[type=checkbox]', 'single'); $('#optionset-picklist').sortable({ cancel: 'input', items: ".draggable-ui", //placeholder: "drag-placeholder", over: function (event, ui) { // if (!ui.item.is('.cell')) return; var parent = $(event.target); }, out: function (event, ui) { // if (!ui.item.is('.cell')) return; var parent = $(event.target); }, start: function (event, ui) { console.log(event); if (event.target && event.target.nodeType && event.target.nodeType == 'Tr') { } }, update: function (event, ui) { }, stop: function (event, ui) { //return false; } }).disableSelection(); $('#renderBody').css({ 'margin-bottom': 40 }); }); //选项集-增加选项 function addOption(id, row) { var $target = $("#" + id); var newRow = row ? row.clone() : $target.find('tr:last').clone(); newRow.find('input[type=text]').val(''); newRow.find('input[type=hidden]').val(false); newRow.find('input[name=detailid]').val(Xms.Utility.Guid.EmptyGuid.ToString()); newRow.find('input[type=checkbox]').prop('checked', false); $target.append(newRow); } //选项集-删除选项 function removeOption(id, row) { var $target = $("#" + id); if ($(row).parents('tr').siblings().length > 0) { $(row).parents('tr').remove(); } else { var newRow = $(row).parents('tr'); $target.find('tbody').empty(); addOption(id, newRow); } } //选项集-清空选项 function clearOption(id) { var $target = $("#" + id); $target.find('tbody').find('tr:gt(0)').remove(); var newRow = $target.find('tbody').find('tr:last'); $target.find('tbody').empty(); addOption(id, newRow); } //选项集-排序选项 function moveOption(id, row, isup) { var $target = $("#" + id); var $this = $(row).parents('tr'); if (isup == true && $this.prev().length > 0) { $this.insertBefore($this.prev()); } else if (isup == false && $this.next().length > 0) { $this.insertAfter($this.next()); } } //检查是否有重复的值 function CheckRepeat(classname) { var check = true; $('.' + classname).each(function (i, n) { var nVal = $(n).val(); var ncheck = true; if (nVal == '') { return true; } $('.' + classname).each(function (ii, nn) { var nnVal = $(nn).val(); if (nnVal == '') { return true; } if (nVal == nnVal && i != ii) { if ($(n).next('label[name="repeatTip"]').length == 0) { $('<label name="repeatTip">不能输入重复的值</label>').insertAfter($(n)); } ncheck = false; check = false; return false; } }); if (ncheck == true) { $(n).next('label[name="repeatTip"]').remove(); } }); return check; } </script> }
the_stack
@{ ViewData["Title"] = "任务调度管理"; } <section class="content-header"> <h1> 任务调度管理 <!-- <small>Control panel</small>--> </h1> <!-- <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> <li class="active">Dashboard</li> </ol>--> </section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-lg-12"> <div class="text-right"> <a class="btn btn-info " data-toggle="modal" data-target="#modalAdd" onclick="resertForm();">添加任务</a> </div> <p></p> </div> </div> <table class="table display dataTable" id="js_table"> <thead> <tr> <th style="text-align:center">任务名称</th> <th style="text-align:center">任务组</th> <th style="text-align:center">触发器类型</th> <th style="text-align:center">url</th> <th style="text-align:center">时间表达式</th> <th style="text-align:center">执行次数</th> <th style="text-align:center">间隔时间(秒)</th> <th style="text-align:center">状态</th> <th style="text-align:center">程序集</th> <th style="text-align:center">IJob实现类</th> <th style="text-align:center">开始时间</th> <th style="text-align:center">结束时间</th> @*<th style="text-align:center">任务描述</th>*@ <th style="text-align:center">操作</th> </tr> </thead> <tbody></tbody> </table> </section> <div class="modal" id="modalAdd" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <form role="form" id="frm"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">添加任务</h4> <input type="hidden" id="jobId" name="JobId" value="" /> </div> <div class="modal-body"> <div class="form-group"> <label for="JobName">任务名称</label> <input type="text" class="form-control" id="jobName" name="JobName" placeholder="请输入名称"> </div> <div class="form-group"> <label for="JobGroup">任务组</label> <input type="text" class="form-control" id="jobGroup" name="JobGroup" placeholder="请输入名称"> </div> <div class="form-group"> <label for="TriggerType">触发器类型</label> <select id="triggerType" name="TriggerType" class="form-control"> <option value="0">simple</option> <option value="1">cron </option> </select> </div> <div class="form-group"> <label for="Url">url</label> <input type="text" class="form-control" id="url" name="Url" placeholder="请输入名称"> </div> <div class="form-group" id="cron-div" style="display:none"> <label for="Cron">执行周期表达式</label> <input type="text" class="form-control" id="cron" name="Cron" placeholder="请输入名称"> </div> <div class="form-group"> <label for="BeginTime">开始时间</label> <input type="text" class="form-control" id="beginTime" name="BeginTime" placeholder="请选择开始时间"> </div> <div class="form-group"> <label for="EndTime">结束时间</label> <input type="text" class="form-control" id="endTime" name="EndTime" placeholder="请选择结束时间"> </div> <div class="form-group" id="runTimes-div"> <label for="RunTimes">执行次数(0不限制次数)</label> <input type="text" class="form-control" id="runTimes" name="RunTimes" placeholder="请输入执行次数"> </div> <div class="form-group" id="IntervalSecond-div"> <label for="IntervalSecond">执行间隔时间(秒为单位)</label> <input type="text" class="form-control" id="intervalSecond" name="IntervalSecond" placeholder="请输入执行间隔"> </div> <div class="form-group"> <label for="IntervalSecond">程序集</label> <input type="text" class="form-control" id="assemblyName" name="AssemblyName" placeholder="请输入程序集"> </div> <div class="form-group"> <label for="IntervalSecond">IJob的实现类</label> <input type="text" class="form-control" id="insideClass" name="ClassName" placeholder="请输入IJob实现类"> </div> <div class="form-group"> <label for="Remark">任务描述</label> <input type="text" class="form-control" id="remark" name="Remark" placeholder="请输入描述"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">取消</button> <button type="submit" id="save" class="btn btn-primary">保存</button> </div> </form> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div> <div class="modal fade" id="delcfmOverhaul"> <div class="modal-dialog"> <div class="modal-content message_align"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title">提示</h4> </div> <div class="modal-body"> <p>您确认要删除该条信息吗?</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"> 取消 </button> <button type="button" class="btn btn-primary" id="deleteHaulBtn"> 确认 </button> </div> </div> </div> </div> <link href="~/plugin/datatables/css/jquery.dataTables.css" rel="stylesheet" /> <link href="~/plugin/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" /> <script src="~/lib/jquery/dist/jquery.min.js"></script> <script src="~/plugin/datatables/js/jquery.dataTables.js"></script> <script src="~/plugin/datatables/js/dataTables.bootstrap.js"></script> <script src="~/plugin/jquery-validate/jquery.validate.min.js"></script> <script src="~/plugin/jquery-validate/localization/messages_zh-CN.min.js"></script> <script src="~/plugin/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script> <script src="~/plugin/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script> <script src="~/js/signalr.js"></script> <script src="~/js/site.js"></script> <script> $(document).ready(function () { $("#beginTime,#endTime").datetimepicker({ format: 'yyyy-mm-dd hh:ii', language: 'zh-CN', autoclose: true, todayBtn: true, pickerPosition: "bottom-left", startDate: new Date() }); //渲染列表 页面初始化时 var t = $("#js_table").DataTable({ "processing": true, "searching": false,//关闭搜索框 "serverSide": true,//服务器分页 "bAutoWidth": false, "ajax": { "url": "/Home/GetSchedule", "type": "post", "dataSrc": "list",//这里是后台返回的数据对象 "data": function (d) {//d 是原始的发送给服务器的数据,默认很长。 var param = {};//因为服务端排序,可以新建一个参数对象 param.start = d.start;//开始的序号 param.length = d.length;//要取的数据的条数 return param;//自定义需要传递的参数。 } }, "createdRow": function (row, data, index) { /* 设置表格中的内容居中 */ $('td', row).attr("class", "text-center"); }, //定义列: 取相应属性字段 "columns": [ { "data": "jobName" }, { "data": "jobGroup" }, { "data": "triggerType", "render": function (data, type, full, callback) { switch (data) { case 0: return "simple"; break; case 1: return "cron"; break; } } }, { "data": "url" }, { "data": "cron" }, { "data": "runTimes" }, { "data": "intervalSecond" }, { "data": "jobStatus", "render": function (data, type, full, callback) { // 0 停止;1 启用; switch (data) { case 0: return "暂停任务"; break; case 1: return "启用任务"; break; } } }, { "data": "assemblyName" }, { "data": "className" }, { "data": "beginTime", "render": function (data, type, full, callback) { return dataTime(data); } }, { "data": "endTime", "render": function (data, type, full, callback) { if (data != null) { return data != "0001-01-01T00:00:00" ? dataTime(data) : null; } return data; } }, //{ "data": "remark" }, //操作列 { "data": "jobId",//json "render": function (data, type, full, callback) { var executeJob = full.jobStatus == 1 ? "disabled" : ""; var stop = full.jobStatus == 0 ? "disabled" : ""; return (`<a class="btn bg-maroon btn-sm ${executeJob}" onclick="executeJob(${data});">执行</a> <a class="btn btn-primary btn-sm " data-toggle="modal" data-target="#modalAdd" onclick="getDetails(${data});">编辑</a> <a class="btn btn-warning btn-sm ${stop}" onclick="stopScheduleJob('${data}');" >停止</a> <a class="btn btn-info btn-sm ${executeJob}" onclick="resumeJob('${data}');" >恢复运行</a> <a class="btn btn-danger btn-sm" data-toggle="modal" data-target="#delcfmOverhaul" onclick="deleteSchedule('${data}');" >删除</a>` ); } } ], "language": { "lengthMenu": "每页 _MENU_ 条记录", "zeroRecords": " ", "info": "当前 _START_ 条到 _END_ 条 共 _TOTAL_ 条", "infoEmpty": "无记录", "infoFiltered": "(从 _MAX_ 条记录过滤)", "search": "用户", "processing": "载入中", "paginate": { "first": "首页", "previous": "上一页", "next": "下一页", "last": "尾页" } }, "aLengthMenu": [ [10, 25, 50, 100], [10, 25, 50, 100] ], "paging": true,//分页 "pagingType": "full_numbers",//显示首页尾页 "ordering": false,//排序 "info": true,//信息 "initComplete": function (settings, data) { }, "drawCallback": function (settings, data) { } }); //参数校验 $('#frm').validate({ focusInvalid: false, rules: { JobName: { required: true }, JobGroup: { required: true }, BeginTime: { required: true } }, messages: { }, submitHandler: function (form) { $.post("/Home/AddJobTask", $(form).serialize()).done(function (data) { var result = data; if (data.code == 1000) { $("#modalAdd").modal('toggle'); layer.msg('操作成功', { icon: 1 }); t.draw(); } else { layer.msg('操作失败', { icon: 2 }); } }); } }); $("#triggerType").change(function () { if ($(this).val() == 1) { $("#cron-div").show(); $("#cron").rules("add", { required: true }); $("#runTimes-div").hide(); $("#IntervalSecond-div").hide(); } else { $("#cron-div").hide(); $("#runTimes-div").show(); $("#runTimes").rules("add", { required: true }); $("#IntervalSecond-div").show(); } }) }); //执行任务 function executeJob(Id) { $.ajax({ url: "/home/ExecuteJob", data: { Id: Id }, type: "post", success: function (data) { if (data.code == 1000) { $("#js_table").DataTable().draw(); layer.msg('操作成功', { icon: 1 }); } else { layer.msg(data.msg, { icon: 2 }); } } }) } //查询详情 function getDetails(Id) { $.ajax({ url: "/home/getDetails", data: { Id: Id }, type: "post", success: function (data) { $("#jobId").val(data.data.jobId); $("#jobName").val(data.data.jobName); $("#jobGroup").val(data.data.jobGroup); $("#triggerType").val(data.data.triggerType); $("#url").val(data.data.url); if (data.data.triggerType == 1) { $("#cron").val(data.data.cron); $("#cron-div").show(); $("#cron").rules("add", { required: true }); $("#runTimes-div").hide(); $("#IntervalSecond-div").hide(); } else { $("#runTimes").val(data.data.runTimes); $("#runTimes-div").show(); $("#runTimes").rules("add", { required: true }); $("#IntervalSecond-div").show(); } $("#beginTime").val(dataTime(data.data.beginTime)); $("#endTime").val(data.data.endTime == null ? null : dataTime(data.data.endTime)); $("#intervalSecond").val(data.data.intervalSecond); $("#remark").val(data.data.remark); $("#assemblyName").val(data.data.assemblyName); $("#insideClass").val(data.data.className); } }); } //停止任务 function stopScheduleJob(Id) { $.ajax({ url: "/home/stopScheduleJob", data: { Id: Id }, type: "post", success: function (data) { if (data.code == 1000) { $("#js_table").DataTable().draw(); layer.msg('操作成功', { icon: 1 }); } else { layer.msg(data.msg, { icon: 2 }); } } }); } //恢复暂停任务 function resumeJob(Id) { $.ajax({ url: "/home/ResumeJob", data: { Id: Id }, type: "post", success: function (data) { if (data.code == 1000) { $("#js_table").DataTable().draw(); layer.msg('操作成功', { icon: 1 }); } else { layer.msg(data.msg, { icon: 2 }); } } }); } //删除任务 function deleteSchedule(Id) { $("#deleteHaulBtn").click(function () { $.ajax({ url: "/home/DeleteSchedule", data: { Id: Id }, type: "post", success: function (data) { if (data.code == 1000) { $("#js_table").DataTable().draw(); layer.msg('操作成功', { icon: 1 }); $("#delcfmOverhaul").modal('toggle'); } else { layer.msg('操作失败', { icon: 2 }); } } }) }) } //时间戳转换 function dataTime(time) { // 比如需要这样的格式 yyyy-MM-dd hh:mm:ss var _date = new Date(time), year = _date.getFullYear(), //年 month = _date.getMonth() + 1, //月 day = _date.getDate(), //日 hour = _date.getHours(), //时间 minute = _date.getMinutes(), //分钟 second = _date.getSeconds();//秒 month = month < 10 ? "0" + month : month; day = day < 10 ? "0" + day : day; minute = minute < 10 ? "0" + minute : minute; return year + "-" + month + "-" + day + " " + hour + ":" + minute; } //清空表单 function resertForm() { $('#frm')[0].reset(); $("#runTimes").rules("add", { required: true }); $("#triggerType").val("0"); $("#runTimes-div").show(); $("#IntervalSecond-div").show(); $("#cron-div").hide(); } </script>
the_stack
@using Resgrid.Model.Helpers @using Resgrid.Web @using Resgrid.Web.Helpers @model Resgrid.Web.Areas.User.Models.Reports.Activity.DepartmentActivityView @{ Layout = null; } <!DOCTYPE html> <html lang="en"> <head> <title>YTD Department Activity Report</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Department Activity Report"> <meta name="author" content="Resgrid"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" crossorigin="anonymous" asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-fallback-test-class="hidden" asp-fallback-test-property="visibility" asp-fallback-test-value="hidden" /> <link rel="stylesheet" href="~/clib/kendo/styles/kendo.common.min.css" /> <link rel="stylesheet" href="~/clib/kendo/styles/kendo.bootstrap.min.css" /> <link rel="stylesheet" href="~/clib/kendo/styles/kendo.dataviz.min.css" /> <link rel="stylesheet" href="~/clib/kendo/styles/kendo.dataviz.bootstrap.min.css" /> <style> .table th, .table td { padding: 8px !important; line-height: 20px !important; text-align: left !important; vertical-align: top !important; } </style> <!--[if lt IE 9]> <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link rel="shortcut icon" href="@Url.Content("~/favicon.ico")" /> <link rel="apple-touch-icon" href="@Url.Content("~/apple-touch-icon-iphone.png")" /> <link rel="apple-touch-icon" sizes="72x72" href="@Url.Content("~/apple-touch-icon-ipad.png")" /> <link rel="apple-touch-icon" sizes="114x114" href="@Url.Content("~/apple-touch-icon-iphone4.png")" /> <link rel="apple-touch-icon" sizes="144x144" href="@Url.Content("~/apple-touch-icon-ipad3.png")" /> </head> <body> <div class="content"> <div class="row"> <div class="col-md-4 col-md-offset-1"> <img src="@Url.Content("~/images/Resgrid_JustText_small.png")" title="Resgrid Logo" style="margin-top: 10px; margin-bottom: 5px;"> </div> <div class="col-md-6" style="text-align: right;"> <h3 style="margin-top: 10px;">YTD Department Activity Report</h3> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> <h4>Calls</h4> </div> </div> <div class="row"> <div class="col-md-5 col-md-offset-1"> <table class="table table-condensed"> <thead> <tr> <th>Type</th> <th>Count</th> <th>%</th> </tr> </thead> <tbody> @foreach (var callType in Model.CallTypeCount.OrderBy(x => x.Item1)) { if (callType.Item1 != "Total") { <tr> <td style="padding-left: 10px;">@callType.Item1</td> <td>@callType.Item2</td> <td> @{ float precent = (callType.Item2 * 100f) / Model.TotalCalls; } @Html.Raw(string.Format("{0}%", precent.ToString("F"))) </td> </tr> } } <tr> <td style="padding-left: 10px;">@Model.CallTypeCount.Single(x => x.Item1 == "Total").Item1</td> <td>@Model.CallTypeCount.Single(x => x.Item1 == "Total").Item2</td> <td></td> </tr> </tbody> </table> </div> <div class="col-md-5"> <div id="calls-per-week-ytd"></div> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> <h4>Personnel Response Detail</h4> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> <table class="table table-condensed"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Group</th> <th>Dispatched</th> @foreach (var callType in Model.CallTypeCount.OrderBy(x => x.Item1)) { if (callType.Item1 != "Total") { <th>@callType.Item1</th> } } </tr> </thead> <tbody> @foreach (var response in Model.Responses) { <tr> <td style="padding-left: 10px;">@response.ID</td> <td>@response.Name</td> <td>@response.Group</td> <td>@response.TotalCalls</td> @foreach (var type in response.CallTypeCount.OrderBy(x => x.Item1)) { <td>@type.Item2</td> } </tr> } </tbody> </table> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> <h4>Trainings</h4> </div> </div> <div class="row"> <div class="col-md-5 col-md-offset-1"> <table class="table table-condensed"> <thead> <tr> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td> <strong><small>January</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 1) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 1).Item2) } else { @Html.Raw(0) } </span> </td> <td> <strong><small>February</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 2) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 2).Item2) } else { @Html.Raw(0) } </span> </td> <td> <strong><small>March</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 3) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 3).Item2) } else { @Html.Raw(0) } </span> </td> </tr> <tr> <td> <strong><small>April</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 4) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 4).Item2) } else { @Html.Raw(0) } </span> </td> <td> <strong><small>May</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 5) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 5).Item2) } else { @Html.Raw(0) } </span> </td> <td> <strong><small>June</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 6) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 6).Item2) } else { @Html.Raw(0) } </span> </td> </tr> <tr> <td> <strong><small>July</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 7) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 7).Item2) } else { @Html.Raw(0) } </span> </td> <td> <strong><small>August</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 8) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 8).Item2) } else { @Html.Raw(0) } </span> </td> <td> <strong><small>September</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 9) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 9).Item2) } else { @Html.Raw(0) } </span> </td> </tr> <tr> <td> <strong><small>October</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 10) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 10).Item2) } else { @Html.Raw(0) } </span> </td> <td> <strong><small>November</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 11) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 11).Item2) } else { @Html.Raw(0) } </span> </td> <td> <strong><small>December</small></strong> <span style="display: block;"> @if (Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 12) != null) { @Html.Raw(Model.TrainingMonthCount.FirstOrDefault(x => x.Item1 == 12).Item2) } else { @Html.Raw(0) } </span> </td> </tr> </tbody> </table> </div> <div class="col-md-5"> <div id="training-per-month-ytd"></div> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> <h4>Personnel Training Detail</h4> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> <table class="table table-condensed"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Group</th> <th>Total</th> <th>Attended</th> <th>%</th> </tr> </thead> <tbody> @foreach (var training in Model.Trainings) { <tr> <td style="padding-left: 10px;">@training.ID</td> <td>@training.Name</td> <td>@training.Group</td> <td>@training.Total</td> <td>@training.Attended</td> <td> @if (training.Attended > 0 && training.Total > 0) { float trainingPrecent = (training.Attended*100f)/training.Total; @Html.Raw(string.Format("{0}%", trainingPrecent.ToString("F"))) } else { <span>0</span> } </td> </tr> } </tbody> </table> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1" style="text-align: right;"> @Model.RunOn.FormatForDepartment(Model.Department) </div> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script> <script> window.jQuery || document.write('<script src="~/Scripts/kendo/jquery.min.js"><\/script>')</script> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" crossorigin="anonymous"></script> <script src="~/clib/flot/jquery.flot.js"></script> <script src="~/clib/flot/jquery.flot.tooltip.min.js"></script> <script src="~/clib/flot/jquery.flot.resize.js"></script> <script src="~/clib/flot/jquery.flot.pie.js"></script> <script src="~/clib/flot/jquery.flot.time.js"></script> <script src="~/clib/flot/jquery.flot.spline.js"></script> <script src="~/clib/kendo/js/kendo.all.min.js"></script> <script src="~/clib/kendo/js/kendo.timezones.min.js"></script> <script> $(document).ready(function () { $("#calls-per-week-ytd").kendoChart({ dataSource: { transport: { read: { url: "@Url.Action("CallsYTD", "Dispatch", new {Area = "User"})", dataType: "json" } }, sort: { field: "WeekNumber", dir: "asc" } }, title: { text: "Calls Per Week" }, transitions: false, theme: "Bootstrap", legend: { position: "bottom" }, chartArea: { margin: { top: 10, right: 5, bottom: 0, left: 10 }, height: 240, background: "transparent" }, seriesDefaults: { type: "verticalBullet", style: "smooth", stack: true, //width: 2, markers: { //visible: false } }, series: [{ type: "column", field: "Count"//, //name: "Week #" }], categoryAxis: { field: "WeekNumber", labels: { visible: true }, majorGridLines: { visible: false }, categories: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52"] }, tooltip: { visible: false//, //template: "#= series.name # <br /> #= category #: #= value #" } }); $("#training-per-month-ytd").kendoChart({ dataSource: { transport: { read: { url: "@Url.Action("TrainingPerMonth", "Logs", new { Area = "User" })", dataType: "json" } }, sort: { field: "MonthNumber", dir: "asc" } }, title: { text: "Training Per Month" }, transitions: false, theme: "Bootstrap", legend: { position: "bottom" }, chartArea: { margin: { top: 10, right: 5, bottom: 0, left: 10 }, height: 240, background: "transparent" }, seriesDefaults: { type: "verticalBullet", style: "smooth", stack: true, //width: 2, markers: { //visible: false } }, series: [{ type: "column", field: "Count"//, //name: "Week #" }], categoryAxis: { field: "Month", labels: { visible: true }, majorGridLines: { visible: false }//, //categories: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", // "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", // "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52"] }, tooltip: { visible: false//, //template: "#= series.name # <br /> #= category #: #= value #" } }); }); </script> </body> </html>
the_stack
@model ReportAbuseViewModel @{ ViewBag.Title = "Report Package " + Model.PackageId + " " + Model.PackageVersion; ViewBag.MdPageColumns = GalleryConstants.ColumnsFormMd; string returnUrl = ViewData.ContainsKey(GalleryConstants.ReturnUrlViewDataKey) ? (string)ViewData[GalleryConstants.ReturnUrlViewDataKey] : Request.RawUrl; } <section role="main" class="container main-container page-report-abuse"> <div class="row report-form"> <div class="@ViewHelpers.GetColumnClasses(ViewBag)"> @Html.Partial( "_PackageHeading", new PackageHeadingModel( Model.PackageId, Model.PackageVersion, "Report package")) <h2><strong>If this package has a bug/failed to install</strong></h2> @ViewHelpers.AlertWarning(isAlertRole: true, htmlContent: @<text> Please do not report using the form below - that is reserved for abusive packages, such as those containing malicious code or spam. <br /> <br /> If "@Model.PackageId" simply doesn't work, or if you need help getting the package installed, please <a href="@Url.ContactOwners(Model)" title="contact the owners">contact the owners instead.</a> </text> ) <h2><strong>To report a security vulnerability</strong></h2> @ViewHelpers.AlertWarning(isAlertRole: true, htmlContent: @<text> Please report security vulnerabilities through the <a href="https://msrc.microsoft.com/create-report" title="report a security vulnerability">official portal</a>. If this is not a Microsoft - owned package, consider also <a href="@Url.ContactOwners(Model)" title="contact the owners">contacting the owners</a>. </text> ) <h2><strong>To report abuse, use this form</strong></h2> @if (!Model.ConfirmedUser) { @ViewHelpers.AlertWarning(isAlertRole: true, htmlContent: @<text> If this is your package, please <a href="@Url.LogOn(returnUrl)">sign in</a> to contact support. </text> ) } <p tabindex="0"> <text> Please provide a detailed abuse report with evidence to support your claim! We cannot delete packages without evidence that they exhibit malicious behavior. </text> </p> @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div id="form-field-reason" class="form-group @Html.HasErrorFor(m => m.Reason)"> @Html.ShowLabelFor(m => m.Reason) <p tabindex="0">Please select the reason for contacting support about this package. This package contains:</p> @Html.ShowEnumDropDownListFor(m => m.Reason, Model.ReasonChoices, "<Choose a Reason>") @Html.ShowValidationMessagesFor(m => m.Reason) </div> <div class="reason-error-has-a-bug" tabindex="0"> <p> Unfortunately we cannot provide support for bugs in NuGet packages. Please <a href="@Url.ContactOwners(Model)" title="contact the owners">contact the owners</a> for assistance. </p> </div> <div class="reason-error-security-vulnerability" tabindex="0"> <p> Please report security vulnerabilities through the <a href="https://msrc.microsoft.com/create-report" title="report a security vulnerability">official portal</a>. If this is not a Microsoft - owned package, consider also <a href="@Url.ContactOwners(Model)" title="contact the owners">contacting the owners</a>. </p> </div> <div id="report-abuse-form"> <div class="form-group @Html.HasErrorFor(m => m.Email)"> @Html.ShowLabelFor(m => m.Email) @Html.ShowTextBoxFor(m => m.Email) @Html.ShowValidationMessagesFor(m => m.Email) </div> <div class="form-group already-contacted-owner @Html.HasErrorFor(m => m.AlreadyContactedOwner)"> @Html.ShowCheckboxFor(m => m.AlreadyContactedOwner) @Html.ShowLabelFor(m => m.AlreadyContactedOwner) @Html.ShowValidationMessagesFor(m => m.AlreadyContactedOwner) </div> <div class="form-group @Html.HasErrorFor(m => m.Message)"> @Html.ShowLabelFor(m => m.Message) <p tabindex="0"> Please provide a detailed description of the problem. <p> <div class="infringement-claim-requirements" tabindex="0"> <p> If you are reporting copyright infringement, please describe the copyrighted material with particularity and provide us with information about your copyright (i.e. title of copyrighted work, URL where to view your copyrighted work, description of your copyrighted work, and any copyright registrations you may have, etc.). For trademark infringement, include the name of your trademark, registration number, and country where registered. </p> </div> <div class="child-sexual-exploitation" tabindex="0"> <p> Note: Please complete this form and submit it so we can proceed with an appropriate response regarding the NuGet package (e.g. removing it). In addition, please proceed to <a href="https://report.cybertip.org">https://report.cybertip.org</a> to report the matter in more detail. </p> </div> <div class="imminent-harm" tabindex="0"> <p> Note: please ensure when reporting this type of abuse that you've considered whether the following are present: <ul> <li>A targeted person or group (including self)</li> <li>An identified actor--i.e. person intending to commit the offense</li> <li>Details of the threat</li> <li>Time and/or place where the act will be carried out</li> </ul> </p> </div> @Html.ShowTextAreaFor(m => m.Message, 10, 50) @Html.ShowValidationMessagesFor(m => m.Message) </div> <div class="form-group @Html.HasErrorFor(m => m.CopySender)"> @Html.ShowCheckboxFor(m => m.CopySender) @Html.ShowLabelFor(m => m.CopySender) @Html.ShowValidationMessagesFor(m => m.CopySender) </div> <div class="form-group infringement-claim-requirements @Html.HasErrorFor(m => m.Signature)"> <h2><span style="color:red">*</span> Required Statements for infringement claims</h2> <h2>Good Faith Belief:</h2> <p> By typing my name (electronic signature), I have a good faith belief that the use of the material is not authorized by the intellectual property owner, its agent, or the law (e.g., it is not fair use). </p> <h2>Authority to Act:</h2> <p> I represent that the information in the notification is accurate, and under penalty of perjury, that I am authorized to act on behalf of the owner of an exclusive right that is allegedly infringed. </p> <h2>512(f) Acknowledgement:</h2> <p> As applicable under 17 U.S.C. 512(f), I acknowledge that I may be subject to liability for damages if I knowingly materially misrepresent that material or activity is infringing. </p> @Html.ShowLabelFor(m => m.Signature) @Html.ShowTextBoxFor(m => m.Signature) @Html.ShowValidationMessagesFor(m => m.Signature) </div> <div class="form-group"> <input id="Submit" type="submit" class="btn btn-primary form-control" value="Report" /> </div> </div> } </div> </div> </section> @section BottomScripts { @ViewHelpers.RecaptchaScripts(Config.Current.ReCaptchaPublicKey, "Submit") <script> function reasonSelected() { var $form = $('#Reason').parents('form'); var val = $('#Reason').val(); if (val) { $form.validate().element($('#Reason')); } // For error conditions, hide the other form fields and show error messages if (val === 'HasABugOrFailedToInstall' || val === 'ContainsSecurityVulnerability') { $('#report-abuse-form').hide(); } else { $('#report-abuse-form').show(); } if (val === 'HasABugOrFailedToInstall') { $form.find('.reason-error-has-a-bug').show(); } else { $form.find('.reason-error-has-a-bug').hide(); } if (val === 'ContainsSecurityVulnerability') { $form.find('.reason-error-security-vulnerability').show(); } else { $form.find('.reason-error-security-vulnerability').hide(); } // We don't suggest the customer contact the owner in the case of safety violations if (val === 'ChildSexualExploitationOrAbuse' || val === 'TerrorismOrViolentExtremism' || val === 'HateSpeech' || val === 'ImminentHarm' || val === 'RevengePorn' || val === 'OtherNudityOrPornography') { $form.find('.already-contacted-owner').hide(); } else { $form.find('.already-contacted-owner').show(); } if (val === 'ChildSexualExploitationOrAbuse') { $form.find('.child-sexual-exploitation').show(); } else { $form.find('.child-sexual-exploitation').hide(); } if (val === 'ImminentHarm') { $form.find('.imminent-harm').show(); } else { $form.find('.imminent-harm').hide(); } if (val == 'ViolatesALicenseIOwn') { $form.find('.infringement-claim-requirements').show(); $('#Signature').rules("add", { required: true, maxlength: 1000, messages: { required: "Please sign using your name." } }); $('#Signature').attr('data-val-required', 'Please sign using your name.'); } else { $form.find('.infringement-claim-requirements').hide(); $('#Signature').rules('remove', 'required'); } } $(function () { $('#Reason').change(reasonSelected); reasonSelected(); // Run once in case it starts with the bad selection }); </script> }
the_stack
#tool "nuget:?package=GitVersion.CommandLine&version=5.2.0" #addin "nuget:?package=Cake.Incubator&version=5.0.1" #addin "nuget:?package=Cake.FileHelpers&version=4.0.1" // see https://www.gep13.co.uk/blog/introducing-cake.dotnettool.module #module nuget:?package=Cake.DotNetTool.Module&version=0.1.0 #tool "dotnet:?package=AzureSignTool&version=2.0.17" using Path = System.IO.Path; using System.Xml; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using Task = System.Threading.Tasks.Task; ////////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); var testFilter = Argument("where", ""); var signFiles = Argument<bool>("sign_files", false); var signingCertificatePath = Argument("signing_certificate_path", ""); var signingCertificatePassword = Argument("signing_certificate_password", ""); // We sign all of our own assemblies - these are the arguments required to sign code using Azure Key Vault // If these arguments are null then the signing defaults to using the local certificate and SignTool var keyVaultUrl = Argument("AzureKeyVaultUrl", ""); var keyVaultAppId = Argument("AzureKeyVaultAppId", ""); var keyVaultAppSecret = Argument("AzureKeyVaultAppSecret", ""); var keyVaultCertificateName = Argument("AzureKeyVaultCertificateName", ""); var buildVerbosity = Argument("build_verbosity", "normal"); var packInParallel = Argument<bool>("packinparallel", false); var appendTimestamp = Argument<bool>("timestamp", false); var setOctopusServerVersion = Argument<bool>("setoctopusserverversion", false); /////////////////////////////////////////////////////////////////////////////// // GLOBAL VARIABLES /////////////////////////////////////////////////////////////////////////////// var localPackagesDir = "../LocalPackages"; var sourceFolder = "./source/"; var artifactsDir = "./artifacts"; var publishDir = "./publish"; var signToolPath = MakeAbsolute(File("./certificates/signtool.exe")); GitVersion gitVersionInfo; string nugetVersion; // From time to time the timestamping services go offline, let's try a few of them so our builds are more resilient var timestampUrls = new string[] { "http://timestamp.digicert.com?alg=sha256", "http://timestamp.comodoca.com" }; /////////////////////////////////////////////////////////////////////////////// // SETUP / TEARDOWN /////////////////////////////////////////////////////////////////////////////// Setup(context => { gitVersionInfo = GitVersion(new GitVersionSettings { OutputType = GitVersionOutput.Json, LogFilePath = "gitversion.log" }); nugetVersion = gitVersionInfo.NuGetVersion; if (appendTimestamp) nugetVersion = nugetVersion + "-" + DateTime.Now.ToString("yyyyMMddHHmmss"); Information("Building Calamari v{0}", nugetVersion); }); Teardown(context => { Information("Finished running tasks."); }); ////////////////////////////////////////////////////////////////////// // PRIVATE TASKS ////////////////////////////////////////////////////////////////////// Task("SetTeamCityVersion") .Does(() => { if(BuildSystem.IsRunningOnTeamCity) BuildSystem.TeamCity.SetBuildNumber(nugetVersion); }); Task("CheckForbiddenWords") .Does(() => { Information("Checking codebase for forbidden words."); IEnumerable<string> redirectedOutput; var exitCodeWithArgument = StartProcess( "git", new ProcessSettings { Arguments = "grep -i -I -n -f ForbiddenWords.txt -- \"./*\" \":!ForbiddenWords.txt\"", RedirectStandardOutput = true }, out redirectedOutput ); var filesContainingForbiddenWords = redirectedOutput.ToArray(); if (filesContainingForbiddenWords.Any()) throw new Exception("Found forbidden words in the following files, please clean them up:\r\n" + string.Join("\r\n", filesContainingForbiddenWords)); Information("Sanity check passed."); }); Task("Clean") .Does(() => { CleanDirectories(publishDir); CleanDirectories(artifactsDir); CleanDirectories("./**/bin"); CleanDirectories("./**/obj"); }); Task("Restore") .IsDependentOn("Clean") .Does(() => DotNetCoreRestore("source", new DotNetCoreRestoreSettings { ArgumentCustomization = args => args.Append("--verbosity").Append(buildVerbosity) })); Task("Build") .IsDependentOn("CheckForbiddenWords") .IsDependentOn("Restore") .Does(() => { DotNetCoreBuild("./source/Calamari.sln", new DotNetCoreBuildSettings { Configuration = configuration, ArgumentCustomization = args => args.Append($"/p:Version={nugetVersion}").Append("--verbosity").Append(buildVerbosity) }); }); Task("Test") .IsDependentOn("Build") .Does(() => { var projects = GetFiles("./source/**/*Tests.csproj"); foreach(var project in projects) DotNetCoreTest(project.FullPath, new DotNetCoreTestSettings { Configuration = configuration, NoBuild = true, ArgumentCustomization = args => { if(!string.IsNullOrEmpty(testFilter)) { args = args.Append("--where").AppendQuoted(testFilter); } return args.Append("--logger:trx") .Append("--verbosity").Append(buildVerbosity); } }); }); Task("PackBinaries") .IsDependentOn("Build") .Does(async () => { var actions = new List<Action>(); actions.Add(() => DoPackage("Calamari", "net40", nugetVersion)); actions.Add(() => DoPackage("Calamari", "net452", nugetVersion, "Cloud")); // Create a portable .NET Core package actions.Add(() => DoPackage("Calamari", "netcoreapp3.1", nugetVersion, "portable")); // Create the self-contained Calamari packages for each runtime ID defined in Calamari.csproj foreach(var rid in GetProjectRuntimeIds(@".\source\Calamari\Calamari.csproj")) { actions.Add(() => DoPackage("Calamari", "netcoreapp3.1", nugetVersion, rid)); } var dotNetCorePackSettings = GetDotNetCorePackSettings(); var commonProjects = GetFiles("./source/**/*.Common.csproj"); foreach(var project in commonProjects) { actions.Add(() => SignAndPack(project.ToString(), dotNetCorePackSettings)); } actions.Add(() => SignAndPack("./source/Calamari.CloudAccounts/Calamari.CloudAccounts.csproj", dotNetCorePackSettings)); await RunPackActions(actions); }); Task("PackTests") .IsDependentOn("Build") .Does(async () => { var actions = new List<Action>(); actions.Add(() => Zip("./source/Calamari.Tests/bin/Release/net461/", Path.Combine(artifactsDir, "Binaries.zip"))); // Create a Zip for each runtime for testing foreach(var rid in GetProjectRuntimeIds(@".\source\Calamari.Tests\Calamari.Tests.csproj")) { actions.Add(() => { var publishedLocation = DoPublish("Calamari.Tests", "netcoreapp3.1", nugetVersion, rid); var zipName = $"Calamari.Tests.netcoreapp.{rid}.{nugetVersion}.zip"; Zip(Path.Combine(publishedLocation, rid), Path.Combine(artifactsDir, zipName)); }); } actions.Add(() => DotNetCorePack("./source/Calamari.Testing/Calamari.Testing.csproj", GetDotNetCorePackSettings())); await RunPackActions(actions); }); Task("Pack") .IsDependentOn("PackBinaries") .IsDependentOn("PackTests"); Task("CopyToLocalPackages") .WithCriteria(BuildSystem.IsLocalBuild) .Does(() => { CreateDirectory(localPackagesDir); CopyFiles(Path.Combine(artifactsDir, $"Calamari.*.nupkg"), localPackagesDir); }); Task("SetOctopusServerVersion") .WithCriteria(BuildSystem.IsLocalBuild) .WithCriteria(setOctopusServerVersion) .Does(() => { var serverProjectFile = Path.GetFullPath("../OctopusDeploy/source/Octopus.Server/Octopus.Server.csproj"); if (FileExists(serverProjectFile)) { Information("Setting Calamari version in Octopus Server project {0} to {1}", serverProjectFile, nugetVersion); SetOctopusServerCalamariVersion(serverProjectFile); } else { Information("Could not set Calamari version in Octopus Server project {0} to {1} as could not find project file", serverProjectFile, nugetVersion); } }); private async Task RunPackActions(List<Action> actions) { if (packInParallel) { var tasks = new List<Task>(); foreach (var action in actions) { tasks.Add(Task.Run(action)); } await Task.WhenAll(tasks); } else { foreach (var action in actions) { action(); } } } private string DoPublish(string project, string framework, string version, string runtimeId = null) { var projectDir = Path.Combine("./source", project); var publishedTo = Path.Combine(publishDir, project, framework); var publishSettings = new DotNetCorePublishSettings { Configuration = configuration, OutputDirectory = publishedTo, Framework = framework, ArgumentCustomization = args => args.Append($"/p:Version={nugetVersion}").Append("--verbosity").Append(buildVerbosity) }; if (!string.IsNullOrEmpty(runtimeId)) { publishSettings.OutputDirectory = Path.Combine(publishedTo, runtimeId); // "portable" is not an actual runtime ID. We're using it to represent the portable .NET core build. publishSettings.Runtime = (runtimeId != null && runtimeId != "portable" && runtimeId != "Cloud") ? runtimeId : null; } DotNetCorePublish(projectDir, publishSettings); SignAndTimestampBinaries(publishSettings.OutputDirectory.FullPath); return publishedTo; } private void SignAndPack(string project, DotNetCorePackSettings dotNetCorePackSettings){ Information("SignAndPack project: " + project); var binariesFolder = GetDirectories($"{Path.GetDirectoryName(project)}/bin/{configuration}/*"); foreach(var directory in binariesFolder){ SignAndTimestampBinaries(directory.ToString()); } DotNetCorePack(project, dotNetCorePackSettings); } private void DoPackage(string project, string framework, string version, string runtimeId = null) { var publishedTo = Path.Combine(publishDir, project, framework); var projectDir = Path.Combine("./source", project); var packageId = $"{project}"; var nugetPackProperties = new Dictionary<string,string>(); var publishSettings = new DotNetCorePublishSettings { Configuration = configuration, OutputDirectory = publishedTo, Framework = framework, ArgumentCustomization = args => args.Append($"/p:Version={nugetVersion}").Append($"--verbosity").Append(buildVerbosity) }; if (!string.IsNullOrEmpty(runtimeId)) { publishedTo = Path.Combine(publishedTo, runtimeId); publishSettings.OutputDirectory = publishedTo; // "portable" is not an actual runtime ID. We're using it to represent the portable .NET core build. publishSettings.Runtime = (runtimeId != null && runtimeId != "portable" && runtimeId != "Cloud") ? runtimeId : null; packageId = $"{project}.{runtimeId}"; nugetPackProperties.Add("runtimeId", runtimeId); } var nugetPackSettings = new NuGetPackSettings { Id = packageId, OutputDirectory = artifactsDir, BasePath = publishedTo, Version = nugetVersion, Verbosity = NuGetVerbosity.Normal, Properties = nugetPackProperties }; DotNetCorePublish(projectDir, publishSettings); SignAndTimestampBinaries(publishSettings.OutputDirectory.FullPath); var nuspec = $"{publishedTo}/{packageId}.nuspec"; CopyFile($"{projectDir}/{project}.nuspec", nuspec); NuGetPack(nuspec, nugetPackSettings); } private void SignAndTimestampBinaries(string outputDirectory) { // When building locally signing isn't really necessary and it could take up to 3-4 minutes to sign all the binaries // as we build for many, many different runtimes so disabling it locally means quicker turn around when doing local development. if (BuildSystem.IsLocalBuild && !signFiles) return; Information($"Signing binaries in {outputDirectory}"); // check that any unsigned libraries, that Octopus Deploy authors, get signed to play nice with security scanning tools // refer: https://octopusdeploy.slack.com/archives/C0K9DNQG5/p1551655877004400 // decision re: no signing everything: https://octopusdeploy.slack.com/archives/C0K9DNQG5/p1557938890227100 var unsignedExecutablesAndLibraries = GetFiles( outputDirectory + "/Calamari*.exe", outputDirectory + "/Calamari*.dll", outputDirectory + "/Octo*.exe", outputDirectory + "/Octo*.dll") .Where(f => !HasAuthenticodeSignature(f)) .ToArray(); if (String.IsNullOrEmpty(keyVaultUrl) && String.IsNullOrEmpty(keyVaultAppId) && String.IsNullOrEmpty(keyVaultAppSecret) && String.IsNullOrEmpty(keyVaultCertificateName)) { Information("Signing files using signtool and the self-signed development code signing certificate."); SignFilesWithSignTool(unsignedExecutablesAndLibraries, signingCertificatePath, signingCertificatePassword); } else { Information("Signing files using azuresigntool and the production code signing certificate"); SignFilesWithAzureSignTool(unsignedExecutablesAndLibraries, keyVaultUrl, keyVaultAppId, keyVaultAppSecret, keyVaultCertificateName); } TimeStampFiles(unsignedExecutablesAndLibraries); } // note: Doesn't check if existing signatures are valid, only that one exists // source: https://blogs.msdn.microsoft.com/windowsmobile/2006/05/17/programmatically-checking-the-authenticode-signature-on-a-file/ private bool HasAuthenticodeSignature(FilePath filePath) { try { X509Certificate.CreateFromSignedFile(filePath.FullPath); return true; } catch { return false; } } void SignFilesWithAzureSignTool(IEnumerable<FilePath> files, string vaultUrl, string vaultAppId, string vaultAppSecret, string vaultCertificateName, string display = "", string displayUrl = "") { var signArguments = new ProcessArgumentBuilder() .Append("sign") .Append("--azure-key-vault-url").AppendQuoted(vaultUrl) .Append("--azure-key-vault-client-id").AppendQuoted(vaultAppId) .Append("--azure-key-vault-client-secret").AppendQuotedSecret(vaultAppSecret) .Append("--azure-key-vault-certificate").AppendQuoted(vaultCertificateName) .Append("--file-digest sha256"); if (!string.IsNullOrWhiteSpace(display)) { signArguments .Append("--description").AppendQuoted(display) .Append("--description-url").AppendQuoted(displayUrl); } foreach (var file in files) signArguments.AppendQuoted(file.FullPath); var azureSignToolPath = MakeAbsolute(File("./tools/azuresigntool.exe")); if (!FileExists(azureSignToolPath)) throw new Exception($"The azure signing tool was expected to be at the path '{azureSignToolPath}' but wasn't available."); Information($"Executing: {azureSignToolPath} {signArguments.RenderSafe()}"); var exitCode = StartProcess(azureSignToolPath.FullPath, signArguments.Render()); if (exitCode != 0) throw new Exception($"AzureSignTool failed with the exit code {exitCode}."); Information($"Finished signing {files.Count()} files."); } void SignFilesWithSignTool(IEnumerable<FilePath> files, FilePath certificatePath, string certificatePassword, string display = "", string displayUrl = "") { if (!FileExists(signToolPath)) throw new Exception($"The signing tool was expected to be at the path '{signToolPath}' but wasn't available."); if (!FileExists(certificatePath)) throw new Exception($"The code-signing certificate was not found at {certificatePath}."); Information($"Signing {files.Count()} files using certificate at '{certificatePath}'..."); var signArguments = new ProcessArgumentBuilder() .Append("sign") .Append("/fd SHA256") .Append("/f").AppendQuoted(certificatePath.FullPath) .Append($"/p").AppendQuotedSecret(certificatePassword); if (!string.IsNullOrWhiteSpace(display)) { signArguments .Append("/d").AppendQuoted(display) .Append("/du").AppendQuoted(displayUrl); } foreach (var file in files) { signArguments.AppendQuoted(file.FullPath); } Information($"Executing: {signToolPath} {signArguments.RenderSafe()}"); var exitCode = StartProcess(signToolPath, new ProcessSettings { Arguments = signArguments }); if (exitCode != 0) { throw new Exception($"Signing files failed with the exit code {exitCode}. Look for 'SignTool Error' in the logs."); } Information($"Finished signing {files.Count()} files."); } private void TimeStampFiles(IEnumerable<FilePath> files) { if (!FileExists(signToolPath)) { throw new Exception($"The signing tool was expected to be at the path '{signToolPath}' but wasn't available."); } Information($"Timestamping {files.Count()} files..."); var timestamped = false; foreach (var url in timestampUrls) { var timestampArguments = new ProcessArgumentBuilder() .Append($"timestamp") .Append("/tr").AppendQuoted(url) .Append("/td").Append("sha256"); foreach (var file in files) { timestampArguments.AppendQuoted(file.FullPath); } try { Information($"Executing: {signToolPath} {timestampArguments.RenderSafe()}"); var exitCode = StartProcess(signToolPath, new ProcessSettings { Arguments = timestampArguments }); if (exitCode == 0) { timestamped = true; break; } else { throw new Exception($"Timestamping files failed with the exit code {exitCode}. Look for 'SignTool Error' in the logs."); } } catch (Exception ex) { Warning(ex.Message); Warning($"Failed to timestamp files using {url}. Maybe we can try another timestamp service..."); } } if (!timestamped) { throw new Exception($"Failed to timestamp files even after we tried all of the timestamp services we use."); } Information($"Finished timestamping {files.Count()} files."); } // Returns the runtime identifiers from the project file private IEnumerable<string> GetProjectRuntimeIds(string projectFile) { var doc = new XmlDocument(); doc.Load(projectFile); var rids = doc.SelectSingleNode("Project/PropertyGroup/RuntimeIdentifiers").InnerText; return rids.Split(';'); } // Sets the Octopus.Server Calamari version property private void SetOctopusServerCalamariVersion(string projectFile) { ReplaceRegexInFiles(projectFile, @"<CalamariVersion>([\S])+<\/CalamariVersion>", $"<CalamariVersion>{nugetVersion}</CalamariVersion>"); } private DotNetCorePackSettings GetDotNetCorePackSettings() { return new DotNetCorePackSettings { Configuration = configuration, OutputDirectory = artifactsDir, NoBuild = true, IncludeSource = true, ArgumentCustomization = args => args.Append($"/p:Version={nugetVersion}") }; } ////////////////////////////////////////////////////////////////////// // TASKS ////////////////////////////////////////////////////////////////////// Task("Default") .IsDependentOn("SetTeamCityVersion") .IsDependentOn("Pack") .IsDependentOn("CopyToLocalPackages") .IsDependentOn("SetOctopusServerVersion"); Task("Local") .IsDependentOn("PackBinaries") .IsDependentOn("CopyToLocalPackages") .IsDependentOn("SetOctopusServerVersion"); ////////////////////////////////////////////////////////////////////// // EXECUTION ////////////////////////////////////////////////////////////////////// RunTarget(target);
the_stack
@model SmartAdmin.Domain.Models.Photo @{ ViewData["Title"] = "照片库"; ViewData["PageName"] = "photos_index"; ViewData["Heading"] = "<i class='fal fa-window text-primary'></i> 照片库"; ViewData["Category1"] = "主数据管理"; ViewData["PageDescription"] = ""; } <div class="row"> <div class="col-lg-12 col-xl-12"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> 照片库 </h2> <div class="panel-toolbar"> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"><i class="fal fa-window-minimize"></i></button> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"><i class="fal fa-expand"></i></button> </div> </div> <div class="panel-container enable-loader show"> <div class="loader"><i class="fal fa-spinner-third fa-spin-4x fs-xxl"></i></div> <div class="panel-content py-2 rounded-bottom border-faded border-left-0 border-right-0 text-muted bg-subtlelight-fade "> <div class="row no-gutters align-items-center"> <div class="col"> <!-- 开启授权控制请参考 @@if (Html.IsAuthorize("Create") --> <div class="btn-group btn-group-sm"> <button onclick="appendItem()" class="btn btn-default"> <span class="fal fa-plus mr-1"></span> 新增 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="training()" class="btn btn-default"> <span class="fal fa-brain mr-1"></span> 添加样本 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="opentest()" class="btn btn-default"> <span class="fal fa-magic mr-1"></span> 测试 </button> </div> <div class="btn-group btn-group-sm"> <button name="deletebutton" disabled onclick="deleteChecked()" class="btn btn-default"> <span class="fal fa-times mr-1"></span> 删除 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="reload()" class="btn btn-default"> <span class="fal fa-search mr-1"></span> 刷新 </button> </div> <div class="btn-group btn-group-sm hidden-xs"> <button onclick="exportExcel()" class="btn btn-default"> <span class="fal fa-file-export mr-1"></span> 导出 </button> </div> </div> </div> </div> <div class="panel-content"> <div class="table-responsive"> <table id="photos_datagrid"> </table> </div> </div> </div> </div> </div> </div> <!-- 弹出窗体form表单 --> <div class="modal fade" id="uploadfilesmodal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title"> 照片上传 </h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true"><i class="fal fa-times"></i></span> </button> </div> <div class="modal-body pb-0 pt-0"> <div id="slimscroll"> <div id="file_empty_div" class="plfile_empty_div"> <span style="color: Dodgerblue;"><i class="fal fa-exclamation-circle"></i></span> 请使用[选择文件]按钮,选择文件。 </div> <ul id="filelist"></ul> </div> <div id="plupload_max_size_alert" class="alert alert-primary mb-0 fw-300 fs-sm p-2 d-none" role="alert"> <strong>提示</strong> 上传文件大小请控制在20MB以内。 </div> <input id="fileupload" type="file" name="fileupload" multiple style="display: none" /> </div> <div class="modal-footer"> <button id="selectuploadfilesbtn" type="button" class="btn btn-info">选择文件</button> <button id="postuploadfilesbtn" type="button" class="btn btn-primary">上传</button> </div> </div> </div> </div> <div class="modal fade" id="photoviewmodal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title"> 预览照片 </h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true"><i class="fal fa-times"></i></span> </button> </div> <div class="modal-body pb-0 pt-0"> <div class="card" id="photo_card"> <div id="photo-container"> </div> @*<img id="photo_img" class="card-img-top" />*@ @*<canvas id="photo-canvas" style="width:456px;height:400px"></canvas>*@ <div class="card-body"> <h5 class="card-title"></h5> <p class="card-text" id="detectedresult"></p> </div> </div> </div> <div class="modal-footer"> <button onclick="predict()" id="detectbutton" disabled type="button" class="btn btn-info">Detect</button> <button onclick="test()" id="testbutton" disabled type="button" class="btn btn-primary">Test</button> </div> </div> </div> </div> <div class="modal fade" id="testviewmodal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title"> 测试 </h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true"><i class="fal fa-times"></i></span> </button> </div> <div class="modal-body pb-0 pt-0"> <input type="file" id="uploadimginput" accept="image/*" onchange="loadedphoto(event)" hidden> <div class="card" id="photo_card"> <div id="photo-container"> <img id="testphoto_img" class="card-img-top" /> </div> <div class="card-body"> <h5 class="card-title" id="testresult"></h5> </div> </div> </div> <div class="modal-footer"> <button onclick="uploadphoto()" id="uploadimgbutton" type="button" class="btn btn-info">Upload</button> <button onclick="testPredict()" id="testpredictbutton" disabled type="button" class="btn btn-primary">Predict</button> </div> </div> </div> </div> @section HeadBlock { <link href="~/css/formplugins/bootstrap-daterangepicker/bootstrap-daterangepicker.css" rel="stylesheet" asp-append-version="true" /> <link href="~/js/easyui/themes/insdep/easyui.css" rel="stylesheet" asp-append-version="true" /> <style> .plfile_empty_div { position: absolute; left: 27%; top: 43%; z-index: 1; } ul#filelist { width: 450px; min-height: 100px; background: #fff; border-left: 0; border-right: 0; line-height: 24px; overflow: hidden; margin: 0 15px; padding: 5px 0; font-size: 12px; } ul#filelist li { list-style-type: none; margin: 4px 0; padding: 0px 17px 0px 0px; } ul#filelist li:hover { background: #d6e7f9; } #filelist li { clear: both; line-height: 22px; height: 22px; } .plupload_filename { width: 230px; display: block; float: left; word-wrap: break-word; margin-right: 10px; line-height: 22px; margin-left: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .plupload_filesize { width: 80px; line-height: 22px; display: block; float: left; } .plupload_d-none { display: none; } .plupload_fileremove { float: right; line-height: 22px; display: block; cursor: pointer; } .plupload_fileprogress { display: block; width: 60px; line-height: 22px; margin-right: 19px; float: right; text-align: right; } </style> } @section ScriptsBlock { <script src="https://unpkg.com/ml5@latest/dist/ml5.min.js" type="text/javascript"></script> <script src="~/js/plugin/filesize/filesize.js"></script> <script src="~/js/dependency/numeral/numeral.min.js" asp-append-version="true"></script> <script src="~/js/dependency/moment/moment.js" asp-append-version="true"></script> <script src="~/js/formplugins/bootstrap-daterangepicker/bootstrap-daterangepicker.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.min.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/datagrid-filter.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/columns-ext.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/columns-reset.js" asp-append-version="true"></script> <script src="~/js/easyui/locale/easyui-lang-zh_CN.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.component.js" asp-append-version="true"></script> <script src="~/js/plugin/filesaver/FileSaver.js" asp-append-version="true"></script> <script src="~/js/plugin/jquery.serializejson/jquery.serializejson.js" asp-append-version="true"></script> <script src="~/js/jquery.custom.extend.js" asp-append-version="true"></script> <script src="~/js/jquery.extend.formatter.js" asp-append-version="true"></script> <script> let facemesh; let predictions = []; facemesh = ml5.facemesh(() => { console.log('facemesh mode ready') $('#detectbutton').attr('disabled', false); }); $('#photoviewmodal').on('shown.bs.modal', function () { console.log('shown') }) function testPredict(){ const img = document.getElementById('testphoto_img'); facemesh.predict(img).then(faces => { console.log(faces) if (faces) { knnClassifier.classify(faces[0].scaledMesh,(err,result)=>{ console.log(result); $.messager.alert('Result:',result.label); $('#testresult').text(result.label); }) } }); } function loadedphoto(e){ var reader = new FileReader(); reader.onload = function(){ var output = document.getElementById('testphoto_img'); output.src = reader.result; if(knnClassifier.getNumLabels()>0){ $('#testpredictbutton').attr('disabled', false); } }; reader.readAsDataURL(e.target.files[0]); } function uploadphoto(){ $('#uploadimginput').trigger('click'); } function opentest(){ $('#testviewmodal').modal('toggle'); } function openphotoviewmodal(photo) { var div = document.getElementById('photo-container'); div.innerHTML = ''; //$('#photo_img').attr("src", photo.Path); var canvas = document.createElement('canvas'); canvas.id = 'photo-canvas'; canvas.setAttribute("photo-id", photo.Id); canvas.setAttribute("photo-name", photo.Name); var octx = canvas.getContext('2d'); var img = new Image(); var w= 456; img.src = photo.Path; img.onload = function () { canvas.width = img.width; canvas.height = img.height; octx.drawImage(img, 0, 0); while (canvas.width * 0.5 > w) { canvas.width *= 0.5; canvas.height *= 0.5; octx.drawImage(canvas, 0, 0, canvas.width, canvas.height); } canvas.width = w; canvas.height = canvas.width * img.height / img.width; octx.drawImage(img, 0, 0, canvas.width, canvas.height); var div = document.getElementById('photo-container'); div.appendChild(canvas) } $('.card-title').text(photo.Name) $('#photoviewmodal').modal('toggle'); } function predict() { const img = document.getElementById('photo-canvas'); facemesh.predict(img).then(faces => { console.log(faces) if (faces) { const canvas = document.getElementById("photo-canvas"); const photoId=canvas.getAttribute("photo-id"); const photoName=canvas.getAttribute("photo-name"); console.log(canvas) var draw = canvas.getContext("2d"); var mesh = faces[0].scaledMesh; console.log(mesh); /* highlight facial landmark points on canvas board */ draw.fillStyle = "#00FF00"; for (i = 0; i < mesh.length; i++) { var [x, y, z] = mesh[i]; draw.fillRect(Math.round(x), Math.round(y), 2, 2); } updateLandmarks(photoId,JSON.stringify(mesh)); knnClassifier.addExample(mesh, photoName); canvas.setAttribute("photo-mesh", JSON.stringify(mesh)); $('#testbutton').attr('disabled', false); } }); } function updateLandmarks(id,landmarks){ $.post('/Photos/Update',{Id:id,Landmarks:landmarks}).done(res=>{ console.log(res); reload(); }).fail(res=>{ $.messager.alert('更新失败', res, 'error'); }) } let knnClassifier =ml5.KNNClassifier(); function training(){ $.messager.progress({msg:'training....'}); $.get('/Photos/GetAll').done(res=>{ for(let i=0;i<50;i++){ res.map(item=>{ if(item.Landmarks){ knnClassifier.addExample(JSON.parse(item.Landmarks), item.Name); } }); } $.messager.progress('close') if(knnClassifier.getNumLabels()>0){ knnClassifier.classify(JSON.parse(res[2].Landmarks),(err,result)=>{ console.log(result); }) $('#testbutton').attr('disabled', false); } }) } async function test(){ if(knnClassifier.getNumLabels()>0){ const canvas = document.getElementById("photo-canvas"); const mesh=canvas.getAttribute("photo-mesh"); const photoid=canvas.getAttribute("photo-id"); let input=null; if(mesh){ input = JSON.parse(mesh); }else{ const item = await $.get('/Photos/GetById?id=' + photoid); console.log(item) input=JSON.parse(item.Landmarks); } knnClassifier.classify(input,(err,result)=>{ console.log(result); $.messager.alert('Result:',result.label); }) }else{ $('#testbutton').attr('disabled', true); } } </script> <script> //全屏事件 document.addEventListener('panel.onfullscreen', () => { $dg.treegrid('resize'); }); var $dg = $('#photos_datagrid'); var EDITINLINE = true; var product = null; var editIndex = undefined; //下载Excel导入模板 //执行导出下载Excel function exportExcel() { const filterRules = JSON.stringify($dg.datagrid('options').filterRules); console.log(filterRules); $.messager.progress({ title: '请等待', msg: '正在执行导出...' }); let formData = new FormData(); formData.append('filterRules', filterRules); formData.append('sort', 'Id'); formData.append('order', 'asc'); $.postDownload('/Photos/ExportExcel', formData).then(res => { $.messager.progress('close'); toastr.success('导出成功!'); }).catch(err => { //console.log(err); $.messager.progress('close'); $.messager.alert('导出失败', err.statusText, 'error'); }); } //弹出明细信息 function previewphoto(id, index) { const photo = $dg.datagrid('getRows')[index]; console.log(photo) openphotoviewmodal(photo) } function reload() { $dg.datagrid('uncheckAll'); $dg.datagrid('reload'); } //新增记录 function appendItem() { openuploadfilemodal(); } //删除选中的行 function deleteChecked() { const checked = $dg.datagrid('getChecked').map(item => { return item.Id; });; if (checked.length > 0) { deleteRows(checked); } else { $.messager.alert('提示', '请先选择要删除的记录!', 'question'); } } //执行删除 function deleteRows(selected) { $.messager.confirm('确认', `你确定要删除这 <span class='badge badge-icon position-relative'>${selected.length} </span> 行记录?`, result => { if (result) { $.post('/Photos/DeleteChecked', { id: selected }) .done(response => { if (response.Succeeded) { toastr.error(`成功删除 [${selected.length}] 行记录`); reload(); } else { $.messager.alert('错误', response.err, 'error'); } }) .fail((jqXHR, textStatus, errorThrown) => { $.messager.alert('异常', `${jqXHR.status}: ${jqXHR.statusText} `, 'error'); }); } }); } $(document).ready(function () { //定义datagrid结构 $dg.datagrid({ rownumbers: true, checkOnSelect: false, selectOnCheck: false, idField: 'Id', sortName: 'Id', sortOrder: 'desc', remoteFilter: true, singleSelect: true, method: 'get', clientPaging: false, pagination: true, striped: true, filterRules: [], height: 670, pageSize: 15, pageList: [15, 20, 50, 100, 500, 2000], onBeforeLoad: function () { $('.enable-loader').removeClass('enable-loader') }, onLoadSuccess: function (data) { editIndex = undefined; $("button[name*='deletebutton']").prop('disabled', true); $("button[name*='savebutton']").prop('disabled', true); $("button[name*='cancelbutton']").prop('disabled', true); }, onCheckAll: function (rows) { if (rows.length > 0) { $("button[name*='deletebutton']").prop('disabled', false); } }, onUncheckAll: function () { $("button[name*='deletebutton']").prop('disabled', true); }, onCheck: function () { $("button[name*='deletebutton']").prop('disabled', false); }, onUncheck: function () { const checked = $(this).datagrid('getChecked').length > 0; $("button[name*='deletebutton']").prop('disabled', !checked); }, onSelect: function (index, row) { product = row; }, onBeginEdit: function (index, row) { //const editors = $(this).datagrid('getEditors', index); }, onEndEdit: function (index, row) { editIndex = undefined; }, onBeforeEdit: function (index, row) { editIndex = index; row.editing = true; $("button[name*='deletebutton']").prop('disabled', false); $("button[name*='cancelbutton']").prop('disabled', false); $("button[name*='savebutton']").prop('disabled', false); $(this).datagrid('refreshRow', index); }, onAfterEdit: function (index, row) { row.editing = false; editIndex = undefined; $(this).datagrid('refreshRow', index); }, onCancelEdit: function (index, row) { row.editing = false; editIndex = undefined; $("button[name*='deletebutton']").prop('disabled', true); $("button[name*='savebutton']").prop('disabled', true); $("button[name*='cancelbutton']").prop('disabled', true); $(this).datagrid('refreshRow', index); }, frozenColumns: [[ /*开启CheckBox选择功能*/ { field: 'ck', checkbox: true }, { field: 'action', title: '操作', width: 85, sortable: false, resizable: true, formatter: function showdetailsformatter(value, row, index) { return `<div class="btn-group">\ <button onclick="previewphoto('${row.Id}', ${index})" class="btn btn-primary btn-sm btn-icon waves-effect waves-themed" title="预览照片" ><i class="fal fal fa-image"></i> </button>\ ` } } ]], columns: [[ { /*名称*/ field: 'Name', title: '@Html.DisplayNameFor(model => model.Name)', width: 160, hidden: false, sortable: true, resizable: true }, { /*路径*/ field: 'Path', title: '@Html.DisplayNameFor(model => model.Path)', width: 220, hidden: false, sortable: true, resizable: true }, { /*大小*/ field: 'Size', title: '@Html.DisplayNameFor(model => model.Size)', width: 120, hidden: false, sortable: true, resizable: true, formatter: function (v) { return filesize(v); } }, { /*扫描结果*/ field: 'Landmarks', title: '@Html.DisplayNameFor(model => model.Landmarks)', width: 280, hidden: false, sortable: true, resizable: true, } ]] }) .datagrid('enableFilter', [ ]) .datagrid('load', '/Photos/GetData'); } ); </script> <script src="~/js/plugin/plupload/plupload.full.min.js"></script> <script src="~/js/plugin/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js"></script> <script src="~/js/plugin/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js"></script> <script type="text/javascript"> function openuploadfilemodal() { $('#uploadfilesmodal').modal('toggle'); } document.addEventListener("DOMContentLoaded", function () { $('#slimscroll').slimScroll({ height: '100px', railVisible: true, alwaysVisible: false, }); var uploader = new plupload.Uploader({ runtimes: 'html5,flash,silverlight,html4', filters: { max_file_size: "20mb" }, browse_button: 'selectuploadfilesbtn', // this can be an id of a DOM element or the DOM element itself url: '/Photos/Upload', }); uploader.init(); //验证文件大小 plupload.addFileFilter('max_file_size', function (maxSize, file, cb) { var undef; if (file.size !== undef && maxSize && file.size > plupload.parseSize(maxSize)) { this.trigger('Error', { code: plupload.FILE_SIZE_ERROR, message: plupload.translate('File size error.'), file: file }); cb(false); } else { cb(true); } }); //初始化 uploader.bind('Init', function (up) { $('#plupload_max_size_alert').addClass('d-none'); }); //设置post参数 uploader.bind('BeforeUpload', function (up) { up.settings.multipart_params.tags = ''; }); //单击选择文件 uploader.bind('Browse', function () { $('#plupload_max_size_alert').addClass('d-none'); }); //分段上传 uploader.bind('ChunkUploaded', function (up, file, info) { console.log(up, file, info) }); //捕获异常 uploader.bind('Error', function (up, error) { console.log(up, error) if (error.code == -600) { $('#plupload_max_size_alert').removeClass('d-none') } else { bootbox.alert(`异常:${error.message}`); } }); //添加文件 uploader.bind('FilesAdded', function (up, files) { $('#file_empty_div').hide() var html = ''; plupload.each(files, function (file) { html += ` <li id="${file.id}" > <span class="plupload_filename">${file.name}</span> <span id="filesize" class="plupload_filesize">(大小:${plupload.formatSize(file.size)})</span> <span id="plfilesize" class="plupload_d-none">${plupload.formatSize(file.size)}</span> <span id="remove" class="plupload_fileremove"> <a href="javascript:void(0);" class="btn btn-outline-info btn-xs btn-icon waves-effect waves-themed"> <i class="fal fa-times"></i> </a> </span> <span id="progress" class="plupload_fileprogress"></span> </li>` //html += '<li id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></li>'; }); document.getElementById('filelist').innerHTML += html; }); //删除队列中的文件 $(document).on('click', '#remove', function (e) { var li = $(this).closest('li'); var fileid = li.attr('id'); uploader.removeFile(fileid); li.remove() if ($('ul#filelist li').length == 0) { $('#file_empty_div').show(); } }); //显示进度 uploader.bind('UploadProgress', function (up, file) { $(`li#${file.id} > .plupload_fileprogress`).text(file.percent + " %") }); uploader.bind('BeforeChunkUpload', function (up, file) { //console.log('BeforeChunkUpload', up, file) }); //完成上传 uploader.bind('UploadComplete', function (up, files) { //console.log('UploadComplete', up.files) $('#plupload_max_size_alert').addClass('d-none'); $('#uploadfilesmodal').modal('toggle') uploader.files.forEach(function (item) { uploader.removeFile(item); $(`ul#filelist #${item.id}`).remove(); }); $('#file_empty_div').show(); reload() }); //开始上传 $('#postuploadfilesbtn').click(function () { uploader.start(); }); }); </script> }
the_stack
<!DOCTYPE html> <html lang="en" class=" is-copy-enabled emoji-size-boost is-u2f-enabled"> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#"> <meta charset='utf-8'> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-31e369ccd2b23a1eccde83f03ef36eafff1f7b9025f6042ccac33a7915753de2.css" integrity="sha256-MeNpzNKyOh7M3oPwPvNur/8fe5Al9gQsysM6eRV1PeI=" media="all" rel="stylesheet" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-42ceeb657525da865f82d1f7a844f3b8ab55c435f054cc62b92911bee9b25e90.css" integrity="sha256-Qs7rZXUl2oZfgtH3qETzuKtVxDXwVMxiuSkRvumyXpA=" media="all" rel="stylesheet" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Language" content="en"> <meta name="viewport" content="width=device-width"> <title>Xamarin-Forms-Labs/build.cake at master · XLabs/Xamarin-Forms-Labs</title> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <link rel="apple-touch-icon" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"> <meta property="fb:app_id" content="1401488693436528"> <meta content="https://avatars3.githubusercontent.com/u/7787062?v=3&amp;s=400" name="twitter:image:src" /><meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="XLabs/Xamarin-Forms-Labs" name="twitter:title" /><meta content="Xamarin-Forms-Labs - Xamarin Forms Labs is a open source project that aims to provide a powerful and cross platform set of controls and helpers tailored to work with Xamarin Forms." name="twitter:description" /> <meta content="https://avatars3.githubusercontent.com/u/7787062?v=3&amp;s=400" property="og:image" /><meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="XLabs/Xamarin-Forms-Labs" property="og:title" /><meta content="https://github.com/XLabs/Xamarin-Forms-Labs" property="og:url" /><meta content="Xamarin-Forms-Labs - Xamarin Forms Labs is a open source project that aims to provide a powerful and cross platform set of controls and helpers tailored to work with Xamarin Forms." property="og:description" /> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="assets" href="https://assets-cdn.github.com/"> <link rel="web-socket" href="wss://live.github.com/_sockets/MjU3MTI4MjpkMzdmZTYzMzdmOGQzNjMyZmM5NGFlMDM5Y2FhYTBhMzo5OGU0NDQxODdhZWUxYThkN2Y3Y2U2ZWUwOWE1OTI4M2YzNzBmMGJkZDlhZDA4ZDZiYmQ5YjgyOTYwMzQzYTg0--641f7f604ec6eb18e2c40392b40e331025f0adee"> <meta name="pjax-timeout" content="1000"> <link rel="sudo-modal" href="/sessions/sudo_modal"> <meta name="request-id" content="1F2EB4FF:08A4:12D74843:582EAC41" data-pjax-transient> <meta name="msapplication-TileImage" content="/windows-tile.png"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="selected-link" value="repo_source" data-pjax-transient> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-analytics" content="UA-3769691-2"> <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="1F2EB4FF:08A4:12D74843:582EAC41" name="octolytics-dimension-request_id" /><meta content="2571282" name="octolytics-actor-id" /><meta content="gabornemeth" name="octolytics-actor-login" /><meta content="3a4a5e8a2ec3a6b32a844886d821ead4481458749c2f1cb0aca9569bcea96b98" name="octolytics-actor-hash" /> <meta content="/&lt;user-name&gt;/&lt;repo-name&gt;/blob/show" data-pjax-transient="true" name="analytics-location" /> <meta class="js-ga-set" name="dimension1" content="Logged In"> <meta name="hostname" content="github.com"> <meta name="user-login" content="gabornemeth"> <meta name="expected-hostname" content="github.com"> <meta name="js-proxy-site-detection-payload" content="NjNkMjg5ZjAwMGNlZGU0NzA3Yzc3ZGRkNDJmM2UzMWM2N2Q2YWU2YzE4ZjZiMmNiM2YxMzZhODNhODE4Y2U1Znx7InJlbW90ZV9hZGRyZXNzIjoiMzEuNDYuMTgwLjI1NSIsInJlcXVlc3RfaWQiOiIxRjJFQjRGRjowOEE0OjEyRDc0ODQzOjU4MkVBQzQxIiwidGltZXN0YW1wIjoxNDc5NDUzNzYyLCJob3N0IjoiZ2l0aHViLmNvbSJ9"> <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000"> <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico"> <meta name="html-safe-nonce" content="9e289dad0a3d8fa1124f9c865d6af3a51ad59814"> <meta content="b0baf8410c9f5013b2fa24609bbf4334384ce20e" name="form-nonce" /> <meta http-equiv="x-pjax-version" content="42e5bf5718362dfefe85e13d1b5a489b"> <meta name="description" content="Xamarin-Forms-Labs - Xamarin Forms Labs is a open source project that aims to provide a powerful and cross platform set of controls and helpers tailored to work with Xamarin Forms."> <meta name="go-import" content="github.com/XLabs/Xamarin-Forms-Labs git https://github.com/XLabs/Xamarin-Forms-Labs.git"> <meta content="7787062" name="octolytics-dimension-user_id" /><meta content="XLabs" name="octolytics-dimension-user_login" /><meta content="20463939" name="octolytics-dimension-repository_id" /><meta content="XLabs/Xamarin-Forms-Labs" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="20463939" name="octolytics-dimension-repository_network_root_id" /><meta content="XLabs/Xamarin-Forms-Labs" name="octolytics-dimension-repository_network_root_nwo" /> <link href="https://github.com/XLabs/Xamarin-Forms-Labs/commits/master.atom" rel="alternate" title="Recent Commits to Xamarin-Forms-Labs:master" type="application/atom+xml"> <link rel="canonical" href="https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/build.cake" data-pjax-transient> </head> <body class="logged-in env-production macintosh vis-public page-blob"> <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div> <a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a> <div class="header header-logged-in true" role="banner"> <div class="container clearfix"> <a class="header-logo-invertocat" href="https://github.com/" data-hotkey="g d" aria-label="Homepage" data-ga-click="Header, go to dashboard, icon:logo"> <svg aria-hidden="true" class="octicon octicon-mark-github" height="28" version="1.1" viewBox="0 0 16 16" width="28"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> </a> <div class="header-search scoped-search site-scoped-search js-site-search" role="search"> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/XLabs/Xamarin-Forms-Labs/search" class="js-site-search-form" data-scoped-search-url="/XLabs/Xamarin-Forms-Labs/search" data-unscoped-search-url="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <label class="form-control header-search-wrapper js-chromeless-input-container"> <div class="header-search-scope">This repository</div> <input type="text" class="form-control header-search-input js-site-search-focus js-site-search-field is-clearable" data-hotkey="s" name="q" placeholder="Search" aria-label="Search this repository" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off"> </label> </form></div> <ul class="header-nav float-left" role="navigation"> <li class="header-nav-item"> <a href="/pulls" aria-label="Pull requests you created" class="js-selected-navigation-item header-nav-link" data-ga-click="Header, click, Nav menu - item:pulls context:user" data-hotkey="g p" data-selected-links="/pulls /pulls/assigned /pulls/mentioned /pulls"> Pull requests </a> </li> <li class="header-nav-item"> <a href="/issues" aria-label="Issues you created" class="js-selected-navigation-item header-nav-link" data-ga-click="Header, click, Nav menu - item:issues context:user" data-hotkey="g i" data-selected-links="/issues /issues/assigned /issues/mentioned /issues"> Issues </a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="https://gist.github.com/" data-ga-click="Header, go to gist, text:gist">Gist</a> </li> </ul> <ul class="header-nav user-nav float-right" id="user-links"> <li class="header-nav-item"> <a href="/notifications" aria-label="You have no unread notifications" class="header-nav-link notification-indicator tooltipped tooltipped-s js-socket-channel js-notification-indicator" data-channel="tenant:1:notification-changed:2571282" data-ga-click="Header, go to notifications, icon:read" data-hotkey="g n"> <span class="mail-status "></span> <svg aria-hidden="true" class="octicon octicon-bell" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 12v1H0v-1l.73-.58c.77-.77.81-2.55 1.19-4.42C2.69 3.23 6 2 6 2c0-.55.45-1 1-1s1 .45 1 1c0 0 3.39 1.23 4.16 5 .38 1.88.42 3.66 1.19 4.42l.66.58H14zm-7 4c1.11 0 2-.89 2-2H5c0 1.11.89 2 2 2z"/></svg> </a> </li> <li class="header-nav-item dropdown js-menu-container"> <a class="header-nav-link tooltipped tooltipped-s js-menu-target" href="/new" aria-label="Create new…" data-ga-click="Header, create new, icon:add"> <svg aria-hidden="true" class="octicon octicon-plus float-left" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 9H7v5H5V9H0V7h5V2h2v5h5z"/></svg> <span class="dropdown-caret"></span> </a> <div class="dropdown-menu-content js-menu-content"> <ul class="dropdown-menu dropdown-menu-sw"> <a class="dropdown-item" href="/new" data-ga-click="Header, create new repository"> New repository </a> <a class="dropdown-item" href="/new/import" data-ga-click="Header, import a repository"> Import repository </a> <a class="dropdown-item" href="https://gist.github.com/" data-ga-click="Header, create new gist"> New gist </a> <a class="dropdown-item" href="/organizations/new" data-ga-click="Header, create new organization"> New organization </a> <div class="dropdown-divider"></div> <div class="dropdown-header"> <span title="XLabs/Xamarin-Forms-Labs">This repository</span> </div> <a class="dropdown-item" href="/XLabs/Xamarin-Forms-Labs/issues/new" data-ga-click="Header, create new issue"> New issue </a> </ul> </div> </li> <li class="header-nav-item dropdown js-menu-container"> <a class="header-nav-link name tooltipped tooltipped-sw js-menu-target" href="/gabornemeth" aria-label="View profile and more" data-ga-click="Header, show menu, icon:avatar"> <img alt="@gabornemeth" class="avatar" height="20" src="https://avatars1.githubusercontent.com/u/2571282?v=3&amp;s=40" width="20" /> <span class="dropdown-caret"></span> </a> <div class="dropdown-menu-content js-menu-content"> <div class="dropdown-menu dropdown-menu-sw"> <div class="dropdown-header header-nav-current-user css-truncate"> Signed in as <strong class="css-truncate-target">gabornemeth</strong> </div> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/gabornemeth" data-ga-click="Header, go to profile, text:your profile"> Your profile </a> <a class="dropdown-item" href="/gabornemeth?tab=stars" data-ga-click="Header, go to starred repos, text:your stars"> Your stars </a> <a class="dropdown-item" href="/explore" data-ga-click="Header, go to explore, text:explore"> Explore </a> <a class="dropdown-item" href="/integrations" data-ga-click="Header, go to integrations, text:integrations"> Integrations </a> <a class="dropdown-item" href="https://help.github.com" data-ga-click="Header, go to help, text:help"> Help </a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/settings/profile" data-ga-click="Header, go to settings, icon:settings"> Settings </a> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/logout" class="logout-form" data-form-nonce="b0baf8410c9f5013b2fa24609bbf4334384ce20e" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="OJhbSjmLCmEqxH8Or1uMc8izzdXfMr2xn5qywnkxv3FuKGQY0g7BTP5VkyfVUBEnfGBWU+PamX2MMTlI4WFIQw==" /></div> <button type="submit" class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout"> Sign out </button> </form> </div> </div> </li> </ul> </div> </div> <div id="start-of-content" class="accessibility-aid"></div> <div id="js-flash-container"> </div> <div role="main"> <div itemscope itemtype="http://schema.org/SoftwareSourceCode"> <div id="js-repo-pjax-container" data-pjax-container> <div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav"> <div class="container repohead-details-container"> <ul class="pagehead-actions"> <li> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-form-nonce="b0baf8410c9f5013b2fa24609bbf4334384ce20e" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="srn7B7derENMAew+aw/pZ81dAb4ynNd7deujw7g8G5w9H9y7qHlQWtOoNPn/W5FbKKIywxXv2BD0QdvE1FvhuA==" /></div> <input class="form-control" id="repository_id" name="repository_id" type="hidden" value="20463939" /> <div class="select-menu js-menu-container js-select-menu"> <a href="/XLabs/Xamarin-Forms-Labs/subscription" class="btn btn-sm btn-with-count select-menu-button js-menu-target" role="button" tabindex="0" aria-haspopup="true" data-ga-click="Repository, click Watch settings, action:blob#show"> <span class="js-select-button"> <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg> Watch </span> </a> <a class="social-count js-social-count" href="/XLabs/Xamarin-Forms-Labs/watchers" aria-label="195 users are watching this repository"> 195 </a> <div class="select-menu-modal-holder"> <div class="select-menu-modal subscription-menu-modal js-menu-content" aria-hidden="true"> <div class="select-menu-header js-navigation-enable" tabindex="-1"> <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg> <span class="select-menu-title">Notifications</span> </div> <div class="select-menu-list js-navigation-container" role="menu"> <div class="select-menu-item js-navigation-item selected" role="menuitem" tabindex="0"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <div class="select-menu-item-text"> <input checked="checked" id="do_included" name="do" type="radio" value="included" /> <span class="select-menu-item-heading">Not watching</span> <span class="description">Be notified when participating or @mentioned.</span> <span class="js-select-button-text hidden-select-button-text"> <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg> Watch </span> </div> </div> <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <div class="select-menu-item-text"> <input id="do_subscribed" name="do" type="radio" value="subscribed" /> <span class="select-menu-item-heading">Watching</span> <span class="description">Be notified of all conversations.</span> <span class="js-select-button-text hidden-select-button-text"> <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg> Unwatch </span> </div> </div> <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <div class="select-menu-item-text"> <input id="do_ignore" name="do" type="radio" value="ignore" /> <span class="select-menu-item-heading">Ignoring</span> <span class="description">Never be notified.</span> <span class="js-select-button-text hidden-select-button-text"> <svg aria-hidden="true" class="octicon octicon-mute" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8 2.81v10.38c0 .67-.81 1-1.28.53L3 10H1c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h2l3.72-3.72C7.19 1.81 8 2.14 8 2.81zm7.53 3.22l-1.06-1.06-1.97 1.97-1.97-1.97-1.06 1.06L11.44 8 9.47 9.97l1.06 1.06 1.97-1.97 1.97 1.97 1.06-1.06L13.56 8l1.97-1.97z"/></svg> Stop ignoring </span> </div> </div> </div> </div> </div> </div> </form> </li> <li> <div class="js-toggler-container js-social-container starring-container "> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/XLabs/Xamarin-Forms-Labs/unstar" class="starred" data-form-nonce="b0baf8410c9f5013b2fa24609bbf4334384ce20e" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="iZIFnRrM0jnl2BI0DloUS3gL0WNUpWc0e5jHhBMy8a6GsxqgD/xQ5by4Wr3MgACTLSbT+KvmI7PKjzQ3PuGjdw==" /></div> <button type="submit" class="btn btn-sm btn-with-count js-toggler-target" aria-label="Unstar this repository" title="Unstar XLabs/Xamarin-Forms-Labs" data-ga-click="Repository, click unstar button, action:blob#show; text:Unstar"> <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"/></svg> Unstar </button> <a class="social-count js-social-count" href="/XLabs/Xamarin-Forms-Labs/stargazers" aria-label="1007 users starred this repository"> 1,007 </a> </form> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/XLabs/Xamarin-Forms-Labs/star" class="unstarred" data-form-nonce="b0baf8410c9f5013b2fa24609bbf4334384ce20e" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="AHza6ifsw9VxXS0KH5aycApTVrJOqzrvqVU8QmNjnzEhMAMd+S8aMi0bL91QvQGNX8Z09QXO57jdEcWGysN/4Q==" /></div> <button type="submit" class="btn btn-sm btn-with-count js-toggler-target" aria-label="Star this repository" title="Star XLabs/Xamarin-Forms-Labs" data-ga-click="Repository, click star button, action:blob#show; text:Star"> <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"/></svg> Star </button> <a class="social-count js-social-count" href="/XLabs/Xamarin-Forms-Labs/stargazers" aria-label="1007 users starred this repository"> 1,007 </a> </form> </div> </li> <li> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/XLabs/Xamarin-Forms-Labs/fork" class="btn-with-count" data-form-nonce="b0baf8410c9f5013b2fa24609bbf4334384ce20e" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="UXM4fZByCMOWz4rTAK086d4CQvic2SKEqh4AlOGz7UpEUJBBkjv3aqKMOBQDRsygsAWLCzoBEXjDAqRfvBREuQ==" /></div> <button type="submit" class="btn btn-sm btn-with-count" data-ga-click="Repository, show fork modal, action:blob#show; text:Fork" title="Fork your own copy of XLabs/Xamarin-Forms-Labs to your account" aria-label="Fork your own copy of XLabs/Xamarin-Forms-Labs to your account"> <svg aria-hidden="true" class="octicon octicon-repo-forked" height="16" version="1.1" viewBox="0 0 10 16" width="10"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg> Fork </button> </form> <a href="/XLabs/Xamarin-Forms-Labs/network" class="social-count" aria-label="777 users forked this repository"> 777 </a> </li> </ul> <h1 class="public "> <svg aria-hidden="true" class="octicon octicon-repo" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg> <span class="author" itemprop="author"><a href="/XLabs" class="url fn" rel="author">XLabs</a></span><!-- --><span class="path-divider">/</span><!-- --><strong itemprop="name"><a href="/XLabs/Xamarin-Forms-Labs" data-pjax="#js-repo-pjax-container">Xamarin-Forms-Labs</a></strong> </h1> </div> <div class="container"> <nav class="reponav js-repo-nav js-sidenav-container-pjax" itemscope itemtype="http://schema.org/BreadcrumbList" role="navigation" data-pjax="#js-repo-pjax-container"> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/XLabs/Xamarin-Forms-Labs" aria-selected="true" class="js-selected-navigation-item selected reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /XLabs/Xamarin-Forms-Labs" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-code" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"/></svg> <span itemprop="name">Code</span> <meta itemprop="position" content="1"> </a> </span> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/XLabs/Xamarin-Forms-Labs/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /XLabs/Xamarin-Forms-Labs/issues" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/></svg> <span itemprop="name">Issues</span> <span class="counter">363</span> <meta itemprop="position" content="2"> </a> </span> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/XLabs/Xamarin-Forms-Labs/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /XLabs/Xamarin-Forms-Labs/pulls" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-git-pull-request" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg> <span itemprop="name">Pull requests</span> <span class="counter">6</span> <meta itemprop="position" content="3"> </a> </span> <a href="/XLabs/Xamarin-Forms-Labs/projects" class="js-selected-navigation-item reponav-item" data-selected-links="repo_projects new_repo_project repo_project /XLabs/Xamarin-Forms-Labs/projects"> <svg aria-hidden="true" class="octicon octicon-project" height="16" version="1.1" viewBox="0 0 15 16" width="15"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg> Projects <span class="counter">0</span> </a> <a href="/XLabs/Xamarin-Forms-Labs/wiki" class="js-selected-navigation-item reponav-item" data-hotkey="g w" data-selected-links="repo_wiki /XLabs/Xamarin-Forms-Labs/wiki"> <svg aria-hidden="true" class="octicon octicon-book" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"/></svg> Wiki </a> <a href="/XLabs/Xamarin-Forms-Labs/pulse" class="js-selected-navigation-item reponav-item" data-selected-links="pulse /XLabs/Xamarin-Forms-Labs/pulse"> <svg aria-hidden="true" class="octicon octicon-pulse" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0v2h3.6l.9-1.8.9 5.4L9 8.5l1.6 1.5H14V8z"/></svg> Pulse </a> <a href="/XLabs/Xamarin-Forms-Labs/graphs" class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors /XLabs/Xamarin-Forms-Labs/graphs"> <svg aria-hidden="true" class="octicon octicon-graph" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M16 14v1H0V0h1v14h15zM5 13H3V8h2v5zm4 0H7V3h2v10zm4 0h-2V6h2v7z"/></svg> Graphs </a> </nav> </div> </div> <div class="container new-discussion-timeline experiment-repo-nav"> <div class="repository-content"> <a href="/XLabs/Xamarin-Forms-Labs/blob/1b55f3a1d7de7d0f85a0d635c4327e6eed2bacdc/build.cake" class="d-none js-permalink-shortcut" data-hotkey="y">Permalink</a> <!-- blob contrib key: blob_contributors:v21:ab533de7bf5c348124077ce8e3cee75c --> <div class="file-navigation js-zeroclipboard-container"> <div class="select-menu branch-select-menu js-menu-container js-select-menu float-left"> <button class="btn btn-sm select-menu-button js-menu-target css-truncate" data-hotkey="w" type="button" aria-label="Switch branches or tags" tabindex="0" aria-haspopup="true"> <i>Branch:</i> <span class="js-select-button css-truncate-target">master</span> </button> <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax aria-hidden="true"> <div class="select-menu-modal"> <div class="select-menu-header"> <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg> <span class="select-menu-title">Switch branches/tags</span> </div> <div class="select-menu-filters"> <div class="select-menu-text-filter"> <input type="text" aria-label="Filter branches/tags" id="context-commitish-filter-field" class="form-control js-filterable-field js-navigation-enable" placeholder="Filter branches/tags"> </div> <div class="select-menu-tabs"> <ul> <li class="select-menu-tab"> <a href="#" data-tab-filter="branches" data-filter-placeholder="Filter branches/tags" class="js-select-menu-tab" role="tab">Branches</a> </li> <li class="select-menu-tab"> <a href="#" data-tab-filter="tags" data-filter-placeholder="Find a tag…" class="js-select-menu-tab" role="tab">Tags</a> </li> </ul> </div> </div> <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches" role="menu"> <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring"> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/2.2.0/build.cake" data-name="2.2.0" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> 2.2.0 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/Release/build.cake" data-name="Release" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> Release </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/WKWebView/build.cake" data-name="WKWebView" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> WKWebView </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/gh-pages/build.cake" data-name="gh-pages" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> gh-pages </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open selected" href="/XLabs/Xamarin-Forms-Labs/blob/master/build.cake" data-name="master" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> master </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/old_master/build.cake" data-name="old_master" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> old_master </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/release-2.0/build.cake" data-name="release-2.0" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> release-2.0 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/revert-1141-master/build.cake" data-name="revert-1141-master" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> revert-1141-master </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/v.1.2.0/build.cake" data-name="v.1.2.0" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> v.1.2.0 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/blob/v.1.2.1/build.cake" data-name="v.1.2.1" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> v.1.2.1 </span> </a> </div> <div class="select-menu-no-results">Nothing to show</div> </div> <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags"> <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring"> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v2.2.0-pre2/build.cake" data-name="v2.2.0-pre2" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.2.0-pre2"> v2.2.0-pre2 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v2.0-pre7/build.cake" data-name="v2.0-pre7" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0-pre7"> v2.0-pre7 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v2.0-pre3/build.cake" data-name="v2.0-pre3" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0-pre3"> v2.0-pre3 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v1.2.1/build.cake" data-name="v1.2.1" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v1.2.1"> v1.2.1 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v1.2.1-pre2/build.cake" data-name="v1.2.1-pre2" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v1.2.1-pre2"> v1.2.1-pre2 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v1.2.0/build.cake" data-name="v1.2.0" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v1.2.0"> v1.2.0 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v1.1.1-beta3/build.cake" data-name="v1.1.1-beta3" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v1.1.1-beta3"> v1.1.1-beta3 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v1.1.1-beta1/build.cake" data-name="v1.1.1-beta1" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v1.1.1-beta1"> v1.1.1-beta1 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v1.1.0/build.cake" data-name="v1.1.0" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v1.1.0"> v1.1.0 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v1.1.0-Beta4/build.cake" data-name="v1.1.0-Beta4" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v1.1.0-Beta4"> v1.1.0-Beta4 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v1.1.0-Beta2/build.cake" data-name="v1.1.0-Beta2" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v1.1.0-Beta2"> v1.1.0-Beta2 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/v.1.0.1/build.cake" data-name="v.1.0.1" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v.1.0.1"> v.1.0.1 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/Release_2.0.0/build.cake" data-name="Release_2.0.0" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="Release_2.0.0"> Release_2.0.0 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/2.3.0-pre05/build.cake" data-name="2.3.0-pre05" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="2.3.0-pre05"> 2.3.0-pre05 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/2.3.0-pre01/build.cake" data-name="2.3.0-pre01" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="2.3.0-pre01"> 2.3.0-pre01 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/2.2.0-pre05/build.cake" data-name="2.2.0-pre05" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="2.2.0-pre05"> 2.2.0-pre05 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/2.0.5653-pre2/build.cake" data-name="2.0.5653-pre2" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="2.0.5653-pre2"> 2.0.5653-pre2 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/2.0.5610.2/build.cake" data-name="2.0.5610.2" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="2.0.5610.2"> 2.0.5610.2 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/2.0.5539-pre2/build.cake" data-name="2.0.5539-pre2" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="2.0.5539-pre2"> 2.0.5539-pre2 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/2.0.5522/build.cake" data-name="2.0.5522" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="2.0.5522"> 2.0.5522 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/XLabs/Xamarin-Forms-Labs/tree/2.0.5520/build.cake" data-name="2.0.5520" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="2.0.5520"> 2.0.5520 </span> </a> </div> <div class="select-menu-no-results">Nothing to show</div> </div> </div> </div> </div> <div class="BtnGroup float-right"> <a href="/XLabs/Xamarin-Forms-Labs/find/master" class="js-pjax-capture-input btn btn-sm BtnGroup-item" data-pjax data-hotkey="t"> Find file </a> <button aria-label="Copy file path to clipboard" class="js-zeroclipboard btn btn-sm BtnGroup-item tooltipped tooltipped-s" data-copied-hint="Copied!" type="button">Copy path</button> </div> <div class="breadcrumb js-zeroclipboard-target"> <span class="repo-root js-repo-root"><span class="js-path-segment"><a href="/XLabs/Xamarin-Forms-Labs"><span>Xamarin-Forms-Labs</span></a></span></span><span class="separator">/</span><strong class="final-path">build.cake</strong> </div> </div> <div class="commit-tease"> <span class="float-right"> <a class="commit-tease-sha" href="/XLabs/Xamarin-Forms-Labs/commit/1b55f3a1d7de7d0f85a0d635c4327e6eed2bacdc" data-pjax> 1b55f3a </a> <relative-time datetime="2016-11-12T18:45:07Z">Nov 12, 2016</relative-time> </span> <div> <img alt="" class="avatar" data-canonical-src="https://0.gravatar.com/avatar/be3577a6792770b36bad7ac416173755?d=https%3A%2F%2Fassets-cdn.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png&amp;r=x&amp;s=140" height="20" src="https://camo.githubusercontent.com/1c185530ae1704f17f44fa2b2b8284eff154e714/68747470733a2f2f302e67726176617461722e636f6d2f6176617461722f62653335373761363739323737306233366261643761633431363137333735353f643d68747470732533412532462532466173736574732d63646e2e6769746875622e636f6d253246696d6167657325324667726176617461727325324667726176617461722d757365722d3432302e706e6726723d7826733d313430" width="20" /> <span class="user-mention">ravensorb</span> <a href="/XLabs/Xamarin-Forms-Labs/commit/1b55f3a1d7de7d0f85a0d635c4327e6eed2bacdc" class="message" data-pjax="true" title="Updates to build script, updated version in nuspec files">Updates to build script, updated version in nuspec files</a> </div> <div class="commit-tease-contributors"> <button type="button" class="btn-link muted-link contributors-toggle" data-facebox="#blob_contributors_box"> <strong>0</strong> contributors </button> </div> <div id="blob_contributors_box" style="display:none"> <h2 class="facebox-header" data-facebox-id="facebox-header">Users who have contributed to this file</h2> <ul class="facebox-user-list" data-facebox-id="facebox-description"> </ul> </div> </div> <div class="file"> <div class="file-header"> <div class="file-actions"> <div class="BtnGroup"> <a href="/XLabs/Xamarin-Forms-Labs/raw/master/build.cake" class="btn btn-sm BtnGroup-item" id="raw-url">Raw</a> <a href="/XLabs/Xamarin-Forms-Labs/blame/master/build.cake" class="btn btn-sm js-update-url-with-hash BtnGroup-item">Blame</a> <a href="/XLabs/Xamarin-Forms-Labs/commits/master/build.cake" class="btn btn-sm BtnGroup-item" rel="nofollow">History</a> </div> <a class="btn-octicon tooltipped tooltipped-nw" href="github-mac://openRepo/https://github.com/XLabs/Xamarin-Forms-Labs?branch=master&amp;filepath=build.cake" aria-label="Open this file in GitHub Desktop" data-ga-click="Repository, open with desktop, type:mac"> <svg aria-hidden="true" class="octicon octicon-device-desktop" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M15 2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm0 9H1V3h14v8z"/></svg> </a> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/XLabs/Xamarin-Forms-Labs/edit/master/build.cake" class="inline-form js-update-url-with-hash" data-form-nonce="b0baf8410c9f5013b2fa24609bbf4334384ce20e" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="4VWLXngpTXtV6SDTpLvNLdVpadzM66jpu/plpmn7tZD2BX6NSlIN8+sID6oKTiNR9P0FRlhvT8yOmjIGYq4N1w==" /></div> <button class="btn-octicon tooltipped tooltipped-nw" type="submit" aria-label="Edit the file in your fork of this project" data-hotkey="e" data-disable-with> <svg aria-hidden="true" class="octicon octicon-pencil" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 0 1 1.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"/></svg> </button> </form> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/XLabs/Xamarin-Forms-Labs/delete/master/build.cake" class="inline-form" data-form-nonce="b0baf8410c9f5013b2fa24609bbf4334384ce20e" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="WuPSPxfKcRc+bE9u2uVQ64EdcOiE1qhp15f+TCFKqy7yAN0qTlOHYaQv95ZZfJPvfmigqCNAUiV8ivc0sW9FLQ==" /></div> <button class="btn-octicon btn-octicon-danger tooltipped tooltipped-nw" type="submit" aria-label="Delete the file in your fork of this project" data-disable-with> <svg aria-hidden="true" class="octicon octicon-trashcan" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"/></svg> </button> </form> </div> <div class="file-info"> 353 lines (296 sloc) <span class="file-info-divider"></span> 10.5 KB </div> </div> <div itemprop="text" class="blob-wrapper data type-c"> <table class="highlight tab-size js-file-line-container" data-tab-size="8"> <tr> <td id="L1" class="blob-num js-line-number" data-line-number="1"></td> <td id="LC1" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L2" class="blob-num js-line-number" data-line-number="2"></td> <td id="LC2" class="blob-code blob-code-inner js-file-line"><span class="pl-c">// Directives</span></td> </tr> <tr> <td id="L3" class="blob-num js-line-number" data-line-number="3"></td> <td id="LC3" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L4" class="blob-num js-line-number" data-line-number="4"></td> <td id="LC4" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L5" class="blob-num js-line-number" data-line-number="5"></td> <td id="LC5" class="blob-code blob-code-inner js-file-line">#l <span class="pl-s"><span class="pl-pds">&quot;</span>tools/versionUtils.cake<span class="pl-pds">&quot;</span></span></td> </tr> <tr> <td id="L6" class="blob-num js-line-number" data-line-number="6"></td> <td id="LC6" class="blob-code blob-code-inner js-file-line">#l <span class="pl-s"><span class="pl-pds">&quot;</span>tools/settingsUtils.cake<span class="pl-pds">&quot;</span></span></td> </tr> <tr> <td id="L7" class="blob-num js-line-number" data-line-number="7"></td> <td id="LC7" class="blob-code blob-code-inner js-file-line">#tool <span class="pl-s"><span class="pl-pds">&quot;</span>nuget:?package=NUnit.ConsoleRunner<span class="pl-pds">&quot;</span></span></td> </tr> <tr> <td id="L8" class="blob-num js-line-number" data-line-number="8"></td> <td id="LC8" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L9" class="blob-num js-line-number" data-line-number="9"></td> <td id="LC9" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L10" class="blob-num js-line-number" data-line-number="10"></td> <td id="LC10" class="blob-code blob-code-inner js-file-line"><span class="pl-c">// ARGUMENTS</span></td> </tr> <tr> <td id="L11" class="blob-num js-line-number" data-line-number="11"></td> <td id="LC11" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L12" class="blob-num js-line-number" data-line-number="12"></td> <td id="LC12" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L13" class="blob-num js-line-number" data-line-number="13"></td> <td id="LC13" class="blob-code blob-code-inner js-file-line"><span class="pl-k">var</span> settings = SettingsUtils.LoadSettings(Context);</td> </tr> <tr> <td id="L14" class="blob-num js-line-number" data-line-number="14"></td> <td id="LC14" class="blob-code blob-code-inner js-file-line"><span class="pl-k">var</span> versionInfo = VersionUtils.LoadVersion(Context, settings);</td> </tr> <tr> <td id="L15" class="blob-num js-line-number" data-line-number="15"></td> <td id="LC15" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L16" class="blob-num js-line-number" data-line-number="16"></td> <td id="LC16" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L17" class="blob-num js-line-number" data-line-number="17"></td> <td id="LC17" class="blob-code blob-code-inner js-file-line"><span class="pl-c">// GLOBAL VARIABLES</span></td> </tr> <tr> <td id="L18" class="blob-num js-line-number" data-line-number="18"></td> <td id="LC18" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L19" class="blob-num js-line-number" data-line-number="19"></td> <td id="LC19" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L20" class="blob-num js-line-number" data-line-number="20"></td> <td id="LC20" class="blob-code blob-code-inner js-file-line"><span class="pl-k">var</span> solutions = GetFiles(settings.Build.SolutionFilePath);</td> </tr> <tr> <td id="L21" class="blob-num js-line-number" data-line-number="21"></td> <td id="LC21" class="blob-code blob-code-inner js-file-line"><span class="pl-k">var</span> solutionPaths = solutions.Select(solution =&gt; solution.GetDirectory());</td> </tr> <tr> <td id="L22" class="blob-num js-line-number" data-line-number="22"></td> <td id="LC22" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L23" class="blob-num js-line-number" data-line-number="23"></td> <td id="LC23" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L24" class="blob-num js-line-number" data-line-number="24"></td> <td id="LC24" class="blob-code blob-code-inner js-file-line"><span class="pl-c">// SETUP / TEARDOWN</span></td> </tr> <tr> <td id="L25" class="blob-num js-line-number" data-line-number="25"></td> <td id="LC25" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L26" class="blob-num js-line-number" data-line-number="26"></td> <td id="LC26" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L27" class="blob-num js-line-number" data-line-number="27"></td> <td id="LC27" class="blob-code blob-code-inner js-file-line">Setup((c) =&gt;</td> </tr> <tr> <td id="L28" class="blob-num js-line-number" data-line-number="28"></td> <td id="LC28" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L29" class="blob-num js-line-number" data-line-number="29"></td> <td id="LC29" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Executed BEFORE the first task.</span></td> </tr> <tr> <td id="L30" class="blob-num js-line-number" data-line-number="30"></td> <td id="LC30" class="blob-code blob-code-inner js-file-line"> settings.Display(c);</td> </tr> <tr> <td id="L31" class="blob-num js-line-number" data-line-number="31"></td> <td id="LC31" class="blob-code blob-code-inner js-file-line"> versionInfo.Display(c);</td> </tr> <tr> <td id="L32" class="blob-num js-line-number" data-line-number="32"></td> <td id="LC32" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L33" class="blob-num js-line-number" data-line-number="33"></td> <td id="LC33" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L34" class="blob-num js-line-number" data-line-number="34"></td> <td id="LC34" class="blob-code blob-code-inner js-file-line">Teardown((c) =&gt;</td> </tr> <tr> <td id="L35" class="blob-num js-line-number" data-line-number="35"></td> <td id="LC35" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L36" class="blob-num js-line-number" data-line-number="36"></td> <td id="LC36" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Executed AFTER the last task.</span></td> </tr> <tr> <td id="L37" class="blob-num js-line-number" data-line-number="37"></td> <td id="LC37" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Finished running tasks.<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L38" class="blob-num js-line-number" data-line-number="38"></td> <td id="LC38" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L39" class="blob-num js-line-number" data-line-number="39"></td> <td id="LC39" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L40" class="blob-num js-line-number" data-line-number="40"></td> <td id="LC40" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L41" class="blob-num js-line-number" data-line-number="41"></td> <td id="LC41" class="blob-code blob-code-inner js-file-line"><span class="pl-c">// TASK DEFINITIONS</span></td> </tr> <tr> <td id="L42" class="blob-num js-line-number" data-line-number="42"></td> <td id="LC42" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L43" class="blob-num js-line-number" data-line-number="43"></td> <td id="LC43" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L44" class="blob-num js-line-number" data-line-number="44"></td> <td id="LC44" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>CleanAll<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L45" class="blob-num js-line-number" data-line-number="45"></td> <td id="LC45" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Cleans all directories that are used during the build process.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L46" class="blob-num js-line-number" data-line-number="46"></td> <td id="LC46" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L47" class="blob-num js-line-number" data-line-number="47"></td> <td id="LC47" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L48" class="blob-num js-line-number" data-line-number="48"></td> <td id="LC48" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Clean solution directories.</span></td> </tr> <tr> <td id="L49" class="blob-num js-line-number" data-line-number="49"></td> <td id="LC49" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span>(<span class="pl-k">var</span> path <span class="pl-k">in</span> solutionPaths)</td> </tr> <tr> <td id="L50" class="blob-num js-line-number" data-line-number="50"></td> <td id="LC50" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L51" class="blob-num js-line-number" data-line-number="51"></td> <td id="LC51" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Cleaning {0}<span class="pl-pds">&quot;</span></span>, path);</td> </tr> <tr> <td id="L52" class="blob-num js-line-number" data-line-number="52"></td> <td id="LC52" class="blob-code blob-code-inner js-file-line"> CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/**/bin<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L53" class="blob-num js-line-number" data-line-number="53"></td> <td id="LC53" class="blob-code blob-code-inner js-file-line"> CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/**/obj<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L54" class="blob-num js-line-number" data-line-number="54"></td> <td id="LC54" class="blob-code blob-code-inner js-file-line"> CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/packages/**/*<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L55" class="blob-num js-line-number" data-line-number="55"></td> <td id="LC55" class="blob-code blob-code-inner js-file-line"> CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/artifacts/**/*<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L56" class="blob-num js-line-number" data-line-number="56"></td> <td id="LC56" class="blob-code blob-code-inner js-file-line"> CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/packages<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L57" class="blob-num js-line-number" data-line-number="57"></td> <td id="LC57" class="blob-code blob-code-inner js-file-line"> CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/artifacts<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L58" class="blob-num js-line-number" data-line-number="58"></td> <td id="LC58" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L59" class="blob-num js-line-number" data-line-number="59"></td> <td id="LC59" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L60" class="blob-num js-line-number" data-line-number="60"></td> <td id="LC60" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> pathTest = MakeAbsolute(Directory(settings.Test.SourcePath)).FullPath;</td> </tr> <tr> <td id="L61" class="blob-num js-line-number" data-line-number="61"></td> <td id="LC61" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Cleaning {0}<span class="pl-pds">&quot;</span></span>, pathTest);</td> </tr> <tr> <td id="L62" class="blob-num js-line-number" data-line-number="62"></td> <td id="LC62" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">try</span> { CleanDirectories(pathTest + <span class="pl-s"><span class="pl-pds">&quot;</span>/**/bin<span class="pl-pds">&quot;</span></span>); } <span class="pl-k">catch</span> {}</td> </tr> <tr> <td id="L63" class="blob-num js-line-number" data-line-number="63"></td> <td id="LC63" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">try</span> { CleanDirectories(pathTest + <span class="pl-s"><span class="pl-pds">&quot;</span>/**/obj<span class="pl-pds">&quot;</span></span>); } <span class="pl-k">catch</span> {}</td> </tr> <tr> <td id="L64" class="blob-num js-line-number" data-line-number="64"></td> <td id="LC64" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L65" class="blob-num js-line-number" data-line-number="65"></td> <td id="LC65" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L66" class="blob-num js-line-number" data-line-number="66"></td> <td id="LC66" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>Clean<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L67" class="blob-num js-line-number" data-line-number="67"></td> <td id="LC67" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Cleans all directories that are used during the build process.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L68" class="blob-num js-line-number" data-line-number="68"></td> <td id="LC68" class="blob-code blob-code-inner js-file-line"> .WithCriteria(settings.ExecuteBuild)</td> </tr> <tr> <td id="L69" class="blob-num js-line-number" data-line-number="69"></td> <td id="LC69" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L70" class="blob-num js-line-number" data-line-number="70"></td> <td id="LC70" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L71" class="blob-num js-line-number" data-line-number="71"></td> <td id="LC71" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Clean solution directories.</span></td> </tr> <tr> <td id="L72" class="blob-num js-line-number" data-line-number="72"></td> <td id="LC72" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span>(<span class="pl-k">var</span> path <span class="pl-k">in</span> solutionPaths)</td> </tr> <tr> <td id="L73" class="blob-num js-line-number" data-line-number="73"></td> <td id="LC73" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L74" class="blob-num js-line-number" data-line-number="74"></td> <td id="LC74" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Cleaning {0}<span class="pl-pds">&quot;</span></span>, path);</td> </tr> <tr> <td id="L75" class="blob-num js-line-number" data-line-number="75"></td> <td id="LC75" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">try</span> { CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/**/bin/<span class="pl-pds">&quot;</span></span> + settings.Configuration); } <span class="pl-k">catch</span> {}</td> </tr> <tr> <td id="L76" class="blob-num js-line-number" data-line-number="76"></td> <td id="LC76" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">try</span> { CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/**/obj/<span class="pl-pds">&quot;</span></span> + settings.Configuration); } <span class="pl-k">catch</span> {}</td> </tr> <tr> <td id="L77" class="blob-num js-line-number" data-line-number="77"></td> <td id="LC77" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L78" class="blob-num js-line-number" data-line-number="78"></td> <td id="LC78" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L79" class="blob-num js-line-number" data-line-number="79"></td> <td id="LC79" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> pathTest = MakeAbsolute(Directory(settings.Test.SourcePath)).FullPath;</td> </tr> <tr> <td id="L80" class="blob-num js-line-number" data-line-number="80"></td> <td id="LC80" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Cleaning {0}<span class="pl-pds">&quot;</span></span>, pathTest);</td> </tr> <tr> <td id="L81" class="blob-num js-line-number" data-line-number="81"></td> <td id="LC81" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">try</span> { CleanDirectories(pathTest + <span class="pl-s"><span class="pl-pds">&quot;</span>/**/bin/<span class="pl-pds">&quot;</span></span> + settings.Configuration); } <span class="pl-k">catch</span> {}</td> </tr> <tr> <td id="L82" class="blob-num js-line-number" data-line-number="82"></td> <td id="LC82" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">try</span> { CleanDirectories(pathTest + <span class="pl-s"><span class="pl-pds">&quot;</span>/**/obj/<span class="pl-pds">&quot;</span></span> + settings.Configuration); } <span class="pl-k">catch</span> {}</td> </tr> <tr> <td id="L83" class="blob-num js-line-number" data-line-number="83"></td> <td id="LC83" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L84" class="blob-num js-line-number" data-line-number="84"></td> <td id="LC84" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L85" class="blob-num js-line-number" data-line-number="85"></td> <td id="LC85" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L86" class="blob-num js-line-number" data-line-number="86"></td> <td id="LC86" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>CleanPackages<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L87" class="blob-num js-line-number" data-line-number="87"></td> <td id="LC87" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Cleans all packages that are used during the build process.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L88" class="blob-num js-line-number" data-line-number="88"></td> <td id="LC88" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L89" class="blob-num js-line-number" data-line-number="89"></td> <td id="LC89" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L90" class="blob-num js-line-number" data-line-number="90"></td> <td id="LC90" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Clean solution directories.</span></td> </tr> <tr> <td id="L91" class="blob-num js-line-number" data-line-number="91"></td> <td id="LC91" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span>(<span class="pl-k">var</span> path <span class="pl-k">in</span> solutionPaths)</td> </tr> <tr> <td id="L92" class="blob-num js-line-number" data-line-number="92"></td> <td id="LC92" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L93" class="blob-num js-line-number" data-line-number="93"></td> <td id="LC93" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Cleaning {0}<span class="pl-pds">&quot;</span></span>, path);</td> </tr> <tr> <td id="L94" class="blob-num js-line-number" data-line-number="94"></td> <td id="LC94" class="blob-code blob-code-inner js-file-line"> CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/packages/**/*<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L95" class="blob-num js-line-number" data-line-number="95"></td> <td id="LC95" class="blob-code blob-code-inner js-file-line"> CleanDirectories(path + <span class="pl-s"><span class="pl-pds">&quot;</span>/packages<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L96" class="blob-num js-line-number" data-line-number="96"></td> <td id="LC96" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L97" class="blob-num js-line-number" data-line-number="97"></td> <td id="LC97" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L98" class="blob-num js-line-number" data-line-number="98"></td> <td id="LC98" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L99" class="blob-num js-line-number" data-line-number="99"></td> <td id="LC99" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>Restore<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L100" class="blob-num js-line-number" data-line-number="100"></td> <td id="LC100" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Restores all the NuGet packages that are used by the specified solution.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L101" class="blob-num js-line-number" data-line-number="101"></td> <td id="LC101" class="blob-code blob-code-inner js-file-line"> .WithCriteria(settings.ExecuteBuild)</td> </tr> <tr> <td id="L102" class="blob-num js-line-number" data-line-number="102"></td> <td id="LC102" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L103" class="blob-num js-line-number" data-line-number="103"></td> <td id="LC103" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L104" class="blob-num js-line-number" data-line-number="104"></td> <td id="LC104" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Restore all NuGet packages.</span></td> </tr> <tr> <td id="L105" class="blob-num js-line-number" data-line-number="105"></td> <td id="LC105" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span>(<span class="pl-k">var</span> solution <span class="pl-k">in</span> solutions)</td> </tr> <tr> <td id="L106" class="blob-num js-line-number" data-line-number="106"></td> <td id="LC106" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L107" class="blob-num js-line-number" data-line-number="107"></td> <td id="LC107" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Restoring {0}...<span class="pl-pds">&quot;</span></span>, solution);</td> </tr> <tr> <td id="L108" class="blob-num js-line-number" data-line-number="108"></td> <td id="LC108" class="blob-code blob-code-inner js-file-line"> NuGetRestore(solution, <span class="pl-k">new</span> NuGetRestoreSettings { ConfigFile = settings.NuGet.NuGetConfig });</td> </tr> <tr> <td id="L109" class="blob-num js-line-number" data-line-number="109"></td> <td id="LC109" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L110" class="blob-num js-line-number" data-line-number="110"></td> <td id="LC110" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L111" class="blob-num js-line-number" data-line-number="111"></td> <td id="LC111" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L112" class="blob-num js-line-number" data-line-number="112"></td> <td id="LC112" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>Build<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L113" class="blob-num js-line-number" data-line-number="113"></td> <td id="LC113" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Builds all the different parts of the project.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L114" class="blob-num js-line-number" data-line-number="114"></td> <td id="LC114" class="blob-code blob-code-inner js-file-line"> .WithCriteria(settings.ExecuteBuild)</td> </tr> <tr> <td id="L115" class="blob-num js-line-number" data-line-number="115"></td> <td id="LC115" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>Clean<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L116" class="blob-num js-line-number" data-line-number="116"></td> <td id="LC116" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>Restore<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L117" class="blob-num js-line-number" data-line-number="117"></td> <td id="LC117" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>UpdateVersion<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L118" class="blob-num js-line-number" data-line-number="118"></td> <td id="LC118" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L119" class="blob-num js-line-number" data-line-number="119"></td> <td id="LC119" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L120" class="blob-num js-line-number" data-line-number="120"></td> <td id="LC120" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (settings.Version.AutoIncrementVersion)</td> </tr> <tr> <td id="L121" class="blob-num js-line-number" data-line-number="121"></td> <td id="LC121" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L122" class="blob-num js-line-number" data-line-number="122"></td> <td id="LC122" class="blob-code blob-code-inner js-file-line"> RunTarget(<span class="pl-s"><span class="pl-pds">&quot;</span>IncrementVersion<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L123" class="blob-num js-line-number" data-line-number="123"></td> <td id="LC123" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L124" class="blob-num js-line-number" data-line-number="124"></td> <td id="LC124" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L125" class="blob-num js-line-number" data-line-number="125"></td> <td id="LC125" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Build all solutions.</span></td> </tr> <tr> <td id="L126" class="blob-num js-line-number" data-line-number="126"></td> <td id="LC126" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span>(<span class="pl-k">var</span> solution <span class="pl-k">in</span> solutions)</td> </tr> <tr> <td id="L127" class="blob-num js-line-number" data-line-number="127"></td> <td id="LC127" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L128" class="blob-num js-line-number" data-line-number="128"></td> <td id="LC128" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Building {0}<span class="pl-pds">&quot;</span></span>, solution);</td> </tr> <tr> <td id="L129" class="blob-num js-line-number" data-line-number="129"></td> <td id="LC129" class="blob-code blob-code-inner js-file-line"> MSBuild(solution, s =&gt;</td> </tr> <tr> <td id="L130" class="blob-num js-line-number" data-line-number="130"></td> <td id="LC130" class="blob-code blob-code-inner js-file-line"> s.SetPlatformTarget(PlatformTarget.MSIL)</td> </tr> <tr> <td id="L131" class="blob-num js-line-number" data-line-number="131"></td> <td id="LC131" class="blob-code blob-code-inner js-file-line"> .SetMaxCpuCount(settings.Build.MaxCpuCount)</td> </tr> <tr> <td id="L132" class="blob-num js-line-number" data-line-number="132"></td> <td id="LC132" class="blob-code blob-code-inner js-file-line"> .WithProperty(<span class="pl-s"><span class="pl-pds">&quot;</span>TreatWarningsAsErrors<span class="pl-pds">&quot;</span></span>,settings.Build.TreatWarningsAsErrors.ToString())</td> </tr> <tr> <td id="L133" class="blob-num js-line-number" data-line-number="133"></td> <td id="LC133" class="blob-code blob-code-inner js-file-line"> .WithTarget(<span class="pl-s"><span class="pl-pds">&quot;</span>Build<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L134" class="blob-num js-line-number" data-line-number="134"></td> <td id="LC134" class="blob-code blob-code-inner js-file-line"> .SetConfiguration(settings.Configuration));</td> </tr> <tr> <td id="L135" class="blob-num js-line-number" data-line-number="135"></td> <td id="LC135" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L136" class="blob-num js-line-number" data-line-number="136"></td> <td id="LC136" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L137" class="blob-num js-line-number" data-line-number="137"></td> <td id="LC137" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L138" class="blob-num js-line-number" data-line-number="138"></td> <td id="LC138" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>UnitTest<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L139" class="blob-num js-line-number" data-line-number="139"></td> <td id="LC139" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Run unit tests for the solution.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L140" class="blob-num js-line-number" data-line-number="140"></td> <td id="LC140" class="blob-code blob-code-inner js-file-line"> .WithCriteria(settings.ExecuteUnitTest)</td> </tr> <tr> <td id="L141" class="blob-num js-line-number" data-line-number="141"></td> <td id="LC141" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>Build<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L142" class="blob-num js-line-number" data-line-number="142"></td> <td id="LC142" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt; </td> </tr> <tr> <td id="L143" class="blob-num js-line-number" data-line-number="143"></td> <td id="LC143" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L144" class="blob-num js-line-number" data-line-number="144"></td> <td id="LC144" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Run all unit tests we can find.</span></td> </tr> <tr> <td id="L145" class="blob-num js-line-number" data-line-number="145"></td> <td id="LC145" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L146" class="blob-num js-line-number" data-line-number="146"></td> <td id="LC146" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> assemplyFilePath = <span class="pl-k">string</span>.Format(<span class="pl-s"><span class="pl-pds">&quot;</span>{0}/**/bin/{1}/{2}<span class="pl-pds">&quot;</span></span>, settings.Test.SourcePath, settings.Configuration, settings.Test.AssemblyFileSpec);</td> </tr> <tr> <td id="L147" class="blob-num js-line-number" data-line-number="147"></td> <td id="LC147" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L148" class="blob-num js-line-number" data-line-number="148"></td> <td id="LC148" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Unit Test Files: {0}<span class="pl-pds">&quot;</span></span>, assemplyFilePath);</td> </tr> <tr> <td id="L149" class="blob-num js-line-number" data-line-number="149"></td> <td id="LC149" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L150" class="blob-num js-line-number" data-line-number="150"></td> <td id="LC150" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> unitTestAssemblies = GetFiles(assemplyFilePath);</td> </tr> <tr> <td id="L151" class="blob-num js-line-number" data-line-number="151"></td> <td id="LC151" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L152" class="blob-num js-line-number" data-line-number="152"></td> <td id="LC152" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span>(<span class="pl-k">var</span> uta <span class="pl-k">in</span> unitTestAssemblies)</td> </tr> <tr> <td id="L153" class="blob-num js-line-number" data-line-number="153"></td> <td id="LC153" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L154" class="blob-num js-line-number" data-line-number="154"></td> <td id="LC154" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Executing Tests for {0}<span class="pl-pds">&quot;</span></span>, uta);</td> </tr> <tr> <td id="L155" class="blob-num js-line-number" data-line-number="155"></td> <td id="LC155" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L156" class="blob-num js-line-number" data-line-number="156"></td> <td id="LC156" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">switch</span> (settings.Test.Framework)</td> </tr> <tr> <td id="L157" class="blob-num js-line-number" data-line-number="157"></td> <td id="LC157" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L158" class="blob-num js-line-number" data-line-number="158"></td> <td id="LC158" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">case</span> TestFrameworkTypes.NUnit2:</td> </tr> <tr> <td id="L159" class="blob-num js-line-number" data-line-number="159"></td> <td id="LC159" class="blob-code blob-code-inner js-file-line"> NUnit(uta.ToString(), <span class="pl-k">new</span> NUnitSettings { });</td> </tr> <tr> <td id="L160" class="blob-num js-line-number" data-line-number="160"></td> <td id="LC160" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">break</span>;</td> </tr> <tr> <td id="L161" class="blob-num js-line-number" data-line-number="161"></td> <td id="LC161" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">case</span> TestFrameworkTypes.NUnit3:</td> </tr> <tr> <td id="L162" class="blob-num js-line-number" data-line-number="162"></td> <td id="LC162" class="blob-code blob-code-inner js-file-line"> NUnit3(uta.ToString(), <span class="pl-k">new</span> NUnit3Settings { Configuration=settings.Configuration });</td> </tr> <tr> <td id="L163" class="blob-num js-line-number" data-line-number="163"></td> <td id="LC163" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">break</span>;</td> </tr> <tr> <td id="L164" class="blob-num js-line-number" data-line-number="164"></td> <td id="LC164" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">case</span> TestFrameworkTypes.XUnit:</td> </tr> <tr> <td id="L165" class="blob-num js-line-number" data-line-number="165"></td> <td id="LC165" class="blob-code blob-code-inner js-file-line"> XUnit(uta.ToString(), <span class="pl-k">new</span> XUnitSettings { OutputDirectory = settings.Test.ResultsPath });</td> </tr> <tr> <td id="L166" class="blob-num js-line-number" data-line-number="166"></td> <td id="LC166" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">break</span>;</td> </tr> <tr> <td id="L167" class="blob-num js-line-number" data-line-number="167"></td> <td id="LC167" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">case</span> TestFrameworkTypes.XUnit2:</td> </tr> <tr> <td id="L168" class="blob-num js-line-number" data-line-number="168"></td> <td id="LC168" class="blob-code blob-code-inner js-file-line"> XUnit2(uta.ToString(), <span class="pl-k">new</span> XUnit2Settings { OutputDirectory = settings.Test.ResultsPath, XmlReportV1 = <span class="pl-c1">true</span> });</td> </tr> <tr> <td id="L169" class="blob-num js-line-number" data-line-number="169"></td> <td id="LC169" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">break</span>;</td> </tr> <tr> <td id="L170" class="blob-num js-line-number" data-line-number="170"></td> <td id="LC170" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L171" class="blob-num js-line-number" data-line-number="171"></td> <td id="LC171" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L172" class="blob-num js-line-number" data-line-number="172"></td> <td id="LC172" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L173" class="blob-num js-line-number" data-line-number="173"></td> <td id="LC173" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L174" class="blob-num js-line-number" data-line-number="174"></td> <td id="LC174" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>Package<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L175" class="blob-num js-line-number" data-line-number="175"></td> <td id="LC175" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Packages all nuspec files into nupkg packages.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L176" class="blob-num js-line-number" data-line-number="176"></td> <td id="LC176" class="blob-code blob-code-inner js-file-line"> .WithCriteria(settings.ExecutePackage)</td> </tr> <tr> <td id="L177" class="blob-num js-line-number" data-line-number="177"></td> <td id="LC177" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>UnitTest<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L178" class="blob-num js-line-number" data-line-number="178"></td> <td id="LC178" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L179" class="blob-num js-line-number" data-line-number="179"></td> <td id="LC179" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L180" class="blob-num js-line-number" data-line-number="180"></td> <td id="LC180" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> artifactsPath = Directory(settings.NuGet.ArtifactsPath);</td> </tr> <tr> <td id="L181" class="blob-num js-line-number" data-line-number="181"></td> <td id="LC181" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> nugetProps = <span class="pl-k">new</span> Dictionary&lt;<span class="pl-k">string</span>, <span class="pl-k">string</span>&gt;() { {<span class="pl-s"><span class="pl-pds">&quot;</span>Configuration<span class="pl-pds">&quot;</span></span>, settings.Configuration} };</td> </tr> <tr> <td id="L182" class="blob-num js-line-number" data-line-number="182"></td> <td id="LC182" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L183" class="blob-num js-line-number" data-line-number="183"></td> <td id="LC183" class="blob-code blob-code-inner js-file-line"> CreateDirectory(artifactsPath);</td> </tr> <tr> <td id="L184" class="blob-num js-line-number" data-line-number="184"></td> <td id="LC184" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L185" class="blob-num js-line-number" data-line-number="185"></td> <td id="LC185" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> nuspecFiles = GetFiles(settings.NuGet.NuSpecFileSpec);</td> </tr> <tr> <td id="L186" class="blob-num js-line-number" data-line-number="186"></td> <td id="LC186" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span>(<span class="pl-k">var</span> nsf <span class="pl-k">in</span> nuspecFiles)</td> </tr> <tr> <td id="L187" class="blob-num js-line-number" data-line-number="187"></td> <td id="LC187" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L188" class="blob-num js-line-number" data-line-number="188"></td> <td id="LC188" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Packaging {0}<span class="pl-pds">&quot;</span></span>, nsf);</td> </tr> <tr> <td id="L189" class="blob-num js-line-number" data-line-number="189"></td> <td id="LC189" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L190" class="blob-num js-line-number" data-line-number="190"></td> <td id="LC190" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (settings.NuGet.UpdateVersion) {</td> </tr> <tr> <td id="L191" class="blob-num js-line-number" data-line-number="191"></td> <td id="LC191" class="blob-code blob-code-inner js-file-line"> VersionUtils.UpdateNuSpecVersion(Context, settings, versionInfo, nsf.ToString()); </td> </tr> <tr> <td id="L192" class="blob-num js-line-number" data-line-number="192"></td> <td id="LC192" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L193" class="blob-num js-line-number" data-line-number="193"></td> <td id="LC193" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L194" class="blob-num js-line-number" data-line-number="194"></td> <td id="LC194" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (settings.NuGet.UpdateLibraryDependencies) {</td> </tr> <tr> <td id="L195" class="blob-num js-line-number" data-line-number="195"></td> <td id="LC195" class="blob-code blob-code-inner js-file-line"> VersionUtils.UpdateNuSpecVersionDependency(Context, settings, versionInfo, nsf.ToString());</td> </tr> <tr> <td id="L196" class="blob-num js-line-number" data-line-number="196"></td> <td id="LC196" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L197" class="blob-num js-line-number" data-line-number="197"></td> <td id="LC197" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L198" class="blob-num js-line-number" data-line-number="198"></td> <td id="LC198" class="blob-code blob-code-inner js-file-line"> NuGetPack(nsf, <span class="pl-k">new</span> NuGetPackSettings {</td> </tr> <tr> <td id="L199" class="blob-num js-line-number" data-line-number="199"></td> <td id="LC199" class="blob-code blob-code-inner js-file-line"> Version = versionInfo.ToString(),</td> </tr> <tr> <td id="L200" class="blob-num js-line-number" data-line-number="200"></td> <td id="LC200" class="blob-code blob-code-inner js-file-line"> ReleaseNotes = versionInfo.ReleaseNotes,</td> </tr> <tr> <td id="L201" class="blob-num js-line-number" data-line-number="201"></td> <td id="LC201" class="blob-code blob-code-inner js-file-line"> Symbols = <span class="pl-c1">true</span>,</td> </tr> <tr> <td id="L202" class="blob-num js-line-number" data-line-number="202"></td> <td id="LC202" class="blob-code blob-code-inner js-file-line"> Properties = nugetProps,</td> </tr> <tr> <td id="L203" class="blob-num js-line-number" data-line-number="203"></td> <td id="LC203" class="blob-code blob-code-inner js-file-line"> OutputDirectory = artifactsPath</td> </tr> <tr> <td id="L204" class="blob-num js-line-number" data-line-number="204"></td> <td id="LC204" class="blob-code blob-code-inner js-file-line"> });</td> </tr> <tr> <td id="L205" class="blob-num js-line-number" data-line-number="205"></td> <td id="LC205" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L206" class="blob-num js-line-number" data-line-number="206"></td> <td id="LC206" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L207" class="blob-num js-line-number" data-line-number="207"></td> <td id="LC207" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L208" class="blob-num js-line-number" data-line-number="208"></td> <td id="LC208" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>Publish<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L209" class="blob-num js-line-number" data-line-number="209"></td> <td id="LC209" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Publishes all of the nupkg packages to the nuget server. <span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L210" class="blob-num js-line-number" data-line-number="210"></td> <td id="LC210" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>Package<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L211" class="blob-num js-line-number" data-line-number="211"></td> <td id="LC211" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L212" class="blob-num js-line-number" data-line-number="212"></td> <td id="LC212" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L213" class="blob-num js-line-number" data-line-number="213"></td> <td id="LC213" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> authError = <span class="pl-c1">false</span>;</td> </tr> <tr> <td id="L214" class="blob-num js-line-number" data-line-number="214"></td> <td id="LC214" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L215" class="blob-num js-line-number" data-line-number="215"></td> <td id="LC215" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (settings.NuGet.FeedApiKey.ToLower() == <span class="pl-s"><span class="pl-pds">&quot;</span>local<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L216" class="blob-num js-line-number" data-line-number="216"></td> <td id="LC216" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L217" class="blob-num js-line-number" data-line-number="217"></td> <td id="LC217" class="blob-code blob-code-inner js-file-line"> settings.NuGet.FeedUrl = Directory(settings.NuGet.FeedUrl).Path.FullPath;</td> </tr> <tr> <td id="L218" class="blob-num js-line-number" data-line-number="218"></td> <td id="LC218" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">//Information(&quot;Using Local repository: {0}&quot;, settings.NuGet.FeedUrl);</span></td> </tr> <tr> <td id="L219" class="blob-num js-line-number" data-line-number="219"></td> <td id="LC219" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L220" class="blob-num js-line-number" data-line-number="220"></td> <td id="LC220" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L221" class="blob-num js-line-number" data-line-number="221"></td> <td id="LC221" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Publishing Packages from {0} to {1} for version {2}<span class="pl-pds">&quot;</span></span>, settings.NuGet.ArtifactsPath, settings.NuGet.FeedUrl, versionInfo.ToString());</td> </tr> <tr> <td id="L222" class="blob-num js-line-number" data-line-number="222"></td> <td id="LC222" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L223" class="blob-num js-line-number" data-line-number="223"></td> <td id="LC223" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Lets get the list of packages (we can skip anything that is not part of the current version being built)</span></td> </tr> <tr> <td id="L224" class="blob-num js-line-number" data-line-number="224"></td> <td id="LC224" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> nupkgFiles = GetFiles(settings.NuGet.NuGetPackagesSpec).Where(x =&gt; x.ToString().Contains(versionInfo.ToString())).ToList();</td> </tr> <tr> <td id="L225" class="blob-num js-line-number" data-line-number="225"></td> <td id="LC225" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L226" class="blob-num js-line-number" data-line-number="226"></td> <td id="LC226" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span><span class="pl-cce">\t</span>{0}<span class="pl-pds">&quot;</span></span>, <span class="pl-k">string</span>.Join(<span class="pl-s"><span class="pl-pds">&quot;</span><span class="pl-cce">\n\t</span><span class="pl-pds">&quot;</span></span>, nupkgFiles.Select(x =&gt; x.GetFilename().ToString()).ToList()));</td> </tr> <tr> <td id="L227" class="blob-num js-line-number" data-line-number="227"></td> <td id="LC227" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L228" class="blob-num js-line-number" data-line-number="228"></td> <td id="LC228" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span> (<span class="pl-k">var</span> n <span class="pl-k">in</span> nupkgFiles)</td> </tr> <tr> <td id="L229" class="blob-num js-line-number" data-line-number="229"></td> <td id="LC229" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L230" class="blob-num js-line-number" data-line-number="230"></td> <td id="LC230" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">try</span></td> </tr> <tr> <td id="L231" class="blob-num js-line-number" data-line-number="231"></td> <td id="LC231" class="blob-code blob-code-inner js-file-line"> { </td> </tr> <tr> <td id="L232" class="blob-num js-line-number" data-line-number="232"></td> <td id="LC232" class="blob-code blob-code-inner js-file-line"> NuGetPush(n, <span class="pl-k">new</span> NuGetPushSettings {</td> </tr> <tr> <td id="L233" class="blob-num js-line-number" data-line-number="233"></td> <td id="LC233" class="blob-code blob-code-inner js-file-line"> Source = settings.NuGet.FeedUrl,</td> </tr> <tr> <td id="L234" class="blob-num js-line-number" data-line-number="234"></td> <td id="LC234" class="blob-code blob-code-inner js-file-line"> ApiKey = settings.NuGet.FeedApiKey,</td> </tr> <tr> <td id="L235" class="blob-num js-line-number" data-line-number="235"></td> <td id="LC235" class="blob-code blob-code-inner js-file-line"> ConfigFile = settings.NuGet.NuGetConfig,</td> </tr> <tr> <td id="L236" class="blob-num js-line-number" data-line-number="236"></td> <td id="LC236" class="blob-code blob-code-inner js-file-line"> Verbosity = NuGetVerbosity.Normal</td> </tr> <tr> <td id="L237" class="blob-num js-line-number" data-line-number="237"></td> <td id="LC237" class="blob-code blob-code-inner js-file-line"> });</td> </tr> <tr> <td id="L238" class="blob-num js-line-number" data-line-number="238"></td> <td id="LC238" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L239" class="blob-num js-line-number" data-line-number="239"></td> <td id="LC239" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">catch</span> (Exception ex)</td> </tr> <tr> <td id="L240" class="blob-num js-line-number" data-line-number="240"></td> <td id="LC240" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L241" class="blob-num js-line-number" data-line-number="241"></td> <td id="LC241" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span><span class="pl-cce">\t</span>Failed to published: <span class="pl-pds">&quot;</span></span>, ex.Message);</td> </tr> <tr> <td id="L242" class="blob-num js-line-number" data-line-number="242"></td> <td id="LC242" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L243" class="blob-num js-line-number" data-line-number="243"></td> <td id="LC243" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (ex.Message.Contains(<span class="pl-s"><span class="pl-pds">&quot;</span>403<span class="pl-pds">&quot;</span></span>)) { authError = <span class="pl-c1">true</span>; }</td> </tr> <tr> <td id="L244" class="blob-num js-line-number" data-line-number="244"></td> <td id="LC244" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L245" class="blob-num js-line-number" data-line-number="245"></td> <td id="LC245" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L246" class="blob-num js-line-number" data-line-number="246"></td> <td id="LC246" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L247" class="blob-num js-line-number" data-line-number="247"></td> <td id="LC247" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (authError &amp;&amp; settings.NuGet.FeedApiKey == <span class="pl-s"><span class="pl-pds">&quot;</span>VSTS<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L248" class="blob-num js-line-number" data-line-number="248"></td> <td id="LC248" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L249" class="blob-num js-line-number" data-line-number="249"></td> <td id="LC249" class="blob-code blob-code-inner js-file-line"> Warning(<span class="pl-s"><span class="pl-pds">&quot;</span><span class="pl-cce">\t</span>You may need to Configuration Your Credentials.<span class="pl-cce">\r\n\t\t</span>CredentialProvider.VSS.exe -Uri {0}<span class="pl-pds">&quot;</span></span>, settings.NuGet.FeedUrl);</td> </tr> <tr> <td id="L250" class="blob-num js-line-number" data-line-number="250"></td> <td id="LC250" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L251" class="blob-num js-line-number" data-line-number="251"></td> <td id="LC251" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L252" class="blob-num js-line-number" data-line-number="252"></td> <td id="LC252" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L253" class="blob-num js-line-number" data-line-number="253"></td> <td id="LC253" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>UnPublish<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L254" class="blob-num js-line-number" data-line-number="254"></td> <td id="LC254" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>UnPublishes all of the current nupkg packages from the nuget server. Issue: versionToDelete must use : instead of . due to bug in cake<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L255" class="blob-num js-line-number" data-line-number="255"></td> <td id="LC255" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L256" class="blob-num js-line-number" data-line-number="256"></td> <td id="LC256" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L257" class="blob-num js-line-number" data-line-number="257"></td> <td id="LC257" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> v = Argument&lt;<span class="pl-k">string</span>&gt;(<span class="pl-s"><span class="pl-pds">&quot;</span>versionToDelete<span class="pl-pds">&quot;</span></span>, versionInfo.ToString()).Replace(<span class="pl-s"><span class="pl-pds">&quot;</span>:<span class="pl-pds">&quot;</span></span>,<span class="pl-s"><span class="pl-pds">&quot;</span>.<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L258" class="blob-num js-line-number" data-line-number="258"></td> <td id="LC258" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L259" class="blob-num js-line-number" data-line-number="259"></td> <td id="LC259" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> nuspecFiles = GetFiles(settings.NuGet.NuSpecFileSpec);</td> </tr> <tr> <td id="L260" class="blob-num js-line-number" data-line-number="260"></td> <td id="LC260" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">foreach</span>(<span class="pl-k">var</span> f <span class="pl-k">in</span> nuspecFiles)</td> </tr> <tr> <td id="L261" class="blob-num js-line-number" data-line-number="261"></td> <td id="LC261" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L262" class="blob-num js-line-number" data-line-number="262"></td> <td id="LC262" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>UnPublishing {0}<span class="pl-pds">&quot;</span></span>, f.GetFilenameWithoutExtension());</td> </tr> <tr> <td id="L263" class="blob-num js-line-number" data-line-number="263"></td> <td id="LC263" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L264" class="blob-num js-line-number" data-line-number="264"></td> <td id="LC264" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> args = <span class="pl-k">string</span>.Format(<span class="pl-s"><span class="pl-pds">&quot;</span>delete {0} {1} -Source {2} -NonInteractive<span class="pl-pds">&quot;</span></span>, </td> </tr> <tr> <td id="L265" class="blob-num js-line-number" data-line-number="265"></td> <td id="LC265" class="blob-code blob-code-inner js-file-line"> f.GetFilenameWithoutExtension(),</td> </tr> <tr> <td id="L266" class="blob-num js-line-number" data-line-number="266"></td> <td id="LC266" class="blob-code blob-code-inner js-file-line"> v,</td> </tr> <tr> <td id="L267" class="blob-num js-line-number" data-line-number="267"></td> <td id="LC267" class="blob-code blob-code-inner js-file-line"> settings.NuGet.FeedUrl</td> </tr> <tr> <td id="L268" class="blob-num js-line-number" data-line-number="268"></td> <td id="LC268" class="blob-code blob-code-inner js-file-line"> );</td> </tr> <tr> <td id="L269" class="blob-num js-line-number" data-line-number="269"></td> <td id="LC269" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L270" class="blob-num js-line-number" data-line-number="270"></td> <td id="LC270" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">//if (settings.NuGet.FeedApiKey != &quot;VSTS&quot; ) {</span></td> </tr> <tr> <td id="L271" class="blob-num js-line-number" data-line-number="271"></td> <td id="LC271" class="blob-code blob-code-inner js-file-line"> args = args + <span class="pl-k">string</span>.Format(<span class="pl-s"><span class="pl-pds">&quot;</span> -ApiKey {0}<span class="pl-pds">&quot;</span></span>, settings.NuGet.FeedApiKey);</td> </tr> <tr> <td id="L272" class="blob-num js-line-number" data-line-number="272"></td> <td id="LC272" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">//}</span></td> </tr> <tr> <td id="L273" class="blob-num js-line-number" data-line-number="273"></td> <td id="LC273" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L274" class="blob-num js-line-number" data-line-number="274"></td> <td id="LC274" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (!<span class="pl-k">string</span>.IsNullOrEmpty(settings.NuGet.NuGetConfig)) {</td> </tr> <tr> <td id="L275" class="blob-num js-line-number" data-line-number="275"></td> <td id="LC275" class="blob-code blob-code-inner js-file-line"> args = args + <span class="pl-k">string</span>.Format(<span class="pl-s"><span class="pl-pds">&quot;</span> -Config {0}<span class="pl-pds">&quot;</span></span>, settings.NuGet.NuGetConfig);</td> </tr> <tr> <td id="L276" class="blob-num js-line-number" data-line-number="276"></td> <td id="LC276" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L277" class="blob-num js-line-number" data-line-number="277"></td> <td id="LC277" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L278" class="blob-num js-line-number" data-line-number="278"></td> <td id="LC278" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>NuGet Command Line: {0}<span class="pl-pds">&quot;</span></span>, args);</td> </tr> <tr> <td id="L279" class="blob-num js-line-number" data-line-number="279"></td> <td id="LC279" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">using</span> (<span class="pl-k">var</span> process = StartAndReturnProcess(<span class="pl-s"><span class="pl-pds">&quot;</span>tools<span class="pl-cce">\\</span>nuget.exe<span class="pl-pds">&quot;</span></span>, <span class="pl-k">new</span> ProcessSettings {</td> </tr> <tr> <td id="L280" class="blob-num js-line-number" data-line-number="280"></td> <td id="LC280" class="blob-code blob-code-inner js-file-line"> Arguments = args</td> </tr> <tr> <td id="L281" class="blob-num js-line-number" data-line-number="281"></td> <td id="LC281" class="blob-code blob-code-inner js-file-line"> }))</td> </tr> <tr> <td id="L282" class="blob-num js-line-number" data-line-number="282"></td> <td id="LC282" class="blob-code blob-code-inner js-file-line"> {</td> </tr> <tr> <td id="L283" class="blob-num js-line-number" data-line-number="283"></td> <td id="LC283" class="blob-code blob-code-inner js-file-line"> process.WaitForExit();</td> </tr> <tr> <td id="L284" class="blob-num js-line-number" data-line-number="284"></td> <td id="LC284" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>nuget delete exit code: {0}<span class="pl-pds">&quot;</span></span>, process.GetExitCode());</td> </tr> <tr> <td id="L285" class="blob-num js-line-number" data-line-number="285"></td> <td id="LC285" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L286" class="blob-num js-line-number" data-line-number="286"></td> <td id="LC286" class="blob-code blob-code-inner js-file-line"> }</td> </tr> <tr> <td id="L287" class="blob-num js-line-number" data-line-number="287"></td> <td id="LC287" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L288" class="blob-num js-line-number" data-line-number="288"></td> <td id="LC288" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L289" class="blob-num js-line-number" data-line-number="289"></td> <td id="LC289" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>UpdateVersion<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L290" class="blob-num js-line-number" data-line-number="290"></td> <td id="LC290" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Updates the version number in the necessary files<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L291" class="blob-num js-line-number" data-line-number="291"></td> <td id="LC291" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L292" class="blob-num js-line-number" data-line-number="292"></td> <td id="LC292" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L293" class="blob-num js-line-number" data-line-number="293"></td> <td id="LC293" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Updating Version to {0}<span class="pl-pds">&quot;</span></span>, versionInfo.ToString());</td> </tr> <tr> <td id="L294" class="blob-num js-line-number" data-line-number="294"></td> <td id="LC294" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L295" class="blob-num js-line-number" data-line-number="295"></td> <td id="LC295" class="blob-code blob-code-inner js-file-line"> VersionUtils.UpdateVersion(Context, settings, versionInfo);</td> </tr> <tr> <td id="L296" class="blob-num js-line-number" data-line-number="296"></td> <td id="LC296" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L297" class="blob-num js-line-number" data-line-number="297"></td> <td id="LC297" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L298" class="blob-num js-line-number" data-line-number="298"></td> <td id="LC298" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>IncrementVersion<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L299" class="blob-num js-line-number" data-line-number="299"></td> <td id="LC299" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Increments the version number and then updates it in the necessary files<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L300" class="blob-num js-line-number" data-line-number="300"></td> <td id="LC300" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L301" class="blob-num js-line-number" data-line-number="301"></td> <td id="LC301" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L302" class="blob-num js-line-number" data-line-number="302"></td> <td id="LC302" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> oldVer = versionInfo.ToString();</td> </tr> <tr> <td id="L303" class="blob-num js-line-number" data-line-number="303"></td> <td id="LC303" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (versionInfo.IsPreRelease) versionInfo.PreRelease++; <span class="pl-k">else</span> versionInfo.Build++;</td> </tr> <tr> <td id="L304" class="blob-num js-line-number" data-line-number="304"></td> <td id="LC304" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L305" class="blob-num js-line-number" data-line-number="305"></td> <td id="LC305" class="blob-code blob-code-inner js-file-line"> Information(<span class="pl-s"><span class="pl-pds">&quot;</span>Incrementing Version {0} to {1}<span class="pl-pds">&quot;</span></span>, oldVer, versionInfo.ToString());</td> </tr> <tr> <td id="L306" class="blob-num js-line-number" data-line-number="306"></td> <td id="LC306" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L307" class="blob-num js-line-number" data-line-number="307"></td> <td id="LC307" class="blob-code blob-code-inner js-file-line"> RunTarget(<span class="pl-s"><span class="pl-pds">&quot;</span>UpdateVersion<span class="pl-pds">&quot;</span></span>); </td> </tr> <tr> <td id="L308" class="blob-num js-line-number" data-line-number="308"></td> <td id="LC308" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L309" class="blob-num js-line-number" data-line-number="309"></td> <td id="LC309" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L310" class="blob-num js-line-number" data-line-number="310"></td> <td id="LC310" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>BuildNewVersion<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L311" class="blob-num js-line-number" data-line-number="311"></td> <td id="LC311" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Increments and Builds a new version<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L312" class="blob-num js-line-number" data-line-number="312"></td> <td id="LC312" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>IncrementVersion<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L313" class="blob-num js-line-number" data-line-number="313"></td> <td id="LC313" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>Build<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L314" class="blob-num js-line-number" data-line-number="314"></td> <td id="LC314" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L315" class="blob-num js-line-number" data-line-number="315"></td> <td id="LC315" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L316" class="blob-num js-line-number" data-line-number="316"></td> <td id="LC316" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L317" class="blob-num js-line-number" data-line-number="317"></td> <td id="LC317" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L318" class="blob-num js-line-number" data-line-number="318"></td> <td id="LC318" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>PublishNewVersion<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L319" class="blob-num js-line-number" data-line-number="319"></td> <td id="LC319" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Increments, Builds, and publishes a new version<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L320" class="blob-num js-line-number" data-line-number="320"></td> <td id="LC320" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>BuildNewVersion<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L321" class="blob-num js-line-number" data-line-number="321"></td> <td id="LC321" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>Publish<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L322" class="blob-num js-line-number" data-line-number="322"></td> <td id="LC322" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L323" class="blob-num js-line-number" data-line-number="323"></td> <td id="LC323" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L324" class="blob-num js-line-number" data-line-number="324"></td> <td id="LC324" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L325" class="blob-num js-line-number" data-line-number="325"></td> <td id="LC325" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L326" class="blob-num js-line-number" data-line-number="326"></td> <td id="LC326" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>DisplaySettings<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L327" class="blob-num js-line-number" data-line-number="327"></td> <td id="LC327" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Displays All Settings.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L328" class="blob-num js-line-number" data-line-number="328"></td> <td id="LC328" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L329" class="blob-num js-line-number" data-line-number="329"></td> <td id="LC329" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L330" class="blob-num js-line-number" data-line-number="330"></td> <td id="LC330" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Settings will be displayed as they are part of the Setup task</span></td> </tr> <tr> <td id="L331" class="blob-num js-line-number" data-line-number="331"></td> <td id="LC331" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L332" class="blob-num js-line-number" data-line-number="332"></td> <td id="LC332" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L333" class="blob-num js-line-number" data-line-number="333"></td> <td id="LC333" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>DisplayHelp<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L334" class="blob-num js-line-number" data-line-number="334"></td> <td id="LC334" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>Displays All Settings.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L335" class="blob-num js-line-number" data-line-number="335"></td> <td id="LC335" class="blob-code blob-code-inner js-file-line"> .Does(() =&gt;</td> </tr> <tr> <td id="L336" class="blob-num js-line-number" data-line-number="336"></td> <td id="LC336" class="blob-code blob-code-inner js-file-line">{</td> </tr> <tr> <td id="L337" class="blob-num js-line-number" data-line-number="337"></td> <td id="LC337" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Settings will be displayed as they are part of the Setup task</span></td> </tr> <tr> <td id="L338" class="blob-num js-line-number" data-line-number="338"></td> <td id="LC338" class="blob-code blob-code-inner js-file-line"> SettingsUtils.DisplayHelp(Context);</td> </tr> <tr> <td id="L339" class="blob-num js-line-number" data-line-number="339"></td> <td id="LC339" class="blob-code blob-code-inner js-file-line">});</td> </tr> <tr> <td id="L340" class="blob-num js-line-number" data-line-number="340"></td> <td id="LC340" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L341" class="blob-num js-line-number" data-line-number="341"></td> <td id="LC341" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L342" class="blob-num js-line-number" data-line-number="342"></td> <td id="LC342" class="blob-code blob-code-inner js-file-line"><span class="pl-c">// TARGETS</span></td> </tr> <tr> <td id="L343" class="blob-num js-line-number" data-line-number="343"></td> <td id="LC343" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L344" class="blob-num js-line-number" data-line-number="344"></td> <td id="LC344" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L345" class="blob-num js-line-number" data-line-number="345"></td> <td id="LC345" class="blob-code blob-code-inner js-file-line">Task(<span class="pl-s"><span class="pl-pds">&quot;</span>Default<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L346" class="blob-num js-line-number" data-line-number="346"></td> <td id="LC346" class="blob-code blob-code-inner js-file-line"> .Description(<span class="pl-s"><span class="pl-pds">&quot;</span>This is the default task which will be ran if no specific target is passed in.<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L347" class="blob-num js-line-number" data-line-number="347"></td> <td id="LC347" class="blob-code blob-code-inner js-file-line"> .IsDependentOn(<span class="pl-s"><span class="pl-pds">&quot;</span>Build<span class="pl-pds">&quot;</span></span>);</td> </tr> <tr> <td id="L348" class="blob-num js-line-number" data-line-number="348"></td> <td id="LC348" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L349" class="blob-num js-line-number" data-line-number="349"></td> <td id="LC349" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L350" class="blob-num js-line-number" data-line-number="350"></td> <td id="LC350" class="blob-code blob-code-inner js-file-line"><span class="pl-c">// EXECUTION</span></td> </tr> <tr> <td id="L351" class="blob-num js-line-number" data-line-number="351"></td> <td id="LC351" class="blob-code blob-code-inner js-file-line"><span class="pl-c">///////////////////////////////////////////////////////////////////////////////</span></td> </tr> <tr> <td id="L352" class="blob-num js-line-number" data-line-number="352"></td> <td id="LC352" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L353" class="blob-num js-line-number" data-line-number="353"></td> <td id="LC353" class="blob-code blob-code-inner js-file-line">RunTarget(settings.Target);</td> </tr> </table> </div> </div> <button type="button" data-facebox="#jump-to-line" data-facebox-class="linejump" data-hotkey="l" class="d-none">Jump to Line</button> <div id="jump-to-line" style="display:none"> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="" class="js-jump-to-line-form" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <input class="form-control linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;" aria-label="Jump to line" autofocus> <button type="submit" class="btn">Go</button> </form></div> </div> <div class="modal-backdrop js-touch-events"></div> </div> </div> </div> </div> <div class="container site-footer-container"> <div class="site-footer" role="contentinfo"> <ul class="site-footer-links float-right"> <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact GitHub</a></li> <li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li> <li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li> <li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li> <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li> <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li> </ul> <a href="https://github.com" aria-label="Homepage" class="site-footer-mark" title="GitHub"> <svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> </a> <ul class="site-footer-links"> <li>&copy; 2016 <span title="0.85882s from github-fe119-cp1-prd.iad.github.net">GitHub</span>, Inc.</li> <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li> <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li> <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li> <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li> <li><a href="https://help.github.com" data-ga-click="Footer, go to help, text:help">Help</a></li> </ul> </div> </div> <div id="ajax-error-message" class="ajax-error-message flash flash-error"> <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg> <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg> </button> You can't perform that action at this time. </div> <script crossorigin="anonymous" integrity="sha256-Nx6NFlbsuXNwgxytKPfrySbpY2rv9pnnWl6tPk7YVhg=" src="https://assets-cdn.github.com/assets/frameworks-371e8d1656ecb97370831cad28f7ebc926e9636aeff699e75a5ead3e4ed85618.js"></script> <script async="async" crossorigin="anonymous" integrity="sha256-q1O55iRgoevO9Kq555Y7W9JJdHRoaWTSfkznVqZfp+A=" src="https://assets-cdn.github.com/assets/github-ab53b9e62460a1ebcef4aab9e7963b5bd2497474686964d27e4ce756a65fa7e0.js"></script> <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none"> <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg> <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span> <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span> </div> <div class="facebox" id="facebox" style="display:none;"> <div class="facebox-popup"> <div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description"> </div> <button type="button" class="facebox-close js-facebox-close" aria-label="Close modal"> <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg> </button> </div> </div> </body> </html>
the_stack
@model SuperDumpService.ViewModels.ReportViewModel @using SuperDumpService.Helpers; @inject IAuthorizationHelper AuthorizationHelper <script> var modalWin = new CreateModalPopUpObject(); //Uncomment below line to make look buttons as link //modalWin.SetButtonStyle("background:none;border:none;textDecoration:underline;cursor:pointer"); function ShowMessage(msg, lines) { modalWin.ShowMessage(msg, 220 + lines * 23, 550, 'User Information'); } function EnrollNow(msg) { modalWin.HideModalPopUp(); modalWin.ShowMessage(msg, 600, 300, 'User Information', null, null); } function EnrollLater() { modalWin.HideModalPopUp(); modalWin.ShowMessage(msg, 600, 300, 'User Information', null, null); } function HideModalWindow() { modalWin.HideModalPopUp(); } </script> <div class="panel panel-primary"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#thread-report"> Thread report </a> </h4> </div> @if (Model.Result.ThreadInformation == null) { <div class="alert alert-warning">No thread information available!</div> } else { <div id="thread-report" class="panel-collapse in"> <div class="panel-body"> <button class="btn btn-success" id="openall">Open all</button> <button class="btn btn-success" id="closeall">Close all</button> <span style="display: inline-block; width:16px">&nbsp;</span> @foreach (var tag in Model.ThreadTags.OrderByDescending(t => t.Importance)) { <button class="btn btn-primary" onclick="openTabs('@tag.Name')"><span class="tag tag-@tag.Name">@tag.Name</span></button> } <div class="list-group"> @foreach (var thread in Model.Result.ThreadInformation.Values.OrderByDescending(t => t.Tags.Count == 0 ? 0 : t.Tags.Max(x => x.Importance)).ThenBy(t => t.EngineId)) { <a id="@thread.OsId" class="list-group-item thread-heading collapsed" data-toggle="collapse" data-parent="#accordion" href="#thread-@thread.OsId"> <strong>EngineId: @thread.EngineId</strong> (0x<span>@thread.EngineId.ToString("X")</span>), OsId: @thread.OsId (0x<span>@thread.OsId.ToString("X")</span>) @if (!string.IsNullOrEmpty(thread.State)) { <span>, ThreadState: @thread.State</span> } @Html.Partial("Tags", @thread.Tags) </a> <div id="thread-@thread.OsId" class="thread-div collapse @string.Join(" ", thread.Tags)"> <!--general information--> <table style="width: 100%;"> <tr> <td> <dl class="row courier-small compact"> <dt class="col-sm-3 text-right">Engine thread ID:</dt> <dd class="col-sm-9">@thread.EngineId (0x<span>@thread.EngineId.ToString("X")</span>)</dd> <dt class="col-sm-3 text-right">OS thread ID:</dt> <dd class="col-sm-9">@thread.OsId (0x<span>@thread.OsId.ToString("X")</span>)</dd> @if (@thread.IsManagedThread) { <dt class="col-sm-3 text-right">Managed thread ID:</dt> <dd class="col-sm-9">@thread.ManagedThreadId (0x<span>@thread.ManagedThreadId.ToString("X")</span>)</dd> <dt class="col-sm-3 text-right">Thread name:</dt> <dd class="col-sm-9">@thread.ThreadName</dd> } @if (!string.IsNullOrEmpty(thread.State)) { <dt class="col-sm-3 text-right">State(s):</dt> <dd class="col-sm-9">@thread.State</dd> } @if (thread.CreationTime > 0) { <dt class="col-sm-3 text-right">Creation time:</dt> <dd class="col-sm-9">@Utility.ConvertWindowsTimeStamp(thread.CreationTime)</dd> } @if (thread.KernelTime > 0) { <dt class="col-sm-3 text-right">Kernel mode time:</dt> <dd class="col-sm-9">@Utility.ConvertWindowsTimeSpan(thread.KernelTime)</dd> } @if (thread.UserTime > 0) { <dt class="col-sm-3 text-right">User mode time:</dt> <dd class="col-sm-9">@Utility.ConvertWindowsTimeSpan(thread.UserTime)</dd> } @if (thread.LastException != null) { <dt class="col-sm-3 text-right">Exception Type:</dt> <dd class="col-sm-9">@thread.LastException.Type</dd> <dt class="col-sm-3 text-right">Exception Message:</dt> <dd class="col-sm-9">@thread.LastException.Message</dd> <dt class="col-sm-3 text-right">Exception Stack:</dt> <dd class="col-sm-9">@Html.Partial("_StacktracePlain", @thread.LastException.StackTrace)</dd> } </dl> </td> <td class="thread-toolbox"> <ul class="flat"> <li class="text-nowrap"><a href="#@thread.OsId">Permalink</a></li> <li class="text-nowrap"><a data-clipboard-target="#thread-@thread.OsId-stacktrace-div" class="copyButton">Copy stack</a> (<a data-clipboard-target="#thread-@thread.OsId-stacktrace-div" class="copyButtonForJira">for JIRA</a>)</li> <li class="text-nowrap"><label><input type="checkbox" class="showaddresses" name="@thread.OsId" checked />show addresses</label></li> <li class="text-nowrap"><label><input type="checkbox" class="showsourceinfo" name="@thread.OsId" checked />show sourceinfo</label></li> <li class="text-nowrap"><label><input type="checkbox" class="showstackptroffset" name="@thread.OsId" />show stackptr offsets</label></li> @if (AuthorizationHelper.CheckPolicy(User, LdapCookieAuthenticationExtension.UserPolicy)) { <li class="text-nowrap"><label><input type="checkbox" class="showstackvars" name="@thread.OsId" />show stack variables</label></li> } </ul> </td> </tr> </table> <!--stacktraces--> <div id="thread-@thread.OsId-stacktrace-div"> <div class="hidden-stacktrace-hack"> {noformat} </div> <table class="table table-stacktrace" id="thread-@thread.OsId-stacktrace"> <thead> <tr> @if (Model.DumpType != SuperDumpService.Models.DumpType.LinuxCoreDump) { // Frames in core dumps are always native, no need to display <th class="nobreak stacktype" style="width: 55px">Type</th> } <th class="nobreak stackptr" style="width: 79px">StackPtr</th> <th class="nobreak stackptroffset">StackPtr.Offset</th> <th class="nobreak stackinstructionptr" style="width: 79px">Instruct.Ptr</th> <th class="nobreak stackreturnaddr" style="width: 79px">Ret.Addr.</th> <th class="nobreak stackmethodname">Module/Method name</th> </tr> </thead> <tbody> @{ int frameNr = 0; } @foreach (var frame in thread.StackTrace) { frameNr++; string frameType = string.Empty; string rowClass = string.Empty; if (frame.Type == SuperDump.Models.StackFrameType.Native) { rowClass = "custom-native"; } else if (frame.Type == SuperDump.Models.StackFrameType.Managed) { rowClass = "custom-managed"; } else if (frame.Type == SuperDump.Models.StackFrameType.Special) { rowClass = "custom-special"; } string disassemblyCmd = Model.DumpType == SuperDumpService.Models.DumpType.WindowsDump ? (frame.Type == SuperDump.Models.StackFrameType.Native ? "u " : "!u ") + (frame.InstructionPointer).ToString("x") + "-8" : "disas 0x" + (frame.InstructionPointer).ToString("x"); <tr id="@frame.StackPointer.ToString("X")" class="@rowClass"> @if (Model.DumpType != SuperDumpService.Models.DumpType.LinuxCoreDump) { <td class="nobreak stacktype">@frame.Type.ToString()</td> } <td class="nobreak stackptr">@frame.StackPointer.ToString("x" + Model.PointerSize)</td> <td class="nobreak stackptroffset">0x<span>@frame.StackPointerOffset.ToString("x")</span> bytes</td> <td class="nobreak stackinstructionptr"> <interactive-link model="@Model" command="@disassemblyCmd"> @frame.InstructionPointer.ToString("x" + Model.PointerSize) </interactive-link> </td> <td class="nobreak stackreturnaddr">@frame.ReturnOffset.ToString("x" + Model.PointerSize)</td> @if (frame.Type == SuperDump.Models.StackFrameType.Special) { <td class="nobreak stackmethodname"> [@(frame.ModuleName)!<b>@(frame.MethodName)</b>+@frame.OffsetInMethod.ToString("x" + Model.PointerSize)] </td> } else { string tagclasses = ""; if (frame.Tags.Count > 0) { tagclasses = "inline-tag " + string.Join(" ", frame.Tags.Select(x => "tag-" + x.Name)); } <td class="nobreak stackmethodname"> <span class="@tagclasses">@(frame.ModuleName)!<b>@(frame.MethodName)</b>+@(frame.OffsetInMethod.ToString("x"))</span> <span class="sourceinfo"> <dynatrace-source-link repository-url="@Model.RepositoryUrl" source-file="@frame.SourceInfo?.File">@frame.SourceInfo?.File:@frame.SourceInfo?.Line</dynatrace-source-link> </span> <div class="nobreak stackvariables"> @if (frame is SuperDumpModels.SDCDCombinedStackFrame) { <table> @foreach (var entry in (frame as SuperDumpModels.SDCDCombinedStackFrame).ArgsWithLinks) { <tr> <td style="width:120px"><b>@(entry.Key)</b></td> <td> @for (int i = 0; i + 1 < entry.Value.Count(); i += 2) { @(entry.Value.ElementAt(i)) <interactive-link Model="@Model" Command="x/32xw @(entry.Value.ElementAt(i + 1))"> @(entry.Value.ElementAt(i + 1)) </interactive-link> } @(entry.Value.Last()) </td> </tr> } @foreach (var entry in (frame as SuperDumpModels.SDCDCombinedStackFrame).LocalsWithLinks) { <tr> <td style="width:120px"><b>@(entry.Key)</b></td> <td> @for (int i = 0; i + 1 < entry.Value.Count(); i += 2) { @(entry.Value.ElementAt(i)) <interactive-link Model="@Model" Command="x/32xw @(entry.Value.ElementAt(i + 1))"> @(entry.Value.ElementAt(i + 1)) </interactive-link> } @(entry.Value.Last()) </td> </tr> } </table> } </div> </td> } @if (AuthorizationHelper.CheckPolicy(User, LdapCookieAuthenticationExtension.UserPolicy)) { <td class="nobreak stackvariables"> @if (frame is SuperDumpModels.SDCDCombinedStackFrame) { <table> @foreach (var entry in (frame as SuperDumpModels.SDCDCombinedStackFrame).ArgsWithLinks) { <tr> <td style="width:120px"><b>@(entry.Key)</b></td> <td> @for (int i = 0; i + 1 < entry.Value.Count(); i += 2) { @(entry.Value.ElementAt(i)) <interactive-link Model="@Model" Command="x/32xw @(entry.Value.ElementAt(i + 1))"> @(entry.Value.ElementAt(i + 1)) </interactive-link> } @(entry.Value.Last()) </td> </tr> } @foreach (var entry in (frame as SuperDumpModels.SDCDCombinedStackFrame).LocalsWithLinks) { <tr> <td style="width:120px"><b>@(entry.Key)</b></td> <td> @for (int i = 0; i + 1 < entry.Value.Count(); i += 2) { @(entry.Value.ElementAt(i)) <interactive-link Model="@Model" Command="x/32xw @(entry.Value.ElementAt(i + 1))"> @(entry.Value.ElementAt(i + 1)) </interactive-link> } @(entry.Value.Last()) </td> </tr> } </table> } </td> } </tr> } </tbody> </table> <div class="hidden-stacktrace-hack">{noformat}</div> </div> </div> } </div> </div> </div> } </div>
the_stack
@model Xms.Web.Customize.Models.EditRibbonButtonModel <div class="panel panel-default"> @*<div class="panel-heading"> <h3 class="panel-title"> <a data-toggle="collapse" href="#collapseTwo"> <strong>@app.PrivilegeTree?.LastOrDefault().DisplayName</strong> </a> </h3> </div>*@ <div id="collapseTwo" class="panel-collapse collapse in"> <div class="panel-body"> <form action="/@app.OrganizationUniqueName/customize/@app.ControllerName/@app.ActionName" method="post" id="editform" class="form-horizontal" role="form"> @Html.AntiForgeryToken() @Html.ValidationSummary() @Html.HiddenFor(x => x.SolutionId) @Html.HiddenFor(x => x.EntityId) @Html.HiddenFor(x => x.RibbonButtonId) @Html.HiddenFor(x => x.CommandRules) <div class="form-group col-sm-12"> <label for="" class="col-sm-2 control-label">选择常用按钮</label> <div class="col-sm-10"> <div class="col-sm-3"> <button class="btn btn-info btn-xs" type="button" onclick="setBtnStyle(this)"><span class="glyphicon glyphicon-plus-sign"></span> 新建</button> <button class="btn btn-info btn-xs" type="button" onclick="setBtnStyle(this)"><span class="glyphicon glyphicon-floppy-disk"></span> 保存</button> <button class="btn btn-info btn-xs" type="button" onclick="setBtnStyle(this)"><span class="glyphicon glyphicon-trash"></span> 删除</button> </div> <div class="col-sm-3"> <a class="btn btn-default btn-xs" href="javascript:void(0)" onclick="setBtnStyle(this)"><span class="glyphicon glyphicon-edit"></span> 编辑</a> <a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="setBtnStyle(this)"><span class="glyphicon glyphicon-trash"></span> 删除</a> </div> <div class="col-sm-3"> <a class="btn btn-link btn-sm" href="javascript:void(0)" onclick="setBtnStyle(this)"><span class="glyphicon glyphicon-plus-sign"></span> 新建</a> <a class="btn btn-link btn-sm" href="javascript:void(0)" onclick="setBtnStyle(this)"><span class="glyphicon glyphicon-trash"></span> 删除</a> </div> </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.Label, "标签", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> @Html.TextBoxFor(x => x.Label, new { @class = "form-control required" }) <label for="ShowLabel">@Html.CheckBoxFor(x => x.ShowLabel) 显示标签?</label> </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.CssClass, "样式", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> @Html.TextBoxFor(x => x.CssClass, new { @class = "form-control" }) </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.Icon, "Icon", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> @Html.TextBoxFor(x => x.Icon, new { @class = "form-control" }) </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.JsLibrary, "JS库", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> <input type="text" class="form-control input-sm lookup" name="jslibrary_text" id="jslibrary_text" /> <input type="hidden" name="jslibrary" id="jslibrary" /> </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.JsAction, "JS方法", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> @Html.TextBoxFor(x => x.JsAction, new { @class = "form-control" }) </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.ShowArea, "显示区域", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> @Html.TextBoxFor(x => x.ShowArea, new { @class = "form-control required", @value = "" }) </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.ShowArea, "显示规则", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#ruleModal"> <span class="glyphicon glyphicon-edit"></span> 配置 </button> </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.StateCode, "状态", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> <label class="checkbox-inline"> @Html.RadioButtonFor(x => x.StateCode, Xms.Core.RecordState.Enabled, new { @class = "required" }) 可用 </label> <label class="checkbox-inline"> @Html.RadioButtonFor(x => x.StateCode, Xms.Core.RecordState.Disabled, new { @class = "required" }) 禁用 </label> </div> </div> <div class="form-group col-sm-12"> @Html.LabelFor(x => x.DisplayOrder, "排序", new { @class = "col-sm-2 control-label" }) <div class="col-sm-10"> @Html.TextBoxFor(x => x.DisplayOrder, new { @class = "form-control required" }) </div> </div> <div class="form-group col-sm-12 text-center" id="form-buttons"> <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-saved"></span> 保存</button> <button type="reset" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> 重置</button> </div> <!-- (Modal) --> <div class="modal fade" id="ruleModal" tabindex="-1" role="dialog" aria-labelledby="ruleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button> <h4 class="modal-title" id="ruleModalLabel"> <span class="glyphicon glyphicon-th"></span> 配置按钮显示规则 </h4> </div> <div class="modal-body"> <ul id="myTab" class="nav nav-tabs"> <li class="active"> <a href="#formstate" data-toggle="tab"> 按表单状态 </a> </li> <li> <a href="#attributevalue" data-toggle="tab"> 按字段值 </a> </li> </ul> <div id="myTabContent" class="tab-content"> <div class="tab-pane fade in active" id="formstate" style="padding:5px;"> <div class="row"> <div class="col-sm-12 form-group"> <div class="col-sm-4"><label>当表单为勾选的状态时</label></div> <div class="col-sm-3"> <div class="visible"> <label for="formstate_visibled1">显示</label> <input type="radio" name="formstate_visibled" id="formstate_visibled1" value="true" /> <label for="formstate_visibled2">隐藏</label> <input type="radio" name="formstate_visibled" id="formstate_visibled2" checked="checked" value="false" /> </div> </div> <div class="col-sm-3"> <div class="enable"> <label for="formstate_enabled1">可用</label> <input type="radio" name="formstate_enabled" id="formstate_enabled1" value="true" /> <label for="formstate_enabled2">禁用</label> <input type="radio" name="formstate_enabled" id="formstate_enabled2" checked="checked" value="false" /> </div> </div> </div> <div id="formStatusBody"> <div id="formStatusAddBody" class="col-sm-12 form-group"> <div class="col-sm-3"><label><input type="checkbox" name="formstate" value="create" />新建</label></div> <div class="col-sm-3"><label><input type="checkbox" name="formstate" value="update" />编辑</label></div> <div class="col-sm-3"><label><input type="checkbox" name="formstate" value="readonly" />只读</label></div> <div class="col-sm-3"><label><input type="checkbox" name="formstate" value="disabled" />禁用</label></div> </div> </div> </div> </div> <div class="tab-pane fade" id="attributevalue" style="padding:5px;"> <div class="row" style="max-height:350px;overflow-y:auto;"> <div class="col-sm-12 form-group"> <div class="col-sm-4"><label>当字段值等于输入值时</label></div> <div class="col-sm-3"> <div class="visible"> <label for="attributevalue_visibled1">显示</label> <input type="radio" name="attributevalue_visibled" id="attributevalue_visibled1" value="true" /> <label for="attributevalue_visibled2">隐藏</label> <input type="radio" name="attributevalue_visibled" id="attributevalue_visibled2" checked="checked" value="false" /> </div> </div> <div class="col-sm-3"> <div class="enable"> <label for="attributevalue_enabled1">可用</label> <input type="radio" name="attributevalue_enabled" id="attributevalue_enabled1" value="true" /> <label for="attributevalue_enabled2">禁用</label> <input type="radio" name="attributevalue_enabled" id="attributevalue_enabled2" checked="checked" value="false" /> </div> </div> </div> <div class="col-sm-12 form-group"> <div class="btn-group"> <button type="button" class="btn btn-primary btn-xs" id="addAttributevalue"> <span class="glyphicon glyphicon-plus-sign"></span> 增加 </button> <button type="button" class="btn btn-default btn-xs" id="removeAttributevalue"> <span class="glyphicon glyphicon-trash"></span> 清空 </button> </div> </div> <div id="attributevalueBody"> <div id="attributevalueOperationBody" class="col-sm-12 col-xs-12 form-group"> <div class="col-sm-4 col-xs-4"> <select class="form-control" id="attributevalue_select"> <option></option> </select> </div> <div class="col-sm-1 col-xs-1">=</div> <div class="col-sm-4 col-xs-4"> <input type="text" class="form-control input-sm" id="attributevalue_text1" name="attributevalue_text" placeholder="值" /> </div> </div> </div> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"> <span class="glyphicon glyphicon-remove"></span> 关闭 </button> <button type="button" class="btn btn-primary" id="btnFormStatusConfirm" name="returnBtn"> <span class="glyphicon glyphicon-ok"></span> 确定 </button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </form> </div> </div> </div> @section Scripts { <script src="/content/js/jquery.form.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-validate/jquery.validate.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-validate/localization/messages_zh.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/xms.metadata.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/common/bsinfos.js?v=@app.PlatformSettings.VersionNumber"></script> <script> $(function () { $('#ShowArea').picklist({ items: [{ label: '表单', value: 'Form' }, { label: '列表头部', value: 'ListHead' }, { label: '列表行内', value: 'ListRow' }, { label: '单据体', value: 'SubGrid' }]// , required: true , changeHandler: function (e) { if ($(this).val() == 'Form') { $('#visibledRule').removeClass('hide'); $('#ruleTab').find('li:first').removeClass('hide').addClass('active').trigger('click'); $('#ruleTab').find('li:last').removeClass('hide'); } else if ($(this).val() == 'ListRow') { $('#visibledRule').removeClass('hide'); $('#ruleTab').find('li:first').addClass('hide').removeClass('active'); $('#ruleTab').find('li:last').removeClass('hide').addClass('active').trigger('click'); } else { $('#visibledRule').addClass('hide'); } } }); //表单验证 Xms.Web.Form($("#editform"), function (response) { Xms.Web.Alert(response.IsSuccess, response.Content, function () { location.reload(); }); Xms.Web.Event.localStorageEvent.trigger('list_ribbonbutton_rebind'); setTimeout(function () { location.reload(); }, 3000); }, null, function () { $('#ShowArea').val($('#ShowArea').next().children('option:selected').val()); }); $(".modal").draggable({ handle: ".modal-header", cursor: 'move', refreshPositions: false }); $('#Icon').xmsAutoComplete({ datas: bsicons, itemClass: 'iconsarr', itemTmpl: '<li class="{{itemClass}} {{itemOther}}" value="{{itemValue}}">{{itemTitle}}</li>', dataFilter: function (data) { var res = []; $.each(data, function (i, n) { var obj = { value: n, other: n, } res.push(obj); }); return res; } }); var btnCssArr = []; $.each(btnColorArr, function (i, n) { $.each(btnSizeArr, function (ii,nn) { btnCssArr.push('btn ' + n + ' ' + nn); }); }); $('#CssClass').xmsAutoComplete({ datas: btnCssArr, itemClass: 'btnCssarr', itemTmpl: '<li class="{{itemClass}}" value="{{itemValue}}"><div class="{{itemOther}}">按钮</div></li>', dataFilter: function (data) { var res = []; $.each(data, function (i, n) { var obj = { value: n, other: n, } res.push(obj); }); return res; } }); /*点击确定时,遍历所有的 拼接字符串*/ $("#btnFormStatusConfirm").click(function () { var StatusJson = {}; //第一个函数传入父节点 遍历出子节点的数据返回对象 StatusJson.FormStateRules = setFormStatusBodyInfo($("#formStatusBody")); StatusJson.ValueRules = setAttributeBody($("#attributevalueBody")); var statusJsonStr = JSON.stringify(StatusJson); $("#CommandRules").val(statusJsonStr); console.log(statusJsonStr); $('#ruleModal').modal('hide'); }); /* 按钮显示规则/按字段值添加*/ $("#addAttributevalue").click(function () { var newAttributevalueOperationBody = $("#attributevalueOperationBody").clone(); newAttributevalueOperationBody.find(".col-sm-1>button").css("display", "inline");/*获取到newAttributevalueOperationBody里面的button元素 设置其样式*/ var idStr = Xms.Utility.Guid.NewGuid().ToString('N');//生成一个guid newAttributevalueOperationBody.prop("id", "attributevalueOperationBody" + idStr); /*修改id */ newAttributevalueOperationBody.find("#attributevalue_select").attr("id", "attributevalue_select" + idStr).val(''); newAttributevalueOperationBody.find("#attributevalue_text1").attr("id", "attributevalue_text1" + idStr).val(''); $("#attributevalueBody").append(newAttributevalueOperationBody); }); /*#按属性进行清空*/ $("#removeAttributevalue").click(function () { removeAll($("#attributevalueBody")); }); $('#jslibrary_text').lookup({ disabled: true, dialog: function () { Xms.Web.OpenDialog('/customize/WebResource/Dialog?singlemode=true&inputid=jslibrary_text', 'selectRecordCallback'); } , clear: function () { $('#jslibrary_text').val(''); $('#jslibrary').val(''); } }); loadAttributes(); }); function setBtnStyle(_this) { var $this = $(_this); $('#Label').val($this.get(0).innerText.trim()); $('#CssClass').val($this.prop('class')); $('#Icon').val($this.find('span:first').prop('class')); $('#ShowArea').val($('#ShowArea').next().children('option:selected').val()); } /*根据attribute选择的数据 设置对象 返回*/ function setAttributeBody(_$attributevalueBody) { var attributeSatusJson = {}; attributeSatusJson.Values = []; var childAttributeStatusBodys = _$attributevalueBody.children(); childAttributeStatusBodys.each(function (index, obj) { var jsonAttribute = {}; var attributeSlectTextValue = Xms.Web.SelectedValue($(this).find("select")); if (!attributeSlectTextValue) return true; jsonAttribute.Field = attributeSlectTextValue; var attributeValue = $(this).find("input[type=text]").val(); jsonAttribute.Value = attributeValue; attributeSatusJson.Values.push(jsonAttribute);//加入到对象数组中 }); if (attributeSatusJson.Values && attributeSatusJson.Values.length > 0) { attributeSatusJson.visibled = $('input[name="attributevalue_visibled"]:checked').val(); attributeSatusJson.enabled = $('input[name="attributevalue_enabled"]:checked').val(); } else { attributeSatusJson = null; } return attributeSatusJson; } /*遍历formStatusBody$对象 返回对应格式的对象*/ function setFormStatusBodyInfo(_$formStatusBody) { var formSatusJson = {}; formSatusJson.States = []; var childFormStatusBodys = _$formStatusBody.find("input[type=checkbox]:checked"); //得到每一个formStatusBody下的所有行 childFormStatusBodys.each(function (index, obj) { formSatusJson.States.push($(obj).val()); }); if (formSatusJson.States && formSatusJson.States.length > 0) { formSatusJson.visibled = $('input[name="formstate_visibled"]:checked').val(); formSatusJson.enabled = $('input[name="formstate_enabled"]:checked').val(); } else { formSatusJson = null; } return formSatusJson; } /*根据父节点循环删除子节点*/ function removeAll(_parentElement) { var elementBodyChild = _parentElement.children(); for (var i = 1; i < elementBodyChild.length; i++) { elementBodyChild[i].remove(); } } /*按钮显示规则/按表单状态单个删除方法,点击的时候调用这个方法,把元素的父节点传递过来*/ function deleteLine(_parentElement) { _parentElement.remove(); } /*ajax请求实体的数据*/ function loadEntities() { Xms.Web.GetJson('/customize/Entity/index?getall=true', null, function (data) { if (!data || data.content.items.length == 0) return; $(data.content.items).each(function (i, n) { $('#entityper_select').append("<option value=\"" + n.name + "\">" + n.localizedname + '</option>'); }); //$('#EntityId').val($('#EntitySel').find('option:selected').val()); }); } /*ajax请求字段数据*/ function loadAttributes() { /*获取到点击进来的实体的 所有的字段*/ $('#attributevalue_select').find('option:gt(0)').remove(); Xms.Schema.GetAttributesByEntityId($('#EntityId').val(), function (data) { if (!data || data.length == 0) return; $(data).each(function (i, n) { $('#attributevalue_select').append("<option value=\"" + n.name + "\">" + n.localizedname + '</option>'); }); //$('#AttributeId').val($('#AttributeSel').find('option:selected').val()); }); } function selectRecordCallback(result, inputid) { $('#' + inputid).val(result[0].name); var valueid = inputid.replace(/_text/, ''); $('#' + valueid).val('$webresource:' + result[0].id); $('#' + inputid).trigger('change'); $('#' + valueid).trigger('change'); } </script> }
the_stack
 @{ ViewBag.Title = "OrderEdit"; Layout = "~/Views/Shared/_LayoutBlank.cshtml"; } @Scripts.Render("~/Scripts/editViewCommon.js") <script> var _id = getQueryString("id"); var _mode = "create";//modify var _data = null; var _table; var _tableLog; $(document).ready(function () { __setReadOnly("form"); initTable(); load(); }); function load() { if (_id == undefined || _id == "") { return; } $("#btnRecord").hide(); $("#btnRecord2").hide(); $("#btnFinish").hide(); _mode = "modify"; $("#btnRemove").show(); var url = "/Api/Order/GetOrder/" + _id; __requestLoadDataApi(url,function(data){ _data = data.Data; __setDto("form", _data); //$.each(_data.Product_Order_Detail, function (index, value) { // value.checked = false; //}); _table.reload({ data: _data.Product_Order_Detail }); _tableLog.reload({ data: _data.Product_Order_Record }); //订单当前状态:1:待付费 2:待发货 3:已发货 4:已收货 5:申请退货 6:退货中 9:已完成 switch (_data.current_status) { case 1: $("#btnRecord").show(); $("#btnRecord").val("付款"); break; case 2: $("#btnRecord").show(); $("#btnRecord").val("发货"); break; case 3: $("#btnRecord").show(); $("#btnRecord").val("已收货"); break; case 4: $("#btnFinish").show(); $("#btnRecord2").show(); break; default: } }); } function removeData() { __requestRemoveDataApi("/Api/Order/RemoveOrder/" + _id); } function initTable() { var args = getTableRenderArgs(); var argsLog = getTableLogRenderArgs(); layui.use('table', function () { var table = layui.table; //展示已知数据 _table = table.render(args); _tableLog = table.render(argsLog); table.on('checkbox(table)', function (obj) { console.log(obj) }); }); } function getTableRenderArgs() { return { elem: '#table' // , width: 790 // , height: 300 , cols: [[ //标题栏 { checkbox: true, fixed: 'left' }, { field: 'Number', title: '货号', width: 120, fixed: 'left', sort: false, templet: "<div><a href='javascript:void(0)' onclick=\"modify('{{d.id}}')\">{{d.product_code}}</a></div>" }, { title: "名称", field: "product_name", width: 100, sort: false, }, { title: "购买数量", field: "buy_num", width: 100, sort: false, }, { title: "证书落款", field: "cert_sign", width: 100, sort: false, }, { title: "购买价", field: "current_price", width: 100, sort: false, }, { title: "成本价", field: "real_price", width: 100, sort: false, }, { title: "出厂价", field: "cost_price", width: 100, sort: false, }, { title: "一级分销商价", field: "first_distribution_price", width: 130, sort: false, }, { title: "二级分销商价", field: "second_distribution_price", width: 130, sort: false, }, { title: "会员价", field: "member_price", width: 100, sort: false, }, { title: "已收货 ", field: "is_receiving", width: 100, sort: false, }, { title: "券名称 ", field: "coupon_name", width: 100, sort: false, }, { title: "用券优惠金额 ", field: "coupon_sale_price", width: 130, sort: false, }, ]] , skin: 'row' //表格风格 , even: true // , page: true //是否显示分页 // , limits: [5, 7, 10] // , limit: 5 //每页默认显示的数量 } } function getTableLogRenderArgs() { return { elem: '#tableLog' // , width: 790 // , height: 300 , cols: [[ //标题栏 { title: "时间", field: "modify_date_time", width: 150, sort: false, }, { title: "备注", field: "modify_comment", width: 600, sort: false, }, ]] , skin: 'row' //表格风格 , even: true // , page: true //是否显示分页 // , limits: [5, 7, 10] // , limit: 5 //每页默认显示的数量 } } function record(status) { //订单当前状态:1:待付费 2:待发货 3:已发货 4:已收货 5:申请退货 6:退货中 9:已完成 var newStatus = 0; if (status == undefined) { switch (_data.current_status) { case 1: newStatus = 2; break; case 2: newStatus = 3; break; case 3: newStatus = 4; break; } } else { newStatus = status; } var url = 'CreateOrderRecord?orderId=' + _id + "&currentStatus=" + _data.current_status + "&newStatus=" + newStatus; layer.open({ type: 2, area: ['500px', '250px'], closeBtn: false, title: "", shift: _layerShift, content: url }); } function finish() { var selectedIds = ""; $.each(_data.Product_Order_Detail, function (index, value) { if (value.LAY_CHECKED != undefined && value.LAY_CHECKED) { selectedIds += value.id + ","; } }); if (selectedIds == "") { layerAlert("请选择已确认完成交易的商品。"); return; } selectedIds = selectedIds.substr(0, selectedIds.length - 1); var url = 'CreateOrderRecord?orderId=' + _id + "&currentStatus=" + _data.current_status + "&newStatus=9&receiving_detail_id=" + selectedIds; layer.open({ type: 2, area: ['500px', '250px'], closeBtn: false, title: "", shift: _layerShift, content: url }); } function __loadDataOnPageAndCloseLayer(layerIndex) { layer.close(layerIndex); load(); } </script> <div class="PopupWindowTitle"> <span id="spanTitle">订单</span> </div> <div style="position:absolute; overflow:auto ;margin-top:5px;left:30px; right:30px; bottom:60px; top:50px; "> <form id="form" onsubmit="return false"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110" height="36">订单号:</td> <td width="320"><input id="txt_id" name="txt_id" type="text" class="input_16" style="width:90%; " keyenter dtoproperty="id" maxlength="50" /></td> <td width="110" height="36">下单时间:</td> <td><input id="txt_order_date_time" name="txt_order_date_time" type="text" class="input_16" style="width:96%; " keyenter dtoproperty="order_date_time" maxlength="50" /></td> </tr> <tr> <td width="110" height="36">会员:</td> <td width="320"><input id="txt_member_name" name="txt_member_name" type="text" class="input_16" style="width:90%; " keyenter dtoproperty="member_name" maxlength="50" /></td> <td width="110" height="36">会员手机号:</td> <td><input id="txt_member_phone_num" name="txt_member_phone_num" type="text" class="input_16" style="width:96%; " keyenter dtoproperty="member_phone_num" maxlength="50" /></td> </tr> <tr> <td width="110" height="36">物流公司:</td> <td width="320"><input id="txt_transport_no" name="txt_transport_no" type="text" class="input_16" style="width:90%; " keyenter dtoproperty="transport_no" maxlength="50" /></td> <td width="110" height="36">发货单号:</td> <td><input id="txt_transport_company" name="txt_transport_company" type="text" class="input_16" style="width:96%; " keyenter dtoproperty="transport_company" maxlength="50" /></td> </tr> <tr> <td width="110" height="36">收货人:</td> <td width="320"><input id="txt_consignee" name="txt_consignee" type="text" class="input_16" style="width:90%; " keyenter dtoproperty="consignee" maxlength="50" /></td> <td width="110" height="36">联系电话:</td> <td><input id="txt_consignee_phone" name="txt_consignee_phone" type="text" class="input_16" style="width:90%; " keyenter dtoproperty="consignee_phone" maxlength="50" /></td> </tr> <tr> <td width="110" height="36">收货地址:</td> <td colspan="3"><input id="txt_consignee_address" name="txt_consignee_address" type="text" class="input_16" style="width:90%; " keyenter dtoproperty="consignee_address" maxlength="50" /></td> </tr> </table> </form> <div> <div> 商品信息 </div> <div style="margin-top:15px;"> <table id="table" lay-filter="table"></table> </div> </div> <div> <div> 处理日志 </div> <div> <table id="tableLog" lay-filter="tableLog"></table> </div> </div> </div> <div style="background-color:#ccc; position:absolute; bottom:55px; left:20px;right:20px; height:1px;"> </div> <div style="position:absolute; bottom:15px; left:20px;right:20px;"> <div style="float:left;"> <input name="btnRemove" type="button" class="btn_red" id="btnRemove" value="删 除" style="display:none" onclick="removeData()" /> </div> <div style="float:right"> <input name="btnRecord" type="button" class="btn_green" id="btnRecord" value="处理订单" onclick="record()" style="display:none" /> <input name="btnFinish" type="button" class="btn_green" id="btnFinish" value="订单完成" onclick="finish()" style="display:none" /> <input name="btnRecord2" type="button" class="btn_green" id="btnRecord2" value="申请退货" onclick="record(5)" style="display:none" /> <input name="btnCancel" type="button" class="btn_aque" id="btnCancel" value="关 闭" onclick="__closePopupFrameLayer()" /> </div> <div style="clear:both"> </div> </div>
the_stack
@{ ViewBag.Title = "Form"; Layout = "~/Views/Shared/_Form.cshtml"; } <!--表格组件end--> <script type="text/javascript"> var keyValue = SF.utility.request('keyValue'); var parentId = SF.utility.request('parentId'); var moduleId =@ViewBag.ModuleId; $(function () { initialPage(); buttonOperation(); getGridButton(); }) //初始化页面 function initialPage() { //加载导向 $('#wizard').wizard().on('change', function (e, data) { var $finish = $("#btn_finish"); var $next = $("#btn_next"); if (data.direction == "next") { if (data.step == 1) { $finish.removeAttr('disabled'); $next.attr('disabled', 'true'); //根据编码获取系统已有的操作 if (moduleId == 0) { $.ajax({ url: "/Api/Module/Button/GetListJson?moduleName=" + $("#EnCode").val(), type: "get", dataType: "json", success: function (data) { buttonJson = data; ButtonListToListTreeJson(buttonJson); }, }); } } else { $finish.attr('disabled', 'true'); } } else { $finish.attr('disabled', 'true'); $next.removeAttr('disabled'); } }); initControl(); } //初始化控件 function initControl() { //目标 SF.utility.comboBox($("#Target"), { description: "==请选择==", height: "200px" }); //上级 SF.utility.comboBoxTree($("#ParentId"), { url: "/Api/Module/GetTreeJson", description: "==请选择==", height: "195px", allowSearch: true }); //获取表单 if (!!keyValue) { SF.utility.setForm({ url: "/Api/Module/" + keyValue, success: function (data) { SF.utility.setWebControls('form1', data); if (data.IsMenu == 1) { $("#btn_next").removeAttr('disabled'); $("#btn_finish").attr('disabled', 'disabled'); } } }); } else { SF.utility.comboBoxTreeSetValue($("#ParentId"), parentId); } } //选取图标 function SelectIcon() { SF.utility.dialogOpen({ id: "SelectIcon", title: '选取图标', url: '/Module/Icon?ControlId=Icon', width: "1000px", height: "600px", btn: false }) } //保存表单 function AcceptClick(type) { if (!$('#form1').Validform()) { return false; } var postData = SF.utility.getWebControls('form1', keyValue); if (postData["ParentId"] == "") { postData["ParentId"] = 0; } postData["moduleButtonListJson"] = JSON.stringify(buttonJson); var url = "/Api/Module/SaveModule"; SF.utility.saveForm({ type: type, url: url, param: postData, loading: "正在保存数据...", success: function () { SF.utility.currentIframe().$("#gridTable").resetSelection(); SF.utility.currentIframe().$("#gridTable").trigger("reloadGrid"); } }) } //按钮操作(上一步、下一步、完成、关闭) function buttonOperation() { var $last = $("#btn_last"); var $next = $("#btn_next"); var $finish = $("#btn_finish"); //如果是菜单,开启 上一步、下一步 $("#IsMenu").click(function () { if (!$('#form1').Validform()) { $(this).attr("checked", false) return }; if (!$(this).attr("checked")) { $(this).attr("checked", true) $next.removeAttr('disabled'); $finish.attr('disabled', 'true'); } else { $(this).attr("checked", false) $next.attr('disabled', 'true'); $finish.removeAttr('disabled'); } }); //完成提交保存 $finish.click(function () { AcceptClick(); }) } /*系统按钮being==================================*/ var buttonJson = ""; function getGridButton() { $.ajax({ url: "/Api/Module/Button/GetListJson?moduleId=" + moduleId, type: "get", dataType: "json", success: function (data) { buttonJson = data; }, }); var $grid = $("#gridTable-button"); $grid.jqGrid({ unwritten: false, url: "/Api/Module/Button/GetTreeListJson?moduleId=" + moduleId, datatype: "json", height: $(window).height() - 165, width: $(window).width() - 11, colModel: [ { label: "主键", name: "Id", hidden: true }, { label: "菜单ID", name: "ModuleId", hidden: true }, { label: "名称", name: "Description", width: 140, align: "left", sortable: false }, { label: "编号", name: "Name", width: 140, align: "left", sortable: false }, { label: "地址", name: "ActionAddress", width: 500, align: "left", sortable: false }, ], treeGrid: true, treeGridModel: "nested", ExpandColumn: "Name", rowNum: "all", rownumbers: true }); //新增 $("#lr-add-button").click(function () { SF.utility.dialogOpen({ id: "buttonForm", title: '添加按钮', url: '/Module/ButtonForm?moduleId=' + moduleId, width: "450px", height: "300px", callBack: function (iframeId) { top.frames[iframeId].AcceptClick(function (data) { buttonJson.push(data); ButtonListToListTreeJson(buttonJson); }); } }); }) //编辑 $("#lr-edit-button").click(function () { var buttonId = $("#gridTable-button").jqGridRowValue("Id"); if ( SF.utility.checkedRow(buttonId)) { SF.utility.dialogOpen({ id: "buttonForm", title: '编辑按钮', url: '/Module/ButtonForm?buttonId=' + buttonId + "&moduleId=" + moduleId, width: "450px", height: "300px", callBack: function (iframeId) { top.frames[iframeId].AcceptClick(function (data) { $.each(buttonJson, function (i) { if (buttonJson[i].Id == buttonId) { buttonJson[i] = data; } }); ButtonListToListTreeJson(buttonJson); }); } }); } }) //删除 $("#lr-delete-button").click(function () { var buttonId = $("#gridTable-button").jqGridRowValue("Id"); if ( SF.utility.checkedRow(buttonId)) { $.each(buttonJson, function (i) { if (buttonJson[i].Id == buttonId) { buttonJson.splice(i, 1); ButtonListToListTreeJson(buttonJson); return false; } }); } }); } //处理Json function ButtonListToListTreeJson(buttonJson) { $.ajax({ url: "/Api/Module/Button/ListToListTreeJson?moduleId=" + moduleId, data: { ModuleButtonJson: JSON.stringify(buttonJson) }, type: "post", dataType: "json", success: function (data) { $("#gridTable-button").clearGridData(); $("#gridTable-button")[0].addJSONData(data); }, }); } /*系统按钮end====================================*/ </script> <div class="widget-body"> <div id="wizard" class="wizard" data-target="#wizard-steps" style="border-left: none; border-top: none; border-right: none;"> <ul class="steps"> <li data-target="#step-1" class="active"><span class="step">1</span>系统功能<span class="chevron"></span></li> <li data-target="#step-2"><span class="step">2</span>系统按钮<span class="chevron"></span></li> </ul> </div> <div class="step-content" id="wizard-steps" style="border-left: none; border-bottom: none; border-right: none;"> <div class="step-pane active" id="step-1" style="margin-left: 0px; margin-top: 15px; margin-right: 30px;"> <input id="Id" type="hidden" value="@ViewBag.ModuleId" /> <table class="form"> <tr> <th class="formTitle">编号<font face="宋体">*</font></th> <td class="formValue"> <input id="EnCode" type="text" class="form-control" placeholder="请输入编号" isvalid="yes" checkexpession="NotNull" /> </td> <th class="formTitle">名称<font face="宋体">*</font></th> <td class="formValue"> <input id="FullName" type="text" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" /> </td> </tr> <tr> <th class="formTitle">上级</th> <td class="formValue"> <div id="ParentId" type="selectTree" class="ui-select"> </div> </td> <th class="formTitle">图标</th> <td class="formValue"> <input id="Icon" type="text" class="form-control" /> <span class="input-button" onclick="SelectIcon()" title="选取图标">...</span> </td> </tr> <tr> <th class="formTitle">目标<font face="宋体">*</font></th> <td class="formValue"> <div id="Target" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull"> <ul> <li data-value="expand">expand</li> <li data-value="iframe">iframe</li> <li data-value="open">open</li> <li data-value="href">href</li> <li data-value="blank">blank</li> </ul> </div> </td> <th class="formTitle">排序<font face="宋体">*</font></th> <td class="formValue"> <input id="SortIndex" type="text" class="form-control" isvalid="yes" checkexpession="Num" /> </td> </tr> <tr> <th class="formTitle">地址</th> <td class="formValue" colspan="3"> <input id="UrlAddress" type="text" class="form-control" /> </td> </tr> <tr> <th class="formTitle" style="height: 37px;">选项</th> <td class="formValue"> <div class="checkbox user-select"> <label> <input id="IsMenu" type="checkbox" /> 菜单 </label> <label> <input id="IsPublic" type="checkbox" /> 公共 </label> <label> <input id="AllowExpand" type="checkbox" /> 展开 </label> <label> <input id="EnabledMark" type="checkbox" checked="checked" /> 有效 </label> </div> </td> </tr> <tr> <th class="formTitle" valign="top" style="padding-top: 4px;"> 描述 </th> <td class="formValue" colspan="3"> <textarea id="Description" class="form-control" style="height: 70px;"></textarea> </td> </tr> </table> </div> <div class="step-pane" id="step-2" style="margin: 5px;"> <div style="height: 40px; line-height: 33px; text-align: right;"> <div class="btn-group"> <a id="lr-add-button" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;新增</a> <a id="lr-edit-button" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;编辑</a> <a id="lr-delete-button" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;删除</a> </div> </div> <table id="gridTable-button"></table> </div> </div> </div> <div class="form-button" id="wizard-actions"> <a disabled class="btn btn-default btn-prev">上一步</a> <a disabled class="btn btn-default btn-next">下一步</a> <a id="btn_finish" class="btn btn-success">完成</a> </div>
the_stack
@page @model StackGenerateModel @{ ViewData["Title"] = "Generate Stack"; ViewData["PageName"] = "icons_stack_generate"; ViewData["Category1"] = "Font Icons"; ViewData["Category2"] = "Stack Icons"; ViewData["Heading"] = "Stack Icons: <span class='fw-300'>Generate Stack</span> <sup class='badge badge-success fw-500'>ADDON</sup>"; ViewData["PageDescription"] = "Generate your unique stack Icon"; } @section HeadBlock { <link rel="stylesheet" media="screen, print" href="~/css/fa-regular.css"> <link rel="stylesheet" media="screen, print" href="~/css/fa-solid.css"> <link rel="stylesheet" media="screen, print" href="~/css/fa-brands.css"> <link rel="stylesheet" media="screen, print" href="~/css/fa-duotone.css"> } <div class="container"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> Unique <span class="fw-300"><i>Icon</i></span> </h2> <div class="panel-toolbar mr-2"> <select id="js-select-layers" class="custom-select form-control custom-select-sm" style="width:8rem"> <option value="2">Two layers</option> <option value="3">Three layers </option> <option value="4">Four layers</option> <option value="5">Five layers</option> <option value="6">Six layers</option> <option value="7">Seven layers</option> </select> </div> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="row"> <div class="col-12 col-xl-auto"> <div class="d-flex align-items-center justify-content-center position-relative w-100 mb-g mb-xl-0" style="font-size: 250px; min-width: 301px; height: 351px; background: url(/img/backgrounds/bg-5.png); border-left:0; border-top:0; "> <h6 class="fw-300 position-absolute pos-top pos-left m-2 bg-fusion-100 p-2 rounded fs-sm opacity-70">Preview</h6> <div id="icon-construct" class="icon-stack m-0 p-0"></div> </div> </div> <div class="flex-1 col-12 col-xl-auto"> <ul class="mb-2 p-0 list-unstyled" id="construct-wrap"></ul> <div class="row"> <div class="col-12 text-right"> <button class="btn btn-success" onclick="copyIcon();"> Copy Icon </button> </div> </div> </div> <textarea id="js-icon-class" class="position-absolute" style="height:0px; width:0px; opacity:0;"></textarea> </div> </div> </div> </div> </div> @section ScriptsBlock { <script> var fa_icon, fa_brand, ni_icon, ni_base, ng_textColors, fa_icon_URL = "/media/data/fa-icon-list.json", fa_brand_URL = "/media/data/fa-brand-list.json", ni_icon_URL = "/media/data/ng-icon-list.json", ni_base_URL = "/media/data/ng-icon-base.json", ng_textColors_URL = "/media/data/ng-text-colors.json", prefix = ["base", "fal", "fas", "far", "fad", "fab", "ni"], iconSize = ["icon-stack-3x", "icon-stack-2x", "icon-stack-1x"], layers = getUrlParameter('layers') || 3, formatedDOMElms = [], formattedDOMIcon = [], formatPrefix = [], formatOpacityValue = [], formatIconSize = [], formatTextColors = [], format_fa_icon = [], format_fa_brand = [], format_ni_icon = [], format_ni_base = []; $.when( $.getJSON(fa_icon_URL, function(data) { fa_icon = data; }), $.getJSON(fa_brand_URL, function(data) { fa_brand = data; }), $.getJSON(ni_icon_URL, function(data) { ni_icon = data; }), $.getJSON(ni_base_URL, function(data) { ni_base = data; }), $.getJSON(ng_textColors_URL, function(data) { ng_textColors = data; }) ).then(function() { if (fa_icon && fa_brand && ni_icon && ni_base && ng_textColors) { //formatPrefix jQuery.each(prefix, function(index, item) { formatPrefix.push($('<option></option>').attr("value", item).text(item)) }); //formatIconSize jQuery.each(iconSize, function(index, item) { formatIconSize.push($('<option></option>').attr("value", item).text("size-" + item.slice(11))) }); //formatTextColors jQuery.each(ng_textColors, function(index, item) { formatTextColors.push($('<option></option>').attr("value", item).addClass("bg" + item.slice(5)).text(item.slice(6))) }); //format_fa_icon jQuery.each(fa_icon, function(index, item) { format_fa_icon.push('<option value="fa' + item + '" data-icon-class="' + item + '">' + item.slice(1) + '</option>') }); //fa_brand jQuery.each(fa_brand, function(index, item) { format_fa_brand.push('<option value="fa' + item + '" data-icon-class="' + item + '">' + item.slice(1) + '</option>') }); //format_ni_icon jQuery.each(ni_icon, function(index, item) { format_ni_icon.push('<option value="ni' + item + '" data-icon-class="' + item + '">' + item.slice(1) + '</option>') }); //format_ni_base jQuery.each(ni_base, function(index, item) { format_ni_base.push('<option value="' + item + '" data-icon-class="' + item + '">' + item + '</option>') }); // create layers for (var i = 0; i < layers; i++) { /* pushing icons */ formattedDOMIcon.push('<i data-icon-select="' + i + '" class=""></i>') /* pushing controls */ formatedDOMElms.push('<li id="' + i + '" class="pl-4 pr-0 bg-subtlelight-fade mb-3 rounded border-faded shadow-1" data-layer-target="' + i + '">\ <div class="d-flex flex-row position-relative">\ <div class="badge badge-icon" style="left: -33px; top: -5px; background: #fff; color: #333; border-color: #c9d9e0;">' + i + '</div>\ <div class="flex-1 row no-gutters pb-2 pt-2">\ <div class="col-sm-6 col-md-4 col-lg-2">\ <div class="form-group mr-2 mb-md-2">\ <label>Icon prefix</label>\ <select class="js-icon-prefix js-select-trigger custom-select w-100"></select>\ </div>\ </div>\ <div class="col-sm-6 col-md-4 col-lg-3">\ <div class="form-group mr-2 mb-md-2">\ <label>Choose Icon</label>\ <select data-icon-target="' + i + '" class="js-icon-class js-select-trigger custom-select w-100"></select>\ </div>\ </div>\ <div class="col-sm-6 col-md-4 col-lg-3">\ <div class="form-group mr-2 mb-md-2">\ <label>Select Color</label>\ <select class="js-icon-color js-select-trigger custom-select w-100"></select>\ </div>\ </div>\ <div class="col-sm-6 col-md-6 col-lg-2">\ <div class="form-group mr-2 mb-md-2">\ <label>Stack Size</label>\ <select class="js-icon-size js-select-trigger custom-select w-100"></select>\ </div>\ </div>\ <div class="col-sm-12 col-md-6 col-lg-2">\ <div class="form-group mb-md-2">\ <label>Opacity</label>\ <input type="range" min="5" max="100" step="5" value="100" class="w-100 js-icon-opacity js-select-trigger">\ </div>\ </div>\ <div class="col-12 position-relative">\ <a class="fs-nano" data-toggle="collapse" href="#advance-' + i + '" role="button" aria-expanded="false" aria-controls="advance-' + i + '">\ More Options\ </a>\ </div>\ <div class="collapse col-12" id="advance-' + i + '">\ <div class="row no-gutters">\ <div class="col-sm-3">\ <div class="form-group mr-2 mb-0">\ <select class="js-icon-animate js-select-trigger custom-select w-100">\ <option value="">Un-animated</option>\ <option value="fa-spin">Animated</option>\ </select>\ </div>\ </div>\ <div class="col-sm-3">\ <div class="form-group mr-2 mb-0">\ <select class="js-icon-rotate js-select-trigger custom-select w-100">\ <option value="">No rotation</option>\ <option value="fa-rotate-90">Rotate 90</option>\ <option value="fa-rotate-180">Rotate 180</option>\ <option value="fa-rotate-270">Rotate 270</option>\ <option value="fa-flip-horizontal">Flip horizontal</option>\ <option value="fa-flip-vertical">Flip vertical</option>\ </select>\ </div>\ </div>\ </div>\ </div>\ </div>\ <div class="width-5 js-move-trigger ml-2">\ <a href="#" class="h-100 w-100 d-flex align-items-center justify-content-center text-dark cursor-move bg-faded">\ <i class="fal fa-ellipsis-v fs-lg btn-m-s mb-2"></i>\ <i class="fal fa-ellipsis-v fs-lg btn-m-s mb-2"></i>\ <i class="fal fa-ellipsis-v fs-lg btn-m-s mb-2"></i>\ </a>\ </div>\ </div>\ </li>'); } $('#construct-wrap').append(formatedDOMElms.reverse().join(" ")); $('#icon-construct').append(formattedDOMIcon.join(" ")); $("select.js-icon-prefix").append(formatPrefix); $("select.js-icon-size").empty().append(formatIconSize.reverse()); $("select.js-icon-class").empty().append(format_ni_base.reverse()); $("select.js-icon-color").empty().append(formatTextColors); //pre-select $('[data-layer-target="0"] .js-icon-size').val('icon-stack-3x'); $('[data-layer-target="1"] .js-icon-size').val('icon-stack-2x'); $('[data-layer-target="0"] .js-icon-color').val('color-primary-500'); $('[data-layer-target="1"] .js-icon-color').val('color-primary-300'); //on prefix change update icon select $(document).on('change', '.js-icon-prefix', function() { var selectValue = $(this).val(); if (selectValue == 'fal' || selectValue == 'fas' || selectValue == 'far') { $(this).closest('[data-layer-target]').find('.js-icon-class').empty().append(format_fa_icon); } else if (selectValue == 'ni') { $(this).closest('[data-layer-target]').find('.js-icon-class').empty().append(format_ni_icon); } else if (selectValue == 'base') { $(this).closest('[data-layer-target]').find('.js-icon-class').empty().append(format_ni_base); } else if (selectValue == 'fab') { $(this).closest('[data-layer-target]').find('.js-icon-class').empty().append(format_fa_brand); } }) // runIconGenerator var runIconGenerator = function(id) { var uID = $('[data-layer-target="' + id + '"]'); var iconPrefix = uID.find('select.js-icon-prefix').val(); var iconClass = uID.find('select.js-icon-class').val(); var iconSize = uID.find('select.js-icon-size').val(); var iconOpacity = uID.find('input.js-icon-opacity').val(); var iconColor = uID.find('select.js-icon-color').val(); var iconAnimate = uID.find('select.js-icon-animate').val(); var iconRotate = uID.find('select.js-icon-rotate').val(); //console.log(iconAnimate) $('#icon-construct').find('[data-icon-select="' + id + '"]').removeClass().addClass(iconPrefix + " " + iconClass + " " + iconSize + " " + "opacity-" + iconOpacity + " " + iconColor + " " + iconAnimate + " " + iconRotate); uID.find('select.js-icon-color').removeClassPrefix('bg-').addClass('bg' + iconColor.slice(5)); }; //select trigger function $(document).on('change', '.js-select-trigger', function() { var uniqueID = $(this).closest('[data-layer-target]').attr('data-layer-target'); runIconGenerator(uniqueID); }) //sample $('[data-layer-target="0"] .js-icon-class').val('base-7').trigger('change'); $('[data-layer-target="1"] .js-icon-class').val('base-7').trigger('change'); $('[data-layer-target="2"] .js-icon-prefix').val('fal').trigger('change'); $('[data-layer-target="2"] .js-icon-class').val('fa-car').trigger('change'); var changeOrder = function (){ var bundleNewElms = []; $('#construct-wrap li').each(function() { $this = $(this) var uID = $this.attr('data-layer-target'); var iconPrefix = $this.find('select.js-icon-prefix').val(); var iconClass = $this.find('select.js-icon-class').val(); var iconSize = $this.find('select.js-icon-size').val(); var iconOpacity = $this.find('input.js-icon-opacity').val(); var iconColor = $this.find('select.js-icon-color').val(); var iconAnimate = $this.find('select.js-icon-animate').val(); var iconRotate = $this.find('select.js-icon-rotate').val(); bundleNewElms.push('<i data-icon-select="' + uID + '" class="'+ iconPrefix + " " + iconClass + " " + iconSize + " " + "opacity-" + iconOpacity + " " + iconColor + " " + iconAnimate + " " + iconRotate + '"></i>') }); //console.log(bundleNewElms); $('#icon-construct').empty().append(bundleNewElms.reverse().join(" ")); }; $('#construct-wrap').sortable({ handle: '.js-move-trigger', update: changeOrder }).disableSelection(); } else { console.log("somethign went wrong!") } }); var copyIcon = function (){ $('#js-icon-class').text("<div class='icon-stack'>\n"+ $('#icon-construct').html().replace(/data-icon-select="[^]"/g, ' ').replace(/\s\s+/g, ' ') +"\n</div>"); $('#js-icon-class').select(); document.execCommand('copy'); }; $('#js-select-layers').on('change', function() { var url = $(this).val(); // get selected value if (url) { // require a URL var params = new URLSearchParams(location.search); params.set('layers', url); window.location.search = params.toString(); } return false; }); $('#js-select-layers').val(layers); </script> }
the_stack
#r "nuget: MavenNet, 2.2.13" #r "nuget: Newtonsoft.Json, 13.0.1" #r "nuget: NuGet.Versioning, 5.11.0" // Usage: // dotnet tool install -g dotnet-script // dotnet script update-config.csx -- ../../config.json <update|bump> // This script compares the versions of Java packages we are currently binding to the // stable versions available in Google's Maven repository. The specified configuration // file can be automatically updated by including the "update" argument. A revision bump // can be applied to all packages with the "bump" argument, which is mutually exclusive // with "update". using MavenNet; using MavenNet.Models; using Newtonsoft.Json; using NuGet.Versioning; using System.ComponentModel; // Parse the configuration file var config_file = Args[0]; if (string.IsNullOrWhiteSpace (config_file) || !File.Exists (config_file)) { System.Console.WriteLine ($"Could not find configuration file: '{config_file}'"); return -1; } var config_json = File.ReadAllText (config_file); var config = JsonConvert.DeserializeObject<List<MyArray>> (config_json); var should_update = Args.Count > 1 && Args[1].ToLowerInvariant () == "update"; var should_minor_bump = Args.Count > 1 && Args[1].ToLowerInvariant () == "bump"; var serializer_settings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }; serializer_settings.Converters.Add (new Newtonsoft.Json.Converters.StringEnumConverter ()); // Keep file sorted by dependency only, then by groupid then by artifactid foreach (var array in config) array.Artifacts.Sort ((ArtifactModel a, ArtifactModel b) => string.Compare ($"{a.DependencyOnly}-{a.GroupId} {a.ArtifactId}", $"{b.DependencyOnly}-{b.GroupId} {b.ArtifactId}")); // Query Maven await MavenFactory.Initialize (config); Console.WriteLine ("| Package (* = Needs Update) | Currently Bound | Latest Stable |"); Console.WriteLine ("|--------------------------------------------------------------|-----------------|-----------------|"); // Find the Maven artifact for each package in our configuration file foreach (var art in config[0].Artifacts.Where (a => !a.DependencyOnly)) { var a = FindMavenArtifact (config, art); if (a is null) continue; var package_name = $"{art.GroupId}.{art.ArtifactId}"; var current_version = art.Version; if (NeedsUpdate (art, a)) { package_name = "* " + package_name; // Update the JSON objects if (should_update) { var new_version = GetLatestVersion (a)?.ToString (); var prefix = art.NugetVersion.StartsWith ("1" + art.Version + ".") ? "1" : string.Empty; art.Version = new_version; art.NugetVersion = prefix + new_version; } } // Bump the revision version of all NuGet versions // If there isn't currently a revision version, make it ".1" if (should_minor_bump) { string version = ""; string release = ""; int revision = 0; var str = art.NugetVersion; if (str.Contains ('-')) { release = str.Substring (str.IndexOf ('-')); str = str.Substring (0, str.LastIndexOf ('-')); } var period_count = str.Count (c => c == '.'); if (period_count == 2) { version = str; revision = 1; } else if (period_count == 3) { version = str.Substring (0, str.LastIndexOf ('.')); revision = int.Parse (str.Substring (str.LastIndexOf ('.') + 1)); revision++; } art.NugetVersion = $"{version}.{revision}{release}"; } Console.WriteLine ($"| {package_name.PadRight (60)} | {current_version.PadRight (15)} | {(GetLatestVersion (a)?.ToString () ?? string.Empty).PadRight (15)} |"); if (should_update || should_minor_bump) { // Write updated config.json back to disk var output = JsonConvert.SerializeObject (config, Formatting.Indented, serializer_settings); File.WriteAllText (config_file, output + Environment.NewLine); } } static Artifact FindMavenArtifact (List<MyArray> config, ArtifactModel artifact) { var repo = MavenFactory.GetMavenRepository (config, artifact); var group = repo.Groups.FirstOrDefault (g => artifact.GroupId == g.Id); return group?.Artifacts?.FirstOrDefault (a => artifact.ArtifactId == a.Id); } static bool NeedsUpdate (ArtifactModel model, Artifact artifact) { // Get latest stable version var latest = GetLatestVersion (artifact); // No stable version if (latest is null) return false; // Already on latest var current = GetVersion (model.Version); if (latest <= current) return false; return true; } public static SemanticVersion GetLatestVersion (Artifact artifact, bool includePrerelease = false) { var versions = artifact.Versions.Select(v => GetVersion (v)); if (!includePrerelease) versions = versions.Where (v => !v.IsPrerelease); if (!versions.Any ()) return null; return versions.Max (); } static SemanticVersion GetVersion (string s) { var hyphen = s.IndexOf ('-'); var version = hyphen >= 0 ? s.Substring (0, hyphen) : s; var tag = hyphen >= 0 ? s.Substring (hyphen) : string.Empty; // Stuff like: 1.1.1d-alpha-1 if (version.Any (c => char.IsLetter (c))) return new SemanticVersion (0, 0, 0); if (version.Count (c => c == '.') == 1) version += ".0"; // SemanticVersion can't handle more than 3 parts, like '0.11.91.1' if (version.Count (c => c == '.') > 2) return new SemanticVersion (0, 0, 0); return SemanticVersion.Parse (version + tag); } public static class MavenFactory { static readonly Dictionary<string, MavenRepository> repositories = new Dictionary<string, MavenRepository> (); public static async Task Initialize (List<MyArray> config) { var artifact_mavens = new List<(MavenRepository, ArtifactModel)> (); foreach (var artifact in config[0].Artifacts.Where (ma => !ma.DependencyOnly)) { var (type, location) = GetMavenInfoForArtifact (config, artifact); var repo = GetOrCreateRepository (type, location); artifact_mavens.Add ((repo, artifact)); } foreach (var maven_group in artifact_mavens.GroupBy (a => a.Item1)) { var maven = maven_group.Key; var artifacts = maven_group.Select (a => a.Item2); foreach (var artifact_group in artifacts.GroupBy (a => a.GroupId)) { var gid = artifact_group.Key; var artifact_ids = artifact_group.Select (a => a.ArtifactId).ToArray (); await maven.Populate (gid, artifact_ids); } } } public static MavenRepository GetMavenRepository (List<MyArray> config, ArtifactModel artifact) { var (type, location) = GetMavenInfoForArtifact (config, artifact); var repo = GetOrCreateRepository (type, location); return repo; } static (MavenRepoType type, string location) GetMavenInfoForArtifact (List<MyArray> config, ArtifactModel artifact) { var template = config[0].GetTemplateSet (artifact.TemplateSet); if (template.MavenRepositoryType.HasValue) return (template.MavenRepositoryType.Value, template.MavenRepositoryLocation); return (config[0].MavenRepositoryType, config[0].MavenRepositoryLocation); } static MavenRepository GetOrCreateRepository (MavenRepoType type, string location) { var key = $"{type}|{location}"; if (repositories.TryGetValue (key, out MavenRepository repository)) return repository; MavenRepository maven; if (type == MavenRepoType.Directory) maven = MavenRepository.FromDirectory (location); else if (type == MavenRepoType.Url) maven = MavenRepository.FromUrl (location); else if (type == MavenRepoType.MavenCentral) maven = MavenRepository.FromMavenCentral (); else maven = MavenRepository.FromGoogle (); repositories.Add (key, maven); return maven; } } // Configuration File Model public class Template { [JsonProperty ("templateFile")] public string TemplateFile { get; set; } [JsonProperty ("outputFileRule")] public string OutputFileRule { get; set; } } public class TemplateSetModel { [JsonProperty ("name")] public string Name { get; set; } [JsonProperty ("mavenRepositoryType")] public MavenRepoType? MavenRepositoryType { get; set; } [JsonProperty ("mavenRepositoryLocation")] public string MavenRepositoryLocation { get; set; } = null; [JsonProperty ("templates")] public List<Template> Templates { get; set; } = new List<Template> (); } public class ArtifactModel { [JsonProperty ("groupId")] public string GroupId { get; set; } [JsonProperty ("artifactId")] public string ArtifactId { get; set; } [JsonProperty ("version")] public string Version { get; set; } [JsonProperty ("nugetVersion")] public string NugetVersion { get; set; } [JsonProperty ("nugetId")] public string NugetId { get; set; } [DefaultValue ("")] [JsonProperty ("dependencyOnly")] public bool DependencyOnly { get; set; } [JsonProperty ("excludedRuntimeDependencies")] public string ExcludedRuntimeDependencies { get; set; } [JsonProperty ("templateSet")] public string TemplateSet { get; set; } [JsonProperty ("metadata")] public Dictionary<string, string> Metadata { get; set; } = new Dictionary<string, string> (); public bool ShouldSerializeMetadata () => Metadata.Any (); } public class MyArray { [JsonProperty ("mavenRepositoryType")] public MavenRepoType MavenRepositoryType { get; set; } [JsonProperty ("mavenRepositoryLocation")] public string MavenRepositoryLocation { get; set; } [JsonProperty ("slnFile")] public string SlnFile { get; set; } [JsonProperty ("strictRuntimeDependencies")] public bool StrictRuntimeDependencies { get; set; } [JsonProperty ("excludedRuntimeDependencies")] public string ExcludedRuntimeDependencies { get; set; } [JsonProperty ("additionalProjects")] public List<string> AdditionalProjects { get; set; } [JsonProperty ("templates")] public List<Template> Templates { get; set; } [JsonProperty ("artifacts")] public List<ArtifactModel> Artifacts { get; set; } [JsonProperty ("templateSets")] public List<TemplateSetModel> TemplateSets { get; set; } = new List<TemplateSetModel> (); public TemplateSetModel GetTemplateSet (string name) { // If an artifact doesn't specify a template set, first try using the original // single template list if it exists. If not, look for a template set called "default". if (string.IsNullOrEmpty (name)) { if (Templates.Any ()) return new TemplateSetModel { Templates = Templates }; name = "default"; } var set = TemplateSets.FirstOrDefault (s => s.Name == name); if (set == null) throw new ArgumentException ($"Could not find requested template set '{name}'"); return set; } } public class Root { [JsonProperty ("MyArray")] public List<MyArray> MyArray { get; set; } } public enum MavenRepoType { Url, Directory, Google, MavenCentral }
the_stack
 <!-- MAIN CONTENT --> <div id="content"> <!-- row --> <div class="row"> <!-- col --> <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4"> <h1 class="page-title txt-color-blueDark"> <!-- PAGE HEADER --> <i class="fa-fw fa fa-home"></i> Page Header <span> > Subtitle </span> </h1> </div> <!-- end col --> <!-- right side of the page with the sparkline graphs --> <!-- col --> <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8"> <!-- sparks --> <ul id="sparks"> <li class="sparks-info"> <h5> My Income <span class="txt-color-blue">$47,171</span></h5> <div class="sparkline txt-color-blue hidden-mobile hidden-md hidden-sm"> 1300, 1877, 2500, 2577, 2000, 2100, 3000, 2700, 3631, 2471, 2700, 3631, 2471 </div> </li> <li class="sparks-info"> <h5> Site Traffic <span class="txt-color-purple"><i class="fa fa-arrow-circle-up" data-rel="bootstrap-tooltip" title="Increased"></i>&nbsp;45%</span></h5> <div class="sparkline txt-color-purple hidden-mobile hidden-md hidden-sm"> 110,150,300,130,400,240,220,310,220,300, 270, 210 </div> </li> <li class="sparks-info"> <h5> Site Orders <span class="txt-color-greenDark"><i class="fa fa-shopping-cart"></i>&nbsp;2447</span></h5> <div class="sparkline txt-color-greenDark hidden-mobile hidden-md hidden-sm"> 110,150,300,130,400,240,220,310,220,300, 270, 210 </div> </li> </ul> <!-- end sparks --> </div> <!-- end col --> </div> <!-- end row --> <!-- The ID "widget-grid" will start to initialize all widgets below You do not need to use widgets if you dont want to. Simply remove the <section></section> and you can use wells or panels instead --> <!-- widget grid --> <section id="widget-grid" class=""> <div class="alert alert-warning"> <strong>Description:</strong> This is a jQuery UI plugin serves as the front end of a simple Comet chat server. It is a pure UI plugin so you can easily plug it into whatever communication protocol of your choice. This plugin is currently only available in the AJAX and HTML version of SmartAdmin. </div> <!-- row --> <div class="row"> <!-- NEW WIDGET START --> <article class="col-xs-12 col-sm-12 col-md-6 col-lg-6"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget well" id="wid-id-0"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-comments"></i> </span> <h2>Widget Title </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <!-- this is what the user will see --> <h5>Here are the few options you can customize for your chat box:</h5> <img src="/Content/img/demo/chat.png" alt="Chat" class="bordered img-responsive" style="margin-bottom:10px;"> <br> <div class="alert alert-info"> In the box below we will capture every chat window opened. Try to open the chat windows by clicking on the left chat users. You will notice all the chats being logged below. </div> <div id="chatlog" style="height: 300px; border:1px dashed #333; overflow-x: auto" class="padding-10 custom-scroll"> <p><i>&lt;- type in your chat window and see this chat log update</i></p> </div> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- WIDGET END --> <!-- NEW WIDGET START --> <article class="col-xs-12 col-sm-12 col-md-6 col-lg-6"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget well" id="wid-id-1"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-comments"></i> </span> <h2>Widget Title </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> <input class="form-control" type="text"> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <!-- this is what the user will see --> <h5>Here are the few options you can customize for your chat box:</h5> <div style="background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"> <pre style="margin: 0; line-height: 125%"> <span style="color: #000000">options</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #000000; font-weight: bold">{</span> <span style="color: #000000">id</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #204a87; font-weight: bold">null</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #8f5902; font-style: italic">//id for the DOM element</span> <span style="color: #000000">title</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #204a87; font-weight: bold">null</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #8f5902; font-style: italic">// title of the chatbox</span> <span style="color: #000000">user</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #204a87; font-weight: bold">null</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #8f5902; font-style: italic">// can be anything associated with this chatbox</span> <span style="color: #000000">hidden</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #204a87; font-weight: bold">false</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #8f5902; font-style: italic">// show or hide the chatbox</span> <span style="color: #000000">offset</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #0000cf; font-weight: bold">0</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #8f5902; font-style: italic">// relative to right edge of the browser window</span> <span style="color: #000000">width</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #0000cf; font-weight: bold">230</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #8f5902; font-style: italic">// width of the chatbox</span> <span style="color: #000000">messageSent</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #204a87; font-weight: bold">function</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #000000">id</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #000000">user</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #000000">msg</span><span style="color: #000000; font-weight: bold">){</span> <span style="color: #8f5902; font-style: italic">// override this</span> <span style="color: #204a87; font-weight: bold">this</span><span style="color: #000000; font-weight: bold">.</span><span style="color: #000000">boxManager</span><span style="color: #000000; font-weight: bold">.</span><span style="color: #000000">addMsg</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #000000">user</span><span style="color: #000000; font-weight: bold">.</span><span style="color: #000000">first_name</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #000000">msg</span><span style="color: #000000; font-weight: bold">);</span> <span style="color: #000000; font-weight: bold">},</span> <span style="color: #000000">boxClosed</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #204a87; font-weight: bold">function</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #000000">id</span><span style="color: #000000; font-weight: bold">)</span> <span style="color: #000000; font-weight: bold">{},</span> <span style="color: #8f5902; font-style: italic">// called when the close icon is clicked</span> <span style="color: #000000; font-weight: bold">...</span> <span style="color: #000000; font-weight: bold">}</span> </pre> </div> <br> <h5>To create a chatbox at the bottom of the browser window with an offset of 200px to the right edge, use the following code:</h5> <div style="background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"> <pre style="margin: 0; line-height: 125%"> <span style="color: #000000">$</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #204a87">document</span><span style="color: #000000; font-weight: bold">).</span><span style="color: #000000">ready</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #204a87; font-weight: bold">function</span><span style="color: #000000; font-weight: bold">(){</span> <span style="color: #8f5902; font-style: italic">// to create</span> <span style="color: #000000">$</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;#chat_div&quot;</span><span style="color: #000000; font-weight: bold">).</span><span style="color: #000000">chatbox</span><span style="color: #000000; font-weight: bold">({</span><span style="color: #000000">id</span> <span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #4e9a06">&quot;chat_div&quot;</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #000000">title</span> <span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #4e9a06">&quot;Title&quot;</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #000000">user</span> <span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #4e9a06">&quot;can be anything&quot;</span> <span style="color: #000000">offset</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #0000cf; font-weight: bold">200</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #000000">messageSent</span><span style="color: #ce5c00; font-weight: bold">:</span> <span style="color: #204a87; font-weight: bold">function</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #000000">id</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #000000">user</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #000000">msg</span><span style="color: #000000; font-weight: bold">){</span> <span style="color: #000000">alert</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;DOM &quot;</span> <span style="color: #ce5c00; font-weight: bold">+</span> <span style="color: #000000">id</span> <span style="color: #ce5c00; font-weight: bold">+</span> <span style="color: #4e9a06">&quot; just typed in &quot;</span> <span style="color: #ce5c00; font-weight: bold">+</span> <span style="color: #000000">msg</span><span style="color: #000000; font-weight: bold">);</span> <span style="color: #000000; font-weight: bold">}});</span> <span style="color: #8f5902; font-style: italic">// to insert a message</span> <span style="color: #000000">$</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;#chat_div&quot;</span><span style="color: #000000; font-weight: bold">).</span><span style="color: #000000">chatbox</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;option&quot;</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #4e9a06">&quot;boxManager&quot;</span><span style="color: #000000; font-weight: bold">).</span><span style="color: #000000">addMsg</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;Mr. Foo&quot;</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #4e9a06">&quot;Barrr!&quot;</span><span style="color: #000000; font-weight: bold">);</span> <span style="color: #000000; font-weight: bold">});</span> </pre> </div> <br> <h5>Use the following standard jQuery UI approach to access the options after the chat box is created:</h5> <div style="background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"> <pre style="margin: 0; line-height: 125%"> <span style="color: #000000; font-weight: bold">...</span> <span style="color: #8f5902; font-style: italic">// getter</span> <span style="color: #204a87; font-weight: bold">var</span> <span style="color: #000000">offset</span> <span style="color: #ce5c00; font-weight: bold">=</span> <span style="color: #000000">$</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;#chat_div&quot;</span><span style="color: #000000; font-weight: bold">).</span><span style="color: #000000">chatbox</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;option&quot;</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #4e9a06">&quot;offset&quot;</span><span style="color: #000000; font-weight: bold">);</span> <span style="color: #8f5902; font-style: italic">// setter, to change the possition of the chatbox</span> <span style="color: #000000">$</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;#chat_div&quot;</span><span style="color: #000000; font-weight: bold">).</span><span style="color: #000000">chatbox</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #4e9a06">&quot;option&quot;</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #4e9a06">&quot;offset&quot;</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #0000cf; font-weight: bold">300</span><span style="color: #000000; font-weight: bold">);</span> </pre> </div> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- WIDGET END --> </div> <!-- end row --> <!-- row --> <div class="row"> <!-- a blank row to get started --> <div class="col-sm-12"> <!-- your contents here --> </div> </div> <!-- end row --> </section> <!-- end widget grid --> </div> <!-- END MAIN CONTENT -->
the_stack
@model Sheng.WeixinConstruction.Client.Shell.Models.PictureVoteViewModel @{ ViewBag.SubTitle = "活动"; Layout = "~/Views/Shared/_LayoutBlank.cshtml"; } <style type="text/css"> body { margin-bottom: 0.55rem; } .campaignName { font-size: 0.14rem; font-weight: bold; } .campaignDescription { font-size: 0.13rem; color: #666; } #divMemberInfo { font-size: 0.14rem; line-height: 0.14rem; text-align: center; margin-top: 0.05rem; } .divPictureVoteItemImage { height: 1.3rem; width: 100%; border: 1px solid #CCC; display: table; text-align: center; } .divPictureVoteItemImageContent { vertical-align: middle; display: table-cell; } .imgPictureVoteItem { max-height: 1.24rem; max-width: 100%; vertical-align: middle; } .divPictureVoteItemTitle { font-weight: bold; font-size: 0.14rem; padding-top: 0.02rem; padding-right: 0.03rem; padding-bottom: 0.02rem; padding-left: 0.03rem; } .divPictureVoteItemDescription { font-size: 0.13rem; padding-top: 0.02rem; padding-right: 0.03rem; padding-bottom: 0.02rem; padding-left: 0.03rem; color: #808080; } .divPictureVoteItemMember { font-size: 0.13rem; padding-top: 0.02rem; padding-right: 0.03rem; padding-bottom: 0.02rem; padding-left: 0.03rem; margin-top: 0.04rem; } .divPictureVoteItemVoteQuantity { padding-top: 0rem; padding-right: 0.03rem; padding-bottom: 0rem; padding-left: 0.03rem; margin-top: 0.01rem; font-size: 0.13rem; margin-top: 0.04rem; } #divShareMask { position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; width: 100%; height: 100%; background-color: black; text-align: right; filter: alpha(opacity=80); -moz-opacity: 0.8; -khtml-opacity: 0.8; opacity: 0.8; } #divFooter { position: fixed; bottom: 0px; left: 0px; right: 0px; height: 0.4rem; font-size: 0.14rem; text-align: center; background-color: #F5F5F5; } </style> <script> //当前页 var _orderBy = "UploadTime"; var _currentPage = 1; var _totalPage = 1; var _status = @((int)Model.CampaignBundle.Campaign.Status); var _allowedNewItem = @(Model.CampaignBundle.PictureVote.AllowedNewItem.ToString().ToLower()); var _fullParticipant = @(Model.FullParticipant.ToString().ToLower()); var _campaignId= getQueryString("campaignId"); $(document).ready(function () { $(document).scroll(function () { $("#divShareMask").css("top", document.body.scrollTop); }); var jsApiConfigStr = "@Newtonsoft.Json.JsonConvert.SerializeObject(Model.JsApiConfig)"; jsApiConfigStr = jsApiConfigStr.replace(new RegExp("&quot;", "gm"), "\""); jsApiConfigStr = jsApiConfigStr.replace(new RegExp("\r\n", "gm"), ""); jsApiConfigStr = jsApiConfigStr.replace(new RegExp("\n", "gm"), ""); var jsApiConfig = eval('(' + jsApiConfigStr + ')'); wx.config(jsApiConfig); loadData(); }); wx.ready(function () { wx.onMenuShareTimeline({ title: '@Model.CampaignBundle.Campaign.ShareTimelineTitle', // 分享标题 link: '@Request.Url.ToString()', // 分享链接 imgUrl: '@Model.CampaignBundle.Campaign.ShareImageUrl', // 分享图标 success: function () { shareSuccess("PictureVoteShareTimeline"); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); wx.onMenuShareAppMessage({ title: '@Model.CampaignBundle.Campaign.ShareAppMessageTitle', // 分享标题 desc: '@Model.CampaignBundle.Campaign.ShareAppMessageDescription', // 分享描述 link: '@Request.Url.ToString()', // 分享链接 imgUrl: '@Model.CampaignBundle.Campaign.ShareImageUrl', // 分享图标 type: 'link', // 分享类型,music、video或link,不填默认为link dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空 success: function () { shareSuccess("PictureVoteShareAppMessage"); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); }); wx.error(function (res) { alert("error:" + res); }); function shareSuccess(type) { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/Campaign/" + type + "/@ViewBag.Domain.Id?campaignId=" + _campaignId, type: "POST", dataType: "json", success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; if (resultObj.Point == 0 && resultObj.Vote == 0) return; var msg = ""; if (resultObj.Point > 0) { msg += "获得积分:" + resultObj.Point; } if (resultObj.Vote > 0) { if (msg != "") { msg += "<br/>"; } msg += "您参与的内容获得系统为您投票:" + resultObj.Vote + " 票/每项"; } if (msg != "") { layerAlertBtn(msg); } } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function loadDataByTime(){ $("#divOrderByTime").attr("class","divRectangle"); $("#divOrderByVoteCount").attr("class","divRectangle_Gray"); _orderBy = "UploadTime"; loadData(); } function loadDataByVoteQuantity(){ $("#divOrderByTime").attr("class","divRectangle_Gray"); $("#divOrderByVoteCount").attr("class","divRectangle"); _orderBy = "VoteQuantity"; loadData(); } function loadData(targetPage) { if (targetPage > _totalPage) return; var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); var args = new Object(); args.Page = targetPage || 1; args.PageSize = 10; args.OrderBy = _orderBy; if(_status==2) { args.OrderBy = "VoteQuantity"; } $.ajax({ url: "/Api/Campaign/GetPictureVoteItemList/@ViewBag.Domain.Id?campaignId=" + _campaignId, type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; _currentPage = resultObj.Page; _totalPage = resultObj.TotalPage; if (_currentPage >= _totalPage) { $("#divPagingContainer").html("没有更多了"); } if(_currentPage==1) { document.getElementById('pictureVoteItemContainer').innerHTML = ""; } if(_status == 2) { var gettpl = document.getElementById('endPictureVoteItemListTemplate').innerHTML; laytpl(gettpl).render(resultObj.ItemList, function (html) { document.getElementById('pictureVoteItemContainer').innerHTML += html; }); }else { var gettpl = document.getElementById('pictureVoteItemListTemplate').innerHTML; laytpl(gettpl).render(resultObj.ItemList, function (html) { document.getElementById('pictureVoteItemContainer').innerHTML += html; }); } } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function searchBySerialNumber() { var serialNumber = $("#txtSerialNumber").val(); if (serialNumber == "") return; var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/Campaign/GetPictureVoteItemIdBySerialNumber/@ViewBag.Domain.Id?serialNumber=" + serialNumber, type: "POST", dataType: "json", success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { showItemDetail(data.Data); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function showItemDetail(itemId) { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/Campaign/GetPictureVoteItem/@ViewBag.Domain.Id?itemId=" + itemId, type: "POST", dataType: "json", success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; //alert(JSON.stringify(resultObj)); var gettpl = document.getElementById('itemDetailTemplate').innerHTML; laytpl(gettpl).render(resultObj, function (html) { var pageii = layer.open({ type: 1, content: html, shadeClose: false, style: 'position:fixed; left:0.1rem; top:0.1rem;right:0.1rem; bottom:0.1rem; border:none;' }); }); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function showCampaignDescription() { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/Campaign/GetCampaignDescription/@ViewBag.Domain.Id?id=" + _campaignId, type: "POST", dataType: "json", success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; var gettpl = document.getElementById('campaignDescription').innerHTML; laytpl(gettpl).render(resultObj, function (html) { var pageii = layer.open({ type: 1, content: html, shadeClose: false, style: 'position:fixed; left:0.1rem; top:0.1rem;right:0.1rem; bottom:0.1rem; border:none;' }); }); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function upload() { if(_status == 2){ layerAlert("本活动已经结束。"); return; } if(_allowedNewItem == false){ layerAlert("参与通道已关闭。"); return; } if(_fullParticipant){ layerAlert("该活动已达最大允许参与人数。"); return; } @if (Model.Attention == false) { <text> layerAlertBtn("请先关注我们才可以参与哦~", function () { window.location.href = '/Home/CampaignGuideSubscribe/@ViewBag.Domain.Id?campaignId=' + _campaignId; }); </text> } else { <text> window.location.href = "/Campaign/PictureVoteUpload/@ViewBag.Domain.Id?campaignId=" + _campaignId; </text> } } function detail(){ @if (Model.PictureVoteItem != null) { <text> window.location.href = "/Campaign/PictureVoteItemDetail/@ViewBag.Domain.Id?campaignId=" + _campaignId + "&itemId=@Model.PictureVoteItem.Id"; </text> } } function vote(itemId) { var confirmIndex = layer.open({ content: '确认为Ta投上一票吗?', btn: ['确认', '取消'], shadeClose: true, yes: function () { layer.close(confirmIndex); var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/Campaign/PictureVote/@ViewBag.Domain.Id?campaignId=" + _campaignId + "&itemId=" + itemId, type: "POST", dataType: "json", success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var msg = ""; switch (data.Data) { case 0: msg = "投票成功!"; var oldQuantity = parseInt($(".quantity" + itemId).html()); $(".quantity" + itemId).html(oldQuantity + 1); break; case 1: msg = "投票失败。"; break; case 2: msg = "该活动已经结束了。"; break; case 3: msg = "该活动还没开始。"; break; case 4: msg = "您已经为Ta投过票啦~"; break; case 5: msg = "您手中已没有更多的选票了~"; break; case 6: msg = "请先关注我们才可以投票~"; break; case 7: msg = "该项目已被锁定。"; break; case 8: msg = "今天您手中已没有更多的选票了,请明天再来~"; break; case 9: msg = "今天您已经为Ta投过票啦,请明天再来~"; break; default: msg = "未知错误"; break; } if (data.Data == 6) { layerAlertBtn(msg, function () { window.location.href = '/Home/CampaignGuideSubscribe/@ViewBag.Domain.Id?campaignId=' + _campaignId; }); } else { layerAlert(msg); } } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } }); } function showLockMessage() { layerAlert("该项目已被锁定。"); } function showShareMask() { $("#divShareMask").css("top", document.body.scrollTop); $("#divShareMask").show(); $("#divFooter").hide(); } function hideShareMask() { $("#divShareMask").hide(); $("#divFooter").show(); } </script> <script id="pictureVoteItemListTemplate" type="text/html"> {{# for(var i = 0, len = d.length; i < len; i=i+2){ }} <div class="divDotLine" style="margin-top: 0.05rem; margin-bottom: 0.1rem;"> </div> <div> <div style="float: left; width: 50%;"> <div style="margin-left: 0px; margin-right: 0.03rem;"> <div class="divPictureVoteItemImage" onclick="showItemDetail('{{ d[i].Id }}')"> <div class="divPictureVoteItemImageContent"> <img src="{{ d[i].Url }}" class="imgPictureVoteItem"> </div> </div> <div style="margin-top: 0.05rem;"> <div class="divPictureVoteItemTitle">{{ d[i].Title }}</div> <div class="divPictureVoteItemMember">{{ d[i].MemberNickName }}</div> <div class="divPictureVoteItemMember">编号:{{ d[i].SerialNumber }}</div> <div class="divPictureVoteItemVoteQuantity">当前票数:<span class="font_red_b quantity{{ d[i].Id }}">{{ d[i].VoteQuantity }}</span></div> {{# if(d[i].Lock == true){ }} <div class="divRectangle_Gray" style="margin-top:0.1rem;" onclick="showLockMessage()"> 锁定 </div> {{# }else{ }} <div class="divRectangle" style="margin-top:0.1rem;" onclick="vote('{{ d[i].Id }}')"> 投Ta一票 </div> {{# } }} </div> </div> </div> {{# if(d[i+1] != undefined){ }} <div style="float: left; width: 50%;"> <div style="margin-left: 0.03rem; margin-right: 0px;"> <div class="divPictureVoteItemImage" onclick="showItemDetail('{{ d[i+1].Id }}')"> <div class="divPictureVoteItemImageContent"> <img src="{{ d[i+1].Url }}" class="imgPictureVoteItem"> </div> </div> <div style="margin-top: 0.05rem;"> <div class="divPictureVoteItemTitle">{{ d[i+1].Title }}</div> <div class="divPictureVoteItemMember">{{ d[i+1].MemberNickName }}</div> <div class="divPictureVoteItemMember">编号:{{ d[i+1].SerialNumber }}</div> <div class="divPictureVoteItemVoteQuantity">当前票数:<span class="font_red_b quantity{{ d[i+1].Id }}">{{ d[i+1].VoteQuantity }}</span></div> {{# if(d[i+1].Lock == true){ }} <div class="divRectangle_Gray" style="margin-top:0.1rem;" onclick="showLockMessage()"> 锁定 </div> {{# }else{ }} <div class="divRectangle" style="margin-top:0.1rem;" onclick="vote('{{ d[i+1].Id }}')"> 投Ta一票 </div> {{# } }} </div> </div> </div> {{# } }} <div style="clear: both"></div> </div> {{# } }} </script> <script id="endPictureVoteItemListTemplate" type="text/html"> {{# for(var i = 0, len = d.length; i < len; i=i+2){ }} <div class="divDotLine" style="margin-top: 0.05rem; margin-bottom: 0.1rem;"> </div> <div> <div style="float: left; width: 50%;"> <div style="margin-left: 0px; margin-right: 0.03rem;"> <div> [ 第 {{# var ranking = i+1 + (_currentPage-1) * 10 }}{{ranking}} 名 ] </div> <div class="divPictureVoteItemImage" onclick="showItemDetail('{{ d[i].Id }}')"> <div class="divPictureVoteItemImageContent"> <img src="{{ d[i].Url }}" class="imgPictureVoteItem"> </div> </div> <div style="margin-top: 0.05rem;"> <div class="divPictureVoteItemTitle">{{ d[i].Title }}</div> <div class="divPictureVoteItemMember">{{ d[i].MemberNickName }}</div> <div class="divPictureVoteItemMember">编号:{{ d[i].SerialNumber }}</div> <div class="divPictureVoteItemVoteQuantity">票数:<span class="font_red_b quantity{{ d[i].Id }}">{{ d[i].VoteQuantity }}</span></div> </div> </div> </div> {{# if(d[i+1] != undefined){ }} <div style="float: left; width: 50%;"> <div style="margin-left: 0.03rem; margin-right: 0px;"> <div> [ 第 {{# var ranking = i+2 + (_currentPage-1) * 10 }}{{ranking}} 名 ] </div> <div class="divPictureVoteItemImage" onclick="showItemDetail('{{ d[i+1].Id }}')"> <div class="divPictureVoteItemImageContent"> <img src="{{ d[i+1].Url }}" class="imgPictureVoteItem"> </div> </div> <div style="margin-top: 0.05rem;"> <div class="divPictureVoteItemTitle">{{ d[i+1].Title }}</div> <div class="divPictureVoteItemMember">{{ d[i+1].MemberNickName }}</div> <div class="divPictureVoteItemMember">编号:{{ d[i+1].SerialNumber }}</div> <div class="divPictureVoteItemVoteQuantity">票数:<span class="font_red_b quantity{{ d[i+1].Id }}">{{ d[i+1].VoteQuantity }}</span></div> </div> </div> </div> {{# } }} <div style="clear: both"></div> </div> {{# } }} </script> <script type="text/html" id="campaignDescription"> <div style="position: fixed; top: 0.1rem; left: 0.1rem; right: 0.1rem; bottom: 0.45rem; overflow: auto;"> {{ d }} </div> <div style="position: fixed; bottom: 0.1rem; left: 0.1rem; right: 0.1rem;"> <div class="divRectangle_Gray" style="margin-top: 0.1rem; " onclick="layer.closeAll()"> 关 闭 </div> </div> </script> <script type="text/html" id="itemDetailTemplate"> <div style="position: fixed; top: 0.1rem; left: 0.1rem; right: 0.1rem; bottom: 0.9rem; overflow: auto"> <div> <img src="{{ d.Url }}" style="width: 100%"> </div> <div class="divPictureVoteItemTitle" style="margin-top: 0.1rem;">{{ d.Title }}</div> <div class="divPictureVoteItemMember" style="margin-top: 0.1rem;">上传者:{{ d.MemberEntity.NickName }}</div> <div class="divPictureVoteItemMember" style="margin-top: 0.1rem;">编号:{{ d.SerialNumber }}</div> <div class="divPictureVoteItemVoteQuantity">当前票数:<span class="font_red_b quantity{{ d.Id }}">{{ d.VoteQuantity }}</span></div> <div class="divPictureVoteItemDescription" style="margin-top: 0.1rem;"> {{ d.Description }} </div> </div> <div style="position: fixed; bottom: 0.1rem; left: 0.1rem; right: 0.1rem;"> {{# if(_status == 1){ }} {{# if(d.Lock == true){ }} <div class="divRectangle_Gray" style="margin-top: 0.1rem;" onclick="showLockMessage()"> 锁定 </div> {{# }else{ }} <div class="divRectangle" style="margin-top: 0.1rem;" onclick="vote('{{ d.Id }}')"> 投Ta一票 </div> {{# } }} {{# } }} <div class="divRectangle_Gray" style="margin-top: 0.1rem; " onclick="layer.closeAll()"> 再看看 </div> </div> </script> <div id="divImageContainer"> <img src="@Model.CampaignBundle.Campaign.ImageUrl" name="img" id="img" style="width: 100%;"> </div> <div class="divContent"> <div style="margin-top: 0.06rem" class="campaignName"> @Model.CampaignBundle.Campaign.Name </div> <div style="margin-top: 0.06rem" class="campaignDescription"> @Html.Raw(Model.CampaignBundle.Campaign.Introduction) </div> @*<div style="text-align: center"> <div class="divVoteButton" style="margin-top: 0.1rem;" onclick="showCampaignDescription()"> 查看活动详情/兑奖说明 </div> </div>*@ @if (Model.PictureVoteItem != null && Model.PictureVoteItem.ApproveStatus == Sheng.WeixinConstruction.Infrastructure.EnumCampaignPictureVoteItemApproveStatus.Rejected) { <div style="margin-top:0.15rem;padding-left:0.1rem;padding-right:0.1rem; padding-top:0.1rem;padding-bottom:0.1rem; background-color:#FFF2E6;border: 1px solid #FF9673;"> 您上传的照片被拒绝,请点击右下角“查看我的”,删除并重新上传。 <br />原因:@Model.PictureVoteItem.RejectedMessage </div> } <div class="divDotLine" style="margin-top: 0.1rem; margin-bottom: 0.1rem;"> </div> <div style="text-align: center; margin-top: 0.1rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="33%" align="center"> 参与人数<br /> <span class="defaultColor" style="font-weight:bold">@Model.DataReport.ApprovedItemsCount</span> </td> <td width="33%" align="center"> 总投票数<br /> <span class="defaultColor" style="font-weight:bold">@Model.DataReport.VoteQuantityCount</span> </td> <td width="33%" align="center"> 围观次数<br /> <span class="defaultColor" style="font-weight:bold">@Model.DataReport.PageVisitCount</span> </td> </tr> </table> </div> <div class="divDotLine" style="margin-top: 0.05rem; margin-bottom: 0.1rem;"> </div> <div id="divMemberInfo" onclick="showShareMask()"> <table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="left" style="width: 0.3rem"> <img src="/Content/Images/shareTimeLine.jpg" style="width: 0.2rem;"> </td> <td> <div>点击这里分享本页试一试~</div> </td> </tr> </table> </div> <div class="divDotLine" style="margin-top: 0.05rem; margin-bottom: 0.1rem;"> </div> <div> <table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="left" style="width: 0.5rem">编号:</td> <td> <input id="txtSerialNumber" name="txtSerialNumber" type="text" class="input_16" style="width: 95%" /> </td> <td style="width: 0.7rem"> <input name="" type="button" class="button" value="查看" style="width:90%" onclick="searchBySerialNumber()"> </td> </tr> </table> </div> @if (Model.CampaignBundle.Campaign.Status == Sheng.WeixinConstruction.Infrastructure.EnumCampaignStatus.Ongoing) { <div style="margin-top: 0.15rem; font-size: 0.14rem; text-align: center;"> <table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> <div id="divOrderByTime" class="divRectangle" onclick="loadDataByTime()"> 时间排序 </div> </td> <td style="width: 0.1rem;">&nbsp;</td> <td> <div id="divOrderByVoteCount" class="divRectangle_Gray" onclick="loadDataByVoteQuantity()"> 名次排序 </div> </td> </tr> </table> </div> } <div id="divShareMask" style="display: none" onclick="hideShareMask()"> <img src="/Content/Images/share.PNG" width="200" height="145"> </div> <div id="pictureVoteItemContainer" style="margin-top: 0.06rem"> </div> <div id="divPagingContainer" class="divPagingContainer" style="margin-top: 0.2rem; text-align: center" onclick="loadData(_currentPage+1)"> 查看更多 </div> </div> <div id="divFooter"> <table align="center" border="0" style="height:100%;width:100%"> <tr> <td valign="middle" align="center" width="50%"> <input name="" type="button" class="button" value="活动说明" style="width:90%" onclick="showCampaignDescription()"> </td> <td valign="middle" align="center" width="50%"> @if (Model.CampaignBundle.Campaign.Status == Sheng.WeixinConstruction.Infrastructure.EnumCampaignStatus.Ongoing) { if (Model.PictureVoteItem == null) { <input name="" type="button" class="button" value="我要参与" style="width:90%" onclick="upload()"> } else { <input name="" type="button" class="button" value="查看我的" style="width:90%" onclick="detail()"> } } </td> </tr> </table> </div>
the_stack
using System; using System.Collections.Generic; using System.IO; using System.Linq; public class VisualStudio { public const string DotNetRelease = "5.0"; public const string DotNetRuntime = "Microsoft.WindowsDesktop.App"; public bool IsReady { get { return !(string.IsNullOrEmpty(PathToVS) || string.IsNullOrEmpty(PathToMSBuild)); } } public string PathToVS { get; private set; } public string PathToMSBuild { get; private set; } public bool LogToFile { get; set; } public VisualStudio() { // Check VS and Win SDK if( !_FindVSInstance() || string.IsNullOrEmpty( GetPathToUCRT() ) || string.IsNullOrEmpty( GetPathToWindowsSDK() ) ) { // VS or SDK missing PathToVS = ""; PathToMSBuild = ""; } } //-------------------------------------------------------------------------------------------------- public bool Clean(string pathToSolution, string projectName, string configuration, string platform) { Printer.Success($"\nCleaning configuration {configuration}..."); var target = "Clean"; if (!string.IsNullOrEmpty(projectName)) target = projectName.Replace(".", "_") + ":Clean"; var commandLine = $"\"{pathToSolution}\" /t:{target} /p:Configuration={configuration} /p:Platform=\"{platform}\" /m /nologo /v:minimal /ds"; if (Common.Run(PathToMSBuild, commandLine) != 0) { Printer.Error("Cleaning failed."); return false; } return true; } //-------------------------------------------------------------------------------------------------- public bool Build(string pathToSolution, string projectName, string configuration, string platform) { Printer.Success($"\nBuilding configuration {configuration}..."); //Environment.SetEnvironmentVariable("MSBuildEmitSolution", "1"); string target = string.IsNullOrEmpty(projectName) ? "Build" : projectName.Replace(".", "_"); var commandLine = $"\"{pathToSolution}\" /t:{target} /p:Configuration={configuration} /p:Platform=\"{platform}\" /m /nologo /ds /verbosity:minimal /clp:Summary;EnableMPLogging"; if(LogToFile) { commandLine += $" /fl /flp:logfile=\"{Path.ChangeExtension(pathToSolution, ".MSBuild.log")}\";verbosity=Detailed"; // Detailed, Diagnostic } commandLine += " /nr:false"; // Disable node reuse to prevent locking of MSBuilExtension.dll if (Common.Run(PathToMSBuild, commandLine) != 0) { Printer.Error("Build failed."); return false; } return true; } //-------------------------------------------------------------------------------------------------- public string GetPathToMSVC() { if (!IsReady) return null; var vcVersionPath = Path.Combine(PathToVS, @"VC\Auxiliary\Build", "Microsoft.VCToolsVersion.default.txt"); if (!File.Exists(vcVersionPath)) { Printer.Error("Path to Visual C++ version file not found."); } var vsVersion = File.ReadLines(vcVersionPath).First().Trim(); return Path.Combine(PathToVS, @"VC\Tools\MSVC", vsVersion); } //-------------------------------------------------------------------------------------------------- public string GetPathToVcRedist() { if (!IsReady) return null; var vcVersionPath = Path.Combine(PathToVS, @"VC\Auxiliary\Build", "Microsoft.VCRedistVersion.default.txt"); if (!File.Exists(vcVersionPath)) { Printer.Error("Path to Visual C++ version file not found."); } var vsVersion = File.ReadLines(vcVersionPath).First().Trim(); return Path.Combine(PathToVS, @"VC\Redist\MSVC", vsVersion); } //-------------------------------------------------------------------------------------------------- public int[] GetVersionOfVcRedist() { if (!IsReady) return null; var vcVersionPath = Path.Combine(PathToVS, @"VC\Auxiliary\Build", "Microsoft.VCRedistVersion.default.txt"); if (!File.Exists(vcVersionPath)) { Printer.Error("Path to Visual C++ version file not found."); } var vsVersion = File.ReadLines(vcVersionPath).First().Trim(); return vsVersion.Split('.').Select(s => Int32.Parse(s)).ToArray(); } //-------------------------------------------------------------------------------------------------- public string GetPathToUCRT() { var pathToWinSDK = GetPathToWindowsSDK(); if (string.IsNullOrEmpty( pathToWinSDK )) return null; var pathToUCRT = Path.Combine(pathToWinSDK, "ucrt"); if (!File.Exists(Path.Combine(pathToUCRT, "stddef.h"))) { Printer.Error("Path to Universal C Runtime (UCRT) not found."); return null; } return pathToUCRT; } //-------------------------------------------------------------------------------------------------- public static string GetPathToWindowsSDK() { var pathToWinSdk = Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0", "InstallationFolder", "") as string; if(string.IsNullOrEmpty(pathToWinSdk)) { Printer.Error("No installed Windows SDK 10 found."); return null; } var pathToWinSdkInclude = Path.Combine(pathToWinSdk, "Include"); string maxVersion = ""; foreach (var version in Directory.EnumerateDirectories(pathToWinSdkInclude)) { if (string.Compare(version, maxVersion, false) > 0) maxVersion = version; } if (string.IsNullOrEmpty(maxVersion)) { Printer.Error("Path to Windows Kits 10 not found."); return null; } string pathToLastWinSdkInclude = Path.Combine(pathToWinSdkInclude, maxVersion); if (!File.Exists(Path.Combine(pathToLastWinSdkInclude, @"um\windows.h"))) { Printer.Error("Path to Windows Kits 10 not found."); return null; } return pathToLastWinSdkInclude; } //-------------------------------------------------------------------------------------------------- public static string GetLatestDotNetVersion() { List<string> dotNetOutput = new(); if (Common.Run("dotnet.exe", "--list-runtimes", null, dotNetOutput ) != 0) { Printer.Error("Calling dotnet.exe failed."); return null; } string highestVersion = ""; foreach(var line in dotNetOutput) { if(line==null || !line.StartsWith(DotNetRuntime)) continue; var rtInfo = line.Split(' '); if(!rtInfo[1].StartsWith(DotNetRelease)) continue; highestVersion = rtInfo[1]; } if(!string.IsNullOrEmpty(highestVersion)) { return highestVersion; } Printer.Error($"No release of .NET {DotNetRuntime} {DotNetRelease} found."); return null; } //-------------------------------------------------------------------------------------------------- #region Finding Visual Studio static readonly List<string> _RequiredComponents = new List<string>(); //-------------------------------------------------------------------------------------------------- bool _FindVSInstance() { if(_RequiredComponents.Count==0) { if(!_ReadVSConfig()) return false; } var exePath = @"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"; var commandLine = "-prerelease -version 16.0 -latest -property installationPath -requires " + string.Join(" ", _RequiredComponents); var vswhereOutput = new List<string>(); if (Common.Run(exePath, commandLine, output: vswhereOutput) != 0) { Console.WriteLine("The VisualStudio Setup API is not available. Assuming no instances are installed."); return false; } if(vswhereOutput.Count>0 && !string.IsNullOrEmpty(vswhereOutput[0])) { PathToVS = vswhereOutput[0]; PathToMSBuild = Path.Combine(PathToVS, @"MSBuild\Current\Bin\MSBuild.exe"); if (!File.Exists(PathToMSBuild)) { Printer.Error($"MSBuild.exe not found in path {PathToMSBuild}."); return false; } Printer.Success($"Found VS in path {PathToVS}"); return true; } Printer.Error("Required installation of VisualStudio 2019 not found."); Printer.Line("Please ensure that the following components are installed:"); foreach (var component in _RequiredComponents) { Printer.Line(" " + component); } return false; } //-------------------------------------------------------------------------------------------------- bool _ReadVSConfig() { var pathToVsConfig = Path.Combine(Common.GetRootFolder(), ".vsconfig"); if(!File.Exists(pathToVsConfig)) { Printer.Error("VSConfig file not found. The repository seems top be corrupted."); return false; } var lines = File.ReadAllLines(pathToVsConfig); // find start int li = 0; char[] charsToTrim = { '"', ' ', '\t', ','}; while(li < lines.Length) { if(lines[li].Contains("\"components\": [")) { li++; while(li < lines.Length && !lines[li].Contains("]")) { _RequiredComponents.Add( lines[li].Trim(charsToTrim) ); li++; } } li++; } if(_RequiredComponents.Count == 0) { Printer.Error("VSConfig file could not be read."); return false; } return true; } #endregion }
the_stack
@model System.Collections.Generic.IEnumerable<Kooboo.CMS.Content.Services.CategoryContents> @{ var textFolder = new Kooboo.CMS.Content.Models.TextFolder(); if (Model.Count() > 0) { foreach (var item in Model) { @(Html.Partial("~/Areas/Contents/Views/TextContent/EditorTemplates/Category.cshtml", item, new ViewDataDictionary())) } } } @*<script type="text/javascript"> $(function () { var mapCacheKey = 'category_selected_cache' + Math.random(); var map = {}; //kooboo.data(mapCacheKey, map = {}); function initMapData(currentHandle) { var $parentTd = currentHandle.parents('td:eq(0)'), $display = $parentTd.find('[name$="_display"]'), $value = $parentTd.find('[name$="_value"]'), isSingle = $parentTd.find('[name$="_single_choice"]').val(), rootFolder = $.request(currentHandle.attr('href')).queryString["folderName"]; if (!map[rootFolder]) { map[rootFolder] = []; } if ($value.val()) { var selected = $value.val().split(','); var displays = $display.val().split(','); selected.each(function (folderAndValue, index) { var displayArr = displays[index].split(':'); var valArr = folderAndValue.split(':'); var currentFolder = valArr[1] || rootFolder; var val = valArr[0]; var query = map[rootFolder].where(function (o, i) { return o.key == val; }); if (query.length == 0) { map[rootFolder].push({ key: val, text: displayArr[0], currentFolder: currentFolder, folderText: displayArr[1] || currentFolder, selected: true }); } }); } } function toggleBackLink($table, rootFolder, currentFolder, prevLink) { var str = '<tbody class="back-to-parent">\ <tr class="folderTr initialized" style="cursor: pointer;">\ <td>\ </td>\ <td>\ <a class="f-icon folder" href="'+ prevLink + '">...</a>\ </td>\ <td colspan="2">\ </td> \ </tr>\ </tbody>'; if ($table.find('tbody.back-to-parent').length == 0 && (rootFolder != currentFolder || !rootFolder)) { $(str).prependTo($table); } } $('.categoryButton').each(function () { var link = $(this); var rootFolder = $.request(link.attr('href')).queryString["folderName"]; initMapData(link); initDisplayAndValueInput(link); var id = new Date().getTime() , destroyMethod = function () { } , counter = 0 , _serializeJSON , _prevLink; link.pop({ id: id, onclose: function () { counter = 0; var serialized = $.parseJSON(_serializeJSON); map[rootFolder].each(function (o) { var old = serialized.where(function (s) { return o.key == s.key; })[0]; if (old) { o.selected = old.selected; } else { o.selected = false; } }); setTimeout(function () { destroyMethod(); if ($.popContext.getCurrent() != null) { $.popContext.getCurrent().find('iframe').height('100%'); } }, 16); }, width: 700, height: 500, popupOnTop: true, onload: function (currentHandle, pop, config) { if (iframeSrc == 'about:blank') { return false; } if (counter++ == 0) { _serializeJSON = $.toJSON(map[rootFolder]); } var iframe = pop.children('iframe'), iframeSrc = iframe[0].contentWindow.document.location.href, currentFolder = $.request(iframeSrc).queryString["folderName"], selectedDatas = map[rootFolder] = (map[rootFolder] || []).where(function (o) { return o.selected; }), isSingle = $("[name='cat_" + rootFolder + "_single_choice']").val() == 'True', contents = iframe.contents(), folderText = contents.find('input:hidden[name="FriendlyFolderName"]').val() selectedTable = contents.find('table.selected tbody'), datasourceTable = contents.find('table.datasource tbody'), datasourceTable.find('tr').css({ cursor: 'pointer' }); toggleBackLink(datasourceTable.parent(), rootFolder, currentFolder, _prevLink); _prevLink = iframeSrc; checkedSelector = selectedDatas.select(function (o) { return '[value="' + o.key + '"]'; }).join(','); var initCheckStatus = function (element) { element.find(checkedSelector).closest('tr').addClass('active'); element.find(checkedSelector).attr('checked', 'checked'); if (isSingle) { handleRadio(element); } else { handleCheckbox(element); } } initCheckStatus(datasourceTable); datasourceTable.parent().bind('treeNodeLoaded', function (e, treeNode) { initCheckStatus(treeNode); }); function checkBoxChange() { var handle = $(this), tr = handle.parents('tr:eq(0)'), key = handle.val(), text = tr.find('td:eq(1)').text(); var query = map[rootFolder].where(function (o, i) { return o.key == key; }); if (handle.attr('checked')) { if (query.length == 0) { map[rootFolder].push({ key: key, text: text, currentFolder: currentFolder, folderText: folderText, selected: true }); } } else { if (query.length > 0) { query[0].selected = false; } } } function handleCheckbox(parent) { var checkboxs = parent.find('input:checkbox') .change(checkBoxChange); } function radioChange() { var handle = $(this), tr = handle.parents('tr:eq(0)'), text = tr.find('td:eq(1)').text(), key = handle.val(), query = map[rootFolder].where(function (o, i) { if (o.key == key) { o.selected = true; } else { o.selected = false; } return o.key == key; }); if (query.length == 0) { map[rootFolder].push({ key: key , text: text , selected: true , currentFolder: currentFolder , folderText: folderText }); } } function handleRadio(parent) { var radios = parent.find('input:radio') .change(radioChange); } (function initButton() { var saveBtn = contents.find('.save'), cancelBtn = contents.find('.cancel'); cancelBtn.click(function () { pop.close(); }); saveBtn.click(function () { _serializeJSON = $.toJSON(map[rootFolder]); initDisplayAndValueInput(link); pop.close(); }); })(); } }); //end $().pop // resolve z-index problem when it's opend in front page by inline edit component. //var topJQ = top._jQuery || top.jQuery; //if (topJQ && top.yardi) { // var contentCon = topJQ('#' + id); // if (contentCon.length > 0) { // var oldZIndex = contentCon.dialog('option', 'zIndex'); // contentCon.dialog('option', 'zIndex', top.yardi.zindexCenter.getMax(top) + oldZIndex + 1); // destroyMethod = function () { contentCon.remove(); }; // } //} }); function initDisplayAndValueInput($link) { var $cagetoryTd = $link.parents('td:eq(0)') , $container = $cagetoryTd.find('.category-list ul') , $template = $container.find('.category-item-template') , $clone = function () { $template = $template.length ? $template : $container.data('template'); if (!$container.data('template')) { $template.data('template', $template.clone()); } return $template.clone() .removeClass('category-item-template hide').addClass('category-item-data'); } , $displays = $cagetoryTd.find('[name$="_display"]') , $values = $cagetoryTd.find('[name$="_value"]') , rootFolder = $.request($link.attr('href')).queryString['folderName'] , selectedDatas = map[rootFolder] = (map[rootFolder] || []).where(function (o) { return o.selected; }) ; $container.find('.category-item-data').remove(); selectedDatas.each(function (val, index) { if (!val) { return false; } var $item = $clone().appendTo($container); var folderText = val.folderText || val.currentFolder; var displayStr = val.text.split(':')[0] + (folderText ? (' ( ' + folderText + ' )') : '').replace(/\~/g, '/'); $item.attr('title', displayStr); $item.find('.text').html(displayStr); $item.find('a.remove').click(function () { val.selected = false; var values = selectedDatas .where(function (o) { return o.selected; }) .select(function (o) { return o.key + ':' + o.currentFolder; }).join(','); $values.val(values); $displays.val(values); $item.remove(); }); }); $values.val(selectedDatas.select(function (o) { return o.key + ':' + o.currentFolder; }).join(',')); } }); //end document.ready </script>*@
the_stack
@page @model TooltipsModel @{ ViewData["Title"] = "Tooltips"; ViewData["PageName"] = "ui_tooltips"; ViewData["Heading"] = "<i class='subheader-icon fal fa-window'></i> Tooltips"; ViewData["Category1"] = "UI Components"; ViewData["PageDescription"] = "Examples for showing pagination to indicate a series of related content exists across multiple pages."; } @section HeadBlock {} <div class="row"> <div class="col-xl-6"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> Tooltip <span class="fw-300"><i>basics</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Hover over the links below to see tooltips: </div> <p class="text-muted">Tight pants next level keffiyeh <a href="#" class="text-info fw-500" data-toggle="tooltip" title="Default tooltip">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" class="text-info fw-500" data-toggle="tooltip" title="Another tooltip">have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan <a href="#" class="text-info fw-500" data-toggle="tooltip" title="Another one here too">whatever keytar</a>, scenester farm-to-table banksy Austin <a href="#" class="text-info fw-500" data-toggle="tooltip" title="The last tip!">twitter handle</a> freegan cred raw denim single-origin coffee viral. </p> </div> </div> </div> <div id="panel-2" class="panel"> <div class="panel-hdr"> <h2> Tooltip <span class="fw-300"><i>Placement</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> <p>How to position the tooltip - auto | top | bottom | left | right. When <code>auto</code> is specified, it will dynamically reorient the tooltip.</p> <p class="m-0">When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second. The <code>this</code> context is set to the tooltip instance.</p> </div> <div class="demo"> <button type="button" class="btn btn-outline-default" data-toggle="tooltip" data-placement="auto" title="" data-original-title="Tooltip on auto">Auto</button> <button type="button" class="btn btn-outline-default" data-toggle="tooltip" data-placement="left" title="" data-original-title="Tooltip on left">Left</button> <button type="button" class="btn btn-outline-default" data-toggle="tooltip" data-placement="top" title="" data-original-title="Tooltip on top"> Top</button> <button type="button" class="btn btn-outline-default" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Tooltip on bottom">Bottom</button> <button type="button" class="btn btn-outline-default" data-toggle="tooltip" data-placement="right" title="" data-original-title="Tooltip on right">Right</button> </div> </div> </div> </div> <div id="panel-3" class="panel"> <div class="panel-hdr"> <h2> Tooltip <span class="fw-300"><i>animation</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Disable the CSS fade transition to the tooltip by using <code>data-animation="false"</code> </div> <div class="demo"> <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="" data-original-title="Animated">Animated</button> <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" data-animation="false" title="" data-original-title="Not Animated"> Not Animated</button> </div> </div> </div> </div> <div id="panel-4" class="panel"> <div class="panel-hdr"> <h2> Tooltip <span class="fw-300"><i>Container</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Appends the tooltip to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the tooltip in the flow of the document near the triggering element - which will prevent the tooltip from floating away from the triggering element during a window resize. </div> <div class="d-flex"> <a href="#" class="mr-auto fs-md fw-500" data-container="#test-container" data-toggle="tooltip" data-placement="top" title="" data-original-title="I am not really here..."> >> Hover to display tooltip </a> <a href="javascript:void(0);" class="btn btn-danger btn-xs ml-auto" data-action="toggle" data-class="d-none" data-target="#test-container"> hide container </a> </div> <div id="test-container" class="p-3 rounded bg-primary-300 mt-3"> Toolip is nested in this container but displayed on the hovered element above. Once this container is hidden the tooltip will not be visible. Try hiding the container by pressing the "hide" button above </div> </div> </div> </div> <div id="panel-5" class="panel"> <div class="panel-hdr"> <h2> Delayed <span class="fw-300"><i>Tooltip</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type. If a number is supplied, delay is applied to both hide/show. Object structure is: <code>delay: { "show": 500, "hide": 100 }</code> </div> <div class="demo demo-h-spacing d-flex align-items-end"> <a href="#" class="btn btn-lg btn-outline-default" data-toggle="tooltip" data-delay='{ "show": 1000, "hide": 1000 }' data-original-title='{ "show": 1000, "hide": 1000 }'>1s delay</a> <a href="#" class="btn btn-outline-default" data-toggle="tooltip" data-delay='{ "show": 500, "hide": 500 }' data-original-title='{ "show": 500, "hide": 500 }'>0.5sec delay</a> <a href="#" class="btn btn-sm btn-outline-default"data-toggle="tooltip" data-delay='{ "show": 0, "hide": 0 }' data-original-title='{ "show": 0, "hide": 0 }'>No delay</a> </div> </div> </div> </div> </div> <div class="col-xl-6"> <div id="panel-7" class="panel"> <div class="panel-hdr"> <h2> Adding <span class="fw-300"><i>dynamic objects</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (jQuery.on support). </div> <p>Toggle the checkbox below and click the 'add new tooltip' button to observe the behavioral differences between using the selector option, and not using it.</p> <hr> <label id="use-selector-label" class="d-flex align-items-center mb-3"> <input id="use-selector" type="checkbox"> <span class="ml-2" data-title="you must re-run this page to change the selector option once you've started the demo">Use selector option</span> </label> <pre id="with-selector-code"> $('body').tooltip({ selector: '.has-tooltip' }); </pre> <pre id="without-selector-code"> $('.has-tooltip').tooltip(); </pre> <button class="btn btn-primary" id="add-button">Add new tooltip</button> <div id="js_buttons_tooltip_demo" style="display:none"> <hr> <button class="btn btn-block btn-success has-tooltip" data-title="Static" data-content="This button was specified in the initial HTML document" data-placement="top"> Working tooltip </button> </div> </div> </div> </div> <div id="panel-8" class="panel"> <div class="panel-hdr"> <h2> Tooltip <span class="fw-300"><i>Templating</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Base HTML to use when creating the tooltip. The tooltip's title will be injected into the <code>.tooltip-inner</code>. The outermost wrapper element should have the <code>.tooltip</code> class and <code>role="tooltip"</code> </div> <h5 class="frame-heading"> Backgrounds </h5> <div class="frame-wrap"> <div class="demo"> <button type="button" class="btn btn-outline-primary" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner bg-primary-500"></div></div>' data-toggle="tooltip" title="" data-original-title="Tooltip primary background"> Primary</button> <button type="button" class="btn btn-outline-secondary" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner bg-fusion-500"></div></div>' data-toggle="tooltip" title="" data-original-title="Tooltip secondary background"> Fusion</button> <button type="button" class="btn btn-outline-success" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner bg-success-500"></div></div>' data-toggle="tooltip" title="" data-original-title="Tooltip success background"> Success</button> <button type="button" class="btn btn-outline-info" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner bg-info-500"></div></div>' data-toggle="tooltip" title="" data-original-title="Tooltip info background"> Info</button> <button type="button" class="btn btn-outline-warning" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner bg-warning-500"></div></div>' data-toggle="tooltip" title="" data-original-title="Tooltip warning background"> Wraning</button> <button type="button" class="btn btn-outline-danger" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner bg-danger-500"></div></div>' data-toggle="tooltip" title="" data-original-title="Tooltip danger background"> Danger</button> <button type="button" class="btn btn-outline-dark" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner bg-dark"></div></div>' data-toggle="tooltip" title="" data-original-title="Tooltip dark background"> Dark</button> <button type="button" class="btn btn-outline-light" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner bg-light text-dark"></div></div>' data-toggle="tooltip" title="" data-original-title="Tooltip light background"> Light</button> </div> </div> <h5 class="frame-heading"> Sizing </h5> <div class="frame-wrap"> <div class="demo demo-h-spacing d-flex align-items-end"> <button type="button" class="btn btn-outline-default btn-lg" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner fs-xl"></div></div>' data-toggle="tooltip" title="" data-original-title="Large font"> Large font</button> <button type="button" class="btn btn-outline-default btn-xs" data-template='<div class="tooltip" role="tooltip"><div class="tooltip-inner small fw-400"></div></div>' data-toggle="tooltip" title="" data-original-title="Small font"> Small font</button> </div> </div> </div> </div> </div> <div id="panel-9" class="panel"> <div class="panel-hdr"> <h2> Tooltip <span class="fw-300"><i>Triggers</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> <p>How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.</p> <p><code>'manual'</code> indicates that the tooltip will be triggered programmatically via the <code>.tooltip('show')</code>, <code>.tooltip('hide')</code> and <code>.tooltip('toggle')</code> methods; this value cannot be combined with any other trigger.</p> <p><code>'hover'</code> on its own will result in tooltips that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present.</p> </div> <div class="demo"> <button type="button" class="btn btn-outline-default" data-toggle="tooltip" data-trigger="click" data-original-title="Displayed on click">Click event</button> <button type="button" class="btn btn-outline-default" data-toggle="tooltip" data-trigger="focus" data-original-title="Displayed on focus">Focus event</button> </div> </div> </div> </div> <div id="panel-10" class="panel"> <div class="panel-hdr"> <h2> Tooltips <span class="fw-300"><i>Offset</i></span> </h2> <div class="panel-toolbar"> <button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button> <button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button> <button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button> </div> </div> <div class="panel-container show"> <div class="panel-content"> <div class="panel-tag"> Offset of the tooltip relative to its target. When a function is used to determine the offset, it is called with an object containing the offset data as its first argument. The function must return an object with the same structure. The triggering element DOM node is passed as the second argument. </div> <div class="demo"> <button type="button" class="btn btn-outline-default" data-offset="0,25" data-toggle="tooltip" data-placement="top" data-original-title="Offset by x=0, y=25"> Top placement (0,25)</button> <button type="button" class="btn btn-outline-default" data-offset="0,25" data-toggle="tooltip" data-placement="bottom" data-original-title="Offset by x=0, y=25"> Bottom placement (0,25)</button> </div> </div> </div> </div> </div> </div> @section ScriptsBlock { <script type="text/javascript"> function usingSelectorOption() { return $('#use-selector').is(':checked'); } function updateCodeView() { $('#with-selector-code').toggle(usingSelectorOption()); $('#without-selector-code').toggle(!usingSelectorOption()); } $(function() { // Update code view when checkbox is toggled updateCodeView(); $('#use-selector').click(function() { updateCodeView(); }); var startedDemo = false; $('#add-button').click(function() { // One-time initialization if (!startedDemo) { if (usingSelectorOption()) { $('body').tooltip({ selector: '.has-tooltip' }); } else { $('.has-tooltip').tooltip(); } startedDemo = true; } // Disable selector checkbox, put a tooltip on it, and show the buttons panel $('#use-selector').attr('disabled', 'disabled'); $('#use-selector-label span').tooltip(); $('#js_buttons_tooltip_demo').show(); // Add a new button that triggers (or doesn't) a tooltip, with the appropriate message var button = null; if (usingSelectorOption()) { button = $('<button class="btn btn-block btn-success has-tooltip" data-title="Dynamic" data-content="This button was added dynamically by JavaScript" data-placement="top">Working dynamically added button</button>'); } else { button = $('<button class="btn btn-block btn-default has-tooltip" data-title="Dynamic" data-content="This button was added dynamically by JavaScript" data-placement="top">Non-working dynamically added button</button>'); } button.appendTo('#js_buttons_tooltip_demo'); }); }); </script> }
the_stack
@model IEnumerable<WebApp.Models.CodeItem> @{ ViewBag.Title = "键值对维护"; } <!-- MAIN CONTENT --> <div id="content"> <!-- quick navigation bar --> <div class="row"> <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4"> <h1 class="page-title txt-color-blueDark"> <i class="fa fa-table fa-fw "></i> 系统管理 <span> > 键值对维护 </span> </h1> </div> <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8"> </div> </div> <!-- end quick navigation bar --> <!-- widget grid --> <section id="widget-grid" class=""> <!-- row --> <div class="row"> <!-- NEW WIDGET START --> <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-table"></i> </span> <h2>键值对维护</h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body no-padding"> <div class="widget-body-toolbar"> <div class="row"> <div class="col-sm-8 "> <div class="btn-group"> <a href="javascript:updatejavascript()" class="btn btn-sm btn-primary"> <i class="fa fa-file-code-o"></i> 更新JS脚本 </a> </div> <div class="btn-group"> <a href="javascript:append()" class="btn btn-sm btn-default"> <i class="fa fa-plus"></i> 新增 </a> </div> <div class="btn-group"> <a href="javascript:removeit()" class="btn btn-sm btn-default"> <i class="fa fa-trash-o"></i> 删除 </a> </div> <div class="btn-group"> <a href="javascript:accept()" class="btn btn-sm btn-default"> <i class="fa fa-floppy-o"></i> 保存 </a> </div> <div class="btn-group"> <a href="javascript:reload()" class="btn btn-sm btn-default"> <i class="fa fa-refresh"></i> 刷新 </a> </div> <div class="btn-group"> <a href="javascript:reject()" class="btn btn-sm btn-default"> <i class="fa fa-window-close-o"></i> 取消 </a> </div> <div class="btn-group"> <button type="button" onclick="importexcel()" class="btn btn-default"><i class="fa fa-upload"></i> 导入数据 </button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span> <span class="sr-only">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> <li><a href="javascript:importexcel()"><i class="fa fa-upload"></i> 上传Excel </a></li> <li role="separator" class="divider"></li> <li><a href="javascript:downloadtemplate()"><i class="fa fa-download"></i> 下载模板 </a></li> </ul> </div> <div class="btn-group"> <a href="javascript:exportexcel()" class="btn btn-sm btn-default"> <i class="fa fa-file-excel-o"></i> 导出Excel </a> </div> <div class="btn-group"> <a href="javascript:print()" class="btn btn-sm btn-default"> <i class="fa fa-print"></i> 打印 </a> </div> <div class="btn-group"> <a href="javascript:dohelp()" class="btn btn-sm btn-default"> <i class="fa fa-question-circle-o"></i> 帮助 </a> </div> </div> <div class="col-sm-4 text-align-right"> <div class="btn-group"> <a href="javascript:window.history.back()" class="btn btn-sm btn-success"> <i class="fa fa-chevron-left"></i> 返回 </a> </div> </div> </div> </div> <div class="alert alert-warning no-margin fade in"> <button class="close" data-dismiss="alert"> × </button> <i class="fa-fw fa fa-info"></i> 当有新增/修改记录后,请执行【更新javascript】才会最终生效 </div> <!--begin datagrid-content --> <div class="table-responsive"> <table id="codeitems_datagrid" > </table> </div> <!--end datagrid-content --> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- WIDGET END --> </div> <!-- end row --> </section> <!-- end widget grid --> <!-- file upload partial view --> @Html.Partial("_ImportWindow", new ViewDataDictionary { { "EntityName", "CodeItem" } }) <!-- end file upload partial view --> </div> <!-- END MAIN CONTENT --> @section Scripts { <script type="text/javascript"> var entityname = "CodeItem"; //更新javascript function updatejavascript() { $.post("/CodeItems/UpdateJavascript", null, function (response) { if (response.success) { $.messager.alert("提示", "更新成功!"); } }, "json").fail(function (response) { $.messager.alert("错误", "提交错误了!", "error"); }); } //下载Excel导入模板 function downloadtemplate() { //TODO: 修改下载模板的路径 var url = "/ExcelTemplate/Code.xlsx"; $.fileDownload(url) .fail(function () { $.messager.alert("错误", "没有找到模板文件! {" + url + "}"); }); } //打开Excel上传导入 function importexcel() { $("#importwindow").window("open"); } //执行Excel到处下载 function exportexcel() { var filterRules = JSON.stringify($dg.datagrid("options").filterRules); //console.log(filterRules); $.messager.progress({ title: "正在执行导出!" }); var formData = new FormData(); formData.append("filterRules", filterRules); formData.append("sort", "Id"); formData.append("order", "asc"); $.postDownload("/CodeItems/ExportExcel", formData, function (fileName) { $.messager.progress("close"); console.log(fileName); }) } //datagrid 增删改查操作 var $dg = $("#codeitems_datagrid"); var editIndex = undefined; function reload() { if (endEditing()) { $dg.datagrid("reload"); } } var prevcodetype = ""; var prevdescription = ""; function endEditing() { if (editIndex === undefined) { return true; } if ($dg.datagrid("validateRow", editIndex)) { $dg.datagrid("endEdit", editIndex); var row = $dg.datagrid("getRows")[editIndex]; prevcodetype = row.CodeType; prevdescription = row.Description; editIndex = undefined; return true; } else { return false; } } function onClickCell(index, field) { var _operates = ["_operate1", "_operate2", "_operate3", "ck"]; if ($.inArray(field, _operates) >= 0) { return; } if (editIndex !== index) { if (endEditing()) { $dg.datagrid("selectRow", index) .datagrid("beginEdit", index); var ed = $dg.datagrid("getEditor", { index: index, field: field }); if (ed) { ($(ed.target).data("textbox") ? $(ed.target).textbox("textbox") : $(ed.target)).focus(); } editIndex = index; } else { $dg.datagrid("selectRow", editIndex); } } } function append() { if (endEditing()) { //$dg.datagrid("appendRow", { Status: 0 }); //editIndex = $dg.datagrid("getRows").length - 1; $dg.datagrid("insertRow", { index: 0, row: { CodeType: prevcodetype, Description: prevdescription, IsDisabled: false } }); editIndex = 0; $dg.datagrid("selectRow", editIndex) .datagrid("beginEdit", editIndex); } } function removeit() { if (editIndex == undefined) { return } $dg.datagrid("cancelEdit", editIndex) .datagrid("deleteRow", editIndex); editIndex = undefined; } function accept() { if (endEditing()) { if ($dg.datagrid("getChanges").length) { var inserted = $dg.datagrid("getChanges", "inserted"); var deleted = $dg.datagrid("getChanges", "deleted"); var updated = $dg.datagrid("getChanges", "updated"); var effectRow = new Object(); if (inserted.length) { effectRow.inserted = inserted; } if (deleted.length) { effectRow.deleted = deleted; } if (updated.length) { effectRow.updated = updated; } //console.log(JSON.stringify(effectRow)); $.post("/CodeItems/SaveData", effectRow, function (response) { //console.log(response); if (response.success) { $.messager.alert("提示", "提交成功!"); $dg.datagrid("acceptChanges"); $dg.datagrid("reload"); } }, "json").fail(function (response) { //console.log(response); $.messager.alert("错误", "提交错误了!", "error"); //$dg.datagrid("reload"); }); } //$dg.datagrid("acceptChanges"); } } function reject() { $dg.datagrid("rejectChanges"); editIndex = undefined; } function getChanges() { var rows = $dg.datagrid("getChanges"); alert(rows.length + " rows are changed!"); } //datagrid 开启筛选功能 $(function () { $dg.datagrid({ rownumbers: true, checkOnSelect: true, selectOnCheck: true, idField: 'Id', sortName: 'Id', sortOrder: 'desc', remoteFilter: true, singleSelect: true, url: '/CodeItems/GetData', method: 'get', onClickCell: onClickCell, pagination: true, striped: true, columns: [[ { field: 'CodeType', width: 140, editor: { type: 'textbox', options: { prompt: '代码名称', required: true, validType: 'regex[\'^[A-Za-z0-9]+$\',\'必须是字母\']' } }, sortable: true, resizable: true, title: '@Html.DisplayNameFor(model => model.CodeType)' }, { field:'Code' ,width:140,editor:{type:'textbox',options:{prompt:'值' ,required:true ,validType:'length[0,50]' } } ,sortable:true,resizable:true,title:'@Html.DisplayNameFor(model => model.Code)' }, { field: 'Text', width: 140, editor: { type: 'textbox', options: { prompt: '显示', required: true, validType: 'length[0,50]' } }, sortable: true, resizable: true, title: '@Html.DisplayNameFor(model => model.Text)' }, { field:'Multiple' ,width:140,editor:{type:'booleaneditor',options:{prompt:'是否支持多选' ,required:true } } ,sortable:true,resizable:true,formatter:booleanformatter,title:'@Html.DisplayNameFor(model => model.Multiple)' }, { field:'Description' ,width:140,editor:{type:'textbox',options:{prompt:'描述' ,required:true ,validType:'length[0,80]' } } ,sortable:true,resizable:true,title:'@Html.DisplayNameFor(model => model.Description)'}, { field: 'IsDisabled', width: 100, align: 'right', editor: { type: 'isdisablededitor', options: { prompt: '是否禁用', required: true } }, sortable: true, resizable: true, formatter: isdisabledformatter, title: '@Html.DisplayNameFor(model => model.IsDisabled)' } ]] }); $dg.datagrid("enableFilter", [ { field: "Id", type: "numberbox", op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal'] }, { field: "IsDisabled", type: "isdisabledfilter", }, { field: "Multiple", type: "booleanfilter", } ]); }); //----------------------------------------------------- //datagrid onSelect //----------------------------------------------------- function showdetailsformatter(value, row, index) { return '<a onclick="showDetailsWindow(' + row.Id + ')" class="link" href="javascript:void(0)">查看明细</a>'; } //弹出明细信息 function showDetailsWindow(id) { //console.log(index, row); } </script> <script src="~/Scripts/jquery.filerupload.min.js"></script> }
the_stack
@******************************************************************************************************* // UnbalanceReport.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: // ---------------------------------------------------------------------------------------------------- // 10/08/2019 - Christoph Lackner // Generated original version of source code. // 05/14/2020 - Christoph Lackner // Fixed Issues in Counting Alarms for SNR. // //*****************************************************************************************************@ @using System @using System.Globalization @using System.Threading @using System.Text @using System.Net.Http @using GSF @using GSF.Data @using GSF.Identity @using GSF.IO @using GSF.Security @using GSF.Security.Cryptography @using GSF.Web @using GSF.Web.Model @using GSF.Web.Shared @using openHistorian.Model @using openHistorian @using AssemblyInfo = GSF.Reflection.AssemblyInfo @inherits ExtendedTemplateBase<AppModel> @section StyleSheets { <link href="@Resources.Root/Shared/Content/jquery-ui.css" rel="stylesheet"> <link href="@Resources.Root/Shared/Content/primeui-theme.css" rel="stylesheet"> <link href="@Resources.Root/Shared/Content/font-awesome.css" rel="stylesheet"> <link href="@Resources.Root/Shared/Content/primeui.css" rel="stylesheet"> <link href="Content/bootstrap-datetimepicker.css" rel="stylesheet"> <style> /* Auto font resize CSS for system health window - targeting fixed 80 char width without wrap and allowing for responsive screen rearrangement when window is col-**-8 and on the right */ @@media screen { .performance-statistics { font-size: 5.25px; } } @@media screen and (min-width: 430px) { .performance-statistics { font-size: 7px; } } @@media screen and (min-width: 470px) { .performance-statistics { font-size: 8px; } } @@media screen and (min-width: 515px) { .performance-statistics { font-size: 9px; } } @@media screen and (min-width: 550px) { .performance-statistics { font-size: 10px; } } @@media screen and (min-width: 600px) { .performance-statistics { font-size: 11px; } } @@media screen and (min-width: 635px) { .performance-statistics { font-size: 12px; } } @@media screen and (min-width: 685px) { .performance-statistics { font-size: 13px; } } @@media screen and (min-width: 725px) { .performance-statistics { font-size: 14px; } } @@media screen and (min-width: 768px) { .performance-statistics { font-size: 8px; } } @@media screen and (min-width: 992px) { .performance-statistics { font-size: 12px; } } @@media screen and (min-width: 1200px) { .performance-statistics { font-size: 14px; } } .badge-fixed { display: inline-block; width: 150px; } #userInfoButton { height: 0px; margin-top: -22px; color: inherit; text-decoration: underline; outline-style: none; } </style> } @{ Layout = "Layout.cshtml"; ViewBag.Title = "Unbalance and SNR Report"; DataContext dataContext = ViewBag.DataContext; StringBuilder PageControlScripts = ViewBag.PageControlScripts; if (PageControlScripts == null) { ViewBag.PageControlScripts = new StringBuilder(); PageControlScripts = ViewBag.PageControlScripts; } HttpRequestMessage request = ViewBag.Request; Dictionary<string, string> parameters = request.QueryParameters(); ViewBag.reportType = int.Parse(parameters["reportType"] ?? "0"); ViewBag.HideAddNewButton = true; ViewBag.BodyRows = BodyRows().ToString(); ViewBag.HeaderColumns = new[] { // { "Field", "Label", "Classes" } new[] { "PointTag", "Tag&nbsp;Name", "text-left" }, new[] { "DeviceName", "Device", "text-left" }, new[] { "Mean" , "Mean", "text-center" }, new[] { "StandardDeviation" , "Standard &nbsp;Dev.", "text-center" }, new[] { "Max" , "Maximum", "text-center" }, new[] { "Min" , "Minimum", "text-center" }, new[] { "AlarmCount", "Alarms Raised", "text-center" }, new[] { "PercentInAlarm", "Percent in Alarm", "text-center" }, }; // Prepend view model extension scripts to occur before model initialization PageControlScripts.Insert(0, ExtendedViewModel(dataContext).ToString().TrimStart()); ; } @helper BodyRows() { <td width="35%" class="text-left valign-middle"><div data-bind="attr: { title: PointTag }"><button type="button" class="btn btn-link btn-sm" data-bind="text: PointTag"></button></div></td> <td width="25%" class="text-left valign-middle"><div data-bind="attr: { title: DeviceName }"><button type="button" class="btn btn-link btn-sm" data-bind="text: DeviceName"></button></div></td> <td width="5%" class="text-left valign-middle"><span data-bind="text: Mean.toFixed(2)"></span></td> <td width="5%" class="text-left valign-middle"><span data-bind="text: StandardDeviation.toFixed(3)"></span></td> <td width="5%" class="text-left valign-middle"><span data-bind="text: Max.toFixed(2)"></span></td> <td width="5%" class="text-left valign-middle"><span data-bind="text: Min.toFixed(2)"></span></td> <td width="10%" class="text-left valign-middle"><span data-bind="text: AlarmCount.toFixed(0)"></span></td> <td width="10%" class="text-left valign-middle"><span data-bind="text: PercentInAlarm.toFixed(2)"> %</span></td> } @section Scripts { <script> "use strict"; const LocalTimeFormat = DateFormat + " hh:mm:ss.fff"; @Raw(dataContext.RenderViewModelConfiguration<ReportMeasurements, DataHub>(ViewBag, "PointTag")) $("#progressBar").hide(); $("#loadingLabel").hide(); $("#progressIcon").hide(); viewModel.updateReport(function () { return dataHub.setReportingSource(viewModel.selectedUnbalance(), viewModel.worstBy(), viewModel.ReportDepth(), viewModel.startMoment(), viewModel.endMoment() ); }); viewModel.getProgress(function () { return dataHub.SetReportingSourceProgress(); }); function updateData() { var reportType = ""; if (viewModel.selectedUnbalance() == 0) { reportType = "SNR"; } else if (viewModel.selectedUnbalance() == 1) { reportType = "Voltage Unbalance"; } else if (viewModel.selectedUnbalance() == 2) { reportType = "Current Unbalance"; } viewModel.ReportTitle("Worst 25 " + reportType + " Report"); const progressBar = $("#progressBar"); const progressLabel = $("#loadingLabel"); const reportTbl = $("#report-tbl"); const progressIcon = $("#progressIcon"); progressBar.show(); progressLabel.show(); progressIcon.show(); reportTbl.hide(); viewModel.updateProgress(0.0); dataHub.setReportingSource(viewModel.selectedUnbalance(), viewModel.worstBy(), viewModel.ReportDepth(), viewModel.startMoment(), viewModel.endMoment()).done(function (result) { setTimeout(function () { dataHub.setReportingSourceProgress().done(function (result) { viewModel.updateProgress(result); }); }, 100); }); } </script> } @functions { } @helper ExtendedViewModel(DataContext dataContext) { <script src="@Resources.Root/Shared/Scripts/moment.js"></script> <script src="Scripts/bootstrap-datetimepicker.js"></script> <script src="Scripts/dateFormat.js"></script> <script> const MomentDateTimeFormat = dateFormat.convert(DateFormat, dateFormat.dotnet, dateFormat.moment); const getToday = () => { let today = moment.utc(); today.minute(0); today.milliseconds(0); today.hour(0); return today; }; function secondstoInterval(seconds) { var day = 0; var hour = 0; var minute = 0; var second = 0; second = seconds % 60.0; minute = Math.floor(seconds / 60.0); hour = Math.floor(minute / 60.0); day = Math.floor(hour / 24.0); hour = hour % 24.0; minute = minute % 60; return (day.toFixed(0) + "d " + hour.toFixed(0) + "h " + minute.toFixed(0) + "m " + second.toFixed(0) + "s"); } function ExtendedViewModel() { const self = this; PagedViewModel.call(self); self.ReportTitle = ko.observable("Worst 25 SNR Report"); self._selectedIntervall = ko.observable(30); self.selectedIntervall = ko.pureComputed({ read: function () { return self._selectedIntervall(); }, write: function (value) { var span = 30; if (value == 1) { span = 1; } else if (value == 2) { span = 7; } else if (value == 3) { span = 14; } else if (value == 4) { span = 30; } else if (value == 5) { span = 60; } else if (value == -1) { span = 5; } self.endTime(getToday().format(MomentDateTimeFormat)); self.startTime(moment.utc(self.endTime(), MomentDateTimeFormat).subtract(span, 'days').format(MomentDateTimeFormat)); self._selectedIntervall(value); }, owner: self }); self._startTime = ko.observable(getToday().subtract(30, "days").format(MomentDateTimeFormat)); self._endTime = ko.observable(getToday().format(MomentDateTimeFormat)); self.startTime = ko.pureComputed({ read: function () { return self._startTime(); }, write: function (value) { self._startTime(value); }, owner: self }); self.endTime = ko.pureComputed({ read: function () { return self._endTime(); }, write: function (value) { self._endTime(value); }, owner: self }); self.startMoment = ko.pureComputed({ read: function () { return moment.utc(self.startTime(), MomentDateTimeFormat); }, owner: self }); self.endMoment = ko.pureComputed({ read: function () { return moment.utc(self.endTime(), MomentDateTimeFormat); }, owner: self }); self.useInterval = ko.pureComputed({ read: function () { if (self.selectedIntervall() == 0) return false; else return true; }, owner: self }); self.worstBy = ko.observable(1); self.ReportDepth = ko.observable(25); self.selectedUnbalance = ko.observable(@Raw(ViewBag.reportType.ToString())); self.updateReport = function (result) { return result } self.updateProgress = function (progress) { const progressBar = $("#progressBar"); const progressLabel = $("#loadingLabel"); const reportTbl = $("#report-tbl"); const progressIcon = $("#progressIcon"); if (isNumber(progress)) { progressBar.text(progress.toFixed(0) + "%"); progressBar.css("width", progress.toString() + "%"); } if (progress == 100.0) { setTimeout(function () { if (viewModel.worstBy() == 0) { viewModel.updateSortOrder("Mean", false); } else if (viewModel.worstBy() == 1) { viewModel.updateSortOrder("Max", false); } if (viewModel.worstBy() == 2) { viewModel.updateSortOrder("TimeinAlarm", false); } progressBar.hide(); progressLabel.hide(); reportTbl.show(); progressIcon.hide(); }, 500); } else { setTimeout(function () { dataHub.setReportingSourceProgress().done(function (result) { viewModel.updateProgress(result); }); }, 250); } } self.getProgress = function (result) { return result; } } function extendViewModel(event, data) { const newViewModel = new ExtendedViewModel(); data.viewModel.cloneConfiguration(newViewModel); data.viewModel = newViewModel; // Define instance name selector before binding ko.bindingHandlers.dateTimePicker = { init: function (element, valueAccessor, allBindingsAccessor) { // Initialize datepicker with some basic options const options = allBindingsAccessor().dateTimePickerOptions || { showClose: true, useCurrent: false, format: MomentDateTimeFormat }; $(element).datetimepicker(options); // When user changes the date, update view model ko.utils.registerEventHandler(element, "dp.change", function (event) { const value = valueAccessor(); if (ko.isObservable(value) && event.date != null) { if (event.date._isAMomentObject) value(event.date.format(MomentDateTimeFormat)); else if (event.date instanceof Date) value(event.date.formatDate(DateTimeFormat, true)); } }); ko.utils.registerEventHandler(element, "dp.show", function (event) { const picker = $(element).data("DateTimePicker"); if (picker) picker.date(moment.utc(ko.utils.unwrapObservable(valueAccessor()), MomentDateTimeFormat)); }); ko.utils.domNodeDisposal.addDisposeCallback(element, function () { const picker = $(element).data("DateTimePicker"); if (picker) picker.destroy(); }); } } ko.validation.init({ registerExtenders: true, messagesOnModified: true, insertMessages: true, parseInputAttributes: true, allowHtmlMessages: true, messageTemplate: null, decorateElement: true, errorElementClass: "has-error", errorMessageClass: "help-block", grouping: { deep: true, observable: true, live: true } }, true); } $(window).on("beforeApplyBindings", extendViewModel); $(window).on("hubConnected", function () { setTimeout(keepAlive, 1000); }); function keepAlive() { if (!hubIsConnected) return; serviceHub.getServerTime().done(function (serverTime) { $("#serverTime").html(serverTime.formatDate()); setTimeout(keepAlive, 1000); }); } </script> } <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12"> <div class="well ui-tabs-panel ui-corner-bottom" ui-widget-content="padding: 10px 20px 10px 20px" id="trendTimeRangeSelection"> @Raw(string.Format(Include("SelectReportRange.cshtml").ToString(), "report").Trim()) </div> </div> </div> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 id="ReportHeader" data-bind="text: ReportTitle"> Worst 25 Unbalanced Report </h3></div> <div class="pull-right" style="font-weight: bold"> <span id="loadingLabel">Loading</span>&nbsp;<span id="progressLabel"></span>&nbsp;&nbsp;<span id="progressIcon" class="glyphicon glyphicon-refresh glyphicon-spin"></span> </div> <br /> <div id="progressDiv" class="progress" style="margin-top: 5px; margin-bottom: -5px"> <div id="progressBar" class="progress-bar progress-bar-striped active" role="progressbar" style="width: 0">0%</div> </div> <div class="panel-body" id="report-tbl"> @Html.RenderResource("GSF.Web.Model.Views.PagedViewModel.cshtml") </div> </div> </div> </div> <script> // Pop-up window code derived from "JK Pop up image viewer script" - by JavaScriptKit.com // Visit JavaScript Kit (http://javascriptkit.com) // for free JavaScript tutorials and scripts // This notice must stay intact for use function detectExistence(obj) { return (typeof obj != "undefined"); } </script>
the_stack
@model Xms.Web.Models.EditRoleEntityPermissionsModel @{ if (Model.Entities.Count(x => x.EntityGroups.IsEmpty()) > 0) { var nullGroup = new Xms.Core.Data.Entity("entitygroup"); nullGroup.SetIdValue(Guid.Empty); nullGroup["name"] = "未分组"; Model.EntityGroups.Insert(0, nullGroup); foreach (var item in Model.Entities.Where(x => x.EntityGroups.IsEmpty())) { item.EntityGroups = Guid.Empty.ToString(); } } } <div class="container-fluid"> <div class="row" style="padding:5px 0px;"> <div class="col-sm-11 btn-group" id="owners"> <button type="button" class="btn btn-sm btn-default">类型:</button> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-toggle="collapse" href="#collapseTwo"> <strong id="rolename" class="text-primary">@Model.Role.Name</strong> - <strong>@app.T[Model.ResourceName].IfEmpty(Model.ResourceName)</strong> </a> </h3> </div> <div id="collapseTwo" class="panel-collapse collapse in"> <div class="panel-body"> <form id="editform" class="form-horizontal" data-jsonajax="true" data-istip="true" action="/@(app.OrganizationUniqueName)/api/role/SaveRolePermissions" method="post"> @Html.AntiForgeryToken() @Html.HiddenFor(x => x.RoleId) @Html.HiddenFor(x => x.ResourceName) <ul id="myTab" class="nav nav-tabs"> @foreach (var group in Model.EntityGroups) { if (Model.Entities.Count(x => x.EntityGroups.IsNotEmpty() && x.EntityGroups.IndexOf(group.Id.ToString(), StringComparison.InvariantCultureIgnoreCase) >= 0) == 0) { continue; } <li> <a href="#tab_@group["name"]" data-toggle="tab"> @group["name"] </a> </li> } </ul> <div id="myTabContent" class="tab-content"> @foreach (var group in Model.EntityGroups) { var groupEntities = Model.Entities.Where(x => x.EntityGroups.IsNotEmpty() && x.EntityGroups.IndexOf(group.Id.ToString(), StringComparison.InvariantCultureIgnoreCase) >= 0)?.ToList(); if (groupEntities.IsEmpty()) { continue; } <div id="tab_@group["name"]" class="tab-pane fade" style="padding:5px;"> <div class="form-group col-sm-12"> <div class="table-responsive" style="overflow:initial;"> <table class="table table-bordered table-condensed table-hover table-striped" id="entities"> <thead> <tr> <th class="xms-checker" checkertype="all">@app.T["entity"]</th> <th class="xms-checker" checkertype="cum">@app.T["security_read"]</th> <th class="xms-checker" checkertype="cum">@app.T["security_create"]</th> <th class="xms-checker" checkertype="cum">@app.T["security_update"]</th> <th class="xms-checker" checkertype="cum">@app.T["security_delete"]</th> <th class="xms-checker" checkertype="cum">@app.T["security_share"]</th> <th class="xms-checker" checkertype="cum">@app.T["security_assign"]</th> <th class="xms-checker" checkertype="cum">@app.T["security_append"]</th> <th class="xms-checker" checkertype="cum">@app.T["security_appendto"]</th> </tr> </thead> <tbody> @{ var maskArray = new Dictionary<string, string>(); maskArray["0"] = "/content/images/ico_18_role_x.gif"; maskArray["1"] = "/content/images/ico_18_role_b.gif"; maskArray["2"] = "/content/images/ico_18_role_l.gif"; maskArray["4"] = "/content/images/ico_18_role_d.gif"; maskArray["16"] = "/content/images/ico_18_role_g.gif"; } @foreach (var item in groupEntities) { var permissions = Model.EntityPermissions.Where(n => n.EntityId == item.EntityId).ToList(); var read = permissions.Find(n => n.AccessRight == Xms.Core.AccessRightValue.Read); var create = permissions.Find(n => n.AccessRight == Xms.Core.AccessRightValue.Create); var update = permissions.Find(n => n.AccessRight == Xms.Core.AccessRightValue.Update); var delete = permissions.Find(n => n.AccessRight == Xms.Core.AccessRightValue.Delete); var share = permissions.Find(n => n.AccessRight == Xms.Core.AccessRightValue.Share); var assign = permissions.Find(n => n.AccessRight == Xms.Core.AccessRightValue.Assign); var append = permissions.Find(n => n.AccessRight == Xms.Core.AccessRightValue.Append); var appendto = permissions.Find(n => n.AccessRight == Xms.Core.AccessRightValue.AppendTo); var readPermission = read != null ? Model.RoleObjectAccess.Find(n => n.ObjectId == read.EntityPermissionId) : null; var createPermission = create != null ? Model.RoleObjectAccess.Find(n => n.ObjectId == create.EntityPermissionId) : null; var updatePermission = update != null ? Model.RoleObjectAccess.Find(n => n.ObjectId == update.EntityPermissionId) : null; var deletePermission = delete != null ? Model.RoleObjectAccess.Find(n => n.ObjectId == delete.EntityPermissionId) : null; var sharePermission = share != null ? Model.RoleObjectAccess.Find(n => n.ObjectId == share.EntityPermissionId) : null; var assignPermission = assign != null ? Model.RoleObjectAccess.Find(n => n.ObjectId == assign.EntityPermissionId) : null; var appendPermission = append != null ? Model.RoleObjectAccess.Find(n => n.ObjectId == append.EntityPermissionId) : null; var appendtoPermission = appendto != null ? Model.RoleObjectAccess.Find(n => n.ObjectId == appendto.EntityPermissionId) : null; var readMask = readPermission != null ? readPermission.AccessRightsMask.ToString().ToLower() : "0"; var createMask = createPermission != null ? createPermission.AccessRightsMask.ToString().ToLower() : "0"; var updateMask = updatePermission != null ? updatePermission.AccessRightsMask.ToString().ToLower() : "0"; var deleteMask = deletePermission != null ? deletePermission.AccessRightsMask.ToString().ToLower() : "0"; var shareMask = sharePermission != null ? sharePermission.AccessRightsMask.ToString().ToLower() : "0"; var assignMask = assignPermission != null ? assignPermission.AccessRightsMask.ToString().ToLower() : "0"; var appendMask = appendPermission != null ? appendPermission.AccessRightsMask.ToString().ToLower() : "0"; var appendtoMask = appendtoPermission != null ? appendtoPermission.AccessRightsMask.ToString().ToLower() : "0"; <tr> <td class="xms-checker" checkertype="col" data-name="@item.Name" data-mask="@item.EntityMask"> <label for="Name">@item.LocalizedName</label> </td> <td> @if (read != null) { <input type="hidden" name="ObjectId" value="@(read.EntityPermissionId)" /> <a href="javascript:void(0)" class="xms-checker-target"> <img src="@maskArray[readMask]" /> </a> <input type="hidden" name="mask" value="@(readMask)" /> } </td> <td> @if (create != null) { <input type="hidden" name="ObjectId" value="@(create.EntityPermissionId)" /> <a href="javascript:void(0)" class="xms-checker-target"> <img src="@maskArray[createMask]" /> </a> <input type="hidden" name="mask" value="@(createMask)" /> } </td> <td> @if (update != null) { <input type="hidden" name="ObjectId" value="@(update.EntityPermissionId)" /> <a href="javascript:void(0)" class="xms-checker-target"> <img src="@maskArray[updateMask]" /> </a> <input type="hidden" name="mask" value="@(updateMask)" /> } </td> <td> @if (delete != null) { <input type="hidden" name="ObjectId" value="@(delete.EntityPermissionId)" /> <a href="javascript:void(0)" class="xms-checker-target"> <img src="@maskArray[deleteMask]" /> </a> <input type="hidden" name="mask" value="@(deleteMask)" /> } </td> <td> @if (share != null) { <input type="hidden" name="ObjectId" value="@(share.EntityPermissionId)" /> <a href="javascript:void(0)" class="xms-checker-target"> <img src="@maskArray[shareMask]" /> </a> <input type="hidden" name="mask" value="@(shareMask)" /> } </td> <td> @if (assign != null) { <input type="hidden" name="ObjectId" value="@(assign.EntityPermissionId)" /> <a href="javascript:void(0)" class="xms-checker-target"> <img src="@maskArray[assignMask]" /> </a> <input type="hidden" name="mask" value="@(assignMask)" /> } </td> <td> @if (append != null) { <input type="hidden" name="ObjectId" value="@(append.EntityPermissionId)" /> <a href="javascript:void(0)" class="xms-checker-target"> <img src="@maskArray[appendMask]" /> </a> <input type="hidden" name="mask" value="@(appendMask)" /> } </td> <td> @if (appendto != null) { <input type="hidden" name="ObjectId" value="@(appendto.EntityPermissionId)" /> <a href="javascript:void(0)" class="xms-checker-target"> <img src="@maskArray[appendtoMask]" /> </a> <input type="hidden" name="mask" value="@(appendtoMask)" /> } </td> </tr> } </tbody> </table> </div> </div> </div> } </div> <div class="form-group col-sm-12"> <table class="table"> <caption><strong>@app.T["entitypermission_mask_explain"]</strong></caption> <tr> <td><img src="/content/images/ico_18_role_x.gif" />@app.T["entitypermission_mask_none"]</td> <td><img src="/content/images/ico_18_role_b.gif" />@app.T["entitypermission_mask_self"]</td> <td><img src="/content/images/ico_18_role_l.gif" />@app.T["entitypermission_mask_businessunit"]</td> <td><img src="/content/images/ico_18_role_d.gif" />@app.T["entitypermission_mask_businessunitandchild"]</td> <td><img src="/content/images/ico_18_role_g.gif" />@app.T["entitypermission_mask_organization"]</td> </tr> </table> </div> <div class="form-group col-sm-12 text-center" id="form-buttons"> <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-saved"></span> @app.T["save"]</button> <button type="reset" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> @app.T["reset"]</button> </div> </form> </div> </div> </div> <div class="pull-right hide" id="mask_dropdownmenu"> <div class="dropdown"> <button type="button" class="btn btn-link dropdown-toggle" id="mask_dropdownbtn" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="mask_dropdownbtn"> <li role="presentation" class="dropdown-header">选择权限级别</li> <li role="presentation"> <a role="menuitem" tabindex="-1" href="javascript:;" data-mask="0"><img src="/content/images/ico_18_role_x.gif" />@app.T["entitypermission_mask_none"]</a> </li> <li role="presentation"> <a role="menuitem" tabindex="-1" href="javascript:;" data-mask="1"><img src="/content/images/ico_18_role_b.gif" />@app.T["entitypermission_mask_self"]</a> </li> <li role="presentation"> <a role="menuitem" tabindex="-1" href="javascript:;" data-mask="2"><img src="/content/images/ico_18_role_l.gif" />@app.T["entitypermission_mask_businessunit"]</a> </li> <li role="presentation"> <a role="menuitem" tabindex="-1" href="javascript:;" data-mask="4"><img src="/content/images/ico_18_role_d.gif" />@app.T["entitypermission_mask_businessunitandchild"]</a> </li> <li role="presentation"> <a role="menuitem" tabindex="-1" href="javascript:;" data-mask="16"><img src="/content/images/ico_18_role_g.gif" />@app.T["entitypermission_mask_organization"]</a> </li> </ul> </div> </div> @section Header { <style> .dropdown-menu { min-width: 100px; } </style> } @section Scripts { <script src="/content/js/jquery.form.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-validate/jquery.validate.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-validate/localization/messages_zh.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script> var FlagArray = new Array(); FlagArray[0] = ['none', '/content/images/ico_18_role_x.gif', 0]; FlagArray[1] = ['self', '/content/images/ico_18_role_b.gif', 1]; FlagArray[2] = ['businessunit', '/content/images/ico_18_role_l.gif', 2]; FlagArray[3] = ['businessunitandchild', '/content/images/ico_18_role_d.gif', 4]; FlagArray[4] = ['organization', '/content/images/ico_18_role_g.gif', 16]; $(function () { //表单验证 Xms.Web.Form($("#editform")); $('#myTab li:first').addClass('active'); $('.tab-pane:first').addClass('in active'); function setMaskState(obj) { var $obj = $(obj); var flag = $obj.find('img').prop('src'); var mask = $obj.next().val(); var index = 0; $(FlagArray).each(function (i, n) { if (n[2] == mask || n[0] == 'none') { index = i + 1; return; } }); if (index == FlagArray.length) index = 0; mask = FlagArray[index][2]; $obj.find('img').prop('src', FlagArray[index][1]); $obj.next().val(mask); } function setAllChecker(parentTable) { var checkers = parentTable.find(".xms-checker-target"); checkers.each(function () { if ($(this).parents('tr:first').find('td:eq(0)').attr('data-mask') !== 'Organization') { setMaskState(this); } else { scalingCul(this); } }); } function setCumChecker(parentTable, index) { var checkers = parentTable.children("tbody").find("tr"); checkers.each(function () { var item = $(this).find("td").eq(index); var ppp = item.find(".xms-checker-target"); if (ppp.parents('tr:first').find('td:eq(0)').attr('data-mask') !== 'Organization') { setMaskState(item.children('a')); } else { scalingCul(item.children('a')); } }); } function setColChecker(parentTable, index) { var checkers = parentTable.children("tbody").find("tr").eq(index).find("td"); var ppp = parentTable.children("tbody").find("tr"); checkers.each(function () { var item = $(this).find("a.xms-checker-target"); if (item.parents('tr').find('td:eq(0)').attr('data-mask') !== 'Organization') { setMaskState(item); } else { scalingCul(item); } }); } function scalingCul(obj) { var FlagArrays = new Array(); FlagArrays[0] = ['none', '/content/images/ico_18_role_x.gif', 0]; FlagArrays[1] = ['organization', '/content/images/ico_18_role_g.gif', 16]; var $obj = $(obj); var flag = $obj.find('img').prop('src'); var mask = $obj.next().val() if (mask) { var index = 0; $(FlagArrays).each(function (i, n) { if (n[2] == mask || n[0] == 'none') { index = i + 1; return; } }); } else { mask = $obj.attr('data-mask'); var index = 0; $(FlagArrays).each(function (i, n) { if (n[2] == mask || n[0] == 'none') { index = i; return; } }); } if (index == FlagArrays.length) index = 0; mask = FlagArrays[index][2]; $obj.find('img').prop('src', FlagArrays[index][1]); $obj.next().val(mask); } function dianji(obj) { var chart = 0; obj.click(function () { chart = chart + 1; }) if (chart == 1) { //$('.xms-checker-target').find('img').prop('src', FlagArray[0][1]); //$('.xms-checker-target').next().val(FlagArray[0][0]); alert(sadsad); } } $('#entities').on('click', 'a', function (e) { if ($(this).parents('tr:first').find('td:eq(0)').attr('data-mask') !== 'Organization') { // setMaskState(this); } else { scalingCul(this); } }); $(".xms-checker").on("click", function () { var index = $(this).parent("tr").find(this).index(), type = $(this).attr("checkertype"), parentTable = $(this).parents("table"); if (type === "all") { setAllChecker(parentTable); //dianji(this); } else if (type === "cum") { setCumChecker(parentTable, index); } else if (type === "col") { // index = $(this).parent("tr").index(); // setColChecker(parentTable, index); } }); //$(".xms-checker").one("click", function () { // var index = $(this).parent("tr").find(this).index(), // type = $(this).attr("checkertype"), // parentTable = $(this).parents("table"); // if (type === "all") { // $('.xms-checker-target').find('img').prop('src', FlagArray[0][1]); // $('.xms-checker-target').next().val(FlagArray[0][0]); // } //}); //$(".xms-checker").one("click", function () { // var index = $(this).parent("tr").find(this).index(), // type = $(this).attr("checkertype"), // parentTable = $(this).parents("table"); // if (type === "cum") { // var checkers = parentTable.children("tbody").find("tr"); // checkers.each(function () { // var item = $(this).find("td").eq(index); // item.find('.xms-checker-target>img').prop('src', FlagArray[0][1]); // item.find('a').next().val(FlagArray[0][0]); // }) // } //}); $('.xms-checker-target').on('click', function (e) { e.stopPropagation(); if ($(this).parents('tr').find('td:eq(0)').attr('data-mask') !== 'Organization') { setMaskState(this) } else { scalingCul(this); } }) //$(".xms-checker").one("click", function () { // var index = $(this).parent("tr").find(this).index(), // type = $(this).attr("checkertype"), // parentTable = $(this).parents("table"); // if (type === "col") { // index = $(this).parent("tr").index(); // var checkers = parentTable.children("tbody").find("tr").eq(index).find("td"); // checkers.each(function () { // var item = $(this).find("a.xms-checker-target"); // if (item.length > 0) { // item.find('img').prop('src', FlagArray[0][1]); // item.next().val(FlagArray[0][0]); // } // }) // } //}); appendMaskDropdownMenus(); $('.xms-checker-target').addClass('btn btn-link'); loadResourceOwners(); }); function loadResourceOwners() { Xms.Web.GetJson(ORG_SERVERURL + "/api/security/ResourceOwners", null, function (data) { if (!data.IsSuccess) return; var items = JSON.parse(data.Content); var resourceName = $('#ResourceName').val().toLowerCase(); var $container = $('#owners'); $(items).each(function (i, n) { var url = (n.uiendpoint || '/role/editrolepermissions') + '?roleid=' + $("#RoleId").val() + '&resourcename=' + n.modulename; $container.append($('<button type="button" class="btn btn-sm ' + (resourceName == n.modulename.toLowerCase() ? 'btn-info' : 'btn-default') + '" data-url="' + url + '">' + n.modulelocalizedname + '</button>')); }); $container.find('button').on('click', null, function () { Xms.Web.Redirect($(this).attr('data-url')); }); }); } function appendMaskDropdownMenus() { var m = $('#mask_dropdownmenu'); $('#entities>tbody>tr').each(function (i, tr) { var type = $(tr).find('.xms-checker').attr('data-mask'); var tdLen = 0; $(tr).find('td:gt(0)').each(function (k, td) { tdLen = k; var el = m.clone(true).removeClass('hide'); el.prop('id', 'mask_dropdownmenu_' + k); if (type == 'Organization') { el.find('a').each(function (j, ela) { var maskValue = $(ela).attr('data-mask').trim().toLowerCase(); if (maskValue != 'none' && maskValue != 'organization') { $(ela).parent('li').addClass('hide'); } }) } el.find('a').on('click', null, function (e) { el.parents('td:first').find('input[name=mask]').val($(e.target).attr('data-mask')); el.parents('td:first').find('input[name=mask]').siblings('.xms-checker-target').eq(0).find('img').prop('src', $(e.target).find('img').prop('src')); }); $(td).find('input[name=mask]').after(el); }); var headerEl = m.clone(true).removeClass('hide'); headerEl.find('a').on('click', null, function (e) { var inputs = headerEl.parents('tr:first').find('input[name=mask]'); inputs.val($(e.target).attr('data-mask')); inputs.each(function () { $(this).siblings('.xms-checker-target').eq(0).find('img').prop('src', $(e.target).find('img').prop('src')); }) }); $(tr).each(function () { var $td = $(this).find('.xms-checker'); var mask = $td.attr('data-mask'); if (mask && mask != '') { mask = mask.toLowerCase(); if (mask == 'organization') { headerEl.find('a').each(function (j, ela) { var maskValue = $(ela).attr('data-mask').trim().toLowerCase(); if (maskValue != 'none' && maskValue != 'organization') { $(ela).parent('li').addClass('hide'); } }) } } $(this).find('.xms-checker').append(headerEl); }); }); } </script> }
the_stack
@using WebApp.Models @model IEnumerable<ApplicationUser> @{ ViewBag.Title = "登录用户管理"; } <!-- MAIN CONTENT --> <div id="content"> <!-- quick navigation bar --> <div class="row"> <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4"> <h1 class="page-title txt-color-blueDark"> <i class="fa fa-table fa-fw "></i> 系统管理 <span> > 系统登录账号 </span> </h1> </div> <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8"> </div> </div> <!-- end quick navigation bar --> <!-- widget grid --> <section id="widget-grid" class=""> <!-- row --> <div class="row"> <!-- NEW WIDGET START --> <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-4" data-widget-editbutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-table"></i> </span> <h2>系统登录账号</h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body no-padding"> <div class="widget-body-toolbar"> <div class="row"> <div class="col-sm-8 "> <div class="btn-group"> <a href="javascript:resetpassword()" class="btn btn-sm btn-primary"> <i class="fa fa-key"></i> 重置密码 </a> </div> <div class="btn-group"> <a href="javascript:append()" class="btn btn-sm btn-default"> <i class="fa fa-plus"></i> 新增 </a> </div> <div class="btn-group"> <a href="javascript:removeit()" class="btn btn-sm btn-default"> <i class="fa fa-trash-o"></i> 删除 </a> </div> <div class="btn-group"> <a href="javascript:accept()" class="btn btn-sm btn-default"> <i class="fa fa-floppy-o"></i> 保存 </a> </div> <div class="btn-group"> <a href="javascript:reload()" class="btn btn-sm btn-default"> <i class="fa fa-refresh"></i> 刷新 </a> </div> <div class="btn-group"> <a href="javascript:reject()" class="btn btn-sm btn-default"> <i class="fa fa-window-close-o"></i> 取消 </a> </div> <div class="btn-group"> <button type="button" onclick="importexcel()" class="btn btn-default"><i class="fa fa-upload"></i> 导入数据 </button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span> <span class="sr-only">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> <li><a href="javascript:importexcel()"><i class="fa fa-upload"></i> 上传Excel </a></li> <li role="separator" class="divider"></li> <li><a href="javascript:downloadtemplate()"><i class="fa fa-download"></i> 下载模板 </a></li> </ul> </div> <div class="btn-group"> <a href="javascript:exportexcel()" class="btn btn-sm btn-default"> <i class="fa fa-file-excel-o"></i> 导出Excel </a> </div> <div class="btn-group"> <a href="javascript:print()" class="btn btn-sm btn-default"> <i class="fa fa-print"></i> 打印 </a> </div> <div class="btn-group"> <a href="javascript:dohelp()" class="btn btn-sm btn-default"> <i class="fa fa-question-circle-o"></i> 帮助 </a> </div> </div> <div class="col-sm-4 text-align-right"> <div class="btn-group"> <a href="javascript:window.history.back()" class="btn btn-sm btn-success"> <i class="fa fa-chevron-left"></i> 返回 </a> </div> </div> </div> </div> <div class="alert alert-warning no-margin fade in"> <button class="close" data-dismiss="alert"> × </button> <i class="fa-fw fa fa-info"></i> 注意事项: </div> <!--begin datagrid-content --> <div class="table-responsive"> <table id="users_datagrid"></table> </div> <!--end datagrid-content --> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- WIDGET END --> </div> <!-- end row --> </section> <!-- end widget grid --> @Html.Partial("_ResetPasswordPartial") </div> <!-- END MAIN CONTENT --> @section Scripts { <script type="text/javascript"> var entityname = "ApplicationUser"; function downloadtemplate() { } //打印 function print() { $dg.datagrid('print', 'DataGrid'); } //打开Excel上传导入 function importexcel() { } //执行Excel到处下载 function exportexcel() { } //显示帮助信息 function dohelp() { } function resetpassword() { var row = $dg.datagrid('getChecked'); if (row.length === 0) { $.messager.alert("提示", "请选中需要重置密码的记录!"); } else { //console.log(row); showresetform(row[0].Id, row[0].UserName); } } function reload() { $dg.datagrid('reload'); } var $dg = $('#users_datagrid'); var editIndex = undefined; function endEditing() { if (editIndex == undefined) { return true } if ($dg.datagrid('validateRow', editIndex)) { $dg.datagrid('endEdit', editIndex); editIndex = undefined; return true; } else { return false; } } function onClickCell(index, field) { if (editIndex != index) { if (endEditing()) { editIndex = index; $dg.datagrid('selectRow', index) .datagrid('beginEdit', index); var ed = $dg.datagrid('getEditor', { index: index, field: field }); if (ed) { ($(ed.target).data('textbox') ? $(ed.target).textbox('textbox') : $(ed.target)).focus(); } } else { $dg.datagrid('selectRow', editIndex); } } } function append() { if (endEditing()) { $dg.datagrid("insertRow", { index: 0, row: { } }); editIndex = $dg.datagrid('getRows').length - 1; $dg.datagrid('selectRow', editIndex) .datagrid('beginEdit', editIndex); } } function removeit() { if (editIndex == undefined) { return } $dg.datagrid('cancelEdit', editIndex) .datagrid('deleteRow', editIndex); editIndex = undefined; } function accept() { if (endEditing()) { if ($dg.datagrid('getChanges').length) { var inserted = $dg.datagrid('getChanges', "inserted"); var deleted = $dg.datagrid('getChanges', "deleted"); var updated = $dg.datagrid('getChanges', "updated"); var effectRow = new Object(); if (inserted.length) { effectRow.inserted = inserted; } if (deleted.length) { effectRow.deleted = deleted; } if (updated.length) { effectRow.updated = updated; } //console.log(JSON.stringify(effectRow)); $.post("/AccountManage/SaveData", effectRow, function (response) { if (response.success) { $.messager.alert("提示", "提交成功!"); $dg.datagrid('acceptChanges'); //$dg.datagrid('reload'); } }, "json").fail(function () { $.messager.alert("错误", "提交错误了!", 'error'); }); } $dg.datagrid('acceptChanges'); } } function reject() { $dg.datagrid('rejectChanges'); editIndex = undefined; } function getChanges() { var rows = $dg.datagrid('getChanges'); alert(rows.length + ' rows are changed!'); } $(function () { $dg.datagrid({ rownumbers: true, checkOnSelect: true, selectOnCheck: true, idField: 'Id', sortName: 'Id', sortOrder: 'desc', remoteFilter: true, singleSelect: true, url: '/AccountManage/GetData', method: 'get', onClickCell: onClickCell, pagination: true, striped: true, columns: [[ { field: 'ck', checkbox: true }, { field: 'UserName', title: '<span class="required">账号名称</span>', width: 140, editor: { type: 'textbox', options: { prompt: '@Html.DisplayNameFor(model => model.UserName)', required: true, validType: 'length[0,30]' } }, sortable: true, resizable: true }, { field: 'FullName', title: '<span class="required">@Html.DisplayNameFor(model => model.FullName)</span>', width: 140, editor: { type: 'textbox', options: { prompt: '@Html.DisplayNameFor(model => model.FullName)', required: true, validType: 'length[0,30]' } }, sortable: true, resizable: true }, { field: 'Email', title: '<span class="required">电子邮件</span>', width: 240, editor: { type: 'textbox', options: { prompt: '@Html.DisplayNameFor(model => model.Email)', required: true, validType: ['email', 'length[0,50]']} }, sortable: true, resizable: true }, { field: 'CompanyCode', title:'@Html.DisplayNameFor(model => model.CompanyCode)', width: 140, editor: { type: 'combogrid', options: { prompt: '公司', required: false, validType: 'length[0,50]', idField: 'CompanyCode', panelWidth: 400, textField: 'CompanyName', method: 'get', url: '/AccountManage/GetCompanyData', columns: [[ { field: 'CompanyCode', title: '公司代码', width: 80 }, { field: 'CompanyName', title: '公司名称', width: 230 }, { field: 'Type', title: '类型', width: 80, formatter: accounttypeformatter } ]], onSelect: function (rowIndex, rowData) { var row = $dg.datagrid('getRows')[editIndex]; row.CompanyName = rowData.CompanyName; row.CompanyCode = rowData.CompanyCode; var ed1 = $dg.datagrid('getEditor', { index: editIndex, field: 'AccountType' }); $(ed1.target).combobox('setValue', rowData.Type); } } }, formatter: function (value, row, index) { return row.CompanyName } }, { field: 'AccountType', title: '<span class="required">企业类型</span>', width: 100, align: 'right', editor: { type: 'accounttypeeditor', options: { prompt: '@Html.DisplayNameFor(model => model.AccountType)', required: true } }, formatter: accounttypeformatter }, { field: 'PhoneNumber', title: '<span class="required">电话号码</span>', width: 140, editor: { type: 'textbox', options: { prompt: '@Html.DisplayNameFor(model => model.PhoneNumber)', required: false } }, sortable: true, resizable: true }, { field: 'AvatarsX50', title: '@Html.DisplayNameFor(model => model.AvatarsX50)', width: 140, editor: { type: 'combobox', options: { prompt: '@Html.DisplayNameFor(model => model.AvatarsX50)', required: false, method: 'get', valueField: 'name', textField: 'name', panelHeight: 'auto', url: '/AccountManage/GetAvatarsX50', formatter: function (row) { var imageFile = '/content/img/avatars/' + row.name + ".png"; return '<img class="item-img" src="' + imageFile + '"/><span class="item-text">' + row.name + '</span>'; } } }, sortable: true, resizable: true }, { field: 'EnabledChat', title: '<span class="required">@Html.DisplayNameFor(model => model.EnabledChat)</span>', width: 120, align: 'center', editor: { type: 'booleaneditor', options: { prompt: '@Html.DisplayNameFor(model => model.EnabledChat)', required: true } }, formatter: booleanformatter, sortable: true, resizable: true }, { field: 'IsOnline', title: 'IsOnline',width: 120, formatter: booleanformatter }, { field: 'AccessFailedCount', title: 'AccessFailedCount', width: 120 }, { field: 'LockoutEnabled', title: 'LockoutEnabled', width: 120, formatter: booleanformatter }, { field: 'LockoutEndDateUtc', title: 'LockoutEndDateUtc', width: 120 } ]] }); $dg.datagrid('enableFilter'); }); </script> <script type="text/javascript"> var $resetForm = {}; $(function () { $resetForm = $("#resetpassword-form").validate({ // Rules for form validation rules: { rusername: { required: true }, rpassword: { required: true, minlength: 3, maxlength: 20 }, rpasswordConfirm: { required: true, minlength: 3, maxlength: 20, equalTo: '#rpassword' } }, // Messages for form validation messages: { rusername: { required: 'Please enter your user name' }, rpassword: { required: 'Please enter your password' }, rpasswordConfirm: { required: 'Please enter your password one more time', equalTo: 'Please enter the same password as above' } }, // Do not change code below errorPlacement: function (error, element) { error.insertAfter(element.parent()); } }); }); function showresetform(userid, username) { $('#rusername').val(username); $('#ruserid').val(userid); console.log(userid); $('#resetpasswordModal').modal('toggle'); } function setpassword() { if ($resetForm.valid()) { var id = $('#ruserid').val(); var password = $('#rpassword').val(); var url = "/AccountManage/ResetPassword?id=" + id + "&newPassword=" + password; $.get(url, function (res) { console.log(res); if (res.Succeeded) { $('#resetpasswordModal').modal('toggle'); } else { $.messager.alert("错误", res.Errors[0]) } }); } } </script> <link href="~/Scripts/easyui/themes/insdep/icon.css" rel="stylesheet" /> <link href="~/Scripts/easyui/themes/insdep/easyui.css" rel="stylesheet" /> <script src="~/Scripts/jquery.filerupload.min.js"></script> }
the_stack
@{ Layout = "~/Views/Shared/_LayoutBlank.cshtml"; } <style> body { /*margin-top: 1.5rem;*/ margin-top: 1.2rem; margin-bottom: 0.55rem; } #divTopTitleBar { position: fixed; left: 0rem; right: 0rem; /*top: 1rem;*/ top:0.7rem; height: 0.4rem; background-color: white; } .imgItem { max-height: 0.75rem; max-width: 0.9rem; vertical-align: middle; } .divItemDetailTitle { height: 0.35rem; line-height: 0.35rem; text-align: center; font-size: 0.16rem; font-weight: bold; color: #FFFFFF; } .divBorder { border: 1px solid #CCC; height: 0.3rem; font-size: 0.15rem; line-height: 0.3rem; } #divFooter { position: fixed; bottom: 0px; left: 0px; right: 0px; height: 0.4rem; font-size: 0.14rem; text-align: center; background-color: #F5F5F5; } </style> <script> var _lucky = false; //当前页 var _currentPage = 1; var _totalPage = 1; $(document).ready(function () { loadData(); }); function loadData(targetPage) { if (targetPage > _totalPage) return; var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); var args = new Object(); args.Page = targetPage || 1; args.PageSize = 10; args.Lucky = _lucky; $.ajax({ url: "/Api/OneDollarBuying/GetParticipatedList/@ViewBag.Domain.Id", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; _currentPage = resultObj.Page; _totalPage = resultObj.TotalPage; if (_currentPage >= _totalPage) { $("#divPagingContainer").html("没有更多了"); } if (_currentPage == 1) { document.getElementById('divCommodityContainer').innerHTML = ""; } var gettpl = document.getElementById('commodityListTemplate').innerHTML; laytpl(gettpl).render(resultObj.ItemList, function (html) { document.getElementById('divCommodityContainer').innerHTML += html; }); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); // alert("Error: " + xmlHttpRequest.status); } }); } function commodityDetail(commodityId, saleId) { window.location.href = '/Campaign/OneDollarBuyingCommodityDetail/@ViewBag.Domain.Id?commodityId=' + commodityId + "&saleId=" + saleId; } function goAvailableSale(commodityId) { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/OneDollarBuying/GetAvailableSaleId/@ViewBag.Domain.Id?commodityId=" + commodityId, type: "POST", dataType: "json", success: function (data, status, jqXHR) { if (data.Success) { var resultObj = data.Data; window.location.href = "/Campaign/OneDollarBuyingCommodityDetail/@ViewBag.Domain.Id?commodityId=" + commodityId + "&saleId=" + resultObj; } else { layer.close(loadLayerIndex); layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function showDealInfo(saleId) { var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/OneDollarBuying/GetDealInfo/@ViewBag.Domain.Id?saleId=" + saleId, type: "POST", dataType: "json", success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; var gettpl = document.getElementById('itemDetailTemplate').innerHTML; laytpl(gettpl).render(resultObj, function (html) { var pageii = layer.open({ type: 1, content: html, shadeClose: false, style: 'position:fixed; left:0.1rem; top:0.1rem;right:0.1rem; border:none;' }); }); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function loadAll() { $("#btnLoadAll").attr("class", "button"); $("#btnLoadLucky").attr("class", "button_gray"); _lucky = false; loadData(); } function loadLucky() { $("#btnLoadAll").attr("class", "button_gray"); $("#btnLoadLucky").attr("class", "button"); _lucky = true; loadData(); } function deposit() { window.location.href = '/Pay/Deposit/@ViewBag.Domain.Id'; } </script> <script id="commodityListTemplate" type="text/html"> {{# for(var i = 0, len = d.length; i < len; i++){ }} <div style="font-size:0.12rem; color:#555555;"> <div onclick="commodityDetail('{{ d[i].CommodityId }}','{{ d[i].Id }}')"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width:1rem;"> <img src="{{ d[i].ImageUrl }}" class="imgItem"> </td> <td> <div style="font-size:0.14rem;font-weight:bold;color:black">{{ d[i].Name }}</div> <div style="margin-top:0.05rem;"> <div style="margin-top:0.05rem;">期号:{{ d[i].PeriodNumber }}</div> <div style="margin-top:0.05rem;">您参与了:<span style="color:red">{{ d[i].MyPartNumberCount }}</span>人次</div> </div> </td> </tr> </table> </div> {{# if(d[i].LuckyMember != null){ }} <div style="margin-top:0.15rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> 获得者: {{# if(d[i].LuckyMember == '@ViewBag.Member.Id'){ }} <span style="color:Red">您</span> {{# }else{}} <span style="color:#2659FF">{{ d[i].LuckyMemberNickName }}</span> (<span style="color:red">{{ d[i].LuckyMemberPartNumberCount }}</span>人次) {{# }}} </td> <td align="right"> <div> <div class="divRectangle" style="width:0.9rem;float:right;margin-left:0.05rem;" onclick="goAvailableSale('{{ d[i].CommodityId }}')"> 再次参与 </div> {{# if(d[i].LuckyMember == '@ViewBag.Member.Id'){ }} {{# if(d[i].Deal == '0'){ }} <div class="divRectangle" style="width:0.7rem;float:right" onclick="showDealInfo('{{ d[i].Id }}')"> 待领取 </div> {{# }else{}} <div class="divRectangle_Gray" style="width:0.7rem;float:right" onclick="showDealInfo('{{ d[i].Id }}')"> 已领取 </div> {{# }}} {{# }}} <div style="clear:both"></div> </div> </td> </tr> </table> </div> {{# }else{}} {{# if(d[i].SoldPart >= d[i].TotalPart ){ }} <div style="margin-top:0.15rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> 马上揭晓 </td> <td align="right"> <div class="divLogButton" style="width:0.7rem;" onclick="goAvailableSale('{{ d[i].CommodityId }}')"> 再次参与 </div> </td> </tr> </table> </div> {{# }else{}} <div style="margin-top:0.15rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> 尚未结束 </td> <td align="right"> <div class="divRectangle" style="width:0.9rem;" onclick="commodityDetail('{{ d[i].CommodityId }}','{{ d[i].Id }}')"> 参与 </div> </td> </tr> </table> </div> {{# }}} {{# }}} </div> <div class="divDotLine" style="margin-top:0.13rem; margin-bottom:0.13rem; "> </div> {{# } }} </script> <script type="text/html" id="itemDetailTemplate"> <div class="divItemDetailTitle defaultBgColor"> 恭喜您 </div> <div style="font-size:0.18rem;padding:0.1rem;padding-bottom:0.2rem;"> <div style="font-size:0.15rem;font-weight:bold">{{ d.CommodityName }}</div> <div style="font-size:0.14rem;margin-top:0.1rem;">期号:{{ d.PeriodNumber }}</div> <div style="font-size:0.14rem;margin-top:0.05rem;">幸运号码:{{ d.LuckyPartNumber }}</div> <div style="font-size:0.14rem;margin-top:0.05rem;">揭晓时间:{{ d.DrawTime }}</div> {{# if(d.Deal == 1){ }} <div style="font-size:0.14rem;margin-top:0.05rem;">领取时间:{{ d.DealTime }}</div> {{# }}} <div style="margin-top:0.2rem;"> {{# if(d.Deal == 0){ }} <div style="margin-left:0.4rem;margin-right:0.4rem;height:0.2rem;line-height:0.2rem;text-align:center;color:red"> 待领取 </div> {{# }else{}} <div style="margin-left:0.4rem;margin-right:0.4rem;height:0.2rem;line-height:0.2rem;text-align:center;color:#555555"> 已领取 </div> {{# }}} <div class="divRectangle_Gray" style="margin-top:0.1rem;margin-left:0.4rem;margin-right:0.4rem;" onclick="layer.closeAll()"> 关闭 </div> </div> </div> </script> @Helpers.OneDollarBuyingIntroduction() @Helpers.HeaderArea(ViewBag, "headimg") <div id="divTopTitleBar"> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:100%"> <tr style="height:0.27rem;"> <td width="33%" align="center"><div onclick="goUrl('/Campaign/OneDollarBuying/@ViewBag.Domain.Id')">正在进行</div></td> <td width="33%" align="center"><div onclick="goUrl('/Campaign/OneDollarBuyingLuckyList/@ViewBag.Domain.Id')">最新揭晓</div></td> <td width="33%" align="center"><div onclick="goUrl('/Campaign/OneDollarBuyingParticipatedList/@ViewBag.Domain.Id')">我的参与</div></td> </tr> <tr style="height:0.03rem;"> <td bgcolor="#E4E4E4"></td> <td bgcolor="#E4E4E4"></td> <td class="defaultBgColor"></td> </tr> </table> </div> <div class="divContent"> <div id="divCommodityContainer" style="padding-left: 0.1rem; padding-right: 0.1rem;margin-top:0.2rem;"> </div> <div id="divPagingContainer" class="divPagingContainer" style="margin-top: 0.2rem; text-align: center" onclick="loadData(_currentPage + 1)"> 查看更多 </div> </div> <div id="divFooter"> <table align="center" border="0" style="height:100%;width:100%"> <tr> <td valign="middle" align="center" width="50%"> <input id="btnLoadAll" name="btnLoadAll" type="button" class="button" value="全部参与" style="width:90%" onclick="loadAll()"> </td> <td valign="middle" align="center" width="50%"> <input id="btnLoadLucky" name="btnLoadLucky" type="button" class="button_gray" value="幸运记录" style="width:90%" onclick="loadLucky()"> </td> </tr> </table> </div>
the_stack
public class MsixInstaller : IInstaller { public MsixInstaller(BuildContext buildContext) { BuildContext = buildContext; Publisher = BuildContext.BuildServer.GetVariable("MsixPublisher", showValue: true); UpdateUrl = BuildContext.BuildServer.GetVariable("MsixUpdateUrl", showValue: true); IsEnabled = BuildContext.BuildServer.GetVariableAsBool("MsixEnabled", true, showValue: true); if (IsEnabled) { // In the future, check if Msix is installed. Log error if not IsAvailable = IsEnabled; } } public BuildContext BuildContext { get; private set; } public string Publisher { get; private set; } public string UpdateUrl { get; private set; } public bool IsEnabled { get; private set; } public bool IsAvailable { get; private set; } //------------------------------------------------------------- public async Task PackageAsync(string projectName, string channel) { if (!IsAvailable) { BuildContext.CakeContext.Information("MSIX is not enabled or available, skipping integration"); return; } var makeAppxFileName = FindLatestMakeAppxFileName(); if (!BuildContext.CakeContext.FileExists(makeAppxFileName)) { BuildContext.CakeContext.Information("Could not find MakeAppX.exe, skipping MSIX integration"); return; } var msixTemplateDirectory = System.IO.Path.Combine(".", "deployment", "msix", projectName); if (!BuildContext.CakeContext.DirectoryExists(msixTemplateDirectory)) { BuildContext.CakeContext.Information($"Skip packaging of app '{projectName}' using MSIX since no MSIX template is present"); return; } var signToolCommand = string.Empty; if (!string.IsNullOrWhiteSpace(BuildContext.General.CodeSign.CertificateSubjectName)) { signToolCommand = string.Format("sign /a /t {0} /n {1}", BuildContext.General.CodeSign.TimeStampUri, BuildContext.General.CodeSign.CertificateSubjectName); } else { BuildContext.CakeContext.Warning("No sign tool is defined, MSIX will not be installable to (most or all) users"); } BuildContext.CakeContext.LogSeparator($"Packaging app '{projectName}' using MSIX"); var deploymentShare = BuildContext.Wpf.GetDeploymentShareForProject(projectName); var installersOnDeploymentsShare = GetDeploymentsShareRootDirectory(projectName, channel); var setupSuffix = BuildContext.Installer.GetDeploymentChannelSuffix(); var msixOutputRoot = System.IO.Path.Combine(BuildContext.General.OutputRootDirectory, "msix", projectName); var msixReleasesRoot = System.IO.Path.Combine(msixOutputRoot, "releases"); var msixOutputIntermediate = System.IO.Path.Combine(msixOutputRoot, "intermediate"); BuildContext.CakeContext.CreateDirectory(msixReleasesRoot); BuildContext.CakeContext.CreateDirectory(msixOutputIntermediate); // Set up MSIX template, all based on the documentation here: https://docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-manual-conversion BuildContext.CakeContext.CopyDirectory(msixTemplateDirectory, msixOutputIntermediate); var msixInstallerName = $"{projectName}_{BuildContext.General.Version.FullSemVer}.msix"; var installerSourceFile = System.IO.Path.Combine(msixReleasesRoot, msixInstallerName); var variables = new Dictionary<string, string>(); variables["[PRODUCT]"] = projectName; variables["[PRODUCT_WITH_CHANNEL]"] = projectName + BuildContext.Installer.GetDeploymentChannelSuffix(""); variables["[PRODUCT_WITH_CHANNEL_DISPLAY]"] = projectName + BuildContext.Installer.GetDeploymentChannelSuffix(" (", ")"); variables["[PUBLISHER]"] = Publisher; variables["[PUBLISHER_DISPLAY]"] = BuildContext.General.Copyright.Company; variables["[CHANNEL_SUFFIX]"] = setupSuffix; variables["[CHANNEL]"] = BuildContext.Installer.GetDeploymentChannelSuffix(" (", ")"); variables["[VERSION]"] = BuildContext.General.Version.MajorMinorPatch; variables["[VERSION_WITH_REVISION]"] = $"{BuildContext.General.Version.MajorMinorPatch}.{BuildContext.General.Version.CommitsSinceVersionSource}"; variables["[VERSION_DISPLAY]"] = BuildContext.General.Version.FullSemVer; variables["[WIZARDIMAGEFILE]"] = string.Format("logo_large{0}", setupSuffix); // Important: urls must be lower case, they are case sensitive in azure blob storage variables["[URL_APPINSTALLER]"] = $"{UpdateUrl}/{projectName}/{channel}/msix/{projectName}.appinstaller".ToLower(); variables["[URL_MSIX]"] = $"{UpdateUrl}/{projectName}/{channel}/msix/{msixInstallerName}".ToLower(); // Installer file var msixScriptFileName = System.IO.Path.Combine(msixOutputIntermediate, "AppxManifest.xml"); ReplaceVariablesInFile(msixScriptFileName, variables); // Update file var msixUpdateScriptFileName = System.IO.Path.Combine(msixOutputIntermediate, "App.AppInstaller"); if (BuildContext.CakeContext.FileExists(msixUpdateScriptFileName)) { ReplaceVariablesInFile(msixUpdateScriptFileName, variables); } // Copy all files to the intermediate directory so MSIX knows what to do var appSourceDirectory = string.Format("{0}/{1}/**/*", BuildContext.General.OutputRootDirectory, projectName); var appTargetDirectory = msixOutputIntermediate; BuildContext.CakeContext.Information("Copying files from '{0}' => '{1}'", appSourceDirectory, appTargetDirectory); BuildContext.CakeContext.CopyFiles(appSourceDirectory, appTargetDirectory, true); BuildContext.CakeContext.Information($"Signing files in '{appTargetDirectory}'"); var filesToSign = new List<string>(); filesToSign.AddRange(BuildContext.CakeContext.GetFiles($"{appTargetDirectory}/**/*.dll").Select(x => x.FullPath)); filesToSign.AddRange(BuildContext.CakeContext.GetFiles($"{appTargetDirectory}/**/*.exe").Select(x => x.FullPath)); SignFiles(BuildContext, signToolCommand, filesToSign); BuildContext.CakeContext.Information("Generating MSIX packages using MakeAppX..."); var processSettings = new ProcessSettings { WorkingDirectory = appTargetDirectory, }; processSettings.WithArguments(a => a.Append("pack") .AppendSwitchQuoted("/p", installerSourceFile) //.AppendSwitchQuoted("/m", msixScriptFileName) // If we specify this one, we *must* provide a mappings file, which we don't want to do //.AppendSwitchQuoted("/f", msixScriptFileName) .AppendSwitchQuoted("/d", appTargetDirectory) //.Append("/v") .Append("/o")); using (var process = BuildContext.CakeContext.StartAndReturnProcess(makeAppxFileName, processSettings)) { process.WaitForExit(); var exitCode = process.GetExitCode(); if (exitCode != 0) { throw new Exception($"Packaging failed, exit code is '{exitCode}'"); } } // As documented at https://docs.microsoft.com/en-us/windows/msix/package/sign-app-package-using-signtool, we // must *always* specify the hash algorithm (/fd) for MSIX files SignFile(BuildContext, signToolCommand, installerSourceFile, "/fd SHA256"); // Always copy the AppInstaller if available if (BuildContext.CakeContext.FileExists(msixUpdateScriptFileName)) { BuildContext.CakeContext.Information("Copying update manifest to output directory"); // - App.AppInstaller => [projectName].AppInstaller BuildContext.CakeContext.CopyFile(msixUpdateScriptFileName, System.IO.Path.Combine(msixReleasesRoot, $"{projectName}.AppInstaller")); } if (BuildContext.Wpf.UpdateDeploymentsShare) { BuildContext.CakeContext.Information("Copying MSIX files to deployments share at '{0}'", installersOnDeploymentsShare); // Copy the following files: // - [ProjectName]_[version].msix => [projectName]_[version].msix // - [ProjectName]_[version].msix => [projectName]_[channel].msix BuildContext.CakeContext.CopyFile(installerSourceFile, System.IO.Path.Combine(installersOnDeploymentsShare, msixInstallerName)); BuildContext.CakeContext.CopyFile(installerSourceFile, System.IO.Path.Combine(installersOnDeploymentsShare, $"{projectName}{setupSuffix}.msix")); if (BuildContext.CakeContext.FileExists(msixUpdateScriptFileName)) { // - App.AppInstaller => [projectName].AppInstaller BuildContext.CakeContext.CopyFile(msixUpdateScriptFileName, System.IO.Path.Combine(installersOnDeploymentsShare, $"{projectName}.AppInstaller")); } } } //------------------------------------------------------------- public async Task<DeploymentTarget> GenerateDeploymentTargetAsync(string projectName) { var deploymentTarget = new DeploymentTarget { Name = "MSIX" }; var channels = new [] { "alpha", "beta", "stable" }; var deploymentGroupNames = new List<string>(); var projectDeploymentShare = BuildContext.Wpf.GetDeploymentShareForProject(projectName); if (BuildContext.Wpf.GroupUpdatesByMajorVersion) { // Check every directory that we can parse as number var directories = System.IO.Directory.GetDirectories(projectDeploymentShare); foreach (var directory in directories) { var deploymentGroupName = new System.IO.DirectoryInfo(directory).Name; if (int.TryParse(deploymentGroupName, out _)) { deploymentGroupNames.Add(deploymentGroupName); } } } else { // Just a single group deploymentGroupNames.Add("all"); } foreach (var deploymentGroupName in deploymentGroupNames) { BuildContext.CakeContext.Information($"Searching for releases for deployment group '{deploymentGroupName}'"); var deploymentGroup = new DeploymentGroup { Name = deploymentGroupName }; var version = deploymentGroupName; if (version == "all") { version = string.Empty; } foreach (var channel in channels) { BuildContext.CakeContext.Information($"Searching for releases for deployment channel '{deploymentGroupName}/{channel}'"); var deploymentChannel = new DeploymentChannel { Name = channel }; var targetDirectory = GetDeploymentsShareRootDirectory(projectName, channel, version); BuildContext.CakeContext.Information($"Searching for release files in '{targetDirectory}'"); var msixFiles = System.IO.Directory.GetFiles(targetDirectory, "*.msix"); foreach (var msixFile in msixFiles) { var releaseFileInfo = new System.IO.FileInfo(msixFile); var relativeFileName = new DirectoryPath(projectDeploymentShare).GetRelativePath(new FilePath(releaseFileInfo.FullName)).FullPath.Replace("\\", "/"); var releaseVersion = releaseFileInfo.Name .Replace($"{projectName}_", string.Empty) .Replace($".msix", string.Empty); // Either empty or matching a release channel should be ignored if (string.IsNullOrWhiteSpace(releaseVersion) || channels.Any(x => x == releaseVersion)) { BuildContext.CakeContext.Information($"Ignoring '{msixFile}'"); continue; } // Special case for stable releases if (channel == "stable") { if (releaseVersion.Contains("-alpha") || releaseVersion.Contains("-beta")) { BuildContext.CakeContext.Information($"Ignoring '{msixFile}'"); continue; } } BuildContext.CakeContext.Information($"Applying release based on '{msixFile}'"); var release = new DeploymentRelease { Name = releaseVersion, Timestamp = releaseFileInfo.CreationTimeUtc }; // Only support full versions release.Full = new DeploymentReleasePart { RelativeFileName = relativeFileName, Size = (ulong)releaseFileInfo.Length }; deploymentChannel.Releases.Add(release); } deploymentGroup.Channels.Add(deploymentChannel); } deploymentTarget.Groups.Add(deploymentGroup); } return deploymentTarget; } //------------------------------------------------------------- private string GetDeploymentsShareRootDirectory(string projectName, string channel) { var version = string.Empty; if (BuildContext.Wpf.GroupUpdatesByMajorVersion) { version = BuildContext.General.Version.Major; } return GetDeploymentsShareRootDirectory(projectName, channel, version); } //------------------------------------------------------------- private string GetDeploymentsShareRootDirectory(string projectName, string channel, string version) { var deploymentShare = BuildContext.Wpf.GetDeploymentShareForProject(projectName); if (!string.IsNullOrWhiteSpace(version)) { deploymentShare = System.IO.Path.Combine(deploymentShare, version); } var installersOnDeploymentsShare = System.IO.Path.Combine(deploymentShare, channel, "msix"); BuildContext.CakeContext.CreateDirectory(installersOnDeploymentsShare); return installersOnDeploymentsShare; } //------------------------------------------------------------- private void ReplaceVariablesInFile(string fileName, Dictionary<string, string> variables) { var fileContents = System.IO.File.ReadAllText(fileName); foreach (var keyValuePair in variables) { fileContents = fileContents.Replace(keyValuePair.Key, keyValuePair.Value); } System.IO.File.WriteAllText(fileName, fileContents); } //------------------------------------------------------------- private string FindLatestMakeAppxFileName() { var directory = FindLatestWindowsKitsDirectory(BuildContext); if (directory != null) { return System.IO.Path.Combine(directory, "x64", "makeappx.exe"); } return null; } }
the_stack
 <!-- MAIN CONTENT --> <div id="content"> <!-- row --> <div class="row"> <!-- col --> <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4"> <h1 class="page-title txt-color-blueDark"> <!-- PAGE HEADER --><i class="fa-fw fa fa-home"></i> Page Header <span> > Subtitle </span> </h1> </div> <!-- end col --> <!-- right side of the page with the sparkline graphs --> <!-- col --> <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8"> <!-- sparks --> <ul id="sparks"> <li class="sparks-info"> <h5> My Income <span class="txt-color-blue">$47,171</span></h5> <div class="sparkline txt-color-blue hidden-mobile hidden-md hidden-sm"> 1300, 1877, 2500, 2577, 2000, 2100, 3000, 2700, 3631, 2471, 2700, 3631, 2471 </div> </li> <li class="sparks-info"> <h5> Site Traffic <span class="txt-color-purple"><i class="fa fa-arrow-circle-up" data-rel="bootstrap-tooltip" title="Increased"></i>&nbsp;45%</span></h5> <div class="sparkline txt-color-purple hidden-mobile hidden-md hidden-sm"> 110,150,300,130,400,240,220,310,220,300, 270, 210 </div> </li> <li class="sparks-info"> <h5> Site Orders <span class="txt-color-greenDark"><i class="fa fa-shopping-cart"></i>&nbsp;2447</span></h5> <div class="sparkline txt-color-greenDark hidden-mobile hidden-md hidden-sm"> 110,150,300,130,400,240,220,310,220,300, 270, 210 </div> </li> </ul> <!-- end sparks --> </div> <!-- end col --> </div> <!-- end row --> <!-- The ID "widget-grid" will start to initialize all widgets below You do not need to use widgets if you dont want to. Simply remove the <section></section> and you can use wells or panels instead --> <!-- widget grid --> <section id="widget-grid" class=""> <!-- row --> <div class="row"> <!-- NEW WIDGET START --> <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <table id="jqgrid"></table> <div id="pjqgrid"></div> <br> <a href="javascript:void(0)" id="m1">Get Selected id's</a> <br> <a href="javascript:void(0)" id="m1s">Select(Unselect) row 13</a> </article> <!-- WIDGET END --> </div> <!-- end row --> </section> <!-- end widget grid --> </div> <!-- END MAIN CONTENT --> @section pagespecific { <script type="text/javascript"> $(document).ready(function () { pageSetUp(); var jqgrid_data = [{ id: "1", date: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "2", date: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "3", date: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }, { id: "4", date: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "5", date: "2007-10-05", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "6", date: "2007-09-06", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }, { id: "7", date: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "8", date: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "9", date: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }, { id: "10", date: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "11", date: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "12", date: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }, { id: "13", date: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "14", date: "2007-10-05", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "15", date: "2007-09-06", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }, { id: "16", date: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "17", date: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "18", date: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }]; jQuery("#jqgrid").jqGrid({ data: jqgrid_data, datatype: "local", height: 'auto', colNames: ['Actions', 'Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'], colModel: [{ name: 'act', index: 'act', sortable: false }, { name: 'id', index: 'id' }, { name: 'date', index: 'date', editable: true }, { name: 'name', index: 'name', editable: true }, { name: 'amount', index: 'amount', align: "right", editable: true }, { name: 'tax', index: 'tax', align: "right", editable: true }, { name: 'total', index: 'total', align: "right", editable: true }, { name: 'note', index: 'note', sortable: false, editable: true }], rowNum: 10, rowList: [10, 20, 30], pager: '#pjqgrid', sortname: 'id', toolbarfilter: true, viewrecords: true, sortorder: "asc", gridComplete: function () { var ids = jQuery("#jqgrid").jqGrid('getDataIDs'); for (var i = 0; i < ids.length; i++) { var cl = ids[i]; be = "<button class='btn btn-xs btn-default' data-original-title='Edit Row' onclick=\"jQuery('#jqgrid').editRow('" + cl + "');\"><i class='fa fa-pencil'></i></button>"; se = "<button class='btn btn-xs btn-default' data-original-title='Save Row' onclick=\"jQuery('#jqgrid').saveRow('" + cl + "');\"><i class='fa fa-save'></i></button>"; ca = "<button class='btn btn-xs btn-default' data-original-title='Cancel' onclick=\"jQuery('#jqgrid').restoreRow('" + cl + "');\"><i class='fa fa-times'></i></button>"; //ce = "<button class='btn btn-xs btn-default' onclick=\"jQuery('#jqgrid').restoreRow('"+cl+"');\"><i class='fa fa-times'></i></button>"; //jQuery("#jqgrid").jqGrid('setRowData',ids[i],{act:be+se+ce}); jQuery("#jqgrid").jqGrid('setRowData', ids[i], { act: be + se + ca }); } }, editurl: "dummy.html", caption: "SmartAdmin jQgrid Skin", multiselect: true, autowidth: true, }); jQuery("#jqgrid").jqGrid('navGrid', "#pjqgrid", { edit: false, add: false, del: true }); jQuery("#jqgrid").jqGrid('inlineNav', "#pjqgrid"); /* Add tooltips */ $('.navtable .ui-pg-button').tooltip({ container: 'body' }); jQuery("#m1").click(function () { var s; s = jQuery("#jqgrid").jqGrid('getGridParam', 'selarrrow'); alert(s); }); jQuery("#m1s").click(function () { jQuery("#jqgrid").jqGrid('setSelection', "13"); }); // remove classes $(".ui-jqgrid").removeClass("ui-widget ui-widget-content"); $(".ui-jqgrid-view").children().removeClass("ui-widget-header ui-state-default"); $(".ui-jqgrid-labels, .ui-search-toolbar").children().removeClass("ui-state-default ui-th-column ui-th-ltr"); $(".ui-jqgrid-pager").removeClass("ui-state-default"); $(".ui-jqgrid").removeClass("ui-widget-content"); // add classes $(".ui-jqgrid-htable").addClass("table table-bordered table-hover"); $(".ui-jqgrid-btable").addClass("table table-bordered table-striped"); $(".ui-pg-div").removeClass().addClass("btn btn-sm btn-primary"); $(".ui-icon.ui-icon-plus").removeClass().addClass("fa fa-plus"); $(".ui-icon.ui-icon-pencil").removeClass().addClass("fa fa-pencil"); $(".ui-icon.ui-icon-trash").removeClass().addClass("fa fa-trash-o"); $(".ui-icon.ui-icon-search").removeClass().addClass("fa fa-search"); $(".ui-icon.ui-icon-refresh").removeClass().addClass("fa fa-refresh"); $(".ui-icon.ui-icon-disk").removeClass().addClass("fa fa-save").parent(".btn-primary").removeClass("btn-primary").addClass("btn-success"); $(".ui-icon.ui-icon-cancel").removeClass().addClass("fa fa-times").parent(".btn-primary").removeClass("btn-primary").addClass("btn-danger"); $(".ui-icon.ui-icon-seek-prev").wrap("<div class='btn btn-sm btn-default'></div>"); $(".ui-icon.ui-icon-seek-prev").removeClass().addClass("fa fa-backward"); $(".ui-icon.ui-icon-seek-first").wrap("<div class='btn btn-sm btn-default'></div>"); $(".ui-icon.ui-icon-seek-first").removeClass().addClass("fa fa-fast-backward"); $(".ui-icon.ui-icon-seek-next").wrap("<div class='btn btn-sm btn-default'></div>"); $(".ui-icon.ui-icon-seek-next").removeClass().addClass("fa fa-forward"); $(".ui-icon.ui-icon-seek-end").wrap("<div class='btn btn-sm btn-default'></div>"); $(".ui-icon.ui-icon-seek-end").removeClass().addClass("fa fa-fast-forward"); }) $(window).on('resize.jqGrid', function () { $("#jqgrid").jqGrid('setGridWidth', $("#content").width()); }) </script> }
the_stack
using System.Collections.Generic; using System.Linq; //Here is a convenient way to build a Void type //Sealed is important to stop sum and be sure that this type as no value and is impossible to construct in any way. sealed class Void { private Void() { } //Try to call this function ! public static T absurd<T>(Void _) => throw new System.NotImplementedException("you can't call me it is absurd!"); } sealed class Unit { private Unit(){ } public static Unit Singleton = new Unit(); } //Sum type thanks to Subtyping. It works for this moment.. But lets go deeper in the book :) //Personal notes //Is not an antipattern by having marker interface ?? Lets discuss on a pull request or twitter. //I don't know but I will use it for this simple case to understand the principle and compliant with the book. //link : https://blog.ndepend.com/marker-interface-isnt-pattern-good-idea/ interface Either { } struct Left<T> : Either { public T Value { get; } public Left(T v) => Value = v; } //Because there is no Higher kinded types aka generics of generics, I have to write the same code for Right. //link : https://github.com/dotnet/csharplang/issues/339 //In fsharp sum types already exists so this porcelain and plumbing code not exists in fsharp implementation. struct Right<T> : Either { public T Value { get; } public Right(T v) => Value = v; } class Functions { //Convenient way to adapt things. Here the compiler ensures that Right is absurd. //Personal note //If we have encoded that with NotImplementedException only, the check is at runtime instead at compile time. //So you may have less problems! //Here you have a boxing issue : if you would like to use sum type on struct for a O alloc (like Kestrel team plan to do) public static T simple<T>(Either x) { switch (x) { case Left<Void> l: return Void.absurd<T>(l.Value); case Right<T> y: return y.Value; } throw new NotImplementedException("The compiler can't check if it is total, so it is not really a sum type"); } } //Here Either is isomorphic to Right because Left is absurd! var r1 = new Right<string>(Functions.simple<string>(new Right<string>("hello"))); var r2 = new Right<string>("hello"); // /!\ Execute this code line by line due to expression/statement issue r1.Equals(r2) //true //Since we can only build the right part, this type is isomorphic to Right /// Personal notes //Now think about how to implement the StreamReader and StreamWriter. //One only reads the stream, it is absurd to write. The opposite is true for the writer //We can build instead a Pipe (reader/writer) and use inheritance polymorphism to build the reader and the writer /// Link Pipe in Haskell : https://stackoverflow.com/questions/14131856/whats-the-absurd-function-in-data-void-useful-for /// For example, Kestrel in dotnet core uses Pipeline pattern for synchronization/timing purpose. /// Simple Sum type like enum : enum Color { Red, Green, Blue } // Maybe //Personal notes : can't be encoded by using enum interface Maybe<T> { } sealed class Nothing<T> : Maybe<T> { private Nothing () { } public static Nothing<T> Singleton<T> () => new Nothing<T>(); } struct Just<T> : Maybe<T> { public T Value; public Just(T value) => Value = value; } //Personal notes //In csharp Nullable is equivalent to Maybe in haskell and Option in fsharp when nullable reference type will be available. //link : https://blogs.msdn.microsoft.com/dotnet/2017/11/15/nullable-reference-types-in-csharp/ //This type could be construct behind Either thanks to our unit type like this : // Either /////////////////////////////////////////////////////////////////////// //Is it possible to reuse our previous definition : class Maybe : Either { } //It is a little bit strange.. class LeftClass<T> : Either { public T Value { get; } public LeftClass(T v) => Value = v; } class RightClass<T> : Either { public T Value { get; } public RightClass(T v) => Value = v; } class Nothing : LeftClass<Unit> { public Nothing() : base(Unit.Singleton) { } } //Can't do that with Left struct, so I have to turn the Left as class.. class Just<T> : RightClass<T> { public Just(T v) : base(v) { } } var r1E = new Nothing(); var r2E = new Just<string>("hello"); var r1E = new Nothing(); var r2E = new Just<string>("hello"); switch ((Either)r1E) { case Nothing _: return "nothing"; case Just<string> x: return x.Value; default: throw new System.NotImplementedException("you have added a new type without the matching implementation"); } // Either2 ////////////////////////////////////////////////////////////////////// // In fact Either interface does not keep track of types : lets create a generic one : interface Either2<L, R> { } //Personal notes : this part is not in the book, but I have to translate it in csharp and I don't know what is the approach. Lets discuss it in a pull request //It is a little bit strange, now in the definition of Left we have to keep the Right type ?? struct Left2<L, R> : Either2<L, R> { public L Value { get; } public Left2(L x) => Value = x; } //Duplicating stuff struct Right2<L, R> : Either2<L, R> { public R Value { get; } public Right2(R x) => Value = x; } //Now it is okay but we have introduced a mutual dependency in the type definition between Left and Right type ?! class Maybe2<T> : Either2<Unit, T> { } var r1E2 = new Right2<Unit, string>("hello"); var r2E2 = new Left2<Unit, string>(Unit.Singleton); switch ((Either2<Unit, string>)r1E2) { case Left2<Unit, string> _: return "nothing"; case Right2<Unit, string> x: return x.Value; default: throw new System.NotImplementedException("you have added a new type without the matching implementation"); } // Either3 ////////////////////////////////////////////////////////////////////// //We can define the Either with only one generic type because. It is a sum after all.. But ... interface Either3<T> { } struct Left3<L> : Either3<L> { public L Value { get; } public Left3(L x) => Value = x; } //Duplicating stuff struct Right3<R> : Either3<R> { public R Value { get; } public Right3(R x) => Value = x; } class Maybe3<T> : Either3<T> { } var r1E3 = new Right3<string>("hello"); var r2E3 = new Left3<Unit>(Unit.Singleton); //This code does not compile at all because Unit != string switch ((Either3<string>)r1E3) { case Left3<string> _: return "nothing"; case Right3<Unit> x: return x.Value; default: throw new System.NotImplementedException("you have added a new type without the matching implementation"); } // Check the factorizers properties.. static class Either3Extension { //How could we write the factorizers. //We could do it but it is not a sum anymore.. The type of left and right should be the same.. //If this sample is a little bit hard, try to implement the prodToSum and sumToProd of the chapter 6.4 public static Either3<R> factorizers<T, R>(Either3<T> x, Func<T, R> f, Func<T, R> g) { switch (x) { case Left3<T> l: return new Left3<R>(f(l.Value)); case Right3<T> r: return new Right3<R>(g(r.Value)); } throw new System.NotImplementedException("unreachable"); } } // Either4 ////////////////////////////////////////////////////////////////////// // Link : https://mikhail.io/2016/01/validation-with-either-data-type-in-csharp/ // Link: https://davesquared.net/2014/04/either.html public class Either4<TL, TR> { private readonly TL left; private readonly TR right; private readonly bool isLeft; public Either4(TL left) { this.left = left; this.isLeft = true; } public Either4(TR right) { this.right = right; this.isLeft = false; } public TL Left => left; public TR Right => right; public T Match4<T>(Func<TL, T> leftFunc, Func<TR, T> rightFunc) => this.isLeft ? leftFunc(this.left) : rightFunc(this.right); public override bool Equals(object obj) { var item = obj as Either4<TL, TR>; if (item == null) { return false; } return item.Match4( left1 => this.Match4(left2 => left2.Equals(left1), right2 => false), right1 => this.Match4(left2 => false, right2 => right2.Equals(right1)) ); } } //Here Either is isomorphic to Right because Left is absurd! var r14 = new Either4<string, Void>( new Either4<string, Void>("hello") .Match4( left => left, right => throw new Exception("error!")) ); var r24 = new Either4<string, Void>("hello"); // /!\ Execute this code line by line due to expression/statement issue r14.Equals(r24) //true class Just4<T> : Either4<Unit, T> { public Just4(T v) : base(v) { } } class Nothing4<T> : Either4<Unit, T> { public Nothing4() : base(Unit.Singleton) { } } var r1E4 = new Just4<string>("hello"); var r2E4 = new Nothing4<string>(); switch ((Either4<Unit, string>)r1E4) { case Nothing4<string> _: return "nothing"; case Just4<string> x: return x.Right; default: throw new System.NotImplementedException("you have added a new type without the matching implementation"); } // Either5 ////////////////////////////////////////////////////////////////////// // Either implemented by using the Vistor pattern public interface IEitherVisitor<A, B> { A visitLeft(Left5<A, B> v); B visitRight(Right5<A, B> v); }; public interface IEither5<A, B> { A acceptLeft(IEitherVisitor<A, B> v); B acceptRight(IEitherVisitor<A, B> v); }; public struct Left5<A, B> : IEither5<A, B> { public A Value { get; } public Left5(A v) => Value = v; public A acceptLeft(IEitherVisitor<A, B> v) => Value; public B acceptRight(IEitherVisitor<A, B> v) => throw new Exception("only Left"); }; public struct Right5<A, B> : IEither5<A, B> { public B Value { get; } public Right5(B v) => Value = v; public A acceptLeft(IEitherVisitor<A, B> v) => throw new Exception("only right"); public B acceptRight(IEitherVisitor<A, B> v) => Value; }; public class EitherVisitor<A, B> : IEitherVisitor<A, B> { public A visitLeft(Left5<A, B> v) => v.acceptLeft(this); public B visitRight(Right5<A, B> v) => v.acceptRight(this); }; var visitor = new EitherVisitor<Void, string>(); var r1 = new Right5<Void, string>(visitor.visitRight(new Right5<Void, string>("hello"))); var r2 = new Right5<Void, string>("hello"); r1.Equals(r2) // true //Wrap Up //Here, only the Either2, 4 and 5 are valid with properties and is compliant. //For the Either2, the client can use the new csharp syntax for pattern matching switch statement but the type definition of left and right are mutually dependent.. //////////////////////////////// // list : // yield is the keyword equivalent of Cons // Enumerable.Empty is the equivalent of Nil + Linq conversion to the type List // The most type used for list in c# is List<T> var empty = Enumerable.Empty<int>().ToList(); var l1 = empty.ToList(); //The add method mute the list. So the last element will be different depending where you add items.. l1.Add(1); var x = l1.Last(); l1.Add(2); var y = l1.Last(); x == y //false! //link Give a try at ImmutableList : https://msdn.microsoft.com/en-us/library/dn467185(v=vs.111).aspx empty.FirstOrDefault() //0 ?? what?? Implicit zero on default constructor provided by struct. var l3 = new[] { 0 }; empty.FirstOrDefault() == l3.FirstOrDefault() //true, now we are not able to see if it is the first element or not ?0? //now it is better but the compiler does not help us because there is no Nullable<T> for FirstOrDefault (due to the reference type issue in Nullable) //A better one for value types empty.Select(x => new Nullable<int>(x)).FirstOrDefault() // It outputs null but it is a true Nullable without value..
the_stack
@model IEnumerable<WebApp.Models.Notification> @{ ViewBag.Title = "消息通知"; } <!-- MAIN CONTENT --> <div id="content"> <!-- quick navigation bar --> <div class="row"> <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4"> <h1 class="page-title txt-color-blueDark"> <i class="fa fa-table fa-fw "></i> 系统管理 <span> > 消息通知 </span> </h1> </div> <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8"> </div> </div> <!-- end quick navigation bar --> <!-- widget grid --> <section id="widget-grid" class=""> <!-- row --> <div class="row"> <!-- NEW WIDGET START --> <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false" data-widget-deletebutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-table"></i> </span> <h2>消息通知</h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body no-padding"> <div class="widget-body-toolbar"> <div class="row"> <div class="col-sm-8 "> <!-- 开启授权控制 --> @*@if (Html.IsAuthorize("Create")) { <div class="btn-group"> <a href="javascript:append()" class="btn btn-sm btn-default"> <i class="fa fa-plus"></i> 新增 </a> </div> } @if (Html.IsAuthorize("Delete")) { <div class="btn-group"> <a href="javascript:removeit()" class="btn btn-sm btn-default"> <i class="fa fa-trash-o"></i> 删除 </a> </div> } @if (Html.IsAuthorize("Edit")) { <div class="btn-group"> <a href="javascript:accept()" class="btn btn-sm btn-default"> <i class="fa fa-floppy-o"></i> 保存 </a> </div> } <div class="btn-group"> <a href="javascript:reload()" class="btn btn-sm btn-default"> <i class="fa fa-refresh"></i> 刷新 </a> </div> <div class="btn-group"> <a href="javascript:reject()" class="btn btn-sm btn-default"> <i class="fa fa-window-close-o"></i> 取消 </a> </div> @if (Html.IsAuthorize("Import")) { <div class="btn-group"> <button type="button" onclick="importexcel()" class="btn btn-default"><i class="fa fa-upload"></i> 导入数据 </button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span> <span class="sr-only">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> <li><a href="javascript:importexcel()"><i class="fa fa-upload"></i> 上传Excel </a></li> <li role="separator" class="divider"></li> <li><a href="javascript:downloadtemplate()"><i class="fa fa-download"></i> 下载模板 </a></li> </ul> </div> } @if (Html.IsAuthorize("Export")) { <div class="btn-group"> <a href="javascript:exportexcel()" class="btn btn-sm btn-default"> <i class="fa fa-file-excel-o"></i> 导出Excel </a> </div> } @if (Html.IsAuthorize("Print")) { <div class="btn-group"> <a href="javascript:print()" class="btn btn-sm btn-default"> <i class="fa fa-print"></i> 打印 </a> </div> } <div class="btn-group"> <a href="javascript:dohelp()" class="btn btn-sm btn-default"> <i class="fa fa-question-circle-o"></i> 帮助 </a> </div>*@ <!--end 开启授权控制--> <div class="btn-group"> <a href="javascript:append()" class="btn btn-sm btn-default"> <i class="fa fa-plus"></i> 新增 </a> </div> <div class="btn-group"> <a href="javascript:removeit()" class="btn btn-sm btn-default"> <i class="fa fa-trash-o"></i> 删除 </a> </div> <div class="btn-group"> <a href="javascript:accept()" class="btn btn-sm btn-default"> <i class="fa fa-floppy-o"></i> 保存 </a> </div> <div class="btn-group"> <a href="javascript:reload()" class="btn btn-sm btn-default"> <i class="fa fa-refresh"></i> 刷新 </a> </div> <div class="btn-group"> <a href="javascript:reject()" class="btn btn-sm btn-default"> <i class="fa fa-window-close-o"></i> 取消 </a> </div> <div class="btn-group"> <button type="button" onclick="importexcel()" class="btn btn-default"><i class="fa fa-upload"></i> 导入数据 </button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span> <span class="sr-only">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> <li><a href="javascript:importexcel()"><i class="fa fa-upload"></i> 上传Excel </a></li> <li role="separator" class="divider"></li> <li><a href="javascript:downloadtemplate()"><i class="fa fa-download"></i> 下载模板 </a></li> </ul> </div> <div class="btn-group"> <a href="javascript:exportexcel()" class="btn btn-sm btn-default"> <i class="fa fa-file-excel-o"></i> 导出Excel </a> </div> <div class="btn-group"> <a href="javascript:print()" class="btn btn-sm btn-default"> <i class="fa fa-print"></i> 打印 </a> </div> <div class="btn-group"> <a href="javascript:dohelp()" class="btn btn-sm btn-default"> <i class="fa fa-question-circle-o"></i> 帮助 </a> </div> </div> <div class="col-sm-4 text-align-right"> <div class="btn-group"> <a href="javascript:window.history.back()" class="btn btn-sm btn-success"> <i class="fa fa-chevron-left"></i> 返回 </a> </div> </div> </div> </div> <div class="alert alert-warning no-margin fade in"> <button class="close" data-dismiss="alert"> × </button> <i class="fa-fw fa fa-info"></i> 注意事项: </div> <!--begin datagrid-content --> <div class="table-responsive"> <table id="notifications_datagrid"></table> </div> <!--end datagrid-content --> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- WIDGET END --> </div> <!-- end row --> </section> <!-- end widget grid --> <!-- file upload partial view --> @Html.Partial("_ImportWindow", new ViewDataDictionary { { "EntityName", "Notification" } }) <!-- end file upload partial view --> <!-- detail popup window --> @Html.Partial("_PopupDetailFormView", new WebApp.Models.Notification()) <!-- end detail popup window --> </div> <!-- END MAIN CONTENT --> @section Scripts { <script type="text/javascript"> var entityname = "Notification"; //下载Excel导入模板 function downloadtemplate() { //默认模板路径存放位置 var url = "/ExcelTemplate/Notification.xlsx"; $.fileDownload(url).fail(function () { $.messager.alert("错误","没有找到模板文件! {" + url + "}","error"); }); } //打印 function print() { $dg.datagrid('print', 'DataGrid'); } //打开Excel上传导入 function importexcel() { $("#importwindow").window("open"); } //执行Excel到处下载 function exportexcel() { var filterRules = JSON.stringify($dg.datagrid("options").filterRules); //console.log(filterRules); $.messager.progress({ title: "正在执行导出!" }); var formData = new FormData(); formData.append("filterRules", filterRules); formData.append("sort", "Id"); formData.append("order", "asc"); $.postDownload("/Notifications/ExportExcel", formData, function (fileName) { $.messager.progress("close"); //console.log(fileName); }); } //显示帮助信息 function dohelp() { } var editIndex = undefined; //重新加载数据 function reload() { if (endEditing()) { $dg.datagrid("reload"); } } //关闭编辑状态 function endEditing() { if (editIndex === undefined) { return true; } if ($dg.datagrid("validateRow", editIndex)) { $dg.datagrid("endEdit", editIndex); editIndex = undefined; return true; } else { return false; } } //单击列开启编辑功能 function onClickCell(index, field) { var _operates = ["_operate1", "_operate2", "_operate3", "ck"]; if ($.inArray(field, _operates) >= 0) { return; } if (editIndex !== index) { if (endEditing()) { $dg.datagrid("selectRow", index) .datagrid("beginEdit", index); editIndex = index; var ed = $dg.datagrid("getEditor", { index: index, field: field }); if (ed) { ($(ed.target).data("textbox") ? $(ed.target).textbox("textbox") : $(ed.target)).focus(); } } else { $dg.datagrid("selectRow", editIndex); } } } //新增记录 function append() { if (endEditing()) { //对必填字段进行默认值初始化 $dg.datagrid("insertRow", { index: 0, row: { } }); editIndex = 0 ; $dg.datagrid("selectRow", editIndex) .datagrid("beginEdit", editIndex); } } //删除编辑的行 function removeit() { if (editIndex === undefined) { return } $dg.datagrid("cancelEdit", editIndex) .datagrid("deleteRow", editIndex); editIndex = undefined; } //删除选中的行 function deletechecked() { var rows = $dg.datagrid("getChecked"); if (rows.length > 0) { var id = rows.map(function (item) { return item.Id; }); $.messager.confirm("确认", "你确定要删除这些记录?", function (r) { if (r) { $.post("/Notifications/DeleteCheckedAsync", { id: id }, function (data, status, xhr) { if (data.success) { reload(); } else { $.messager.alert("错误", data.err,"error"); } }); } }); } else { $.messager.alert("提示", "请先选择要删除的记录!"); } } //提交保存后台数据库 function accept() { if (endEditing()) { if ($dg.datagrid("getChanges").length) { var inserted = $dg.datagrid("getChanges", "inserted"); var deleted = $dg.datagrid("getChanges", "deleted"); var updated = $dg.datagrid("getChanges", "updated"); var item = new Object(); if (inserted.length) { item.inserted = inserted; } if (deleted.length) { item.deleted = deleted; } if (updated.length) { item.updated = updated; } //console.log(JSON.stringify(item)); $.post("/Notifications/SaveDataAsync", item, function (response,textStatus,jqXHR ) { //console.log(response); if (response.success) { $.messager.alert("提示", "提交成功!"); $dg.datagrid("acceptChanges"); $dg.datagrid("reload"); } else { $.messager.alert("错误", response.err ,"error"); } }, "json").fail(function (jqXHR, textStatus, errorThrown) { //console.log(errorThrown); $.messager.alert("错误", "提交错误了!" + errorThrown,"error"); //$dg.datagrid("reload"); }); } } } function reject() { $dg.datagrid("rejectChanges"); editIndex = undefined; } function getChanges() { var rows = $dg.datagrid("getChanges"); alert(rows.length + " rows are changed!"); } //弹出明细信息 function showDetailsWindow(id) { //console.log(index, row); $.getJSON("/Notifications/PopupEditAsync/" + id, function (data, status, xhr) { //console.log(data); $("#detailswindow").window("open"); loadData(id,data); }); } //初始化定义datagrid var $dg = $("#notifications_datagrid"); $(function () { //定义datagrid结构 $dg.datagrid({ rownumbers:true, checkOnSelect:true, selectOnCheck:true, idField:'Id', sortName:'Id', sortOrder:'desc', remoteFilter: true, singleSelect: true, toolbar: '#notifications_toolbar', url: '/Notifications/GetDataAsync', method: 'get', onClickCell: onClickCell, pagination: true, striped:true, columns: [[ /*开启CheckBox选择功能*/ /*{ field: 'ck', checkbox: true },*/ { field: '_operate1', title:'操作', width: 120, sortable: false, resizable: true, formatter: function showdetailsformatter(value, row, index) { return '<a onclick="showDetailsWindow(' + row.Id + ')" class="btn btn-default btn-sm" href="javascript:void(0)"><i class="fa fa-list"></i> 查看明细</a>'; } }, /*{field:'Id',width:80 ,sortable:true,resizable:true }*/ { field:'Title', title:'<span class="required">@Html.DisplayNameFor(model => model.Title)</span>', width:260, editor:{ type:'textbox', options:{ prompt:'主题',required:true ,validType:'length[0,50]' } }, sortable:true, resizable:true }, { field:'Content', title:'@Html.DisplayNameFor(model => model.Content)', width:300, editor:{ type:'textbox', options:{ prompt:'消息',required:false ,validType:'length[0,255]' } }, sortable:true, resizable:true }, { field:'Link', title:'@Html.DisplayNameFor(model => model.Link)', width:300, editor:{ type:'textbox', options:{ prompt:'链接',required:false ,validType:'length[0,255]' } }, sortable:true, resizable:true }, { field:'Read', title:'<span class="required">@Html.DisplayNameFor(model => model.Read)</span>', width:100, align:'right', editor:{ type:'isneweditor', options:{prompt:'已读', required:true } }, sortable:true, resizable: true, formatter: isnewformatter }, { field:'From', title:'@Html.DisplayNameFor(model => model.From)', width:140, editor:{ type:'textbox', options:{ prompt:'From',required:false } }, sortable:true, resizable:true }, { field:'To', title:'@Html.DisplayNameFor(model => model.To)', width:140, editor:{ type:'textbox', options:{ prompt:'To',required:false } }, sortable:true, resizable:true }, { field:'Group', title:'<span class="required">@Html.DisplayNameFor(model => model.Group)</span>', width:100, align:'right', editor:{ type:'messagegroupeditor', options:{prompt:'分组', required:true } }, sortable:true, resizable: true, formatter: messagegroupformatter }, { field:'Created', title:'<span class="required">@Html.DisplayNameFor(model => model.Created)</span>', width:120, align:'right', editor:{ type:'datebox', options:{prompt:'Created',required:true} }, sortable:true, resizable:true, formatter:dateformatter } , { field:'Creator', title:'@Html.DisplayNameFor(model => model.Creator)', width:140, editor:{ type:'textbox', options:{ prompt:'Creator',required:false } }, sortable:true, resizable:true }, ]] }); $dg.datagrid("enableFilter",[ { field: "Id", type: "numberbox", op:['equal','notequal','less','lessorequal','greater','greaterorequal'] }, { field: "Read", type: "isnewfilter" }, { field: "Group", type: "messagegroupfilter" }, { field: "Created", type: "dateRange", options: { onChange: function (value) { $dg.datagrid("addFilterRule", { field: "Created", op: "between", value: value }); $dg.datagrid("doFilter"); } } }, ]); }); </script> <script type="text/javascript"> //load data by foreign key var notificationid = 0; function loadData(id, data) { notificationid = id; $('#notification_form').form('load', data); } var $editform = $('#notification_form'); //save item function saveitem() { if ($editform.form('enableValidation').form('validate')) { var notification = $editform.serializeJSON(); var token = $('input[name="__RequestVerificationToken"]', $editform).val(); $.ajax({ type: "POST", url: "/Notifications/EditAsync", data: { __RequestVerificationToken: token, notification: notification }, dataType: 'json', contentType: 'application/x-www-form-urlencoded; charset=utf-8' }) .done(function (response, textStatus, jqXHR) { if (response.success) { $dg.datagrid('reload'); $.messager.alert("提示", "保存成功!"); $('#detailswindow').window("close"); } else { $.messager.alert("错误", "保存失败!" + response.err, "error"); } }) .fail(function (jqXHR, textStatus, errorThrown) { $.messager.alert("错误", "保存失败!" + errorThrown, "error"); }); } } // cancel function cancelitem() { $('#detailswindow').window('close'); } // reload function refreshitem() { $('#detailswindow').window('close'); } </script> <script src="~/Scripts/jquery.filerupload.min.js"></script> }
the_stack
@using SharedLibraryCore.Configuration @using Data.Models.Client.Stats @using Stats.Helpers @using Data.Models.Client @using Data.Models.Client.Stats.Reference @using Humanizer @using Humanizer.Localisation @using IW4MAdmin.Plugins.Stats @model Stats.Dtos.AdvancedStatsInfo @{ ViewBag.Title = "Advanced Client Statistics"; ViewBag.Description = Model.ClientName.StripColors(); const int maxItems = 5; const string headshotKey = "MOD_HEAD_SHOT"; const string headshotKey2 = "headshot"; const string meleeKey = "MOD_MELEE"; var suicideKeys = new[] {"MOD_SUICIDE", "MOD_FALLING"}; // if they've not copied default settings config this could be null var config = (GameStringConfiguration) ViewBag.Config ?? new GameStringConfiguration(); var headerClass = Model.Level == EFClient.Permission.Banned ? "bg-danger" : "bg-primary"; var textClass = Model.Level == EFClient.Permission.Banned ? "text-danger" : "text-primary"; var borderBottomClass = Model.Level == EFClient.Permission.Banned ? "border-bottom-danger border-top-danger" : "border-bottom border-top"; var borderClass = Model.Level == EFClient.Permission.Banned ? "border-danger" : "border-primary"; var buttonClass = Model.Level == EFClient.Permission.Banned ? "btn-danger" : "btn-primary"; string GetWeaponNameForHit(EFClientHitStatistic stat) { if (stat == null) { return null; } var rebuiltName = stat.RebuildWeaponName(); var name = config.GetStringForGame(rebuiltName, stat.Weapon?.Game); return !rebuiltName.Equals(name, StringComparison.InvariantCultureIgnoreCase) ? name : config.GetStringForGame(stat.Weapon.Name, stat.Weapon.Game); } string GetWeaponAttachmentName(EFWeaponAttachmentCombo attachment) { if (attachment == null) { return null; } var attachmentText = string.Join('+', new[] { config.GetStringForGame(attachment.Attachment1.Name, attachment.Attachment1.Game), config.GetStringForGame(attachment.Attachment2?.Name, attachment.Attachment2?.Game), config.GetStringForGame(attachment.Attachment3?.Name, attachment.Attachment3?.Game) }.Where(attach => !string.IsNullOrWhiteSpace(attach))); return attachmentText; } var weapons = Model.ByWeapon .Where(hit => hit.DamageInflicted > 0 || (hit.DamageInflicted == 0 && hit.HitCount > 0)) .GroupBy(hit => new {hit.WeaponId}) .Select(group => { var withoutAttachments = group.FirstOrDefault(hit => hit.WeaponAttachmentComboId == null); var mostUsedAttachment = group.Except(new[] {withoutAttachments}) .OrderByDescending(g => g.DamageInflicted) .GroupBy(g => g.WeaponAttachmentComboId) .FirstOrDefault() ?.FirstOrDefault(); if (withoutAttachments == null || mostUsedAttachment == null) { return withoutAttachments; } withoutAttachments.WeaponAttachmentComboId = mostUsedAttachment.WeaponAttachmentComboId; withoutAttachments.WeaponAttachmentCombo = mostUsedAttachment.WeaponAttachmentCombo; return withoutAttachments; }) .Where(hit => hit != null) .OrderByDescending(hit => hit.KillCount) .ToList(); var allPerServer = Model.All.Where(hit => hit.ServerId == Model.ServerId).ToList(); // if the serverId is supplied we want all the entries with serverID but nothing else var aggregate = Model.ServerId == null ? Model.Aggregate : allPerServer.Where(hit => hit.WeaponId == null) .Where(hit => hit.HitLocation == null) .Where(hit => hit.ServerId == Model.ServerId) .Where(hit => hit.WeaponAttachmentComboId == null) .FirstOrDefault(hit => hit.MeansOfDeathId == null); var filteredHitLocations = Model.ByHitLocation .Where(hit => hit.HitCount > 0) .Where(hit => hit.HitLocation.Name != "none") .Where(hit => hit.HitLocation.Name != "neck") .Where(hit => hit.ServerId == Model.ServerId) .OrderByDescending(hit => hit.HitCount) .ThenBy(hit => hit.HitLocationId) .ToList(); var uniqueWeapons = allPerServer.Any() ? Model.ByWeapon.Where(hit => hit.ServerId == Model.ServerId) .Where(weapon => weapon.DamageInflicted > 0) .GroupBy(weapon => weapon.WeaponId) .Count() : (int?) null; // want to default to -- in ui instead of 0 var activeTime = weapons.Any() ? TimeSpan.FromSeconds(weapons.Sum(weapon => weapon.UsageSeconds ?? 0)) : (TimeSpan?) null; // want to default to -- in ui instead of 0 var kdr = aggregate == null ? null : Math.Round(aggregate.KillCount / (float) aggregate.DeathCount, 2).ToString(Utilities.CurrentLocalization.Culture); var serverLegacyStat = Model.LegacyStats .FirstOrDefault(stat => stat.ServerId == Model.ServerId); // legacy stats section var performance = Model.Performance; var skill = Model.ServerId != null ? serverLegacyStat?.Skill.ToNumericalString() : Model.LegacyStats.WeightValueByPlaytime(nameof(EFClientStatistics.Skill), 0).ToNumericalString(); var elo = Model.ServerId != null ? serverLegacyStat?.EloRating.ToNumericalString() : Model.LegacyStats.WeightValueByPlaytime(nameof(EFClientStatistics.EloRating), 0).ToNumericalString(); var spm = Model.ServerId != null ? serverLegacyStat?.SPM.ToNumericalString() : Model.LegacyStats.WeightValueByPlaytime(nameof(EFClientStatistics.SPM), 0).ToNumericalString(); var performanceHistory = Model.Ratings .Select(rating => rating.PerformanceMetric); if (performance != null) { performanceHistory = performanceHistory.Append(performance.Value); } var score = allPerServer.Any() ? allPerServer.Sum(stat => stat.Score) : null; var headShots = allPerServer.Any() ? allPerServer.Where(hit => hit.MeansOfDeath?.Name == headshotKey || hit.HitLocation?.Name == headshotKey2).Sum(hit => hit.HitCount) : (int?) null; // want to default to -- in ui instead of 0 var meleeKills = allPerServer.Any() ? allPerServer.Where(hit => hit.MeansOfDeath?.Name == meleeKey).Sum(hit => hit.KillCount) : (int?) null; var suicides = allPerServer.Any() ? allPerServer.Where(hit => suicideKeys.Contains(hit.MeansOfDeath?.Name ?? "")).Sum(hit => hit.KillCount) : (int?) null; var statCards = new[] { new { Name = (ViewBag.Localization["PLUGINS_STATS_TEXT_KILLS"] as string).Titleize(), Value = aggregate?.KillCount.ToNumericalString() }, new { Name = (ViewBag.Localization["PLUGINS_STATS_TEXT_DEATHS"] as string).Titleize(), Value = aggregate?.DeathCount.ToNumericalString() }, new { Name = (ViewBag.Localization["PLUGINS_STATS_TEXT_KDR"] as string).Titleize(), Value = kdr }, new { Name = (ViewBag.Localization["WEBFRONT_ADV_STATS_SCORE"] as string).Titleize(), Value = score.ToNumericalString() }, new { Name = (ViewBag.Localization["WEBFRONT_ADV_STATS_ZSCORE"] as string), Value = Model.ZScore.ToNumericalString(2) }, new { Name = (ViewBag.Localization["PLUGINS_STATS_TEXT_SKILL"] as string).ToLower().Titleize(), Value = skill }, new { Name = (ViewBag.Localization["WEBFRONT_ADV_STATS_ELO"] as string).Titleize(), Value = elo }, new { Name = (ViewBag.Localization["PLUGINS_STATS_META_SPM"] as string).Titleize(), Value = spm }, new { Name = ViewBag.Localization["WEBFRONT_ADV_STATS_TOTAL_DAMAGE"] as string, Value = aggregate?.DamageInflicted.ToNumericalString() }, new { Name = ViewBag.Localization["WEBFRONT_ADV_STATS_SUICIDES"] as string, Value = suicides.ToNumericalString() }, new { Name = ViewBag.Localization["WEBFRONT_ADV_STATS_HEADSHOTS"] as string, Value = headShots.ToNumericalString() }, new { Name = ViewBag.Localization["WEBFRONT_ADV_STATS_MELEES"] as string, Value = meleeKills.ToNumericalString() }, new { Name = ViewBag.Localization["WEBFRONT_ADV_STATS_FAV_WEAP"] as string, Value = GetWeaponNameForHit(weapons.FirstOrDefault()) }, new { Name = ViewBag.Localization["WEBFRONT_ADV_STATS_FAV_ATTACHMENTS"] as string, Value = GetWeaponAttachmentName(weapons.FirstOrDefault()?.WeaponAttachmentCombo) }, new { Name = ViewBag.Localization["WEBFRONT_ADV_STATS_TOTAL_WEAPONS_USED"] as string, Value = uniqueWeapons.ToNumericalString() }, new { Name = ViewBag.Localization["WEBFRONT_ADV_STATS_TOTAL_ACTIVE_TIME"] as string, Value = activeTime?.HumanizeForCurrentCulture() } }; } <div class="w-100 @headerClass mb-1"> <select class="w-100 @headerClass text-white pl-4 pr-4 pt-2 pb-2 m-auto h5 @borderClass" id="server_selector" onchange="if (this.value) window.location.href=this.value"> @if (Model.ServerId == null) { <option value="@Url.Action("Advanced", "ClientStatistics")" selected>@ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"]</option> } else { <option value="@Url.Action("Advanced", "ClientStatistics")">@ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"]</option> } @foreach (var server in Model.Servers) { if (server.Endpoint == Model.ServerEndpoint) { <option value="@Url.Action("Advanced", "ClientStatistics", new {serverId = server.Endpoint})" selected>@server.Name.StripColors()</option> } else { <option value="@Url.Action("Advanced", "ClientStatistics", new {serverId = server.Endpoint})">@server.Name.StripColors()</option> } } </select> </div> <div class="@headerClass p-4 mb-0 d-flex flex-wrap"> <div class="align-self-center d-flex flex-column flex-lg-row text-center text-lg-left mb-3 mb-md-0 p-2 ml-lg-0 mr-lg-0 ml-auto mr-auto"> <div class="mr-lg-3 m-auto"> <img class="img-fluid align-self-center" id="rank_icon" src="~/images/stats/ranks/rank_@(Model.ZScore.RankIconIndexForZScore()).png" alt="@performance"/> </div> <div class="d-flex flex-column align-self-center" id="client_stats_summary"> <div class="h1 mb-0 font-weight-bold"> <a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.ClientId">@Model.ClientName.StripColors()</a> </div> @if (Model.Level == EFClient.Permission.Banned) { <div class="h5 mb-0">@ViewBag.Localization["GLOBAL_PERMISSION_BANNED"]</div> } else if (Model.ZScore != null) { if (Model.ServerId != null) { <div class="h5 mb-0">@((ViewBag.Localization["WEBFRONT_ADV_STATS_PERFORMANCE"] as string).FormatExt(performance.ToNumericalString()))</div> } else { <div class="h5 mb-0">@((ViewBag.Localization["WEBFRONT_ADV_STATS_RATING"] as string).FormatExt(Model.Rating.ToNumericalString()))</div> } if (Model.Ranking > 0) { <div class="h5 mb-0">@((ViewBag.Localization["WEBFRONT_ADV_STATS_RANKED"] as string).FormatExt(Model.Ranking.ToNumericalString()))</div> } else { <div class="h5 mb-0">@ViewBag.Localization["WEBFRONT_ADV_STATS_EXPIRED"]</div> } } else { <div class="h5 mb-0">@ViewBag.Localization["WEBFRONT_STATS_INDEX_UNRANKED"]</div> } </div> </div> <div class="w-50 m-auto ml-md-auto mr-md-0" id="client_performance_history_container"> <canvas id="client_performance_history" data-history="@Html.Raw(Json.Serialize(performanceHistory))"></canvas> </div> </div> <div class="mb-4 bg-dark @borderBottomClass d-flex flex-wrap"> @foreach (var card in statCards) { <div class="pl-3 pr-4 pb-3 pt-3 stat-card flex-fill w-50 w-md-auto"> @if (string.IsNullOrWhiteSpace(card.Value)) { <h5 class="card-title @textClass">&mdash;</h5> } else { <h5 class="card-title @textClass">@card.Value</h5> } <h6 class="card-subtitle mb-0 text-muted">@card.Name</h6> </div> } </div> <div class="row"> <!-- WEAPONS USED --> <div class="col-12 mb-4"> <div class="@headerClass h4 mb-1 p-2"> <div class="text-center">@ViewBag.Localization["WEBFRONT_ADV_STATS_WEAP_USAGE"]</div> </div> <table class="table mb-0"> <tr class="@headerClass"> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_WEAPON"]</th> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_FAV_ATTACHMENTS"]</th> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"]</th> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_HITS"]</th> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_DAMAGE"]</th> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_USAGE"]</th> </tr> @foreach (var weaponHit in weapons.Take(maxItems)) { <tr class="bg-dark"> <td class="@textClass text-force-break">@GetWeaponNameForHit(weaponHit)</td> @{ var attachments = GetWeaponAttachmentName(weaponHit.WeaponAttachmentCombo); } @if (string.IsNullOrWhiteSpace(attachments)) { <td class="text-muted text-force-break">&mdash;</td> } else { <td class="text-muted text-force-break">@attachments</td> } <td class="text-success text-force-break">@weaponHit.KillCount.ToNumericalString()</td> <td class="text-muted text-force-break">@weaponHit.HitCount.ToNumericalString()</td> <td class="text-muted text-force-break">@weaponHit.DamageInflicted.ToNumericalString()</td> <td class="text-muted text-force-break">@TimeSpan.FromSeconds(weaponHit.UsageSeconds ?? 0).HumanizeForCurrentCulture(minUnit: TimeUnit.Second)</td> </tr> } <!-- OVERFLOW --> @foreach (var weaponHit in weapons.Skip(maxItems)) { <tr class="bg-dark hidden-row" style="display:none"> <td class="@textClass text-force-break">@GetWeaponNameForHit(weaponHit)</td> @{ var attachments = GetWeaponAttachmentName(weaponHit.WeaponAttachmentCombo); } @if (string.IsNullOrWhiteSpace(attachments)) { <td class="text-muted text-force-break">&mdash;</td> } else { <td class="text-muted text-force-break">@attachments</td> } <td class="text-success text-force-break">@weaponHit.KillCount.ToNumericalString()</td> <td class="text-muted text-force-break">@weaponHit.HitCount.ToNumericalString()</td> <td class="text-muted text-force-break">@weaponHit.DamageInflicted.ToNumericalString()</td> <td class="text-muted text-force-break">@TimeSpan.FromSeconds(weaponHit.UsageSeconds ?? 0).HumanizeForCurrentCulture()</td> </tr> } <tr> </table> <button class="btn @buttonClass btn-block table-slide"> <span class="oi oi-chevron-bottom"></span> </button> </div> </div> <div class="row"> <!-- HIT LOCATIONS --> <div class="col-lg-6 col-12 pr-3 pr-lg-0" id="hit_location_table"> <div class="@headerClass h4 mb-1 p-2"> <div class="text-center">@ViewBag.Localization["WEBFRONT_ADV_STATS_HIT_LOCATIONS"]</div> </div> <table class="table @borderBottomClass bg-dark mb-0 pb-0"> <tr class="@headerClass"> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_LOCATION"]</th> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_HITS"]</th> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_PERCENTAGE"]</th> <th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_DAMAGE"]</th> </tr> @{ var totalHits = filteredHitLocations.Sum(hit => hit.HitCount); } @foreach (var hitLocation in filteredHitLocations.Take(8)) { <tr> <td class="@textClass text-force-break">@config.GetStringForGame(hitLocation.HitLocation.Name, hitLocation.HitLocation.Game)</td> <td class="text-success text-force-break">@hitLocation.HitCount</td> <td class="text-muted text-force-break">@Math.Round((hitLocation.HitCount / (float) totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)%</td> <td class="text-muted text-force-break">@hitLocation.DamageInflicted.ToNumericalString()</td> </tr> } @foreach (var hitLocation in filteredHitLocations.Skip(8)) { <tr class="bg-dark hidden-row" style="display:none;"> <td class="@textClass text-force-break">@config.GetStringForGame(hitLocation.HitLocation.Name, hitLocation.HitLocation.Game)</td> <td class="text-success text-force-break">@hitLocation.HitCount</td> <td class="text-muted text-force-break">@Math.Round((hitLocation.HitCount / (float) totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)%</td> <td class="text-muted text-force-break">@hitLocation.DamageInflicted.ToNumericalString()</td> </tr> } </table> <button class="btn @buttonClass btn-block table-slide"> <span class="oi oi-chevron-bottom"></span> </button> </div> <div class="col-lg-6 col-12 pl-3 pl-lg-0"> <div class="@borderBottomClass text-center h-100" id="hitlocation_container"> <canvas id="hitlocation_model"> </canvas> </div> </div> </div> @{ var projection = filteredHitLocations.Select(loc => new { name = loc.HitLocation.Name, // we want to count head and neck as the same percentage = (loc.HitLocation.Name == "head" ? filteredHitLocations.FirstOrDefault(c => c.HitLocation.Name == "neck")?.HitCount ?? 0 + loc.HitCount : loc.HitCount) / (float) totalHits }).ToList(); var maxPercentage = projection.Any() ? projection.Max(p => p.percentage) : 0; } @section scripts { <script type="text/javascript"> const hitLocationData = @Html.Raw(Json.Serialize(projection)); const maxPercentage = @maxPercentage; </script> <environment include="Development"> <script type="text/javascript" src="~/js/advanced_stats.js"></script> </environment> }
the_stack
@model ThankNet.Models.Introduce @{ ViewBag.Title = "Introduce"; Layout = "~/Views/Shared/_Admin.cshtml"; } <style> .editor-field input{width: 100%;} #showimg, #showimg1,#showimg2,#showimg3,#showimg4,#showimg5,#showimg6 { padding: 10px; background-color: #00bfff; height: auto; display: block; } </style> <script src="~/Content/uploadify/jquery.uploadify.js"></script> <link href="~/Content/uploadify/uploadify.css" rel="stylesheet" /> <script src="~/Content/ckeditor/ckeditor.js"></script> @using (Html.BeginForm()) { @Html.AntiForgeryToken() @Html.ValidationSummary(true) <fieldset> <legend>关于我们内容编辑</legend> @if(TempData["message"] != null) { <div class="alert alert-block alert-success"> <button type="button" class="close" data-dismiss="alert"> <i class="icon-remove"></i> </button> <strong class="green"> @TempData["message"] </strong> </div> } <div class="editor-label"> @Html.LabelFor(model => model.TitleTop) </div> <div class="editor-field"> @Html.EditorFor(model => model.TitleTop) @Html.ValidationMessageFor(model => model.TitleTop) </div> <div class="editor-label"> @Html.LabelFor(model => model.TitleTopSmall) </div> <div class="editor-field"> @Html.EditorFor(model => model.TitleTopSmall) @Html.ValidationMessageFor(model => model.TitleTopSmall) </div> <div class="editor-label"> @Html.LabelFor(model => model.TitleCenter1) </div> <div class="editor-field"> @Html.EditorFor(model => model.TitleCenter1) @Html.ValidationMessageFor(model => model.TitleCenter1) </div> <div class="editor-label"> @Html.LabelFor(model => model.TitleCenter2) </div> <div class="editor-field"> @Html.EditorFor(model => model.TitleCenter2) @Html.ValidationMessageFor(model => model.TitleCenter2) </div> <div class="editor-field"> <div id="showimg1"><img src="@Model.Tag1" /> </div> @Html.HiddenFor(n => Model.Tag1) </div> <input type="file" id="file_upload1" name="file_upload" /> <div class="editor-label"> @Html.LabelFor(model => model.Tag1Des) </div> <div class="editor-field"> @Html.EditorFor(model => model.Tag1Des) @Html.ValidationMessageFor(model => model.Tag1Des) </div> <div class="editor-field"> <div id="showimg2"><img src="@Model.Tag2" /> </div> @Html.HiddenFor(n => Model.Tag2) </div> <input type="file" id="file_upload2" name="file_upload" /> <div class="editor-label"> @Html.LabelFor(model => model.Tag2Des) </div> <div class="editor-field"> @Html.EditorFor(model => model.Tag2Des) @Html.ValidationMessageFor(model => model.Tag2Des) </div> <div class="editor-field"> <div id="showimg3"><img src="@Model.Tag3" /> </div> @Html.HiddenFor(n => Model.Tag3) </div> <input type="file" id="file_upload3" name="file_upload" /> <div class="editor-label"> @Html.LabelFor(model => model.Tag3Des) </div> <div class="editor-field"> @Html.EditorFor(model => model.Tag3Des) @Html.ValidationMessageFor(model => model.Tag3Des) </div> <div class="editor-field"> <div id="showimg4"><img src="@Model.Tag4" /> </div> @Html.HiddenFor(n => Model.Tag4) </div> <input type="file" id="file_upload4" name="file_upload" /> <div class="editor-label"> @Html.LabelFor(model => model.Tag4Des) </div> <div class="editor-field"> @Html.EditorFor(model => model.Tag4Des) @Html.ValidationMessageFor(model => model.Tag4Des) </div> <div class="editor-field"> <div id="showimg5"><img src="@Model.Tag5" /> </div> @Html.HiddenFor(n => Model.Tag5) </div> <input type="file" id="file_upload5" name="file_upload" /> <div class="editor-label"> @Html.LabelFor(model => model.Tag5Des) </div> <div class="editor-field"> @Html.EditorFor(model => model.Tag5Des) @Html.ValidationMessageFor(model => model.Tag5Des) </div> <div class="editor-label"> @Html.LabelFor(model => model.Title2) </div> <div class="editor-field"> @Html.EditorFor(model => model.Title2) @Html.ValidationMessageFor(model => model.Title2) </div> <div class="editor-label"> @Html.LabelFor(model => model.StrongWrod) </div> <div class="editor-field"> @Html.EditorFor(model => model.StrongWrod) @Html.ValidationMessageFor(model => model.StrongWrod) </div> <div class="editor-label"> @Html.LabelFor(model => model.Brife) </div> <div class="editor-field"> <textarea class="ckeditor" id="editor1" name="Brife"> @Model.Brife </textarea> </div> <div class="editor-field"> <div id="showimg6"><img src="@Model.ImgUrl" /> </div> @Html.HiddenFor(n => Model.ImgUrl) </div> <input type="file" id="file_upload6" name="file_upload" /> <div id="fileQueue"></div> <span class="errorinfo"></span> <p> <input type="submit" class="btn btn-primary" value="Create" /> </p> </fieldset> } <script> $(function () { $(".page-header h1 span,#currentpart").html("控制台"); $(".page-header h1 small span").html("二维码"); $(".nav-list>li:eq(0)").addClass("active").siblings().removeClass("active"); $(".nav-list>li:eq(0)>ul>li:eq(2)").addClass("active").siblings().removeClass("active"); $('#file_upload1').uploadify({ 'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")', 'uploader': '@Url.Action("UploadImg","Product")', multi: false, 'buttonText': '上传图片', 'queueID': 'fileQueue', 'auto': true, 'onUploadSuccess': function (file, data, response) { eval("data=" + data); //alert('文件 ' + file.name + ' 已经上传成功,并返回 ' + response + ' 保存文件名称为 ' + data.SaveName); if (data.Success) { var str = "../../Content/UploadFiles/" + data.SaveName; $("#showimg1").html("<img src='" + str + "' alt='' />"); $("#Tag1").val(str); } else { $.infoShow(data.Message, 0); } } }); $('#file_upload2').uploadify({ 'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")', 'uploader': '@Url.Action("UploadImg","Product")', multi: false, 'buttonText': '上传图片', 'queueID': 'fileQueue', 'auto': true, 'onUploadSuccess': function (file, data, response) { eval("data=" + data); //alert('文件 ' + file.name + ' 已经上传成功,并返回 ' + response + ' 保存文件名称为 ' + data.SaveName); if (data.Success) { var str = "../../Content/UploadFiles/" + data.SaveName; $("#showimg2").html("<img src='" + str + "' alt='' />"); $("#Tag2").val(str); } else { $.infoShow(data.Message, 0); } } }); $('#file_upload6').uploadify({ 'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")', 'uploader': '@Url.Action("UploadImg","Product")', multi: false, 'buttonText': '上传图片', 'queueID': 'fileQueue', 'auto': true, 'onUploadSuccess': function (file, data, response) { eval("data=" + data); //alert('文件 ' + file.name + ' 已经上传成功,并返回 ' + response + ' 保存文件名称为 ' + data.SaveName); if (data.Success) { var str = "../../Content/UploadFiles/" + data.SaveName; $("#showimg6").html("<img src='" + str + "' alt='' />"); $("#ImgUrl").val(str); } else { $.infoShow(data.Message, 0); } } }); $('#file_upload3').uploadify({ 'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")', 'uploader': '@Url.Action("UploadImg","Product")', multi: false, 'buttonText': '上传图片', 'queueID': 'fileQueue', 'auto': true, 'onUploadSuccess': function (file, data, response) { eval("data=" + data); //alert('文件 ' + file.name + ' 已经上传成功,并返回 ' + response + ' 保存文件名称为 ' + data.SaveName); if (data.Success) { var str = "../../Content/UploadFiles/" + data.SaveName; $("#showimg3").html("<img src='" + str + "' alt='' />"); $("#Tag3").val(str); } else { $.infoShow(data.Message, 0); } } }); $('#file_upload4').uploadify({ 'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")', 'uploader': '@Url.Action("UploadImg","Product")', multi: false, 'buttonText': '上传图片', 'queueID': 'fileQueue', 'auto': true, 'onUploadSuccess': function (file, data, response) { eval("data=" + data); //alert('文件 ' + file.name + ' 已经上传成功,并返回 ' + response + ' 保存文件名称为 ' + data.SaveName); if (data.Success) { var str = "../../Content/UploadFiles/" + data.SaveName; $("#showimg4").html("<img src='" + str + "' alt='' />"); $("#Tag4").val(str); } else { $.infoShow(data.Message, 0); } } }); $('#file_upload5').uploadify({ 'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")', 'uploader': '@Url.Action("UploadImg","Product")', multi: false, 'buttonText': '上传图片', 'queueID': 'fileQueue', 'auto': true, 'onUploadSuccess': function (file, data, response) { eval("data=" + data); //alert('文件 ' + file.name + ' 已经上传成功,并返回 ' + response + ' 保存文件名称为 ' + data.SaveName); if (data.Success) { var str = "../../Content/UploadFiles/" + data.SaveName; $("#showimg5").html("<img src='" + str + "' alt='' />"); $("#Tag5").val(str); } else { $.infoShow(data.Message, 0); } } }); }) </script> <div> @Html.ActionLink("Back to List", "Index") </div> @section Scripts { @Scripts.Render("~/bundles/jqueryval") }
the_stack
@model SmartAdmin.Domain.Models.Company @{ ViewData["Title"] = "企业信息"; ViewData["PageName"] = "Companies_Index"; ViewData["Heading"] = "<i class='fal fa-window text-primary'></i> 企业信息"; ViewData["Category1"] = "组织架构"; ViewData["PageDescription"] = ""; } <div class="row"> <div class="col-lg-12 col-xl-12"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> 公司信息 </h2> <div class="panel-toolbar"> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"><i class="fal fa-window-minimize"></i></button> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"><i class="fal fa-expand"></i></button> </div> </div> <div class="panel-container enable-loader show"> <div class="loader"><i class="fal fa-spinner-third fa-spin-4x fs-xxl"></i></div> <div class="panel-content py-2 rounded-bottom border-faded border-left-0 border-right-0 text-muted bg-subtlelight-fade "> <div class="row no-gutters align-items-center"> <div class="col"> <!-- 开启授权控制请参考 @@if (Html.IsAuthorize("Create") --> <div class="btn-group btn-group-sm"> <button name="searchbutton" class="btn btn-default"> <span class="fal fa-search mr-1"></span> 查询 </button> <button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="sr-only">Toggle Dropdown</span> </button> <div class="dropdown-menu dropdown-menu-animated"> <button name="searchmemenu" class="dropdown-item js-waves-on"> 我的记录 </button> <div class="dropdown-divider"></div> <button name="searchcustommenu" class="dropdown-item js-waves-on"> 自定义查询 </button> </div> </div> <div class="btn-group btn-group-sm"> <button name="appendbutton" class="btn btn-default"> <span class="fal fa-plus mr-1"></span> 新增 </button> </div> <div class="btn-group btn-group-sm"> <button name="deletebutton" disabled class="btn btn-default"> <span class="fal fa-times mr-1"></span> 删除 </button> </div> <div class="btn-group btn-group-sm"> <button name="savebutton" disabled class="btn btn-default"> <span class="fal fa-save mr-1"></span> 保存 </button> </div> <div class="btn-group btn-group-sm"> <button name="cancelbutton" disabled class="btn btn-default"> <span class="fal fa-ban mr-1"></span> 取消 </button> </div> <div class="btn-group btn-group-sm hidden-xs"> <button type="button" name="importbutton" class="btn btn-default"><span class="fal fa-cloud-upload mr-1"></span> 导入 </button> <button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split waves-effect waves-themed" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="sr-only">Toggle Dropdown</span> </button> <div class="dropdown-menu dropdown-menu-animated"> <a class="dropdown-item js-waves-on" name="downloadmenu" href="javascript:void()"> <span class="fal fa-download"></span> 下载模板 </a> </div> </div> <div class="btn-group btn-group-sm hidden-xs"> <button name="exportbutton" class="btn btn-default"> <span class="fal fa-file-export mr-1"></span> 导出 </button> </div> </div> </div> </div> <div class="panel-content"> <div class="table-responsive"> <table id="companies_datagrid"> </table> </div> </div> </div> </div> </div> </div> <!-- 弹出窗体form表单 --> <div id="companydetailwindow" class="easyui-window" title="明细数据" data-options="modal:true, closed:true, minimizable:false, collapsible:false, maximized:false, iconCls:'fal fa-window', onOpen:function(){ $(this).window('vcenter'); $(this).window('hcenter'); }, onRestore:function(){ }, onMaximize:function(){ } " style="width:720px;height:420px;display:none"> <!-- toolbar --> <div class="panel-content py-2 rounded-bottom border-faded border-left-0 border-right-0 text-muted bg-subtlelight-fade sticky-top"> <div class="d-flex flex-row-reverse pr-4"> <div class="btn-group btn-group-sm mr-1"> <button name="saveitembutton" class="btn btn-default"> <i class="fal fa-save"></i> 保存 </button> </div> <div class="btn-group btn-group-sm mr-1" id="deleteitem-btn-group"> <button name="deleteitembutton" class="btn btn-danger"> <i class="fal fa-trash-alt"></i> 删除 </button> </div> </div> </div> <div class="panel-container show"> <div class="container"> <div class="panel-content"> <form id="company_form" class="easyui-form form-horizontal p-1" method="post" > @Html.AntiForgeryToken() <!--Primary Key--> @Html.HiddenFor(model => model.Id) <fieldset class="form-group"> <!-- begin row --> <!--名称--> <div class="row h-100 justify-content-center align-items-center"> <label class="col-md-2 pr-1 form-label text-right text-danger">@Html.DisplayNameFor(model => model.Name)</label> <div class="col-md-4 mb-1 pl-1"> <input id="@Html.IdFor(model => model.Name)" name="@Html.NameFor(model => model.Name)" value="@Html.ValueFor(model => model.Name)" tabindex="0" required class="easyui-textbox" style="width:100%" type="text" data-options="prompt:'@Html.DescriptionFor(model => model.Name)', required:true, validType: 'length[0,50]' " /> </div> <label class="col-md-2 pr-1 form-label text-right text-danger">@Html.DisplayNameFor(model => model.Code)</label> <div class="col-md-4 mb-1 pl-1"> <input id="@Html.IdFor(model => model.Code)" name="@Html.NameFor(model => model.Code)" value="@Html.ValueFor(model => model.Code)" tabindex="1" required class="easyui-textbox" style="width:100%" type="text" data-options="prompt:'@Html.DescriptionFor(model => model.Code)', required:true, validType: 'length[0,12]' " /> </div> <label class="col-md-2 pr-1 form-label text-right">@Html.DisplayNameFor(model => model.Address)</label> <div class="col-md-4 mb-1 pl-1"> <input id="@Html.IdFor(model => model.Address)" name="@Html.NameFor(model => model.Address)" value="@Html.ValueFor(model => model.Address)" tabindex="2" class="easyui-textbox" style="width:100%" type="text" data-options="prompt:'@Html.DescriptionFor(model => model.Address)', required:false, validType: 'length[0,50]' " /> </div> <label class="col-md-2 pr-1 form-label text-right">@Html.DisplayNameFor(model => model.Contact)</label> <div class="col-md-4 mb-1 pl-1"> <input id="@Html.IdFor(model => model.Contact)" name="@Html.NameFor(model => model.Contact)" value="@Html.ValueFor(model => model.Contact)" tabindex="3" class="easyui-textbox" style="width:100%" type="text" data-options="prompt:'@Html.DescriptionFor(model => model.Contact)', required:false, validType: 'length[0,12]' " /> </div> <label class="col-md-2 pr-1 form-label text-right">@Html.DisplayNameFor(model => model.PhoneNumber)</label> <div class="col-md-4 mb-1 pl-1"> <input id="@Html.IdFor(model => model.PhoneNumber)" name="@Html.NameFor(model => model.PhoneNumber)" value="@Html.ValueFor(model => model.PhoneNumber)" tabindex="4" class="easyui-textbox" style="width:100%" type="text" data-options="prompt:'@Html.DescriptionFor(model => model.PhoneNumber)', required:false, validType: 'length[0,20]' " /> </div> <label class="col-md-2 pr-1 form-label text-right text-danger">@Html.DisplayNameFor(model => model.RegisterDate)</label> <div class="col-md-4 mb-1 pl-1"> <input id="@Html.IdFor(model => model.RegisterDate)" name="@Html.NameFor(model => model.RegisterDate)" value="@Html.ValueFor(model => model.RegisterDate)" tabindex="5" required class="easyui-datebox" style="width:100%" type="text" data-options="prompt:'@Html.DescriptionFor(model => model.RegisterDate)', required:true, formatter:dateformatter" /> </div> </div> </fieldset> </form> </div> </div> </div> </div> @await Component.InvokeAsync("ImportExcel", new ImportExcelOptions { entity="Company", folder="Companies", url= "/Companies", tpl= "Company.xlsx", callback="reload()" }) @section HeadBlock { <link href="~/css/formplugins/bootstrap-daterangepicker/bootstrap-daterangepicker.css" rel="stylesheet" asp-append-version="true" /> <link href="~/js/easyui/themes/insdep/easyui.css" rel="stylesheet" asp-append-version="true" /> } @section ScriptsBlock { <script src="~/js/dependency/moment/moment.js" asp-append-version="true"></script> <script src="~/js/formplugins/bootstrap-daterangepicker/bootstrap-daterangepicker.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.min.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/datagrid-filter.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/columns-ext.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/columns-reset.js" asp-append-version="true"></script> <script src="~/js/easyui/locale/easyui-lang-zh_CN.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.component.js" asp-append-version="true"></script> <script src="~/js/plugin/jquery.serializejson/jquery.serializejson.js" asp-append-version="true"></script> <script src="~/js/jquery.custom.extend.js" asp-append-version="true"></script> <script src="~/js/jquery.extend.formatter.js" asp-append-version="true"></script> <script> class company { constructor() { //this.$dg = $('#companies_datagrid'); this.EDITINLINE = true; this.MODELSTATE = null; this.item = null; this.editIndex = undefined; this.id = null; this.init(); } init() { this.$searchbutton = $('button[name="searchbutton"]'); this.$appendbutton = $('button[name="appendbutton"]'); this.$deletebutton = $('button[name="deletebutton"]'); this.$savebutton = $('button[name="savebutton"]'); this.$cancelbutton = $('button[name="cancelbutton"]'); this.$importbutton = $('button[name="importbutton"]'); this.$downloadmenu = $('a[name="downloadmenu"]'); this.$exportbutton = $('button[name="exportbutton"]'); this.$searchmemenu = $('a[name="searchmemenu"]'); this.$searchcustommenu = $('a[name="searchcustommenu"]'); this.$saveitembutton = $('button[name="saveitembutton"]'); this.$deleteitembutton = $('button[name="deleteitembutton"]'); this.$detailwindow = $("#companydetailwindow"); this.$form = $('#company_form'); document.addEventListener('panel.onfullscreen', () => { this.$dg.datagrid('resize'); }) this.$searchbutton.on('click', this.reloadData.bind(this)); this.$appendbutton.on('click', this.appendItem.bind(this)); this.$deletebutton.on('click', this.removeItem.bind(this)); this.$savebutton.on('click', this.acceptChanges.bind(this)); this.$cancelbutton.on('click', this.rejectChanges.bind(this)); this.$exportbutton.on('click', this.exportexcel.bind(this)); this.$importbutton.on('click', () => { importExcel.upload(); }); this.$downloadmenu.on('click', () => { importExcel.downloadtemplate(); }) this.$saveitembutton.on('click', this.saveItem.bind(this)); this.$deleteitembutton.on('click', this.deleteItem.bind(this)); this.$dg = $('#companies_datagrid').datagrid({ rownumbers: true, checkOnSelect: false, selectOnCheck: false, idField: 'Id', sortName: 'Id', sortOrder: 'desc', remoteFilter: true, singleSelect: true, method: 'get', clientPaging: false, pagination: true, striped: true, height: 670, pageSize: 15, pageList: [15, 20, 50, 100, 500, 2000], filterRules: [], onClickCell: (index, field) => { this.onClickCell(index, field); }, onBeforeLoad: () => { $('.enable-loader').removeClass('enable-loader') }, onLoadSuccess: () => { this.editIndex = undefined; this.$deletebutton.prop('disabled', true); this.$savebutton.prop('disabled', true); this.$cancelbutton.prop('disabled', true); this.bindActionEvents(); }, onCheckAll: (rows) => { if (rows.length > 0) { this.$deletebutton.prop('disabled', false); } }, onUncheckAll: () => { this.$deletebutton.prop('disabled', true); }, onCheck: () => { this.$deletebutton.prop('disabled', false); }, onUncheck: () => { const checked = this.$dg.datagrid('getChecked').length > 0; this.$deletebutton.prop('disabled', !checked); }, onSelect: (index, row) => { this.item = row; }, onBeginEdit: function (index, row) { //const editors = $(this).datagrid('getEditors', index); }, onEndEdit: (index, row) => { this.editIndex = undefined; }, onBeforeEdit: (index, row) => { row.editing = true; this.editIndex = index; this.$deletebutton.prop('disabled', false); this.$savebutton.prop('disabled', false); this.$cancelbutton.prop('disabled', false); this.$dg.datagrid('refreshRow', index); }, onAfterEdit: (index, row) => { row.editing = false; this.editIndex = undefined; this.$dg.datagrid('refreshRow', index); }, onCancelEdit: (index, row) => { row.editing = false; this.editIndex = undefined; this.$deletebutton.prop('disabled', true); this.$savebutton.prop('disabled', true); this.$cancelbutton.prop('disabled', true); this.$dg.datagrid('refreshRow', index); }, frozenColumns: [[ /*开启CheckBox选择功能*/ { field: 'ck', checkbox: true }, { field: 'action', title: '操作', width: 85, sortable: false, resizable: true, formatter: (value, row, index) => { if (!row.editing) { return `<div class="btn-group">\ <button name="actionbutton" data-cmd="edit" data-index="${index}" data-id="${row.Id}" class="btn btn-primary btn-sm btn-icon waves-effect waves-themed" title="查看明细" ><i class="fal fa-edit"></i> </button>\ <button name="actionbutton" data-cmd="delete" data-index="${index}" data-id="${row.Id}" class="btn btn-primary btn-sm btn-icon waves-effect waves-themed" title="删除记录" ><i class="fal fa-times"></i> </button>\ </div>`; } else { return `<button class="btn btn-primary btn-sm btn-icon waves-effect waves-themed" disabled title="查看明细" ><i class="fal fa-edit"></i> </button>`; } } } ]], columns: [[ { /*名称*/ field: 'Name', title: '<span class="required">@Html.DisplayNameFor(model => model.Name)</span>', width: 200, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.Name)', required: true, validType: 'length[0,50]' } }, sortable: true, resizable: true }, { /*组织代码*/ field: 'Code', title: '<span class="required">@Html.DisplayNameFor(model => model.Code)</span>', width: 120, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.Code)', required: true, validType: 'length[0,12]' } }, sortable: true, resizable: true }, { /*地址*/ field: 'Address', title: '@Html.DisplayNameFor(model => model.Address)', width: 200, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.Address)', required: false, validType: 'length[0,50]' } }, sortable: true, resizable: true }, { /*联系人*/ field: 'Contact', title: '@Html.DisplayNameFor(model => model.Contact)', width: 120, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.Contact)', required: false, validType: 'length[0,12]' } }, sortable: true, resizable: true }, { /*联系电话*/ field: 'PhoneNumber', title: '@Html.DisplayNameFor(model => model.PhoneNumber)', width: 120, hidden: false, editor: { type: 'textbox', options: { prompt: '@Html.DescriptionFor(model => model.PhoneNumber)', required: false, validType: 'length[0,20]' } }, sortable: true, resizable: true }, { /*注册日期*/ field: 'RegisterDate', title: '<span class="required">@Html.DisplayNameFor(model => model.RegisterDate)</span>', width: 140, align: 'right', hidden: false, editor: { type: 'datebox', options: { prompt: '@Html.DescriptionFor(model => model.RegisterDate)', required: true } }, formatter: dateformatter, sortable: true, resizable: true }, ]] }).datagrid('columnMoving') .datagrid('resetColumns') .datagrid('enableFilter', [ { /*注册日期*/ field: 'RegisterDate', type: 'dateRange', options: { onChange: value => { $dg.datagrid('addFilterRule', { field: 'RegisterDate', op: 'between', value: value }); $dg.datagrid('doFilter'); } } }, ]) .datagrid('load', '/Companies/GetData'); } //动态绑定datagrid操作时间 bindActionEvents() { $('button[name="actionbutton"]').off('click').on('click', $('button[name="actionbutton"]'), (e) => { console.log('-------') console.log(e) let $button = null; if ($(e.target).is(':button')) { $button = $(e.target); } else { $button = $(e.target).parent(); } const action = $button.data('cmd'); const id = $($button).data('id'); const index = $($button).data('index'); if (action == 'edit') { this.editItem(id, index); } else { this.deleteRow(id); } }); } //执行导出下载Excel exportexcel() { const filterRules = JSON.stringify(this.$dg.datagrid('options').filterRules); $.messager.progress({ title: '请等待', msg: '正在执行导出...' }); let formData = new FormData(); formData.append('filterRules', filterRules); formData.append('sort', 'Id'); formData.append('order', 'asc'); $.postDownload('/Companies/ExportExcel', formData).then(res => { $.messager.progress('close'); toastr.success('导出成功!'); }).catch(err => { //console.log(err); $.messager.progress('close'); $.messager.alert('导出失败', err.statusText, 'error'); }); } //显示快捷菜单 showContextMenu(e, index) { this.$dg.datagrid('columnMenu').menu('show', { left: e.pageX, top: e.pageY }); } //弹出编辑信息 editItem(id, index) { this.MODELSTATE = "Modified" this.item = this.$dg.datagrid('getRows')[index]; this.showDetailWindow(this.item); } //重载或查询数据 reloadData() { this.$dg.datagrid('unselectAll'); this.$dg.datagrid('uncheckAll'); this.$dg.datagrid('reload'); } //新增记录 appendItem() { this.item = { Address: '-', RegisterDate: moment().format('YYYY-MM-DD HH:mm:ss'), }; if (!this.EDITINLINE) { //弹出新增窗口 this.MODELSTATE = 'Added'; this.showDetailWindow(this.item); } else { if (this.endEditing()) { //对必填字段进行默认值初始化 this.$dg.datagrid('insertRow', { index: 0, row: this.item }); this.editIndex = 0; this.$dg.datagrid('selectRow', this.editIndex) .datagrid('beginEdit', this.editIndex); this.hook = true; } } } //删除编辑的行 removeItem() { if (this.$dg.datagrid('getChecked').length <= 0 && this.EDITINLINE) { if (this.editIndex !== undefined) { const delindex = this.editIndex; this.$dg.datagrid('cancelEdit', delindex) .datagrid('deleteRow', delindex); this.hook = true; } else { const rows = this.$dg.datagrid('getChecked'); rows.slice().reverse().forEach(row => { const rowindex = this.$dg.datagrid('getRowIndex', row); this.$dg.datagrid('deleteRow', rowindex); this.hook = true; }); } this.$savebutton.prop('disabled', false); this.$cancelbutton.prop('disabled', false); } else { this.deletechecked(); } } //删除该行 deleteRow(id) { $.messager.confirm('确认', '你确定要删除该记录?', result => { if (result) { this.dodeletechecked([id]); } }) } //删除选中的行 deletechecked() { const id = this.$dg.datagrid('getChecked').filter(item => item.Id > 0).map(item => { return item.Id; }); if (id.length > 0) { $.messager.confirm('确认', `你确定要删除这 <span class='badge badge-icon position-relative'>${id.length} </span> 行记录?`, result => { if (result) { this.dodeletechecked(id); } }); } else { $.messager.alert('提示', '请先选择要删除的记录!', 'question'); } } //执行删除 dodeletechecked(id) { $.post('/Companies/DeleteChecked', { id: id }) .done(response => { if (response.success) { toastr.error(`成功删除[${id.length}]行记录`); this.reloadData(); } else { $.messager.alert('错误', response.err, 'error'); } }) .fail((jqXHR, textStatus, errorThrown) => { $.messager.alert('异常', `${jqXHR.status}: ${jqXHR.statusText} `, 'error'); }); } //开启编辑状态 onClickCell(index, field) { console.log('onClickCell') this.item = this.$dg.datagrid('getRows')[index]; const _actions = ['action', 'ck']; if (!this.EDITINLINE || $.inArray(field, _actions) >= 0) { return; } if (this.editIndex !== index) { if (this.endEditing()) { this.$dg.datagrid('selectRow', index) .datagrid('beginEdit', index); this.hook = true; this.editIndex = index; const ed = this.$dg.datagrid('getEditor', { index: index, field: field }); if (ed) { ($(ed.target).data('textbox') ? $(ed.target).textbox('textbox') : $(ed.target)).focus(); } } else { this.$dg.datagrid('selectRow', index); } } } //关闭编辑状态 endEditing() { if (this.editIndex === undefined) { return true; } if (this.$dg.datagrid('validateRow', this.editIndex)) { this.$dg.datagrid('endEdit', this.editIndex); return true; } else { const invalidinput = $('input.validatebox-invalid', this.$dg.datagrid('getPanel')); const fieldnames = invalidinput.map((index, item) => { return $(item).attr('placeholder') || $(item).attr('id'); }); $.messager.alert('提示', `${Array.from(fieldnames)} 输入有误.`, 'error'); return false; } } //提交保存后台数据库 acceptChanges() { if (this.endEditing()) { if (this.$dg.datagrid('getChanges').length > 0) { const inserted = this.$dg.datagrid('getChanges', 'inserted').map(item => { item.TrackingState = 1; return item; }); const updated = this.$dg.datagrid('getChanges', 'updated').map(item => { item.TrackingState = 2 return item; }); const deleted = this.$dg.datagrid('getChanges', 'deleted').map(item => { item.TrackingState = 3 return item; }); //过滤已删除的重复项 const changed = inserted.concat(updated.filter(item => { return !deleted.includes(item); })).concat(deleted); //$.messager.progress({ title: '请等待', msg: '正在保存数据...', interval: 200 }); $.post('/Companies/AcceptChanges', { companies: changed }) .done(response => { //$.messager.progress('close'); //console.log(response); if (response.success) { toastr.success('保存成功'); this.$dg.datagrid('acceptChanges'); this.reloadData(); this.hook = false; } else { $.messager.alert('错误', response.err, 'error'); } }) .fail((jqXHR, textStatus, errorThrown) => { //$.messager.progress('close'); $.messager.alert('异常', `${jqXHR.status}: ${jqXHR.statusText} `, 'error'); }); } } } //取消变更 rejectChanges() { this.$dg.datagrid('rejectChanges'); this.editIndex = undefined; this.hook = false; } //弹出编辑窗体 showDetailWindow(data) { this.id = (data.Id || 0); this.$detailwindow.window("open"); this.$form.form('reset'); this.$form.form('load', data); } //删除当前记录 deleteItem() { $.messager.confirm('确认', '你确定要删除该记录?', result => { if (result) { const url = `/Companies/Delete/${this.item.Id}`; $.get(url).done(res => { if (res.success) { toastr.success("删除成功"); this.$detailwindow.window("close"); this.reloadData(); } else { $.messager.alert("错误", res.err, "error"); } }); } }); } //保存当然编辑 saveItem() { if (this.$form.form('enableValidation').form('validate')) { let company = this.$form.serializeJSON(); let url = '/Companies/Edit'; //判断是新增或是修改方法 if (this.MODELSTATE === 'Added') { url = '/Companies/Create'; } var token = $('input[name="__RequestVerificationToken"]', this.$form).val(); //$.messager.progress({ title: '请等待', msg: '正在保存数据...', interval: 200 }); $.ajax({ type: "POST", url: url, data: { __RequestVerificationToken: token, company: company }, dataType: 'json', contentType: 'application/x-www-form-urlencoded; charset=utf-8' }) .done(response => { //$.messager.progress('close'); if (response.success) { this.hook = false; this.$form.form('disableValidation'); this.$dg.datagrid('reload'); this.$detailwindow.window("close"); toastr.success("保存成功"); } else { $.messager.alert("错误", response.err, "error"); } }) .fail((jqXHR, textStatus, errorThrown) => { $.messager.alert('异常', `${jqXHR.status}: ${jqXHR.statusText} `, 'error'); }); } } //关闭窗口 closedetailwindow() { this.$detailwindow.window('close'); } } $(() => { var mycompany = new company(); console.log(mycompany); }) </script> }
the_stack
using System.Net; using System.Text.RegularExpressions; using System.Xml; using System.Xml.Linq; ////////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// var target = Argument("t", Argument("target", "Default")); var configuration = Argument("c", Argument("configuration", "Release")); var packagesToBuild = Argument ("id", "")?.Split (new [] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (packagesToBuild?.Length > 0) { Information ($"Building {packagesToBuild.Length} project(s): " + string.Join (", ", packagesToBuild)); } else { packagesToBuild = null; Information ($"Building all the projects."); } EnsureDirectoryExists ("./output"); public enum TargetOS { Windows, Mac, Android, iOS, tvOS, } ////////////////////////////////////////////////////////////////////// // VERSIONS ////////////////////////////////////////////////////////////////////// var versions = new Dictionary<string, string[]> { { "JakeWharton.Picasso2OkHttp3Downloader", new [] { "1.1.0" , "1.1.0.1" } }, { "Square.Aardvark", new [] { "3.4.1" , "3.4.1" } }, { "Square.AndroidTimesSquare", new [] { "1.7.3" , "1.7.3.1" } }, { "Square.CoreAardvark", new [] { "2.2.1" , "2.2.1" } }, { "Square.OkHttp.UrlConnection", new [] { "2.7.5" , "2.7.5.1" } }, { "Square.OkHttp.WS", new [] { "2.7.5" , "2.7.5.1" } }, { "Square.OkHttp", new [] { "2.7.5" , "2.7.5.1" } }, { "Square.OkHttp3.WS", new [] { "3.4.2" , "3.4.2.1" } }, { "Square.OkHttp3.UrlConnection", new [] { "3.12.3" , "3.12.3" } }, { "Square.OkHttp3", new [] { "4.2.2" , "4.2.2" } }, { "Square.OkIO", new [] { "2.4.1" , "2.4.1" } }, { "Square.Picasso", new [] { "2.5.2" , "2.5.2.2" } }, { "Square.Pollexor", new [] { "2.0.4" , "2.0.4.1" } }, { "Square.Retrofit", new [] { "1.9.0" , "1.9.0.1" } }, { "Square.Retrofit2.AdapterRxJava2", new [] { "2.4.0" , "2.4.0.1" } }, { "Square.Retrofit2.ConverterGson", new [] { "2.4.0" , "2.4.0.1" } }, { "Square.Retrofit2", new [] { "2.4.0" , "2.4.0.1" } }, { "Square.Seismic", new [] { "1.0.2" , "1.0.2.1" } }, { "Square.SocketRocket", new [] { "0.5.1" , "0.5.1.1" } }, { "Square.Valet", new [] { "2.4.1" , "2.4.1.1" } }, }; var macOnly = new [] { "Square.SocketRocket", "Square.Valet", "Square.Aardvark", "Square.CoreAardvark", "AardvarkSample", "SocketRocketSample", "SocketRocketSample-OSX", "SocketRocketSample-TVOS", "ValetSample", }; //////////////////////////////////////////////////////////////////////////////////////////////////// // TOOLS & FUNCTIONS - the bits to make it all work //////////////////////////////////////////////////////////////////////////////////////////////////// var NugetToolPath = Context.Tools.Resolve ("nuget.exe"); void RunLipo (DirectoryPath directory, FilePath output, FilePath[] inputs) { if (!IsRunningOnUnix ()) { throw new InvalidOperationException ("lipo is only available on Unix."); } var dir = directory.CombineWithFilePath (output).GetDirectory (); if (!DirectoryExists (dir)) { CreateDirectory (dir); } var inputString = string.Join(" ", inputs.Select (i => string.Format ("\"{0}\"", i))); StartProcess ("lipo", new ProcessSettings { Arguments = string.Format("-create -output \"{0}\" {1}", output, inputString), WorkingDirectory = directory, }); } void BuildXCode (FilePath project, string libraryTitle, DirectoryPath workingDirectory, TargetOS os) { if (!IsRunningOnUnix ()) { return; } var fatLibrary = string.Format("lib{0}.a", libraryTitle); var output = string.Format ("lib{0}.a", libraryTitle); var i386 = string.Format ("lib{0}-i386.a", libraryTitle); var x86_64 = string.Format ("lib{0}-x86_64.a", libraryTitle); var armv7 = string.Format ("lib{0}-armv7.a", libraryTitle); var armv7s = string.Format ("lib{0}-armv7s.a", libraryTitle); var arm64 = string.Format ("lib{0}-arm64.a", libraryTitle); var buildArch = new Action<string, string, FilePath> ((sdk, arch, dest) => { if (!FileExists (dest)) { XCodeBuild (new XCodeBuildSettings { Project = workingDirectory.CombineWithFilePath (project).ToString (), Target = libraryTitle, Sdk = sdk, Arch = arch, Configuration = "Release", }); var outputPath = workingDirectory.Combine ("build").Combine (os == TargetOS.Mac ? "Release" : ("Release-" + sdk)).Combine (libraryTitle).CombineWithFilePath (output); CopyFile (outputPath, dest); } }); if (os == TargetOS.Mac) { buildArch ("macosx", "x86_64", workingDirectory.CombineWithFilePath (x86_64)); if (!FileExists (workingDirectory.CombineWithFilePath (fatLibrary))) { RunLipo (workingDirectory, fatLibrary, new [] { (FilePath)x86_64 }); } } else if (os == TargetOS.iOS) { buildArch ("iphonesimulator", "i386", workingDirectory.CombineWithFilePath (i386)); buildArch ("iphonesimulator", "x86_64", workingDirectory.CombineWithFilePath (x86_64)); buildArch ("iphoneos", "armv7", workingDirectory.CombineWithFilePath (armv7)); buildArch ("iphoneos", "armv7s", workingDirectory.CombineWithFilePath (armv7s)); buildArch ("iphoneos", "arm64", workingDirectory.CombineWithFilePath (arm64)); if (!FileExists (workingDirectory.CombineWithFilePath (fatLibrary))) { RunLipo (workingDirectory, fatLibrary, new [] { (FilePath)i386, (FilePath)x86_64, (FilePath)armv7, (FilePath)armv7s, (FilePath)arm64 }); } } else if (os == TargetOS.tvOS) { buildArch ("appletvsimulator", "x86_64", workingDirectory.CombineWithFilePath (x86_64)); buildArch ("appletvos", "arm64", workingDirectory.CombineWithFilePath (arm64)); if (!FileExists (workingDirectory.CombineWithFilePath (fatLibrary))) { RunLipo (workingDirectory, fatLibrary, new [] { (FilePath)x86_64, (FilePath)arm64 }); } } } void BuildDynamicXCode (FilePath project, string libraryTitle, DirectoryPath workingDirectory, TargetOS os) { if (!IsRunningOnUnix ()) return; var fatLibrary = (DirectoryPath)string.Format("{0}.framework", libraryTitle); var fatLibraryPath = workingDirectory.Combine (fatLibrary); var output = (DirectoryPath)string.Format ("{0}.framework", libraryTitle); var i386 = (DirectoryPath)string.Format ("{0}-i386.framework", libraryTitle); var x86_64 = (DirectoryPath)string.Format ("{0}-x86_64.framework", libraryTitle); var armv7 = (DirectoryPath)string.Format ("{0}-armv7.framework", libraryTitle); var armv7s = (DirectoryPath)string.Format ("{0}-armv7s.framework", libraryTitle); var arm64 = (DirectoryPath)string.Format ("{0}-arm64.framework", libraryTitle); var buildArch = new Action<string, string, DirectoryPath> ((sdk, arch, dest) => { if (!DirectoryExists (dest)) { XCodeBuild (new XCodeBuildSettings { Project = workingDirectory.CombineWithFilePath (project).ToString (), Target = libraryTitle, Sdk = sdk, Arch = arch, Configuration = "Release", }); var outputPath = workingDirectory.Combine ("build").Combine (os == TargetOS.Mac ? "Release" : ("Release-" + sdk)).Combine (libraryTitle).Combine (output); CopyDirectory (outputPath, dest); } }); if (os == TargetOS.Mac) { buildArch ("macosx", "x86_64", workingDirectory.Combine (x86_64)); if (!DirectoryExists (fatLibraryPath)) { CopyDirectory (workingDirectory.Combine (x86_64), fatLibraryPath); RunLipo (workingDirectory, fatLibrary.CombineWithFilePath (libraryTitle), new [] { x86_64.CombineWithFilePath (libraryTitle), }); } } else if (os == TargetOS.iOS) { buildArch ("iphonesimulator", "i386", workingDirectory.Combine (i386)); buildArch ("iphonesimulator", "x86_64", workingDirectory.Combine (x86_64)); buildArch ("iphoneos", "armv7", workingDirectory.Combine (armv7)); buildArch ("iphoneos", "armv7s", workingDirectory.Combine (armv7s)); buildArch ("iphoneos", "arm64", workingDirectory.Combine (arm64)); if (!DirectoryExists (fatLibraryPath)) { CopyDirectory (workingDirectory.Combine (arm64), fatLibraryPath); RunLipo (workingDirectory, fatLibrary.CombineWithFilePath (libraryTitle), new [] { i386.CombineWithFilePath (libraryTitle), x86_64.CombineWithFilePath (libraryTitle), armv7.CombineWithFilePath (libraryTitle), armv7s.CombineWithFilePath (libraryTitle), arm64.CombineWithFilePath (libraryTitle) }); } } else if (os == TargetOS.tvOS) { buildArch ("appletvsimulator", "x86_64", workingDirectory.Combine (x86_64)); buildArch ("appletvos", "arm64", workingDirectory.Combine (arm64)); if (!DirectoryExists (fatLibraryPath)) { CopyDirectory (workingDirectory.Combine (arm64), fatLibraryPath); RunLipo (workingDirectory, fatLibrary.CombineWithFilePath (libraryTitle), new [] { x86_64.CombineWithFilePath (libraryTitle), arm64.CombineWithFilePath (libraryTitle) }); } } } void DownloadPod (bool isDynamic, DirectoryPath podfilePath, string platform, string platformVersion, IDictionary<string, string> pods) { if (!IsRunningOnUnix ()) return; if (!FileExists (podfilePath.CombineWithFilePath ("Podfile.lock"))) { var builder = new StringBuilder (); builder.AppendFormat ("platform :{0}, '{1}'", platform, platformVersion); builder.AppendLine (); builder.AppendLine ("install! 'cocoapods', :integrate_targets => false"); if (isDynamic) builder.AppendLine ("use_frameworks!"); builder.AppendLine ("target 'Xamarin' do"); foreach (var pod in pods) { builder.AppendFormat (" pod '{0}', '{1}'", pod.Key, pod.Value); builder.AppendLine (); } builder.AppendLine ("end"); if (!DirectoryExists (podfilePath)) CreateDirectory (podfilePath); System.IO.File.WriteAllText (podfilePath.CombineWithFilePath ("Podfile").ToString (), builder.ToString ()); CocoaPodInstall (podfilePath); } } void CreatePod (string packageId, bool isDynamic, string osxVersion, string iosVersion, string tvosVersion, params string[] podIds) { if (packagesToBuild != null && packagesToBuild.All (x => !x.Equals (packageId, StringComparison.OrdinalIgnoreCase))) return; var pods = new Dictionary<string, string> (); foreach (var id in podIds) { pods [id] = versions ["Square." + id] [0]; } var path = ((DirectoryPath)"./externals").Combine (packageId); var name = pods.Keys.First (); var build = isDynamic ? new Action<FilePath, string, DirectoryPath, TargetOS> (BuildDynamicXCode) : new Action<FilePath, string, DirectoryPath, TargetOS> (BuildXCode); if (osxVersion != null) { DownloadPod (isDynamic, path.Combine("osx"), "osx", osxVersion, pods); build ("Pods/Pods.xcodeproj", name, path.Combine ("osx"), TargetOS.Mac); } if (iosVersion != null) { DownloadPod (isDynamic, path.Combine("ios"), "ios", iosVersion, pods); build ("Pods/Pods.xcodeproj", name, path.Combine ("ios"), TargetOS.iOS); } if (tvosVersion != null) { DownloadPod (isDynamic, path.Combine("tvos"), "tvos", tvosVersion, pods); build ("Pods/Pods.xcodeproj", name, path.Combine ("tvos"), TargetOS.tvOS); } } void DownloadJar (string source, FilePath destination) { var packageId = destination.GetDirectory ().GetDirectoryName (); if (packagesToBuild != null && packagesToBuild.All (x => !x.Equals (packageId, StringComparison.OrdinalIgnoreCase))) return; destination = ((DirectoryPath)"./externals").CombineWithFilePath (destination); var version = versions [packageId] [0]; var url = string.Format("http://search.maven.org/remotecontent?filepath=" + source, version); EnsureDirectoryExists (destination.GetDirectory ()); if (!FileExists (destination)) DownloadFile (url, destination); } //////////////////////////////////////////////////////////////////////////////////////////////////// // EXTERNALS - //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("externals") .Does (() => { DownloadJar ("com/squareup/okio/okio/{0}/okio-{0}.jar", "Square.OkIO/okio.jar"); DownloadJar ("com/squareup/okhttp/okhttp/{0}/okhttp-{0}.jar", "Square.OkHttp/okhttp.jar"); DownloadJar ("com/squareup/okhttp3/okhttp/{0}/okhttp-{0}.jar", "Square.OkHttp3/okhttp3.jar"); DownloadJar ("com/squareup/okhttp/okhttp-ws/{0}/okhttp-ws-{0}.jar", "Square.OkHttp.WS/okhttp-ws.jar"); DownloadJar ("com/squareup/okhttp3/okhttp-ws/{0}/okhttp-ws-{0}.jar", "Square.OkHttp3.WS/okhttp3-ws.jar"); DownloadJar ("com/squareup/okhttp/okhttp-urlconnection/{0}/okhttp-urlconnection-{0}.jar", "Square.OkHttp.UrlConnection/okhttp-urlconnection.jar"); DownloadJar ("com/squareup/okhttp3/okhttp-urlconnection/{0}/okhttp-urlconnection-{0}.jar", "Square.OkHttp3.UrlConnection/okhttp-urlconnection.jar"); DownloadJar ("com/squareup/picasso/picasso/{0}/picasso-{0}.jar", "Square.Picasso/picasso.jar"); DownloadJar ("com/squareup/android-times-square/{0}/android-times-square-{0}.aar", "Square.AndroidTimesSquare/android-times-square.aar"); DownloadJar ("com/squareup/seismic/{0}/seismic-{0}.jar", "Square.Seismic/seismic.jar"); DownloadJar ("com/squareup/pollexor/{0}/pollexor-{0}.jar", "Square.Pollexor/pollexor.jar"); DownloadJar ("com/squareup/retrofit/retrofit/{0}/retrofit-{0}.jar", "Square.Retrofit/retrofit.jar"); DownloadJar ("com/squareup/retrofit2/retrofit/{0}/retrofit-{0}.jar", "Square.Retrofit2/retrofit2.jar"); DownloadJar ("com/squareup/retrofit2/converter-gson/{0}/converter-gson-{0}.jar", "Square.Retrofit2.ConverterGson/convertergson.jar"); DownloadJar ("com/squareup/retrofit2/adapter-rxjava2/{0}/adapter-rxjava2-{0}.jar", "Square.Retrofit2.AdapterRxJava2/adapterrxjava2.jar"); DownloadJar ("com/jakewharton/picasso/picasso2-okhttp3-downloader/{0}/picasso2-okhttp3-downloader-{0}.jar", "JakeWharton.Picasso2OkHttp3Downloader/picasso2-okhttp3-downloader.jar"); if (IsRunningOnUnix ()) { CreatePod ("Square.SocketRocket", false, "10.8", "6.0", "9.0", new [] { "SocketRocket" }); CreatePod ("Square.Valet", false, "10.10", "6.0", null, new [] { "Valet" }); CreatePod ("Square.Aardvark", true, null, "8.0", null, new [] { "Aardvark", "CoreAardvark" }); CreatePod ("Square.CoreAardvark", true, null, "8.0", null, new [] { "CoreAardvark" }); } }); //////////////////////////////////////////////////////////////////////////////////////////////////// // LIBS - //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("libs") .IsDependentOn ("externals") .Does (() => { foreach (var file in GetFiles ("./binding/*/*.csproj")) { var id = file.GetFilenameWithoutExtension ().ToString (); if (packagesToBuild != null && packagesToBuild.All (x => !x.Equals (id, StringComparison.OrdinalIgnoreCase))) continue; var version = Version.Parse (versions [id] [0]); var assemblyVersion = $"{version.Major}.0.0.0"; var fileVersion = $"{version.Major}.{version.Minor}.{version.Build}.0"; var infoVersion = versions [id] [1]; var packageVersion = versions [id] [1]; XmlPoke(file, "/Project/PropertyGroup/Version", assemblyVersion); XmlPoke(file, "/Project/PropertyGroup/FileVersion", fileVersion); XmlPoke(file, "/Project/PropertyGroup/InformationalVersion", fileVersion); XmlPoke(file, "/Project/PropertyGroup/PackageVersion", packageVersion); } foreach (var file in GetFiles ("./binding/*/*.csproj")) { var id = file.GetFilenameWithoutExtension ().ToString (); if (packagesToBuild != null && packagesToBuild.All (x => !x.Equals (id, StringComparison.OrdinalIgnoreCase))) continue; if (IsRunningOnWindows () && macOnly.Contains (id)) continue; var settings = new MSBuildSettings () .SetConfiguration (configuration) .SetVerbosity (Verbosity.Minimal) .WithRestore () // .WithProperty ("IncludeSymbols", "true") .WithProperty ("DesignTimeBuild", "false") .WithProperty ("PackageOutputPath", MakeAbsolute ((DirectoryPath)"./output/").FullPath) .WithTarget ("Pack"); MSBuild (file, settings); } }); //////////////////////////////////////////////////////////////////////////////////////////////////// // PACKAGING - //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("nuget") .IsDependentOn ("libs") .Does (() => { EnsureDirectoryExists ("./output/new/"); var newCount = 0; foreach (var package in versions) { var id = package.Key; if (packagesToBuild != null && packagesToBuild.All (x => !x.Equals (id, StringComparison.OrdinalIgnoreCase))) continue; var version = package.Value [1]; Information ($"Checking for {version} of {id}..."); try { DownloadFile ($"https://api.nuget.org/v3/registration3/{id.ToLower ()}/{version}.json"); Information ($"Version {version} already published."); } catch { Information ($"No matching versions found, copying..."); newCount++; CopyFileToDirectory ($"./output/{id}.{version}.nupkg", "./output/new/"); } } if (newCount == 0) Warning ("No new package versions built."); }); Task ("component") .IsDependentOn ("nuget"); Task ("diff") .IsDependentOn ("nuget") .Does (() => { var res = StartProcess("api-tools", "nuget-diff ./output --latest --group-ids --ignore-unchanged --output ./output/api-diff --cache ./externals/package_cache"); if (res != 0) throw new Exception($"Process api-tools exited with code {res}."); }); //////////////////////////////////////////////////////////////////////////////////////////////////// // SAMPLES - //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("samples") .Does (() => { foreach (var file in GetFiles ("./sample/*/*.sln")) { var id = file.GetFilenameWithoutExtension ().ToString (); if (IsRunningOnWindows () && macOnly.Contains (id)) continue; var settings = new MSBuildSettings () .SetConfiguration (configuration) .SetVerbosity (Verbosity.Minimal) .WithRestore () .WithProperty ("DesignTimeBuild", "false"); MSBuild (file, settings); } }); //////////////////////////////////////////////////////////////////////////////////////////////////// // CLEAN - //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("clean") .Does (() => { CleanDirectories ("./binding/*/bin"); CleanDirectories ("./binding/*/obj"); CleanDirectories ("./binding/packages"); CleanDirectories ("./sample/*/bin"); CleanDirectories ("./sample/*/obj"); CleanDirectories ("./sample/packages"); CleanDirectories ("./output"); }); Task ("clean-native") .IsDependentOn ("clean") .Does (() => { CleanDirectories("./externals"); }); //////////////////////////////////////////////////////////////////////////////////////////////////// // START - //////////////////////////////////////////////////////////////////////////////////////////////////// Task("Fast") .IsDependentOn("externals") .IsDependentOn("libs") .IsDependentOn("nuget") .IsDependentOn("diff"); Task("Default") .IsDependentOn("externals") .IsDependentOn("libs") .IsDependentOn("nuget") .IsDependentOn("diff") .IsDependentOn("samples"); RunTarget (target);
the_stack
@model Xms.Web.Customize.Models.EditDashBoardModel @section Header { <link href="/content/css/iconfon.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet" /> <link href="/content/css/sumoselect.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet" /> } <form action="/@app.OrganizationUniqueName/customize/dashboard/editdashboard" method="post" id="editform" data-jsonajax="true" class="form-horizontal" role="form"> @Html.AntiForgeryToken() @Html.HiddenFor(x => x.SolutionId) @Html.HiddenFor(x => x.EntityId) @Html.HiddenFor(x => x.SystemFormId) @Html.HiddenFor(x => x.FormConfig) <div class="container-fluid sc-toolbar ykf-toolbar"> <div class="form-group"> <div class="col-sm-12 ykf-toolbar-items"> <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-saved"></span> @app.T["save"]</button> <span onclick="charslayoutShow()" class="btn btn-info"> <em class="glyphicon glyphicon-th-large"></em> @app.T["select_layout"] </span> <span onclick="charRowModal()" class="btn btn-info"> <em class="glyphicon glyphicon-th-large"></em> 添加区块 </span> </div> </div> <form action="" class="form-horizontal"> <input type="hidden" name="dashBoardType" id="dashBoardType" value="" /> <div class="form-group"> <label class="col-sm-1 control-label">@app.T["dashboard_name_colon"]</label> <div class="col-sm-5"><input type="text" class="form-control required" name="Name" id="Name" value="@Model.Name" /></div> </div> </form> </div> <div id="wrapbydashboard" class="wrapbydashboard custom-group-box"> <div class="custom-group-section clearfix"> </div> </div> <div class="modal" id="charslayout" style="display:none;"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span class="m-close-btn" aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title"><span class="glyphicon glyphicon-th"></span> @app.T["select_layout"]</h4> </div> <div class="modal-body"> <div class="row custom-list-center"> <div class="custom-list-item" data-type="1" data-target="#customGroupBox1"> <ul class="custom-list-dgroup first clearfix"> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> <p class="text-center">@app.T["three_line"]</p> <p class="text-center">@app.T["convention_dashboard"]</p> </div> <div class="custom-list-item" data-type="2" data-target="#customGroupBox2"> <ul class="custom-list-dgroup second clearfix"> <li></li> <li class="p43"></li> <li></li> <li class="p43"></li> <li class="p43"></li> </ul> <p class="text-center">@app.T["three_line"]</p> <p class="text-center">@app.T["multi_focus_dashboard"]</p> </div> <div class="custom-list-item" data-type="3" data-target="#customGroupBox3"> <ul class="custom-list-dgroup third clearfix"> <li></li> <li></li> <li></li> <li></li> <li class="lfull"></li> </ul> <p class="text-center">@app.T["four_line"]</p> <p class="text-center">@app.T["summarize_dashboard"]</p> </div> <div class="custom-list-item" data-type="4" data-target="#customGroupBox4"> <ul class="custom-list-dgroup clearfix"> <li class="p43"></li> <li class="p43"></li> <li class="p43"></li> <li class="p43"></li> </ul> <p class="text-center">@app.T["two_line"]</p> <p class="text-center">@app.T["convention_dashboard"]</p> </div> <div class="custom-list-item" data-type="5" data-target="#customGroupBox5"> <ul class="custom-list-dgroup fifth clearfix"> <li></li> <li></li> <li></li> <li class="lfull"></li> </ul> <p class="text-center">@app.T["three_line"]</p> <p class="text-center">@app.T["summarize_dashboard"]</p> </div> <div class="custom-list-item" data-type="6" data-target="#customGroupBox6"> <ul class="custom-list-dgroup sixth clearfix"> <li class="fhei"></li> <li></li> <li></li> <li></li> <li></li> </ul> <p class="text-center">@app.T["three_line"]</p> <p class="text-center">@app.T["focus_dashboard"]</p> </div> </div> </div> <div class="modal-footer"> @*<button type="button" class="btn btn-primary m-accept-btn">创建</button>*@ </div> </div> </div> </div> <div class="modal" id="charRowModal" style="display:none;"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span class="m-close-btn" aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title"><span class="glyphicon glyphicon-th"></span> 选择添加</h4> </div> <div class="modal-body"> <div class="row custom-list-center"> <div class="custom-list-item" data-type="0" data-target="#customGroupBox3"> <ul class="custom-list-dgroup third clearfix"> <li class="active"></li> <li></li> <li></li> <li></li> </ul> <p class="text-center">1/4个</p> </div> <div class="custom-list-item" data-type="2" data-target="#customGroupBox1"> <ul class="custom-list-dgroup first clearfix"> <li class="active"></li> <li></li> <li></li> </ul> <p class="text-center">1/3个</p> </div> <div class="custom-list-item" data-type="1" data-target="#customGroupBox2"> <ul class="custom-list-dgroup second clearfix"> <li class="p43 active"></li> <li class="p43"></li> </ul> <p class="text-center">1/2个</p> </div> <div class="custom-list-item" data-type="3" data-target="#customGroupBox5"> <ul class="custom-list-dgroup fifth clearfix"> <li class="lfull active"></li> </ul> <p class="text-center">1行</p> </div> <div class="custom-list-item" data-type="4" data-target="#customGroupBox6"> <ul class="custom-list-dgroup sixth clearfix"> <li class="fhei active"></li> <li class="fhei"></li> </ul> <p class="text-center">占2行2列(左)</p> </div> <div class="custom-list-item custom-item-right" data-type="5" data-target="#customGroupBox6"> <ul class="custom-list-dgroup sixth clearfix"> <li class="fhei"></li> <li class="fhei active" style="float:right;"></li> </ul> <p class="text-center">占2行2列(右)</p> </div> </div> </div> <div class="modal-footer"> @*<button type="button" class="btn btn-primary m-accept-btn">创建</button>*@ </div> </div> </div> </div> <div class="container-fluid" id="custon-charts-section"></div> <div class="custom-group-box" style="display:none;" id="customGroupBox1"> <div class="custom-group-section clearfix"> <h5>title</h5> <div class="custom-item custom-item-33"> <div class="custom-insert-box" data-cellspan="4" data-rowspan="1"> </div> </div> <div class="custom-item custom-item-33"><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div> <div class="custom-item custom-item-33"><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div> <div class="custom-item custom-item-33"><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div> <div class="custom-item custom-item-33"><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div> <div class="custom-item custom-item-33"><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div> </div> </div> <div class="custom-group-box" style="display:none;" id="customGroupBox2"> <div class="custom-group-section clearfix"> <h5>title</h5> <div class="custom-item custom-item-23"> <div class="custom-insert-box" data-cellspan="3" data-rowspan="1"> </div> </div> <div class="custom-item custom-item-53"><div class="custom-insert-box" data-cellspan="6" data-rowspan="1"></div></div> <div class="custom-item custom-item-23"><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div> <div class="custom-item custom-item-49"><div class="custom-insert-box" data-cellspan="6" data-rowspan="1"></div></div> <div class="custom-item custom-item-49"><div class="custom-insert-box" data-cellspan="6" data-rowspan="1"></div></div> </div> </div> <div class="custom-group-box" style="display:none;" id="customGroupBox3"> <div class="custom-group-section clearfix"> <h5>title</h5> <div class="custom-item custom-item-24"> <div class="custom-insert-box" data-cellspan="3" data-rowspan="1"> </div> </div> <div class="custom-item custom-item-24"><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div> <div class="custom-item custom-item-24"><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div> <div class="custom-item custom-item-24"><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div> <div class="custom-item custom-item-99"><div class="custom-insert-box" data-cellspan="12" data-rowspan="1"></div></div> </div> </div> <div class="custom-group-box" style="display:none;" id="customGroupBox4"> <div class="custom-group-section clearfix"> <h5>title</h5> <div class="custom-item custom-item-49"> <div class="custom-insert-box" data-cellspan="6" data-rowspan="1"> </div> </div> <div class="custom-item custom-item-49"><div class="custom-insert-box" data-cellspan="6" data-rowspan="1"></div></div> <div class="custom-item custom-item-49"><div class="custom-insert-box" data-cellspan="6" data-rowspan="1"></div></div> <div class="custom-item custom-item-49"><div class="custom-insert-box" data-cellspan="6" data-rowspan="1"></div></div> </div> </div> <div class="custom-group-box" style="display:none;" id="customGroupBox5"> <div class="custom-group-section clearfix"> <h5>title</h5> <div class="custom-item custom-item-33"><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div> <div class="custom-item custom-item-33"><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div> <div class="custom-item custom-item-33"><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div> <div class="custom-item custom-item-99"><div class="custom-insert-box" data-cellspan="12" data-rowspan="1"></div></div> </div> </div> <div class="custom-group-box" style="display:none;" id="customGroupBox6"> <div class="custom-group-section clearfix"> <h5>title</h5> <div class="custom-item custom-item-49"> <div class="custom-insert-box custom-insert-dbox" data-cellspan="6" data-rowspan="2"> </div> </div> <div class="custom-item custom-item-24"><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div> <div class="custom-item custom-item-24"><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div> <div class="custom-item custom-item-24"><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div> <div class="custom-item custom-item-24"><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div> </div> </div> </form> <!--script html tmplate--> <script id="customIconList" type="text/x-jquery-tmpl"> <ul class="clearfix"> <li><span class="sc-charts-w"><em class="iconfont icon-tongji"></em></span></li> <li><span class="sc-grids-w"><em class="iconfont icon-fenlei"></em></span></li> <li><span class="sc-iframe-w"><em class="iconfont icon-fangxingweixuanzhong"></em></span></li> <li><span class="sc-resource-w"><em class="iconfont icon-duoyuyan"></em></span></li> </ul> </script> <script id="iframeModal" type="text/x-jquery-tmpl"> <div class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span class="m-close-btn" aria-hidden="true">@app.T["times_sign"]</span> <span class="sr-only">@app.T["close"]</span> </button> <h4 class="modal-title"><span class="glyphicon glyphicon-file"></span> @app.T["board_modal_title"]</h4> <p class="text-muted">@app.T["add_IFRAMEto_dashboard"]</p> </div> <div class="modal-body"> <div class="form-group row"> <label class="col-sm-3 control-label"><span>@app.T["dashboard_name"]</span></label> <div class="col-sm-9"> <input name="iframe-name" value="" class="form-control input-sm iframe-name" disabled="disabled" type="text" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["label"]</label> <div class="col-sm-9 "> <input name="iframe-label" value="" class="form-control input-sm iframe-label" type="text" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["show_label"]</label> <div class="col-sm-9 "> <input class="iframe-isshowlabel" name="iframe-isshowlabel" checked="checked" type="checkbox" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["dashboard_url"]</label> <div class="col-sm-9"> <input name="iframe-url" value="" class="form-control input-sm iframe-url" type="text" /> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary m-accept-btn"><span class="glyphicon glyphicon-ok"></span> @app.T["dashboard_confirm"]</button> </div> </div> </div> </div> </script> <script id="resourceModal" type="text/x-jquery-tmpl"> <div class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span class="m-close-btn" aria-hidden="true">×</span> <span class="sr-only">@app.T["close"]</span> </button> <h4 class="modal-title"><span class="glyphicon glyphicon-link"></span> @app.T["board_modal_title"]</h4> <p class="text-muted">@app.T["add_web_resources_to_dashboard"]</p> </div> <div class="modal-body"> <div class="form-group row"> <label class="col-sm-3 control-label"><span>@app.T["dashboard_name"]</span></label> <div class="col-sm-9"> <input name="resource-name" value="" class="form-control input-sm resource-name" disabled="disabled" type="text" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["label"]</label> <div class="col-sm-9 "> <input name="resource-label" value="" class="form-control input-sm resource-label" type="text" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["show_label"]</label><!--显示标签--> <div class="col-sm-9 "> <input class="resource-isshowlabel" name="resource-isshowlabel" checked="checked" type="checkbox" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["webresource"]</label> <div class="col-sm-9"> <select class="form-control" id="ResourceList"> {{if datas}} <option value="">@app.T["please_select"]</option> {{each datas}} <option value="${$value.webresourceid}">@app.T["webresourceid_value_name"]</option> {{/each}} {{/if}} </select> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary m-accept-btn"><span class="glyphicon glyphicon-ok"></span> @app.T["confirm"]</button> </div> </div> </div> </div> </script> <script id="ccSelModal" type="text/x-jquery-tmpl"> <div class="modal fade" id=""> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span class="m-close-btn" aria-hidden="true">×</span> <span class="sr-only">@app.T["close"]</span><!--Close--> </button> <h4 class="modal-title"><span class="glyphicon glyphicon-stats"></span> @app.T["board_modal_title"]</h4> <p class="text-muted">@app.T["select_need_added_dashboard_assembly"]</p> </div> <div class="modal-body"> <div class="form-group row"> <label class="col-sm-3 control-label"><span>@app.T["name"]</span></label> <div class="col-sm-9"> <input name="chart-name" value="" class="form-control input-sm chart-name" disabled="disabled" type="text" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["label"]</label> <div class="col-sm-9 "> <input name="chart-label" value="" class="form-control input-sm chart-label" type="text" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["show_label"]</label> <div class="col-sm-9 "> <input class="chart-isshowlabel" name="chart-isshowlabel" checked="checked" type="checkbox" /> </div> </div> {{if ttype==="grids"}} <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["allows_quick_query"]</label> <div class="col-sm-9 "> <input class="chart-enablequickfind" name="chart-enablequickfind" checked="checked" type="checkbox" /> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["page_amounts"]</label> <div class="col-sm-9 "> <input class="form-control input-sm chart-recordsperpage " name="chart-recordsperpage" value="10" type="text" /> </div> </div> {{/if}} <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["Allows_view_selected"]</label> <div class="col-sm-9 "> <input class="chart-enableviewpicker" name="chart-enableviewpicker" checked="checked" type="checkbox" /> </div> </div> {{if ttype==="charts"}} <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["Allows_chart_choose"]</label> <div class="col-sm-9 "> <input class="chart-enablechartpicker " name="chart-enablechartpicker" checked="checked" type="checkbox" /> </div> </div> {{/if}} <div class="form-group row"> <label class="col-sm-3 control-label"><span>@app.T["record_type"]</span></label> <div class="col-sm-9 entitySelect"> <select class="form-control" id="EntitysList"> {{if datas}} <option value="">@app.T["please_select"]</option> {{each datas}} <option value="${$value.entityid}">${$value.localizedname}</option> {{/each}} {{/if}} </select> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["queryview"]</label> <div class="col-sm-9 viewSelector"> <select class="form-control"></select> </div> </div> {{if ttype==="charts"}} <div class="form-group row"> <label class="col-sm-3 control-label">@app.T["chart"]</label> <div class="col-sm-9 chartSelector"> <select class="form-control"></select> </div> </div> {{/if}} @*{{if ttype==="grids"}} <div class="form-group"> <select class="form-control"> {{if datas}} {{each datas}} <option value="${$value.entityid}">${$value.localizedname}</option> {{/each}} {{/if}} </select> </div> {{/if}}*@ </div> <div class="modal-footer"> <button type="button" class="btn btn-primary m-accept-btn"><span class="glyphicon glyphicon-ok"></span> @app.T["confirm"]</button> </div> </div> </div> </div> </script> <script id="Selrender" type="text/x-jquery-tmpl"> <select class="form-control"> {{if datas}} {{each datas}} <option value="${$value.queryviewid}">${$value.name}</option> {{/each}} {{/if}} </select> </script> <script id="Chartrender" type="text/x-jquery-tmpl"> <select class="form-control"> {{if datas}} {{each datas}} <option value="${$value.chartid}">${$value.name}</option> {{/each}} {{/if}} </select> </script> <style> #main { margin-bottom: 0 !important; } </style> <link href="~/content/js/jquery-ui-1.10.3/themes/base/jquery.ui.all.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet"> <link href="/content/js/grid/pqgrid.dev.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet"> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.core.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.widget.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.mouse.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.draggable.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.button.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.mouse.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.autocomplete.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.draggable.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.resizable.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.tooltip.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/fetch.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery.form.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-validate/jquery.validate.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-validate/localization/messages_zh.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/form.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/chars.module.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery.tmpl.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/echarts.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery.sumoselect.js"></script> <script src="/content/js/xms.metadata.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/grid/pqgrid.dev.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/grid/localize/pq-localize-zh.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/cdatagrid.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/pages/m.datagrid.js?v=@app.PlatformSettings.VersionNumber"></script> <script> //添加的单个块 var layoutList = [ { html: '<div class="custom-item custom-item-24"><div class="custom-item-remove"><span class="glyphicon glyphicon-remove"></span></div><div class="custom-insert-box" data-cellspan="3" data-rowspan="1"></div></div>' },//1/4 { html: '<div class="custom-item custom-item-49"><div class="custom-item-remove"><span class="glyphicon glyphicon-remove"></span></div><div class="custom-insert-box" data-cellspan="6" data-rowspan="1"></div></div>' },//1/3 { html: '<div class="custom-item custom-item-33"><div class="custom-item-remove"><span class="glyphicon glyphicon-remove"></span></div><div class="custom-insert-box" data-cellspan="4" data-rowspan="1"></div></div>' },//1/2 { html: '<div class="custom-item custom-item-99"><div class="custom-item-remove"><span class="glyphicon glyphicon-remove"></span></div><div class="custom-insert-box" data-cellspan="12" data-rowspan="1"></div></div>' },//1/1 { html: '<div class="custom-item custom-item-49"><div class="custom-item-remove"><span class="glyphicon glyphicon-remove"></span></div><div class="custom-insert-box custom-insert-dbox" data-cellspan="6" data-rowspan="2"></div></div>' },//2,2 { html: '<div class="custom-item custom-item-49 custom-item-right"><div class="custom-item-remove"><span class="glyphicon glyphicon-remove"></span></div><div class="custom-insert-box custom-insert-dbox" data-cellspan="6" data-rowspan="3"></div></div>' } ]; //布局配置 var typelist = [[2, 2, 2, 2, 2, 2], [0, 1, 0, 1, 1], [0, 0, 0, 0, 3], [1, 1, 1, 1], [2, 2, 2, 3], [4, 0, 0, 0, 0]]; //兼容旧数据配置 var fixedLayerType = [{ 'colspan': '3', 'rowspan': '1' }, { 'colspan': '6', 'rowspan': '1' }, { 'colspan': '4', 'rowspan': '1' }, { 'colspan': '12', 'rowspan': '1' }, { 'colspan': '6', 'rowspan': '2' }, { 'colspan': '6', 'rowspan': '3' }] var solutionid = $('#SolutionId').val(); //表格编辑删除按钮 var formGroupHtml = '<div class="form-group"><span class="item-top-title pull-left pl-1 pt-1"></span><span onclick="editCotroll(this)" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-edit"></span> 编辑</span><span onclick="delCotroll(this)" class="btn btn-warning btn-xs" ><span class="glyphicon glyphicon-trash"></span> 删除</span></div>'; (function ($, root) { "use strict" //绑定和触发自定义事件 var methodOb = {}; //获取可用图表数据 var getMethod = {}; //订阅,发布 methodOb.context = $({}); $.each(["on", "trigger", "off"], function (key, item) { methodOb[item] = function () { methodOb.context[item].apply(methodOb.context, arguments); return methodOb; }; }); getMethod.getCharts = function (obj, pdata) {//获取可选择的图表数据 $.ajax({ url: "", datatype: "json", type: "get", data: pdata || {} }).done(function (data) { methodOb.context.trigger("getcharts", { obj: obj, data: data });//触发绑定好的事件 }); } getMethod.getGrids = function (obj, pdata) {//获取可选择的数据 $.ajax({ url: "", datatype: "json", type: "get", data: pdata || {} }).done(function (data) { methodOb.context.trigger("getGrids", { obj: obj, data: data });//触发绑定好的事件 }); } getMethod.getIframe = function (obj, pdata) {//获取iframe $.ajax({ url: "", datatype: "json", type: "get", data: pdata || {} }).done(function (data) { methodOb.context.trigger("getIframe", { obj: obj, data: data });//触发绑定好的事件 }); } getMethod.getResource = function (obj, pdata) {//获取Resource $.ajax({ url: "", datatype: "json", type: "get", data: pdata || {} }).done(function (data) { methodOb.context.trigger("getResource", { obj: obj, data: data });//触发绑定好的事件 }); } var sc_modal = {}, tempdata = {//打开的窗口的配置信息saveChartLayout title: "添加组件", ttype: "charts" }; sc_modal.Modal = null; methodOb.context.on("getcharts", function (e, obj) { var args = [].slice.call(arguments); var temp = args.splice(1, args.length - 1); Xms.Schema.GetEntities({ solutionid: solutionid, getall: true }, function (data) { var nowdata = $(obj.obj).children(".custom-insert-box").attr('data-data'); if (typeof nowdata != 'undefined') { var oparent = $(obj.obj).children(".custom-insert-box"); tempdata.datas = data; tempdata.title = '编辑组件'; tempdata.ttype = "charts"; sc_modal.Modal = $("#ccSelModal").tmpl(tempdata); tempdata.datas = temp; tempdata.ttype = "charts"; if (sc_modal.Modal.length === 0) { sc_modal.Modal.appendTo($("#custon-charts-section")); } sc_modal.Modal.modal("show"); var chartConfig = JSON.parse(decodeURI(nowdata)); sc_modal.Modal.find('.chart-name').val(chartConfig.name); sc_modal.Modal.find('.chart-label').val(chartConfig.label); if (chartConfig.isshowlabel == true) { sc_modal.Modal.find('.chart-isshowlabel').prop('checked', true); } else { sc_modal.Modal.find('.chart-isshowlabel').prop('checked', false); } if (chartConfig.enableviewpicker == true) { sc_modal.Modal.find('.chart-enableviewpicker').prop('checked', true); } else { sc_modal.Modal.find('.chart-enableviewpicker').prop('checked', false); } if (chartConfig.enablechartpicker == true) { sc_modal.Modal.find('.chart-enablechartpicker').prop('checked', true); } else { sc_modal.Modal.find('.chart-enablechartpicker').prop('checked', false); } sc_modal.Modal.find('.entitySelect select').find('option[value="' + chartConfig.entityid + '"]').prop('selected', true); loadViewChart(chartConfig.entityid, chartConfig, sc_modal); } else { tempdata.datas = data; tempdata.title = '添加组件'; tempdata.ttype = "charts"; sc_modal.Modal = $("#ccSelModal").tmpl(tempdata); tempdata.datas = temp; tempdata.ttype = "charts"; if (sc_modal.Modal.length === 0) { sc_modal.Modal.appendTo($("#custon-charts-section")); } sc_modal.Modal.modal("show"); var name = 'charts_' + Math.round(new Date().getTime() / 1000); sc_modal.Modal.find('.chart-name').val(name); sc_modal.Modal.find('.chart-label').val(name); var oparent = $(obj.obj).parents(".custom-insert-box"); } //保存选择了的图表 sc_modal.Modal.find(".m-accept-btn").off("click").on("click", function () { //var oparent = $(obj.obj).parents(".custom-insert-box"); sc_modal.Modal.find('select').each(function (i, n) { if ($(n).find('option').length <= 0 || $(n).find('option:selected').val() == '') { if ($(n).next('.requiredError').length <= 0) { $(n).after('<em class="requiredError">此项为必填</em>'); } } }); if (sc_modal.Modal.find('.requiredError').length > 0) { return false; } var chartPar = { name: '', label: '', isshowlabel: true, entityid: sc_modal.Modal.find('.entitySelect select').find('option:selected').val(), viewid: sc_modal.Modal.find('.viewSelector select').find('option:selected').val(), chartid: sc_modal.Modal.find('.chartSelector select').find('option:selected').val(), enableviewpicker: true, enablechartpicker: true }; chartPar.name = sc_modal.Modal.find('.chart-name').val(); chartPar.label = sc_modal.Modal.find('.chart-label').val(); if (sc_modal.Modal.find('.chart-isshowlabel').prop('checked') == false) { chartPar.isshowlabel = false; } else { chartPar.isshowlabel = true; } if (sc_modal.Modal.find('.chart-enableviewpicker').prop('checked') == false) { chartPar.enableviewpicker = false; } else { chartPar.enableviewpicker = true; } if (sc_modal.Modal.find('.chart-enablechartpicker').prop('checked') == false) { chartPar.enablechartpicker = false; } else { chartPar.enablechartpicker = true; } //var chardata = new ChartData(); //createChart(parnet, chardata, { "min-height": 290 }, null, ""); oparent.children("ul.clearfix").remove(); oparent.attr("data-data", encodeURI(JSON.stringify(chartPar))); oparent.attr("data-type", tempdata.ttype); var j = oparent.parent().index(); Xms.Web.Load('/component/RenderChart?queryid=' + chartPar.viewid + '&chartid=' + chartPar.chartid + '&enableviewpicker=' + chartPar.enableviewpicker + '&enablechartpicker=' + chartPar.enablechartpicker, function (cdata) { try { if (typeof cdata != "string") { return false; } cdata = cdata.replace(/chart1/g, 'chart' + j); } catch (e) { } var dHtml = $(cdata); dHtml.find('.chartA:last').css({ 'width': '100%;', 'height': oparent.innerHeight() - 50 }); oparent.html(''); oparent.append(formGroupHtml); oparent.find('.item-top-title').text(chartPar.label); sc_modal.Modal.modal("hide"); saveform(); oparent.append(dHtml); //虽然能成功添加但是会报错影响后面的代码,所以放到最后 }); }); }); }); methodOb.context.on("getIframe", function (e, obj) { var args = [].slice.call(arguments); var temp = args.splice(1, args.length - 1); var nowdata = $(obj.obj).children(".custom-insert-box").attr('data-data'); if (typeof nowdata != 'undefined') { var oparent = $(obj.obj).children(".custom-insert-box"); tempdata.title = '编辑Iframe'; tempdata.ttype = "iframe"; sc_modal.Modal = $("#iframeModal").tmpl(tempdata); if (sc_modal.Modal.length === 0) { sc_modal.Modal.appendTo($("#custon-charts-section")); } sc_modal.Modal.modal("show"); var iframeConfig = JSON.parse(decodeURI(nowdata)); sc_modal.Modal.find('.iframe-name').val(iframeConfig.name); sc_modal.Modal.find('.iframe-label').val(iframeConfig.label); sc_modal.Modal.find('.iframe-url').val(iframeConfig.url); if (iframeConfig.isshowlabel == true) { sc_modal.Modal.find('.iframe-isshowlabel').prop('checked', true); } else { sc_modal.Modal.find('.iframe-isshowlabel').prop('checked', false); } } else { var oparent = $(obj.obj).parents(".custom-insert-box"); tempdata.title = '添加Iframe'; tempdata.ttype = "iframe"; sc_modal.Modal = $("#iframeModal").tmpl(tempdata); if (sc_modal.Modal.length === 0) { sc_modal.Modal.appendTo($("#custon-charts-section")); } sc_modal.Modal.modal("show"); var name = 'iframe_' + Math.round(new Date().getTime() / 1000); sc_modal.Modal.find('.iframe-name').val(name); sc_modal.Modal.find('.iframe-label').val(name); } sc_modal.Modal.find(".m-accept-btn").off("click").on("click", function () { if (sc_modal.Modal.find('.iframe-url').val() == '') { if (sc_modal.Modal.find('.iframe-url').next('.requiredError').length <= 0) { sc_modal.Modal.find('.iframe-url').after('<em class="requiredError">此项为必填</em>'); } } if (sc_modal.Modal.find('.requiredError').length > 0) { return false; } var iframePar = { name: '', label: '', isshowlabel: true, url: '' }; iframePar.name = sc_modal.Modal.find('.iframe-name').val(); iframePar.label = sc_modal.Modal.find('.iframe-label').val(); if (sc_modal.Modal.find('.iframe-isshowlabel').prop('checked') == false) { iframePar.isshowlabel = false; } else { iframePar.isshowlabel = true; } iframePar.url = sc_modal.Modal.find('.iframe-url').val(); oparent.children("ul.clearfix").remove(); oparent.attr("data-data", encodeURI(JSON.stringify(iframePar))); oparent.attr("data-type", tempdata.ttype); oparent.html(''); oparent.append(formGroupHtml); oparent.find('.item-top-title').text(iframePar.label); var showurl = iframePar.url if (showurl && showurl.indexOf('\/') == 0) { showurl = ORG_SERVERURL + showurl; } oparent.append('<iframe src="' + showurl + '" frameborder="0" width="100%" height="' + (oparent.innerHeight() - 50) + '"></iframe>'); sc_modal.Modal.modal("hide"); saveform(); }); /// }); methodOb.context.on("getResource", function (e, obj) { var args = [].slice.call(arguments); var temp = args.splice(1, args.length - 1); Xms.Web.GetJson('/customize/WebResource/index?getall=true&LoadData=true&SolutionId=' + solutionid, null, function (data) { var nowdata = $(obj.obj).children(".custom-insert-box").attr('data-data'); if (typeof nowdata != 'undefined') { var oparent = $(obj.obj).children(".custom-insert-box"); tempdata.datas = data.content.items; console.log(tempdata.datas) tempdata.title = '编辑Web资源'; tempdata.ttype = "webresource"; sc_modal.Modal = $("#resourceModal").tmpl(tempdata); if (sc_modal.Modal.length === 0) { sc_modal.Modal.appendTo($("#custon-charts-section")); } sc_modal.Modal.modal("show"); var webConfig = JSON.parse(decodeURI(nowdata)); sc_modal.Modal.find('.resource-name').val(webConfig.name); sc_modal.Modal.find('.resource-label').val(webConfig.label); if (webConfig.isshowlabel == true) { sc_modal.Modal.find('.resource-isshowlabel').prop('checked', true); } else { sc_modal.Modal.find('.resource-isshowlabel').prop('checked', false); } sc_modal.Modal.find('#ResourceList').find('option[value="' + webConfig.webresource + '"]').prop('selected', true); } else { var oparent = $(obj.obj).parents(".custom-insert-box"); tempdata.datas = data.content.items; console.log(tempdata.datas) tempdata.title = '添加Web资源'; tempdata.ttype = "webresource"; sc_modal.Modal = $("#resourceModal").tmpl(tempdata); if (sc_modal.Modal.length === 0) { sc_modal.Modal.appendTo($("#custon-charts-section")); } sc_modal.Modal.modal("show"); var name = 'resource_' + Math.round(new Date().getTime() / 1000); sc_modal.Modal.find('.resource-name').val(name); sc_modal.Modal.find('.resource-label').val(name); } sc_modal.Modal.find(".m-accept-btn").off("click").on("click", function () { sc_modal.Modal.find('select').each(function (i, n) { if ($(n).find('option').length <= 0 || $(n).find('option:selected').val() == '') { if ($(n).next('.requiredError').length <= 0) { $(n).after('<em class="requiredError">此项为必填</em>'); } } }); if (sc_modal.Modal.find('.requiredError').length > 0) { return false; } var resourcePar = { name: '', label: '', isshowlabel: true, webresource: '' }; resourcePar.name = sc_modal.Modal.find('.resource-name').val(); resourcePar.label = sc_modal.Modal.find('.resource-label').val(); if (sc_modal.Modal.find('.resource-isshowlabel').prop('checked') == false) { resourcePar.isshowlabel = false; } else { resourcePar.isshowlabel = true; } resourcePar.webresource = sc_modal.Modal.find("select").find('option:selected').val(); oparent.children("ul.clearfix").remove(); oparent.attr("data-data", encodeURI(JSON.stringify(resourcePar))); oparent.attr("data-type", tempdata.ttype); Xms.Web.Load('/api/webresource?ids=' + resourcePar.webresource, function (cdata) { var dHtml = $('<pre></pre>'); dHtml.css({ 'width': '100%;', 'text-align': 'left', 'margin-bottom': '0px', 'height': oparent.innerHeight() - 37 }).text(cdata.replace(/</g, "&lt;").replace( />/g, "&gt;")); oparent.html(''); oparent.append(formGroupHtml); oparent.find('.item-top-title').text(resourcePar.label); oparent.append(dHtml); sc_modal.Modal.modal("hide"); saveform(); }); }); }); /// }); methodOb.context.on("getGrids", function (e, obj) { var args = [].slice.call(arguments); var temp = args.splice(1, args.length - 1); Xms.Web.GetJson('/customize/entity/index?solutionid=' + solutionid + '&loaddata=true&getall=true', null, function (data) { var nowdata = $(obj.obj).children(".custom-insert-box").attr('data-data'); if (typeof nowdata != 'undefined') { var oparent = $(obj.obj).children(".custom-insert-box"); tempdata.datas = data.content.items; tempdata.ttype = "grids"; tempdata.title = '编辑组件'; sc_modal.Modal = $("#ccSelModal").tmpl(tempdata); if (sc_modal.Modal.length === 0) { sc_modal.Modal.appendTo($("#custon-charts-section")); } sc_modal.Modal.modal("show"); var gridConfig = JSON.parse(decodeURI(nowdata)); sc_modal.Modal.find('.chart-name').val(gridConfig.name); sc_modal.Modal.find('.chart-label').val(gridConfig.label); sc_modal.Modal.find('.chart-recordsperpage').val(gridConfig.recordsperpage); if (gridConfig.isshowlabel == true) { sc_modal.Modal.find('.chart-isshowlabel').prop('checked', true); } else { sc_modal.Modal.find('.chart-isshowlabel').prop('checked', false); } if (gridConfig.enablequickfind == true) { sc_modal.Modal.find('.chart-enablequickfind').prop('checked', true); } else { sc_modal.Modal.find('.chart-enablequickfind').prop('checked', false); } if (gridConfig.enableviewpicker == true) { sc_modal.Modal.find('.chart-enableviewpicker').prop('checked', true); } else { sc_modal.Modal.find('.chart-enableviewpicker').prop('checked', false); } sc_modal.Modal.find('.entitySelect select').find('option[value="' + gridConfig.entityid + '"]').prop('selected', true); loadViewChart(gridConfig.entityid, gridConfig, sc_modal); } else { var oparent = $(obj.obj).parents(".custom-insert-box"); tempdata.datas = data.content.items; tempdata.ttype = "grids"; tempdata.title = '添加组件'; sc_modal.Modal = $("#ccSelModal").tmpl(tempdata); if (sc_modal.Modal.length === 0) { sc_modal.Modal.appendTo($("#custon-charts-section")); } sc_modal.Modal.modal("show"); var name = 'grid_' + Math.round(new Date().getTime() / 1000); sc_modal.Modal.find('.chart-name').val(name); sc_modal.Modal.find('.chart-label').val(name); } sc_modal.Modal.find(".m-accept-btn").off("click").on("click", function () { sc_modal.Modal.find('select').each(function (i, n) { if ($(n).find('option').length <= 0 || $(n).find('option:selected').val() == '') { if ($(n).next('.requiredError').length <= 0) { $(n).after('<em class="requiredError">此项为必填</em>'); } } }); var reg = /^[1-9]\d*$/; if (sc_modal.Modal.find('.chart-recordsperpage').val() == '' || !reg.test(sc_modal.Modal.find('.chart-recordsperpage').val())) { if (sc_modal.Modal.find('.chart-recordsperpage').next('.requiredError').length <= 0) { sc_modal.Modal.find('.chart-recordsperpage').after('<em class="requiredError">请输入正整数</em>'); } } if (sc_modal.Modal.find('.requiredError').length > 0) { return false; } var gridPar = { name: '', label: '', isshowlabel: true, entityid: sc_modal.Modal.find('.entitySelect select').find('option:selected').val(), viewid: sc_modal.Modal.find('.viewSelector select').find('option:selected').val(), enablequickfind: true, recordsperpage: sc_modal.Modal.find('.chart-recordsperpage').val(), enableviewpicker: true }; gridPar.name = sc_modal.Modal.find('.chart-name').val(); gridPar.label = sc_modal.Modal.find('.chart-label').val(); if (sc_modal.Modal.find('.chart-isshowlabel').prop('checked') == false) { gridPar.isshowlabel = false; } else { gridPar.isshowlabel = true; } if (sc_modal.Modal.find('.chart-enablequickfind').prop('checked') == false) { gridPar.enablequickfind = false; } else { gridPar.enablequickfind = true; } if (sc_modal.Modal.find('.chart-enableviewpicker').prop('checked') == false) { gridPar.enableviewpicker = false; } else { gridPar.enableviewpicker = true; } //var chardata = new ChartData(); //createChart(parnet, chardata, { "min-height": 290 }, null, ""); oparent.children("ul.clearfix").remove(); oparent.attr("data-data", encodeURI(JSON.stringify(gridPar))); oparent.attr("data-type", tempdata.ttype); //Xms.Web.Load('/entity/rendergridview?queryid=' + gridPar.viewid + '&enablequickfind=' + gridPar.enablequickfind + '&enableviewpicker=' + gridPar.enableviewpicker + '&recordsperpage=' + gridPar.recordsperpage + '&IsShowButtons=false&IsEnabledFilter=false&IsEnabledFastSearch=false&IsEnabledViewSelector=false&iseditable=false', function (cdata) { // if (typeof cdata != "string") { return false; } // var dHtml = $(cdata); // dHtml.css({ 'width': '100%;', 'overflow-y': 'auto', 'overflow-x': 'hidden', 'height': oparent.innerHeight() - 50 }); // oparent.html(''); // oparent.append(formGroupHtml); // oparent.append(dHtml); // sc_modal.Modal.modal("hide"); // saveform(); //}); oparent.html('') var $grid = $('<div></div>'); oparent.append(formGroupHtml); oparent.find('.item-top-title').text(gridPar.label); oparent.append($grid); var offsetH = -40; var table = new tableGrid($grid, { queryid: gridPar.viewid, height: oparent.innerHeight() + offsetH,isNotLoadData:true }); table.init(); sc_modal.Modal.modal("hide"); saveform(); }); }); /// }); //添加ICON到布局里 var addIconToLayer = function (obj) { obj.find(".custom-insert-box").each(function () { if ($(this).attr('data-iconed') == 1) return true; var tmplele = $("#customIconList").tmpl({}); $(this).append($(tmplele[0])).attr('data-iconed', 1); }); } root.methodOb = methodOb; root.getMethod = getMethod; root.addIconToLayer = addIconToLayer; })(jQuery, window); </script> <script> //测试数据 var testDat = { "fetch": [{ "attribute": "accountid", "type": "series", "aggregate": "count" }, { "attribute": "createdon", "type": "category", "dategrouping": "month", "groupby": true }] }; var FormConfig = JSON.parse($('#FormConfig').val()); function saveform() { var panel = {}//new Xms.Form.PanelDescriptor(); //panel.section = []; panel.cell = []; $(".custom-insert-box:visible").each(function () { var cellitem = { colspan: $(this).attr("data-cellspan"), rowspan: $(this).attr("data-rowspan"), type: $(this).attr("data-type"), control: {} }; var itemData = $(this).attr("data-data"); if (itemData) { //panel.section.push(JSON.parse(decodeURI(itemData))); cellitem.control = JSON.parse(decodeURI(itemData)); } else { //panel.section.push({}); cellitem.control = {}; } panel.cell.push(cellitem); }); panel.name = $("#Name").val(); panel.type = $("#dashBoardType").val(); $('#FormConfig').val(JSON.stringify(panel)); console.log(panel); } ; (function ($, root, un) { "use strict" var dataStack = root.dataStack; var dataStackHandle = root.dataStackHandle; var getMethod = root.getMethod; var datahandler = new dataStackHandle(); //layoutType function layoutType(data, element, type) { dataStack.call(this, data, element, type); this.type = type; } layoutType.prototype.showTarget = function () { this.element.show(); this.element.siblings('.custom-group-box').hide(); resetCotroll($('.custom-group-box').find('.custom-item')); } layoutType.prototype.hideTarget = function () { this.element.hide(); resetCotroll($('.custom-group-box').find('.custom-item')); } function showLayerS(obj) { var $this = $(obj), target = $this.data().target, $target = $(target), type = $this.data().type; if ($target && $target.length > 0) { var layoutt = new layoutType({}, $target, type); datahandler.add(layoutt); layoutt.showTarget(); addIconToLayer($target); } } function getLayoutCellType(col, row) { var res = -1; $.each(fixedLayerType, function (i, n) { console.log(n); if (n.colspan == col && n.rowspan == row) { res = i; return false; } }); return res; } function initform() { var type = parseInt(FormConfig.type) + 1; var that = $('.row').find('.custom-list-item[data-type="' + type + '"]'); var index = that.index(); var $wrap = $('#wrapbydashboard'); var $list = $wrap.children('.custom-group-section'); //$("#Name").val(FormConfig.name); $("#dashBoardType").val(index); //showLayerS(that); for (var i = 0; i < FormConfig.cell.length; i++) { // console.log(FormConfig.cell[i].control); (function (j) { if (FormConfig.cell[j].control.name != null) { var _type = getLayoutCellType(FormConfig.cell[j].colspan, FormConfig.cell[j].rowspan); // console.log(_type, FormConfig.cell[j].colspan, FormConfig.cell[j].rowspan); if (_type == -1) { return true; } var target = addLayoutCell(_type).children('.custom-insert-box'); //var target = $('.custom-insert-box:visible').eq(j); // var target = if (FormConfig.cell[j].type == 'charts') { Xms.Web.Load('/component/RenderChart?queryid=' + FormConfig.cell[j].control.viewid + '&chartid=' + FormConfig.cell[j].control.chartid + '&enableviewpicker=' + FormConfig.cell[j].control.enableviewpicker + '&enablechartpicker=' + FormConfig.cell[j].control.enablechartpicker, function (cdata) { try { if (typeof cdata != "string") { return false; } cdata = cdata.replace(/chart1/g, 'chart' + j); } catch (e) { } var dHtml = $(cdata); dHtml.find('.chartA:last').css({ 'width': '100%;', 'height': target.innerHeight() - 50 }); target.html(''); target.append(formGroupHtml); target.find('.item-top-title').text(FormConfig.cell[j].control.label); target.append(dHtml); }); } else if (FormConfig.cell[j].type == 'grids') { //Xms.Web.Load('/component/rendergridview?queryid=' + FormConfig.cell[j].control.viewid + '&enablequickfind=' + FormConfig.cell[j].control.enablequickfind + '&enableviewpicker=' + FormConfig.cell[j].control.enableviewpicker + '&recordsperpage=' + FormConfig.cell[j].control.recordsperpage + '&IsShowButtons=false&IsEnabledFilter=false&IsEnabledFastSearch=false&IsEnabledViewSelector=false&iseditable=false', function (cdata) { // if (typeof cdata != "string") { return false; } // var dHtml = $(cdata); // dHtml.css({ 'width': '100%;', 'overflow-y': 'auto', 'overflow-x': 'hidden', 'height': target.innerHeight() - 37 }); // target.html(''); // target.append(formGroupHtml); // target.append(dHtml); //}); target.html(''); var $grid = $('<div></div>'); target.append(formGroupHtml); target.find('.item-top-title').text(FormConfig.cell[j].control.label); target.append($grid); var offsetH = -40; var table = new tableGrid($grid, { queryid: FormConfig.cell[j].control.viewid, height: target.innerHeight() + offsetH,isNotLoadData:true }); table.init(); //sc_modal.Modal.modal("hide"); //saveform(); } else if (FormConfig.cell[j].type == 'iframe') { target.html(''); target.append(formGroupHtml); target.find('.item-top-title').text(FormConfig.cell[j].control.label); var showurl = FormConfig.cell[j].control.url if (showurl && showurl.indexOf('\/') == 0) { showurl = ORG_SERVERURL + showurl; } target.append('<iframe src="' + showurl + '" frameborder="0" width="100%" height="' + (target.innerHeight() - 50) + '"></iframe>'); } else if (FormConfig.cell[j].type == 'webresource') { Xms.Web.Load('/api/webresource?ids=' + FormConfig.cell[j].control.webresource, function (cdata) { var dHtml = $('<pre></pre>'); dHtml.css({ 'width': '100%;', 'text-align': 'left', 'margin-bottom': '0px', 'height': target.innerHeight() - 37 }).text(cdata.replace(/</g, "&lt;").replace( />/g, "&gt;")); target.html(''); target.append(formGroupHtml); target.find('.item-top-title').text(FormConfig.cell[j].control.label); target.append(dHtml); }); } else { target.html(JSON.stringify(FormConfig.cell[j].control)); } target.attr("data-data", encodeURI(JSON.stringify(FormConfig.cell[j].control))); target.attr("data-type", FormConfig.cell[j].type); } else { var _type = getLayoutCellType(FormConfig.cell[j].colspan, FormConfig.cell[j].rowspan); // console.log(_type, FormConfig.cell[j].colspan, FormConfig.cell[j].rowspan); if (_type == -1) { return true; } var target = addLayoutCell(_type).children('.custom-insert-box'); } })(i); } } $("body").on("click", "#charslayout .custom-list-item", function () { var index = $(this).index(); $(this).parents(".modal").modal("hide"); $("#dashBoardType").val(index); var type = $(this).attr('data-type'); //showLayerS(this); addDashBoardLayout(type); }); $("body").on("click", ".sc-charts-w", function () { getMethod.getCharts(this); }); $("body").on("click", ".sc-grids-w", function () { getMethod.getGrids(this); }); $("body").on("click", ".sc-iframe-w", function () { getMethod.getIframe(this); }); $("body").on("click", ".sc-resource-w", function () { getMethod.getResource(this); }); $("body").on("click", ".custom-item-remove", function (e) { var $this = $(this); if ($(this).siblings('.custom-insert-box').children('ul').length == 0) { Xms.Web.Confirm('提示', '是否删除这一块区域和数据', function () { delCotroll($this); removeCellData($this) $this.parents('.custom-item:first').remove(); }); } else { removeCellData($this); $(this).parents('.custom-item:first').remove(); } }); //dbclick //$("body").on("dblclick", ".custom-item", function () { // editCotroll(this); //}); $("body").on("click", ".custom-item", function (e) { var $this = $(this); $(this).siblings(".custom-item").removeClass("active").end().addClass("active") }); $('body').on('click', '#charRowModal .custom-list-item', function () { var $this = $(this); var type = $this.attr('data-type'); addLayoutCell(type); // hidecharRowModal(); }); //保存数据 $("#Name").keyup(function () { saveform(); }); Xms.Web.Form($('#editform'), function (response) { Xms.Web.Alert(response.IsSuccess, response.Content); Xms.Web.Event.publish('refresh'); }, null, function () { var $wrap = $('#wrapbydashboard>.custom-group-section'); if ($wrap.children().length <= 1) { Xms.Web.Alert(false, '请选择仪表板布局或者添加一个区块。'); return false; } var $isauthorization = $('#IsAuthorization'); if ($isauthorization.prop('checked')) { if (!$('#securityUser').val() || $('#securityUser').val() == '') { Xms.Web.Alert(false, "请先勾选角色"); return false; } } }); initform(); })(jQuery, window); //添加布局 function addDashBoardLayout(type) { Xms.Web.Confirm('提示', '确定后会覆盖之前的配置信息,是否确定更改?', function () { type = type - 1; var _layout = typelist[type]; for (var i = 0, len = _layout.length; i < len; i++) { addLayoutCell(_layout[i]); } }, function () { }) } function addLayoutCell(type) { var html = layoutList[type].html; var $html = $(html); var $wrap = $('#wrapbydashboard>.custom-group-section'); $wrap.append($html); addIconToLayer($html); return $html; } //加载视图图表 function loadViewChart(entityid, config, modal) { if (entityid == '' || entityid == -1) { $('.viewSelector').find('select').html(''); $('.chartSelector').find('select').html(''); return false; } if ($('.viewSelector').length > 0 || (modal && modal.Modal.find('.viewSelector').length > 0)) { Xms.Web.GetJson('/customize/QueryView/index?EntityId=' + entityid + '&LoadData=true&getall=true', null, function (data) { var viewtempdata = {}; viewtempdata.datas = data.content.items; if (typeof config != 'undefined') { modal.Modal.find('.viewSelector').html(''); $("#Selrender").tmpl(viewtempdata).appendTo(modal.Modal.find('.viewSelector')); modal.Modal.find('.viewSelector').find('option[value="' + config.viewid + '"]').prop('selected', true); } else { $(".viewSelector").html(''); $("#Selrender").tmpl(viewtempdata).appendTo($(".viewSelector")); $('.viewSelector').find('option:first').prop('selected', true); } }); } if ($('.chartSelector').length > 0 || (modal && modal.Modal.find('.chartSelector').length > 0)) { Xms.Web.GetJson('/customize/Chart/index?EntityId=' + entityid + '&LoadData=true&solutionid=' + solutionid + '&getall=true', null, function (data) { var charttempdata = {}; charttempdata.datas = data.content.items; $(".chartSelector").html(''); $("#Chartrender").tmpl(charttempdata).appendTo($(".chartSelector")); if (typeof config != 'undefined') { modal.Modal.find('.chartSelector').html(''); $("#Chartrender").tmpl(charttempdata).appendTo(modal.Modal.find('.chartSelector')); modal.Modal.find('.chartSelector').find('option[value="' + config.chartid + '"]').prop('selected', true); } else { $(".chartSelector").html(''); $("#Chartrender").tmpl(charttempdata).appendTo($(".chartSelector")); $('.chartSelector').find('option:first').prop('selected', true); } }); } } function editCotroll(e) { if ($(e).hasClass('btn')) { e = $(e).parents('.custom-item'); } var child = $(e).children('.custom-insert-box'); if (child.attr('data-type') == 'charts') { getMethod.getCharts(e); } else if (child.attr('data-type') == 'webresource') { getMethod.getResource(e); } else if (child.attr('data-type') == 'grids') { getMethod.getGrids(e); } else if (child.attr('data-type') == 'iframe') { getMethod.getIframe(e); } } function delCotroll(e) { var tParent = $(e).parents('.custom-item:first'); delItemFormData(e); resetCotroll($(e).parents('.custom-item:first')); tParent.children().removeAttr('data-iconed') addIconToLayer(tParent); } function removeCellData(e) { var tParent = $(e).parents('.custom-item:first'); removeItemFormData(e); } function removeItemFormData(obj) { //console.log(obj, index); var $obj = $(obj); var tParent = $obj.parents('.custom-item'); var index = tParent.index() - 1; var formConfig = $('#FormConfig').val(); var dataObj = JSON.parse(formConfig); var dataItems = dataObj.cell; console.log(tParent, index); if (dataItems && dataItems.length > 0) { dataItems.splice(index, 1); } $('#FormConfig').val(JSON.stringify(dataObj)); } function delItemFormData(obj) { //console.log(obj, index); var $obj = $(obj); var tParent = $obj.parents('.custom-item'); var index = tParent.index() - 1; var formConfig = $('#FormConfig').val(); var dataObj = JSON.parse(formConfig); var dataItems = dataObj.cell; console.log(tParent, index); if (dataItems && dataItems.length > 0) { var cell = tParent.find('.custom-insert-box:visible'); var cellitem = { colspan: cell.attr("data-cellspan"), rowspan: cell.attr("data-rowspan"), control: {} }; cellitem.control = {}; console.log(cellitem) dataItems[index] = cellitem; } $('#FormConfig').val(JSON.stringify(dataObj)); } function charslayoutShow() { $("#charslayout").modal('show'); } function charRowModal() { $("#charRowModal").modal('show'); } function hidecharRowModal() { $("#charRowModal").modal('hide'); } function resetCotroll(target) { target.each(function (i, n) { $(n).find('.custom-insert-box').removeAttr('data-data'); $(n).find('.custom-insert-box').removeAttr('data-type'); $(n).find('.custom-insert-box').html(''); }); } $(function () { "use strict" $('body').on('change', 'select', function () { if ($(this).prop('id') == 'EntitysList') { var entityid = $(this).find('option:selected').val(); loadViewChart(entityid); } if ($(this).find('option:selected').val() != '') { $(this).nextAll('.requiredError').remove(); } }); $('body').on('keyup', 'input', function () { if ($(this).val() != '') { $(this).nextAll('.requiredError').remove(); } }); $(".modal").draggable({ handle: ".modal-header", cursor: 'move', refreshPositions: false }); $('.xms-checkbox').xmsCheckbox({ trueHandler: function () { $('#securityUserBox').removeClass('hide'); } , falseHandler: function () { $('#securityUserBox').addClass('hide'); } }); var $isauthorization = $('#IsAuthorization'); if ($isauthorization.prop('checked')) { $('#securityUserBox').removeClass('hide'); } }); </script>
the_stack
@model NccPost @{ Layout = Constants.AdminLayoutName; var mainName = "My Post"; var controllerName = "PostAuthor"; Title = mainName + " Create"; SubTitle = "Create a new " + mainName.ToLower(); if (Model.Id > 0) { Title = mainName + " Edit"; SubTitle = "Update information of a " + mainName.ToLower(); } } <style> .tabBorderDesign { border-left: 1px solid #ddd; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; } .bootstrap-tagsinput { width: 100%; min-height: 100px; } .bootstrap-tagsinput .label { font-size: 100%; } </style> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <div class="panel-heading"> @SubTitle <div class="pull-right"> @if (Model.Id > 0) { if (GlobalContext.WebSite.IsMultiLangual == true || Model.PostDetails.Where(x => x.Language == GlobalContext.WebSite.Language).Count() <= 0) { for (var j = 0; j < Model.PostDetails.Count; j++) { <a asp-controller="@controllerName" asp-action="Details" asp-route-slug="@Model.PostDetails[j].Slug" target="_blank" class="btn btn-outline btn-info btn-xs"> <i class="fa fa-eye"></i> @Model.PostDetails[j].Language </a> } } else { var temp = Model.PostDetails.Where(x => x.Language == GlobalContext.WebSite.Language).FirstOrDefault(); <a asp-controller="@controllerName" asp-action="Details" asp-route-slug="@temp.Slug" target="_blank" class="btn btn-outline btn-info btn-xs"><i class="fa fa-eye"></i> @temp.Language</a> } <a asp-controller="@controllerName" asp-action="CreateEdit" asp-route-id="" class="btn btn-outline btn-success btn-xs">New Post</a> } <a asp-controller="@controllerName" asp-action="Manage" class="btn btn-outline btn-primary btn-xs">Manage Post</a> </div> </div> <div class="panel-body"> <div class="row"> <form id="createEditForm" class="form-horizontal" asp-controller="@controllerName" asp-action="CreateEdit" method="post"> <div class="col-md-8"> <span asp-validation-summary="ValidationSummary.All" class="text-danger"></span> <input type="hidden" asp-for="Id" /> <input type="hidden" asp-for="Status" /> <div class=""> @{ var tabBorderDesign = ""; } @if (GlobalContext.WebSite.IsMultiLangual == true) { <ul class="nav nav-tabs" role="tablist"> @foreach (var item in Model.PostDetails) { if (GlobalContext.WebSite.Language == item.Language) { <li role="presentation" class="active"> <a href="#@item.Language" aria-controls="@item.Language" role="tab" data-toggle="tab"> (D) @SupportedCultures.Cultures.Where(x => x.TwoLetterISOLanguageName == item.Language).FirstOrDefault().NativeName </a> </li> } else { <li role="presentation" class=""> <a href="#@item.Language" aria-controls="@item.Language" role="tab" data-toggle="tab"> @if (SupportedCultures.Cultures.Where(x => x.TwoLetterISOLanguageName == item.Language).Count() > 0) { <span>@SupportedCultures.Cultures.Where(x => x.TwoLetterISOLanguageName == item.Language).FirstOrDefault().NativeName</span> } else { <span>@item.Language</span> } </a> </li> } } </ul> tabBorderDesign = "tabBorderDesign"; } <!-- Tab panes --> <div class="tab-content @tabBorderDesign"> @{ var activeClass = ""; var i = 0;} @foreach (var item in Model.PostDetails) { if (GlobalContext.WebSite.Language == item.Language) { activeClass = "active"; } else { activeClass = ""; } <div role="tabpanel" class="tab-pane row @activeClass" id="@item.Language"> <div class="" style="padding:10px 25px 25px 25px;"> <div class="col-md-12"> <input type="hidden" asp-for="PostDetails[i].Id" /> <input type="hidden" asp-for="PostDetails[i].Language" /> <input type="hidden" asp-for="PostDetails[i].Status" /> <div class="form-group input-group"> <span class="input-group-addon">Post Title: </span> <input type="text" class="form-control postTitle" asp-for="PostDetails[i].Title" placeholder="Enter Post Title in @item.Language"> <span asp-validation-for="PostDetails[i].Title" class="text-danger"></span> </div> <div class="form-group input-group"> <span class="input-group-addon">@ViewBag.DomainName</span> <input type="text" class="form-control postSlug" asp-for="PostDetails[i].Slug" placeholder="Slug in @item.Language"> <span asp-validation-for="PostDetails[i].Slug" class="text-danger"></span> </div> </div> <div class=""> <label>Content</label> <textarea class="form-control postContent" asp-for="PostDetails[i].Content"></textarea> <span asp-validation-for="PostDetails[i].Content" class="text-danger"></span> </div> <div class=""> <label>Meta Description</label> <textarea class="form-control" asp-for="PostDetails[i].MetaDescription" placeholder="Meta description in @item.Language"></textarea> </div> <div class=""> <label>Meta Keyword</label> <textarea class="form-control" asp-for="PostDetails[i].MetaKeyword" placeholder="Meta keyword in @item.Language"></textarea> </div> </div> </div> i++; } </div> </div> </div> <div class="col-md-4"> <div class="panel panel-default"> <div class="panel-body" style="padding:0;"> <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true" style="margin:0;"> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingOne"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne" style="color:#000;"> <div class="panel-title"> <i class="more-less glyphicon glyphicon-chevron-down"></i> Attributes </div> </a> </div> <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne"> <div class="panel-body"> <div class="row" style="margin-bottom:5px;"> <label class="control-label col-sm-4">Status</label> <div class="col-sm-8"> <select class="form-control" asp-for="PostStatus" id="PostStatus" asp-items="@ViewBag.PostStatus"></select> </div> </div> <div class="row" style="margin-bottom:5px;"> <label class="control-label col-sm-4">Visibility</label> <div class="col-sm-8"> <select class="form-control" asp-for="PostType" asp-items="@ViewBag.PostType"></select> </div> </div> <div class="row" style="margin-bottom:5px;"> <label class="control-label col-sm-4">Schedule Date</label> <div class="col-sm-8"> <div class='input-group date datetimepicker'> <input type="text" class="form-control" asp-for="PublishDate" value="@Model.PublishDate.ToString("MMM dd, yyyy hh:mm tt")" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <div class="row" style="margin-bottom:5px;"> <label class="control-label col-sm-4 text-right">Layout</label> <div class="col-sm-8"> <select class="form-control" asp-for="Layout" asp-items="@ViewBag.Layouts"></select> </div> </div> <div class="row" style="margin-bottom:5px;"> <label class="control-label col-sm-4 text-right">Parrent:</label> <div class="col-sm-8"> <select class="form-control" asp-for="Parent" name="ParentId" asp-items="@ViewBag.AllPosts"> <option value="0">Select Parent</option> </select> </div> </div> <div class="pull-right" style="padding:5px;"> <label>Is Featured</label> <input type="checkbox" asp-for="IsFeatured" /> </div> <div class="pull-right" style="padding:5px;"> <label>Is Stiky</label> <input type="checkbox" asp-for="IsStiky" /> </div> <div class="pull-right" style="padding:5px;"> <label>Allow Comment</label> <input type="checkbox" asp-for="AllowComment" /> </div> </div> </div> </div> <!--Category--> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingTwo"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo" class="collapsed" style="color:#000;"> <div class="panel-title"> <i class="more-less glyphicon glyphicon-chevron-down"></i> Categories </div> </a> </div> <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-expanded="false" aria-labelledby="headingTwo"> <div class="panel-body" style="max-height:30vh;overflow:auto;"> <div> @*<select class="form-control" asp-for="Categories" asp-items="@ViewBag.Categories"></select>*@ @foreach (NccCategory item in ViewBag.CategoryList) { if (Model.Categories.Where(x => x.CategoryId == item.Id).Count() > 0) { <input type="checkbox" name="SelecetdCategories[]" value="@item.Id" checked="checked" /> } else { <input type="checkbox" name="SelecetdCategories[]" value="@item.Id" /> } <span>@item.Name </span><br /> } </div> </div> </div> </div> <!--TAGs--> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingThree"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree" class="collapsed" style="color:#000;"> <div class="panel-title"> <i class="more-less glyphicon glyphicon-chevron-down"></i> Tags </div> </a> </div> <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-expanded="false" aria-labelledby="headingThree"> <div class="panel-body"> <div> @{ var tags = string.Join(", ", Model.Tags.Select(x => x.Tag.Name));} <input type="hidden" class="form-control" id="SelectedTags" name="SelectedTags" value="@tags" data-role="tagsinput" style="width:100%; min-height:30px;" placeholder="Enter tags here" /> </div> </div> </div> </div> <!--Featured Image--> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingFour"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour" class="collapsed" style="color:#000;"> <div class="panel-title"> <i class="more-less glyphicon glyphicon-chevron-down"></i> Featured Image </div> </a> </div> <div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-expanded="false" aria-labelledby="headingFour"> <div class="panel-body"> <div> <img src="@Model.ThumImage" id="ThumImageView" style="max-width:350px;max-height:100px;padding-bottom:5px;" /><br /> <input type="button" class="btn btn-default" id="ThumImageSelect" value="Select Image" onclick="openFFPromotionPopup('/MediaHome/?inputId=ThumImage')" /> <input type="hidden" class="form-control" asp-for="ThumImage" /> </div> </div> </div> </div> </div> </div> <div class="panel-footer"> <input type="hidden" name="SubmitType" id="SubmitType" value="Save" /> <div class="pull-left"> <button id="save" class="btn btn-sm btn-primary" type="button"> @if (Model.Id > 0) { <span>Update</span> } else { <span>Save</span> } </button> </div> <div class="pull-right"> @if (Model.Id == 0 || (int)Model.PostStatus != 2) { <button id="publish" class="btn btn-sm btn-success" type="button">Save and exit</button> } </div> <div style="clear:both;"></div> </div> </div> </div> </form> </div> <!-- /.row (nested) --> </div> <!-- /.panel-body --> </div> <!-- /.panel --> </div> </div> @section Scripts{ <link href="~/lib/bootstrap-tagsinput-latest/dist/bootstrap-tagsinput.css" rel="stylesheet" /> <script src="~/lib/bootstrap-tagsinput-latest/dist/bootstrap-tagsinput.min.js"></script> <script> $('#SelectedTags').tagsinput({ }); </script> <script> KEDITOR_BASEPATH = "@Url.Content("~/lib/ckeditor/")"; </script> <script src="~/lib/ckeditor/ckeditor.js"></script> <script> $(document).ready(function () { var elements = document.getElementsByClassName('postContent'); for (var i = 0; i < elements.length; ++i) { CKEDITOR.replace(elements[i], { enterMode: CKEDITOR.ENTER_DIV, filebrowserBrowseUrl: '/MediaHome/?isFile=true&inputId=ckeditor', filebrowserImageBrowseUrl: '/MediaHome/?inputId=ckeditor', //filebrowserUploadUrl: '/media/files', //filebrowserImageUploadUrl: '/MediaHome/Upload', //filebrowserWindowWidth: 800, //filebrowserWindowHeight: 500, toolbar: [ { name: 'document', items: ['Source', '-', /*'Save', 'NewPage', 'DocProps', 'Preview', 'Print', '-', 'Templates'*/] }, { name: 'clipboard', items: ['Cut', 'Copy', 'Paste'] }, { name: 'clipboard1', items: ['PasteText', 'PasteFromWord'] }, { name: 'clipboard2', items: ['Undo', 'Redo'] }, { name: 'editing', items: ['Find', 'Replace', 'SelectAll'] }, { name: 'editing1', items: ['SpellChecker', 'Scayt'] }, { name: 'styles', items: ['Styles'] }, { name: 'styles1', items: ['Format'] }, { name: 'styles2', items: ['Font'] }, { name: 'styles3', items: ['FontSize'] }, { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline'] }, { name: 'basicstyles1', items: ['Strike', 'Subscript', 'Superscript'] }, //{ name: 'basicstyles2', items: ['-', 'RemoveFormat'] }, { name: 'paragraph', items: ['NumberedList', 'BulletedList'] }, { name: 'paragraph1', items: ['Outdent', 'Indent'] }, { name: 'paragraph2', items: ['Blockquote', 'CreateDiv'] }, { name: 'paragraph3', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] }, //{ name: 'paragraph4', items: ['-', 'BidiLtr', 'BidiRtl'] }, { name: 'links', items: ['Link', 'Unlink', 'Anchor'] }, { name: 'insert', items: ['Image', /*'Flash',*/ 'Table'] }, //'/', { name: 'colors', items: ['TextColor', 'BGColor'] }, { name: 'insert1', items: ['HorizontalRule', 'Smiley'] }, { name: 'insert2', items: ['SpecialChar', 'PageBreak'] }, { name: 'tools', items: ['Maximize', 'ShowBlocks'] } ], }); } $(".postTitle").change(function () { $(this).parent().parent().find(".postSlug").val(NccUtil.GetSafeSlug($(this).val())); }); $("#publish").click(function () { //var element = document.getElementById('PostStatus'); //element.value = "2"; //console.log($("#Slug").val()); //if ($("#Slug").val() == "") { // document.getElementById("Slug").value = NccUtil.GetSafeSlug($("#Title").val()); // console.log($("#Slug").val()); //} document.getElementById("SubmitType").value = "saveAndExit"; //$("#SubmitType").value = "publish"; //$('#PostContent').html(CKEDITOR.instances["PostContent"].getData()); document.getElementById("createEditForm").submit(); }); $("#save").click(function () { //if ($("#Slug").val() == "") { // $("#Slug").val(NccUtil.GetSafeSlug($(this).val())); //} $("#SubmitType").val("Save"); //$('#PostContent').html(CKEDITOR.instances["PostContent"].getData()); document.getElementById("createEditForm").submit(); }); }); </script> <script> var windowObjectReference = null; // global variable function openFFPromotionPopup(siteUrl) { if (windowObjectReference == null || windowObjectReference.closed) { windowObjectReference = window.open(siteUrl, "PromoteFirefoxWindowName", "resizable,scrollbars,status"); } else { windowObjectReference.focus(); }; } setInterval(function () { $("#ThumImageView").attr("src", $("#ThumImage").val()); //console.log($("#SiteLogoUrl").val()); }, 500); </script> }
the_stack
 <!-- MAIN CONTENT --> <div id="content"> <div class="row"> <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4"> <h1 class="page-title txt-color-blueDark"> <i class="fa fa-pencil-square-o fa-fw "></i> Forms <span> > Form Plugins </span> </h1> </div> <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8"> <ul id="sparks" class=""> <li class="sparks-info"> <h5> My Income <span class="txt-color-blue">$47,171</span></h5> <div class="sparkline txt-color-blue hidden-mobile hidden-md hidden-sm"> 1300, 1877, 2500, 2577, 2000, 2100, 3000, 2700, 3631, 2471, 2700, 3631, 2471 </div> </li> <li class="sparks-info"> <h5> Site Traffic <span class="txt-color-purple"><i class="fa fa-arrow-circle-up" data-rel="bootstrap-tooltip" title="Increased"></i>&nbsp;45%</span></h5> <div class="sparkline txt-color-purple hidden-mobile hidden-md hidden-sm"> 110,150,300,130,400,240,220,310,220,300, 270, 210 </div> </li> <li class="sparks-info"> <h5> Site Orders <span class="txt-color-greenDark"><i class="fa fa-shopping-cart"></i>&nbsp;2447</span></h5> <div class="sparkline txt-color-greenDark hidden-mobile hidden-md hidden-sm"> 110,150,300,130,400,240,220,310,220,300, 270, 210 </div> </li> </ul> </div> </div> <!-- widget grid --> <section id="widget-grid" class=""> <!-- row --> <div class="row"> <!-- NEW COL START --> <article class="col-sm-12"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget jarviswidget-color-blueDark" id="wid-id-0" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-custombutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-edit"></i> </span> <h2>x-ediable </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <div class="widget-body-toolbar"> <div class="row"> <div class="col-sm-6"> <button id="enable" class="btn btn btn-default"> enable / disable </button> </div> <div class="col-sm-6 text-right"> <div class="onoffswitch-container"> <span class="onoffswitch-title">Auto Open Next</span> <span class="onoffswitch"> <input type="checkbox" class="onoffswitch-checkbox" id="autoopen"> <label class="onoffswitch-label" for="autoopen"> <span class="onoffswitch-inner" data-swchon-text="ON" data-swchoff-text="OFF"></span> <span class="onoffswitch-switch"></span> </label> </span> </div> <div class="onoffswitch-container"> <span class="onoffswitch-title">Open Inline</span> <span class="onoffswitch"> <input type="checkbox" class="onoffswitch-checkbox" id="inline"> <label class="onoffswitch-label" for="inline"> <span class="onoffswitch-inner" data-swchon-text="ON" data-swchoff-text="OFF"></span> <span class="onoffswitch-switch"></span> </label> </span> </div> </div> </div> </div> <table id="user" class="table table-bordered table-striped" style="clear: both"> <tbody> <tr> <td style="width:35%;">Simple text field</td> <td style="width:65%"><a href="form-x-editable.html#" id="username" data-type="text" data-pk="1" data-original-title="Enter username">superuser</a></td> </tr> <tr> <td>Empty text field, required</td> <td><a href="form-x-editable.html#" id="firstname" data-type="text" data-pk="1" data-placement="right" data-placeholder="Required" data-original-title="Enter your firstname"></a></td> </tr> <tr> <td>Select, local array, custom display</td> <td><a href="form-x-editable.html#" id="sex" data-type="select" data-pk="1" data-value="" data-original-title="Select sex"></a></td> </tr> <tr> <td>Select, remote array, no buttons</td> <td><a href="form-x-editable.html#" id="group" data-type="select" data-pk="1" data-value="5" data-source="/groups" data-original-title="Select group">Admin</a></td> </tr> <tr> <td>Select, error while loading</td> <td><a href="form-x-editable.html#" id="status" data-type="select" data-pk="1" data-value="0" data-source="/status" data-original-title="Select status">Active</a></td> </tr> <tr> <td>Datepicker</td> <td><a href="#" id="vacation" data-type="date" data-viewformat="dd.mm.yyyy" data-pk="1" data-placement="right" data-original-title="When you want vacation to start?">25.02.2013</a></td> </tr> <tr> <td>Combodate (date)</td> <td><a href="form-x-editable.html#" id="dob" data-type="combodate" data-value="1984-05-15" data-format="YYYY-MM-DD" data-viewformat="DD/MM/YYYY" data-template="D / MMM / YYYY" data-pk="1" data-original-title="Select Date of birth"></a></td> </tr> <tr> <td>Combodate (datetime)</td> <td><a href="form-x-editable.html#" id="event" data-type="combodate" data-template="D MMM YYYY HH:mm" data-format="YYYY-MM-DD HH:mm" data-viewformat="MMM D, YYYY, HH:mm" data-pk="1" data-original-title="Setup event date and time"></a></td> </tr> <tr> <td>Textarea, buttons below. Submit by <i>ctrl+enter</i></td> <td><a href="form-x-editable.html#" id="comments" data-type="textarea" data-pk="1" data-placeholder="Your comments here..." data-original-title="Enter comments">awesome user!</a></td> </tr> <tr> <td>Twitter typeahead.js</td> <td><a href="form-x-editable.html#" id="state2" data-type="typeaheadjs" data-pk="1" data-placement="right" data-original-title="Start typing State.."></a></td> </tr> <tr> <td>Checklist</td> <td><a href="form-x-editable.html#" id="fruits" data-type="checklist" data-value="2,3" data-original-title="Select fruits"></a></td> </tr> <tr> <td>Select2 (tags mode)</td> <td><a href="form-x-editable.html#" id="tags" data-type="select2" data-pk="1" data-original-title="Enter tags">html, javascript</a></td> </tr> <tr> <td>Select2 (dropdown mode)</td> <td><a href="form-x-editable.html#" id="country" data-type="select2" data-pk="1" data-select-search="true" data-value="BS" data-original-title="Select country"></a></td> </tr> <tr> <td>Custom input, several fields</td> <td><a href="form-x-editable.html#" id="address" data-type="address" data-pk="1" data-original-title="Please, fill address"></a></td> </tr> </tbody> </table> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget jarviswidget-color-darken" id="wid-id-1" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-custombutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-edit"></i> </span> <h2>Sliders </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form> <fieldset> <legend> Smart Scale Slider </legend> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <input id="range-slider-1" type="text" name="range_1" value=""> </div> </div> <div class="col-sm-6"> <div class="form-group"> <input id="range-slider-2" type="text" name="range_2" value="1000;100000" data-type="double" data-step="500" data-postfix=" €" data-from="30000" data-to="90000" data-hasgrid="true"> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <input id="range-slider-3" type="text" name="range_2a" value=""> </div> </div> <div class="col-sm-6"> <div class="form-group"> <input id="range-slider-4" type="text" name="range_4" value=""> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <input id="range-slider-5" type="text" name="range_5a" value=""> </div> </div> </div> </fieldset> <fieldset> <legend> noScale Slider </legend> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label>Default</label> <div id="nouislider-1" class="noUiSlider"></div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Range slider (<span class="nouislider-value">20 - 60</span>)</label> <div id="nouislider-3" class="noUiSlider"></div> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label>Default Slider (disabled)</label> <div id="nouislider-4" class="noUiSlider"></div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Skips a beat</label> <div id="nouislider-2" class="noUiSlider"></div> </div> </div> </div> </fieldset> <fieldset class="margin-top-10"> <legend> JQuery UI Slider </legend> <div class="row"> <div class="col-sm-6"> <label><code>.slider .slider-danger</code></label> <input type="text" class="slider slider-danger" id="sal" value="" data-slider-min="10" data-slider-max="1000" data-slider-step="1" data-slider-value="[50,450]" data-slider-handle="round"> </div> <div class="col-sm-6"> <label><code>.slider .slider-success</code></label> <input type="text" class="slider slider-success" id="sa2" value="" data-slider-min="10" data-slider-max="1000" data-slider-step="1" data-slider-value="[150,760]" data-slider-handle="triangle"> </div> </div> <div class="row"> <div class="col-sm-6"> <label><code>.slider .slider-warning</code></label> <input type="text" class="slider slider-warning" id="sa3" value="" data-slider-min="1" data-slider-max="300" data-slider-value="150" data-slider-selection="before" data-slider-handle="squar"> </div> <div class="col-sm-6"> <label><code>.slider .slider-info</code></label> <input type="text" class="slider slider-info" id="sa4" value="" data-slider-min="1" data-slider-max="300" data-slider-value="150" data-slider-selection="after" data-slider-handle="round"> </div> </div> <div class="row"> <div class="col-sm-12"> <label><code>.slider .slider-primary</code></label> <input type="text" class="slider slider-primary" id="sa5" value="" data-slider-min="1" data-slider-max="300" data-slider-value="150" data-slider-selection="before" data-slider-handle="round"> </div> </div> <div class="row"> <div class="col-sm-6"> <pre><strong class="margin-top-10 margin-bottom-10 font-lg">Usage</strong><br> <code><strong>&lt;input data-slider-min="10" .. /&gt;</strong></code> data-slider-orientation="vertical" <span class="text-muted"> // vertical or horizontal</span> data-slider-step="1" <span class="text-muted"> // increment step</span> data-slider-min="10" <span class="text-muted"> // slider min value</span> data-slider-max="500" <span class="text-muted"> // slider max value</span> data-slider-value="315" <span class="text-muted"> // handler position on slider</span> data-slider-selection = "after" <span class="text-muted"> // handler position on slider</span> data-slider-handle="round" <span class="text-muted"> // round or square</span> data-slider-tooltip = "show" <span class="text-muted"> // show or hide</span> </pre> </div> <div class="col-sm-6"> <div class="well"> <table> <tbody> <tr> <td> <input type="text" class="slider slider-danger" value="" data-slider-min="-20" data-slider-max="20" data-slider-step="1" data-slider-value="-13" data-slider-orientation="vertical" data-slider-selection="after" data-slider-handle="square" data-slider-tooltip="hide"> </td> <td> <input type="text" class="slider" value="" data-slider-min="-20" data-slider-max="20" data-slider-step="1" data-slider-value="-11" data-slider-orientation="vertical" data-slider-selection="after" data-slider-handle="triangle" data-slider-tooltip="hide"> </td> <td> <input type="text" class="slider" value="" data-slider-min="-20" data-slider-max="20" data-slider-step="1" data-slider-value="-6" data-slider-orientation="vertical" data-slider-selection="after" data-slider-tooltip="hide"> </td> <td> <input type="text" class="slider" value="" data-slider-min="-20" data-slider-max="20" data-slider-step="1" data-slider-value="-4" data-slider-orientation="vertical" data-slider-selection="after" data-slider-tooltip="hide"> </td> <td> <input type="text" class="slider" value="" data-slider-min="-20" data-slider-max="20" data-slider-step="1" data-slider-value="-6" data-slider-orientation="vertical" data-slider-selection="after" data-slider-tooltip="hide"> </td> <td> <input type="text" class="slider slider-warning" value="" data-slider-min="-20" data-slider-max="20" data-slider-step="1" data-slider-value="[-11, 19]" data-slider-orientation="vertical" data-slider-selection="after" data-slider-handle="triangle" data-slider-tooltip="show"> </td> <td> <input type="text" class="slider slider-success" value="" data-slider-min="-20" data-slider-max="20" data-slider-step="1" data-slider-value="-17" data-slider-orientation="vertical" data-slider-selection="after" data-slider-tooltip="show"> </td> </tr> </tbody> </table> </div> </div> </div> </fieldset> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget jarviswidget-color-darken" id="wid-id-2" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-custombutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-edit"></i> </span> <h2>Bootstrap Duallist Box </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <select multiple="multiple" size="10" name="duallistbox_demo2" id="initializeDuallistbox"> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3" selected="selected">Option 3</option> <option value="option4">Option 4</option> <option value="option5">Option 5</option> <option value="option6" selected="selected">Option 6</option> <option value="option7">Option 7</option> <option value="option8">Option 8</option> <option value="option9">Option 9</option> <option value="option0">Option 10</option> <option value="option0">Option 11</option> <option value="option0">Option 12</option> <option value="option0">Option 13</option> <option value="option0">Option 14</option> <option value="option0">Option 15</option> <option value="option0">Option 16</option> <option value="option0">Option 17</option> <option value="option0">Option 18</option> <option value="option0">Option 19</option> <option value="option0">Option 20</option> </select> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- END COL --> </div> <!-- end row --> <!-- START ROW --> <div class="row"> <!-- NEW COL START --> <article class="col-sm-12 col-md-12 col-lg-6"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-3" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-custombutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-edit"></i> </span> <h2>Plugins & Enhancers </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form class=""> <fieldset> <legend> Select 2 </legend> <div class="form-group"> <label>Select2 Plugin (select)</label> <select style="width:100%" class="select2"> <optgroup label="Alaskan/Hawaiian Time Zone"> <option value="AK">Alaska</option> <option value="HI">Hawaii</option> </optgroup> <optgroup label="Pacific Time Zone"> <option value="CA">California</option> <option value="NV">Nevada</option> <option value="OR">Oregon</option> <option value="WA">Washington</option> </optgroup> <optgroup label="Mountain Time Zone"> <option value="AZ">Arizona</option> <option value="CO">Colorado</option> <option value="ID">Idaho</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NM">New Mexico</option> <option value="ND">North Dakota</option> <option value="UT">Utah</option> <option value="WY">Wyoming</option> </optgroup> <optgroup label="Central Time Zone"> <option value="AL">Alabama</option> <option value="AR">Arkansas</option> <option value="IL">Illinois</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="OK">Oklahoma</option> <option value="SD">South Dakota</option> <option value="TX">Texas</option> <option value="TN">Tennessee</option> <option value="WI">Wisconsin</option> </optgroup> <optgroup label="Eastern Time Zone"> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="IN">Indiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="OH">Ohio</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WV">West Virginia</option> </optgroup> </select> <div class="note"> <strong>Usage:</strong> &lt;select style=&quot;width:100%&quot; class=&quot;select2&quot; &quot;&gt;...&lt;/select&gt; </div> </div> <div class="form-group"> <label>Select2 Plugin (multi-select)</label> <select multiple style="width:100%" class="select2"> <optgroup label="Alaskan/Hawaiian Time Zone"> <option value="AK">Alaska</option> <option value="HI">Hawaii</option> </optgroup> <optgroup label="Pacific Time Zone"> <option value="CA">California</option> <option value="NV" selected="selected">Nevada</option> <option value="OR">Oregon</option> <option value="WA">Washington</option> </optgroup> <optgroup label="Mountain Time Zone"> <option value="AZ">Arizona</option> <option value="CO">Colorado</option> <option value="ID">Idaho</option> <option value="MT" selected="selected">Montana</option> <option value="NE">Nebraska</option> <option value="NM">New Mexico</option> <option value="ND">North Dakota</option> <option value="UT">Utah</option> <option value="WY">Wyoming</option> </optgroup> <optgroup label="Central Time Zone"> <option value="AL">Alabama</option> <option value="AR">Arkansas</option> <option value="IL">Illinois</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="OK">Oklahoma</option> <option value="SD">South Dakota</option> <option value="TX">Texas</option> <option value="TN">Tennessee</option> <option value="WI">Wisconsin</option> </optgroup> <optgroup label="Eastern Time Zone"> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="IN">Indiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI" selected="selected">Michigan</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="OH">Ohio</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WV">West Virginia</option> </optgroup> </select> <div class="note"> <strong>Usage:</strong> &lt;select multiple style=&quot;width:100%&quot; class=&quot;select2&quot; &gt;...&lt;/select&gt; </div> </div> </fieldset> <fieldset> <legend> Date Picker (Jquery UI) </legend> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <label>Select a date (single):</label> <div class="input-group"> <input type="text" name="mydate" placeholder="Select a date" class="form-control datepicker" data-dateformat="dd/mm/yy"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> </div> </div> </div> <div class="col-sm-12"> <label>Select a date (range):</label> </div> <div class="col-sm-6"> <div class="form-group"> <div class="input-group"> <input class="form-control" id="from" type="text" placeholder="From"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <div class="input-group"> <input class="form-control" id="to" type="text" placeholder="Select a date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> </div> </div> </div> </div> </fieldset> <fieldset> <legend> Bootstrap Timepicker </legend> <div class="row"> <div class="col-sm-12"> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <label>Timepicker (default):</label> <div class="input-group"> <input class="form-control" id="timepicker" type="text" placeholder="Select time"> <span class="input-group-addon"><i class="fa fa-clock-o"></i></span> </div> </div> </div> </div> </div> </div> </fieldset> <fieldset> <legend> Clockpicker </legend> <div class="row"> <div class="col-sm-12"> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <label>Clockpicker:</label> <div class="input-group"> <input class="form-control" id="clockpicker" type="text" placeholder="Select time" data-autoclose="true"> <span class="input-group-addon"><i class="fa fa-clock-o"></i></span> </div> </div> </div> </div> </div> </div> </fieldset> <fieldset> <legend> Spinners </legend> <div class="row"> <div class="col-sm-6 col-md-4 col-lg-4"> <div class="form-group"> <label>Default</label> <input class="form-control spinner-left" id="spinner" name="spinner" value="1" type="text"> </div> </div> <div class="col-sm-6 col-md-4 col-lg-4"> <div class="form-group"> <label>Decimal spinner</label> <input class="form-control" id="spinner-decimal" name="spinner-decimal" value="7.99"> </div> </div> <div class="col-sm-12 col-md-4 col-lg-4"> <div class="form-group"> <label>Increment spinner</label> <input class="form-control spinner-both" id="spinner-currency" name="spinner-currency" value="5"> </div> </div> </div> </fieldset> <fieldset> <legend> Color Pickers </legend> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label>Color Picker (HEX)</label> <input class="form-control" id="colorpicker-1" type="text" value="#8fff00"> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Color Picker (RGBA)</label> <input class="form-control" id="colorpicker-2" type="text" value="rgba(0,194,255,0.78)" data-color-format="rgba"> </div> </div> </div> </fieldset> <fieldset> <legend> Tags </legend> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <label>Type and enter to add tag</label> <input class="form-control tagsinput" value="Amsterdam,Washington,Sydney,Beijing,Cairo" data-role="tagsinput"> </div> </div> </div> </fieldset> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> Cancel </button> <button class="btn btn-primary" type="submit"> <i class="fa fa-save"></i> Submit </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- END COL --> <!-- NEW COL START --> <article class="col-sm-12 col-md-12 col-lg-6"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-4" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-custombutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-edit"></i> </span> <h2>All Masking </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <p class="alert alert-info text-align-center"> USAGE: &lt;input type=&quot;text&quot; <strong>data-mask=&quot;99/99/9999&quot; data-mask-placeholder= &quot;-&quot;&gt;</strong> </p> <form> <fieldset> <legend> Input Masking made easier! </legend> <div class="form-group"> <label>Date masking</label> <div class="input-group"> <input type="text" class="form-control" data-mask="99/99/9999" data-mask-placeholder="-"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> </div> <p class="note"> Data format **/**/**** </p> </div> <div class="form-group"> <label>Phone masking</label> <div class="input-group"> <input type="text" class="form-control" data-mask="(999) 999-9999" data-mask-placeholder="X"> <span class="input-group-addon"><i class="fa fa-phone"></i></span> </div> <p class="note"> Data format (XXX) XXX-XXXX </p> </div> <div class="form-group"> <label>Credit card masking</label> <div class="input-group"> <input type="text" class="form-control" data-mask="9999-9999-9999-9999" data-mask-placeholder="*"> <span class="input-group-addon"><i class="fa fa-credit-card"></i></span> </div> <p class="note"> Data format ****-****-****-**** </p> </div> <div class="form-group"> <label>Serial number masking</label> <div class="input-group"> <input type="text" class="form-control" data-mask="***-***-***-***-***-***" data-mask-placeholder="_"> <span class="input-group-addon"><i class="fa fa-asterisk"></i></span> </div> <p class="note"> Data format ***-***-***-***-***-*** </p> </div> <div class="form-group"> <label>Tax ID masking</label> <div class="input-group"> <input type="text" class="form-control" data-mask="99-9999999" data-mask-placeholder="X"> <span class="input-group-addon"><i class="fa fa-briefcase"></i></span> </div> <p class="note"> Data format 99-9999999 </p> </div> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> Cancel </button> <button class="btn btn-primary" type="submit"> <i class="fa fa-save"></i> Submit </button> </div> </div> </div> </fieldset> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget jarviswidget-color-darken" id="wid-id-5" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-custombutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-edit"></i> </span> <h2>JS Knob </h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body"> <form> <fieldset> <legend> JS Knob Input </legend> <div class="knobs-demo"> <div> <input class="knob" data-width="120" data-height="120" data-displayinput=true value="35" data-displayprevious=true data-fgcolor="#428BCA"> </div> <div> <input class="knob" data-width="180" data-height="180" data-cursor=true data-fgcolor="#222222" data-thickness=.3 value="29"> </div> <div> <input class="knob" data-width="80" data-height="80" data-fgcolor="#71843F" data-angleoffset=-125 data-anglearc=250 value="33" data-thickness=.3> </div> </div> </fieldset> <div class="form-actions"> <div class="row"> <div class="col-md-12"> <button class="btn btn-default" type="submit"> Cancel </button> <button class="btn btn-primary" type="submit"> <i class="fa fa-save"></i> Submit </button> </div> </div> </div> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- END COL --> </div> <!-- END ROW --> </section> <!-- end widget grid --> </div> <!-- END MAIN CONTENT --> @section pagespecific { <!-- PAGE RELATED PLUGIN(S) --> <script src="/scripts/plugin/maxlength/bootstrap-maxlength.min.js"></script> <script src="/scripts/plugin/bootstrap-timepicker/bootstrap-timepicker.min.js"></script> <script src="/scripts/plugin/clockpicker/clockpicker.min.js"></script> <script src="/scripts/plugin/bootstrap-tags/bootstrap-tagsinput.min.js"></script> <script src="/scripts/plugin/noUiSlider/jquery.nouislider.min.js"></script> <script src="/scripts/plugin/ion-slider/ion.rangeSlider.min.js"></script> <script src="/scripts/plugin/bootstrap-duallistbox/jquery.bootstrap-duallistbox.min.js"></script> <script src="/scripts/plugin/colorpicker/bootstrap-colorpicker.min.js"></script> <script src="/scripts/plugin/knob/jquery.knob.min.js"></script> <script src="/scripts/plugin/x-editable/moment.min.js"></script> <script src="/scripts/plugin/x-editable/jquery.mockjax.min.js"></script> <script src="/scripts/plugin/x-editable/x-editable.min.js"></script> <script src="/scripts/plugin/typeahead/typeahead.min.js"></script> <script src="/scripts/plugin/typeahead/typeaheadjs.min.js"></script> <script type="text/javascript"> // DO NOT REMOVE : GLOBAL FUNCTIONS! $(document).ready(function () { // PAGE RELATED SCRIPTS // Spinners $("#spinner").spinner(); $("#spinner-decimal").spinner({ step: 0.01, numberFormat: "n" }); $("#spinner-currency").spinner({ min: 5, max: 2500, step: 25, start: 1000, numberFormat: "C" }); //Maxlength $('input[maxlength]').maxlength({ warningClass: "label label-success", limitReachedClass: "label label-important", }); // START AND FINISH DATE $('#startdate').datepicker({ dateFormat: 'dd.mm.yy', prevText: '<i class="fa fa-chevron-left"></i>', nextText: '<i class="fa fa-chevron-right"></i>', onSelect: function (selectedDate) { $('#finishdate').datepicker('option', 'minDate', selectedDate); } }); $('#finishdate').datepicker({ dateFormat: 'dd.mm.yy', prevText: '<i class="fa fa-chevron-left"></i>', nextText: '<i class="fa fa-chevron-right"></i>', onSelect: function (selectedDate) { $('#startdate').datepicker('option', 'maxDate', selectedDate); } }); // Date Range Picker $("#from").datepicker({ defaultDate: "+1w", changeMonth: true, numberOfMonths: 3, prevText: '<i class="fa fa-chevron-left"></i>', nextText: '<i class="fa fa-chevron-right"></i>', onClose: function (selectedDate) { $("#to").datepicker("option", "maxDate", selectedDate); } }); $("#to").datepicker({ defaultDate: "+1w", changeMonth: true, numberOfMonths: 3, prevText: '<i class="fa fa-chevron-left"></i>', nextText: '<i class="fa fa-chevron-right"></i>', onClose: function (selectedDate) { $("#from").datepicker("option", "minDate", selectedDate); } }); /* * TIMEPICKER */ $('#timepicker').timepicker(); /* * CLOCKPICKER */ $('#clockpicker').clockpicker({ placement: 'top', donetext: 'Done' }); /* * JS SLIDER */ $("#nouislider-1").noUiSlider({ range: [2, 100], start: 55, handles: 1, connect: true, }); $("#nouislider-2").noUiSlider({ range: [0, 300], start: [55, 130], step: 60, handles: 2, connect: true }); $("#nouislider-3").noUiSlider({ range: [0, 1000], start: [264, 776], step: 1, connect: true, slide: function () { var values = $(this).val(); $(".nouislider-value").text(values[0] + " - " + values[1]); } }); $("#nouislider-4").noUiSlider({ range: [0, 100], start: 50, handles: 1 }).attr("disabled", "disabled"); /* * ION SLIDER */ $("#range-slider-1").ionRangeSlider({ min: 0, max: 5000, from: 1000, to: 4000, type: 'double', step: 1, prefix: "$", prettify: false, hasGrid: true }); $("#range-slider-2").ionRangeSlider(); $("#range-slider-3").ionRangeSlider({ min: 0, from: 2.3, max: 10, type: 'single', step: 0.1, postfix: " mm", prettify: false, hasGrid: true }); $("#range-slider-4").ionRangeSlider({ min: -50, max: 50, from: 5, to: 25, type: 'double', step: 1, postfix: "°", prettify: false, hasGrid: true }); $("#range-slider-5").ionRangeSlider({ min: 0, from: 0, max: 10, type: 'single', step: 0.1, postfix: " mm", prettify: false, hasGrid: true }); /* * BOOTSTRAP DUALLIST BOX */ var initializeDuallistbox = $('#initializeDuallistbox').bootstrapDualListbox({ nonSelectedListLabel: 'Non-selected', selectedListLabel: 'Selected', preserveSelectionOnMove: 'moved', moveOnSelect: false, nonSelectedFilter: 'ion ([7-9]|[1][0-2])' }); /* * COLOR PICKER */ $('#colorpicker-1').colorpicker() $('#colorpicker-2').colorpicker() /* * KNOB */ $('.knob').knob({ change: function (value) { //console.log("change : " + value); }, release: function (value) { //console.log(this.$.attr('value')); //console.log("release : " + value); }, cancel: function () { //console.log("cancel : ", this); } }); /* * X-Ediable */ (function (e) { "use strict"; var t = function (e) { this.init("address", e, t.defaults) }; e.fn.editableutils.inherit(t, e.fn.editabletypes.abstractinput); e.extend(t.prototype, { render: function () { this.$input = this.$tpl.find("input") }, value2html: function (t, n) { if (!t) { e(n).empty(); return } var r = e("<div>").text(t.city).html() + ", " + e("<div>").text(t.street).html() + " st., bld. " + e("<div>").text(t.building).html(); e(n).html(r) }, html2value: function (e) { return null }, value2str: function (e) { var t = ""; if (e) for (var n in e) t = t + n + ":" + e[n] + ";"; return t }, str2value: function (e) { return e }, value2input: function (e) { if (!e) return; this.$input.filter('[name="city"]').val(e.city); this.$input.filter('[name="street"]').val(e.street); this.$input.filter('[name="building"]').val(e.building) }, input2value: function () { return { city: this.$input.filter('[name="city"]').val(), street: this.$input.filter('[name="street"]').val(), building: this.$input.filter('[name="building"]').val() } }, activate: function () { this.$input.filter('[name="city"]').focus() }, autosubmit: function () { this.$input.keydown(function (t) { t.which === 13 && e(this).closest("form").submit() }) } }); t.defaults = e.extend({}, e.fn.editabletypes.abstractinput.defaults, { tpl: '<div class="editable-address"><label><span>City: </span><input type="text" name="city" class="input-small"></label></div><div class="editable-address"><label><span>Street: </span><input type="text" name="street" class="input-small"></label></div><div class="editable-address"><label><span>Building: </span><input type="text" name="building" class="input-mini"></label></div>', inputclass: "" }); e.fn.editabletypes.address = t })(window.jQuery); //ajax mocks $.mockjaxSettings.responseTime = 500; $.mockjax({ url: '/post', response: function (settings) { log(settings, this); } }); $.mockjax({ url: '/error', status: 400, statusText: 'Bad Request', response: function (settings) { this.responseText = 'Please input correct value'; log(settings, this); } }); $.mockjax({ url: '/status', status: 500, response: function (settings) { this.responseText = 'Internal Server Error'; log(settings, this); } }); $.mockjax({ url: '/groups', response: function (settings) { this.responseText = [{ value: 0, text: 'Guest' }, { value: 1, text: 'Service' }, { value: 2, text: 'Customer' }, { value: 3, text: 'Operator' }, { value: 4, text: 'Support' }, { value: 5, text: 'Admin' }]; log(settings, this); } }); //TODO: add this div to page function log(settings, response) { var s = [], str; s.push(settings.type.toUpperCase() + ' url = "' + settings.url + '"'); for (var a in settings.data) { if (settings.data[a] && typeof settings.data[a] === 'object') { str = []; for (var j in settings.data[a]) { str.push(j + ': "' + settings.data[a][j] + '"'); } str = '{ ' + str.join(', ') + ' }'; } else { str = '"' + settings.data[a] + '"'; } s.push(a + ' = ' + str); } s.push('RESPONSE: status = ' + response.status); if (response.responseText) { if ($.isArray(response.responseText)) { s.push('['); $.each(response.responseText, function (i, v) { s.push('{value: ' + v.value + ', text: "' + v.text + '"}'); }); s.push(']'); } else { s.push($.trim(response.responseText)); } } s.push('--------------------------------------\n'); $('#console').val(s.join('\n') + $('#console').val()); } /* * X-EDITABLES */ $('#inline').on('change', function (e) { if ($(this).prop('checked')) { window.location.href = '?mode=inline#ajax/plugins.html'; } else { window.location.href = '?#ajax/plugins.html'; } }); if (window.location.href.indexOf("?mode=inline") > -1) { $('#inline').prop('checked', true); $.fn.editable.defaults.mode = 'inline'; } else { $('#inline').prop('checked', false); $.fn.editable.defaults.mode = 'popup'; } //defaults $.fn.editable.defaults.url = '/post'; //$.fn.editable.defaults.mode = 'inline'; use this to edit inline //enable / disable $('#enable').click(function () { $('#user .editable').editable('toggleDisabled'); }); //editables $('#username').editable({ url: '/post', type: 'text', pk: 1, name: 'username', title: 'Enter username' }); $('#firstname').editable({ validate: function (value) { if ($.trim(value) == '') return 'This field is required'; } }); $('#sex').editable({ prepend: "not selected", source: [{ value: 1, text: 'Male' }, { value: 2, text: 'Female' }], display: function (value, sourceData) { var colors = { "": "gray", 1: "green", 2: "blue" }, elem = $.grep(sourceData, function (o) { return o.value == value; }); if (elem.length) { $(this).text(elem[0].text).css("color", colors[value]); } else { $(this).empty(); } } }); $('#status').editable(); $('#group').editable({ showbuttons: false }); $('#vacation').editable({ datepicker: { todayBtn: 'linked' } }); $('#dob').editable(); $('#event').editable({ placement: 'right', combodate: { firstItem: 'name' } }); $('#meeting_start').editable({ format: 'yyyy-mm-dd hh:ii', viewformat: 'dd/mm/yyyy hh:ii', validate: function (v) { if (v && v.getDate() == 10) return 'Day cant be 10!'; }, datetimepicker: { todayBtn: 'linked', weekStart: 1 } }); $('#comments').editable({ showbuttons: 'bottom' }); $('#note').editable(); $('#pencil').click(function (e) { e.stopPropagation(); e.preventDefault(); $('#note').editable('toggle'); }); $('#state').editable({ source: ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Dakota", "North Carolina", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" ] }); $('#state2').editable({ value: 'California', typeahead: { name: 'state', local: ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Dakota", "North Carolina", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" ] } }); $('#fruits').editable({ pk: 1, limit: 3, source: [{ value: 1, text: 'banana' }, { value: 2, text: 'peach' }, { value: 3, text: 'apple' }, { value: 4, text: 'watermelon' }, { value: 5, text: 'orange' }] }); $('#tags').editable({ inputclass: 'input-large', select2: { tags: ['html', 'javascript', 'css', 'ajax'], tokenSeparators: [",", " "] } }); var countries = []; $.each({ "BD": "Bangladesh", "BE": "Belgium", "BF": "Burkina Faso", "BG": "Bulgaria", "BA": "Bosnia and Herzegovina", "BB": "Barbados", "WF": "Wallis and Futuna", "BL": "Saint Bartelemey", "BM": "Bermuda", "BN": "Brunei Darussalam", "BO": "Bolivia", "BH": "Bahrain", "BI": "Burundi", "BJ": "Benin", "BT": "Bhutan", "JM": "Jamaica", "BV": "Bouvet Island", "BW": "Botswana", "WS": "Samoa", "BR": "Brazil", "BS": "Bahamas", "JE": "Jersey", "BY": "Belarus", "O1": "Other Country", "LV": "Latvia", "RW": "Rwanda", "RS": "Serbia", "TL": "Timor-Leste", "RE": "Reunion", "LU": "Luxembourg", "TJ": "Tajikistan", "RO": "Romania", "PG": "Papua New Guinea", "GW": "Guinea-Bissau", "GU": "Guam", "GT": "Guatemala", "GS": "South Georgia and the South Sandwich Islands", "GR": "Greece", "GQ": "Equatorial Guinea", "GP": "Guadeloupe", "JP": "Japan", "GY": "Guyana", "GG": "Guernsey", "GF": "French Guiana", "GE": "Georgia", "GD": "Grenada", "GB": "United Kingdom", "GA": "Gabon", "SV": "El Salvador", "GN": "Guinea", "GM": "Gambia", "GL": "Greenland", "GI": "Gibraltar", "GH": "Ghana", "OM": "Oman", "TN": "Tunisia", "JO": "Jordan", "HR": "Croatia", "HT": "Haiti", "HU": "Hungary", "HK": "Hong Kong", "HN": "Honduras", "HM": "Heard Island and McDonald Islands", "VE": "Venezuela", "PR": "Puerto Rico", "PS": "Palestinian Territory", "PW": "Palau", "PT": "Portugal", "SJ": "Svalbard and Jan Mayen", "PY": "Paraguay", "IQ": "Iraq", "PA": "Panama", "PF": "French Polynesia", "BZ": "Belize", "PE": "Peru", "PK": "Pakistan", "PH": "Philippines", "PN": "Pitcairn", "TM": "Turkmenistan", "PL": "Poland", "PM": "Saint Pierre and Miquelon", "ZM": "Zambia", "EH": "Western Sahara", "RU": "Russian Federation", "EE": "Estonia", "EG": "Egypt", "TK": "Tokelau", "ZA": "South Africa", "EC": "Ecuador", "IT": "Italy", "VN": "Vietnam", "SB": "Solomon Islands", "EU": "Europe", "ET": "Ethiopia", "SO": "Somalia", "ZW": "Zimbabwe", "SA": "Saudi Arabia", "ES": "Spain", "ER": "Eritrea", "ME": "Montenegro", "MD": "Moldova, Republic of", "MG": "Madagascar", "MF": "Saint Martin", "MA": "Morocco", "MC": "Monaco", "UZ": "Uzbekistan", "MM": "Myanmar", "ML": "Mali", "MO": "Macao", "MN": "Mongolia", "MH": "Marshall Islands", "MK": "Macedonia", "MU": "Mauritius", "MT": "Malta", "MW": "Malawi", "MV": "Maldives", "MQ": "Martinique", "MP": "Northern Mariana Islands", "MS": "Montserrat", "MR": "Mauritania", "IM": "Isle of Man", "UG": "Uganda", "TZ": "Tanzania, United Republic of", "MY": "Malaysia", "MX": "Mexico", "IL": "Israel", "FR": "France", "IO": "British Indian Ocean Territory", "FX": "France, Metropolitan", "SH": "Saint Helena", "FI": "Finland", "FJ": "Fiji", "FK": "Falkland Islands (Malvinas)", "FM": "Micronesia, Federated States of", "FO": "Faroe Islands", "NI": "Nicaragua", "NL": "Netherlands", "NO": "Norway", "NA": "Namibia", "VU": "Vanuatu", "NC": "New Caledonia", "NE": "Niger", "NF": "Norfolk Island", "NG": "Nigeria", "NZ": "New Zealand", "NP": "Nepal", "NR": "Nauru", "NU": "Niue", "CK": "Cook Islands", "CI": "Cote d'Ivoire", "CH": "Switzerland", "CO": "Colombia", "CN": "China", "CM": "Cameroon", "CL": "Chile", "CC": "Cocos (Keeling) Islands", "CA": "Canada", "CG": "Congo", "CF": "Central African Republic", "CD": "Congo, The Democratic Republic of the", "CZ": "Czech Republic", "CY": "Cyprus", "CX": "Christmas Island", "CR": "Costa Rica", "CV": "Cape Verde", "CU": "Cuba", "SZ": "Swaziland", "SY": "Syrian Arab Republic", "KG": "Kyrgyzstan", "KE": "Kenya", "SR": "Suriname", "KI": "Kiribati", "KH": "Cambodia", "KN": "Saint Kitts and Nevis", "KM": "Comoros", "ST": "Sao Tome and Principe", "SK": "Slovakia", "KR": "Korea, Republic of", "SI": "Slovenia", "KP": "Korea, Democratic People's Republic of", "KW": "Kuwait", "SN": "Senegal", "SM": "San Marino", "SL": "Sierra Leone", "SC": "Seychelles", "KZ": "Kazakhstan", "KY": "Cayman Islands", "SG": "Singapore", "SE": "Sweden", "SD": "Sudan", "DO": "Dominican Republic", "DM": "Dominica", "DJ": "Djibouti", "DK": "Denmark", "VG": "Virgin Islands, British", "DE": "Germany", "YE": "Yemen", "DZ": "Algeria", "US": "United States", "UY": "Uruguay", "YT": "Mayotte", "UM": "United States Minor Outlying Islands", "LB": "Lebanon", "LC": "Saint Lucia", "LA": "Lao People's Democratic Republic", "TV": "Tuvalu", "TW": "Taiwan", "TT": "Trinidad and Tobago", "TR": "Turkey", "LK": "Sri Lanka", "LI": "Liechtenstein", "A1": "Anonymous Proxy", "TO": "Tonga", "LT": "Lithuania", "A2": "Satellite Provider", "LR": "Liberia", "LS": "Lesotho", "TH": "Thailand", "TF": "French Southern Territories", "TG": "Togo", "TD": "Chad", "TC": "Turks and Caicos Islands", "LY": "Libyan Arab Jamahiriya", "VA": "Holy See (Vatican City State)", "VC": "Saint Vincent and the Grenadines", "AE": "United Arab Emirates", "AD": "Andorra", "AG": "Antigua and Barbuda", "AF": "Afghanistan", "AI": "Anguilla", "VI": "Virgin Islands, U.S.", "IS": "Iceland", "IR": "Iran, Islamic Republic of", "AM": "Armenia", "AL": "Albania", "AO": "Angola", "AN": "Netherlands Antilles", "AQ": "Antarctica", "AP": "Asia/Pacific Region", "AS": "American Samoa", "AR": "Argentina", "AU": "Australia", "AT": "Austria", "AW": "Aruba", "IN": "India", "AX": "Aland Islands", "AZ": "Azerbaijan", "IE": "Ireland", "ID": "Indonesia", "UA": "Ukraine", "QA": "Qatar", "MZ": "Mozambique" }, function (k, v) { countries.push({ id: k, text: v }); }); $('#country').editable({ source: countries, select2: { width: 200 } }); $('#address').editable({ url: '/post', value: { city: "Moscow", street: "Lenina", building: "12" }, validate: function (value) { if (value.city == '') return 'city is required!'; }, display: function (value) { if (!value) { $(this).empty(); return; } var html = '<b>' + $('<div>').text(value.city).html() + '</b>, ' + $('<div>').text(value.street) .html() + ' st., bld. ' + $('<div>').text(value.building).html(); $(this).html(html); } }); $('#user .editable').on('hidden', function (e, reason) { if (reason === 'save' || reason === 'nochange') { var $next = $(this).closest('tr').next().find('.editable'); if ($('#autoopen').is(':checked')) { setTimeout(function () { $next.editable('show'); }, 300); } else { $next.focus(); } } }); }) </script> }
the_stack
@using Xms.Schema.Extensions; @using Xms.RibbonButton.Abstractions; @using Xms.QueryView.Abstractions; @model Xms.Web.Models.EntityGridModel @{ Layout = null; } @{ this.app.PageTitle = Model.QueryView.Name; } @{ var mainEntity = Model.EntityList.First(); var jsLibs = new List<string>(); var resources = new List<Guid>(); if (Model.IsShowButtons && Model.RibbonButtons.NotEmpty()) { foreach (var btn in Model.RibbonButtons) { if (btn.JsLibrary.IsNotEmpty()) { if (btn.JsLibrary.StartsWith("$webresource:")) { var wsId = Guid.Parse(btn.JsLibrary.Replace("$webresource:", "")); if (!resources.Contains(wsId)) { resources.Add(wsId); } } else if (!jsLibs.Contains(btn.JsLibrary)) { jsLibs.Add(btn.JsLibrary); } } } } var hasNonePermissionField = Model.NonePermissionFields.NotEmpty(); } <div> <div id="queryview-section"> @{ if (Model.IsShowButtons) { <div class="container-fluid margin-bottom" style="border:1px #eee dashed;position:relative;"> @{ if (Model.RibbonButtons.NotEmpty()) { var headButtons = Model.RibbonButtons.Where(n => n.ShowArea == RibbonButtonArea.ListHead).ToList(); foreach (var btn in headButtons) { <a class="@btn.CssClass@(btn.IsVisibled ? "" : " hide")" href="javascript:void(0)" onclick="@btn.JsAction" @(btn.IsEnabled ? "" : " disabled")><span class="@btn.Icon"></span> @btn.Label</a> } } } @*<a class="btn btn-link btn-sm" href="javascript:void(0)" onclick="Xms.Data.Export('@Model.QueryViewId')" target="_blank"><span class="glyphicon glyphicon-export"></span> @app.T["export"]</a>*@ <div class="btn-group hide"> <a class="btn btn-link btn-sm dropdown-toggle" data-toggle="dropdown"> <span class="glyphicon glyphicon-import"></span> @app.T["export"] <span class="caret"></span> </a> <ul class="dropdown-menu" role="menu"> <li> <a class="btn btn-link btn-sm" href="javascript:void(0)" onclick="Xms.Data.Export('@Model.QueryViewId', 0, filters)" target="_blank"><span class="glyphicon glyphicon-chevron-right"></span> @app.T["export"]</a> </li> <li> <a class="btn btn-link btn-sm" href="javascript:void(0)" onclick="Xms.Data.Export('@Model.QueryViewId', 1, filters)" target="_blank"><span class="glyphicon glyphicon-chevron-right"></span> @app.T["export_includeprimarykey"]</a> </li> </ul> </div> <a class="btn btn-link btn-sm hide" href="#" onclick="Xms.Web.OpenDialog('/entity/import?entityid=@Model.EntityId','')"><span class="glyphicon glyphicon-import"></span> 导入数据</a> </div> } } <div class="margin-bottom" style="padding-top:10px;"> <div class="container-fluid form-inline"> <div class="custom-form-group row"> @*<h5><strong>@Model.QueryView.Name - 视图</strong></h5>*@ <div class="custom-input-ctrl col-xs-3 col-sm-3" style="margin-top:6px; min-width:175px;"> @*@if (Model.IsEnabledViewSelector) { <a id="viewDropdown" class="dropdown-toggle btn btn-info btn-sm viewDropdown-btn" data-toggle="dropdown" title="@Model.QueryView.Name" href="#"> <span class="glyphicon glyphicon-th"></span> <span class="selecter-label">@Model.QueryView.Name</span> <span class="caret"></span> </a> <ul class="dropdown-menu" id="viewSelector" data-value="@Model.QueryView.QueryViewId"> @foreach (var item in Model.QueryViews) { @: <li><a href="javascript:void(0)" data-value="@item.QueryViewId" title="@item.Name">@item.Name</a></li> } </ul> } else { <label class="custom-input-inline col-sm-6" id="viewSelector" title="@Model.QueryView.Name" data-value="@Model.QueryView.QueryViewId" style="text-align:left;">@Model.QueryView.Name</label> } <div class="btn-group list-align-style" id="listAlignStyle" role="group" aria-label="切换显示方式"> <span type="button" id="listAlignTop" data-type="top" class="btn "><em class="glyphicon glyphicon-object-align-top"></em></span> <span type="button" id="listAlignLeft" data-type="left" class="btn active"><em class="glyphicon glyphicon-object-align-left"></em></span> </div>*@ </div> <div class="xms-form-dropdown col-xs-4 col-sm-4 xms-formDropDown kanban-filter hide" style="width:150px;"> <div class="btn-group"> <div class="btn btn-default btn-sm xms-formDownInput " style="width:130px;border-radius:4px;" title="@app.T["filter"]"> <span class="glyphicon glyphicon-filter"></span> 请选择字段 </div><span class="caret" style="position: absolute;right: 15px;top: 50%;z-index:9;"></span> </div> <div class="xms-formDropDown-List container-fluid in" id="kanbanSearch" style="width:250px; padding:10px;"> <div class="custom-input-ctrl col-sm-10"> <div class="row seacher-row xms-formDropDown-Item" data-name="" data-type="picklist"> <label class="col-sm-6 text-right" for="">统计字段</label> <div class="col-sm-6"> <div class="form-group"> <select class="form-control" id="aggregateField"> <option></option> @foreach (var attr in Model.AttributeList.Where(n => n.TypeIsInt() || n.TypeIsFloat() || n.TypeIsDecimal() || n.TypeIsMoney())) { <option value="@attr.Name">@attr.LocalizedName</option> } </select> </div> </div> </div> <div class="row seacher-row xms-formDropDown-Item" data-name="" data-type="picklist"> <label class="col-sm-6 text-right" for="">分组字段</label> <div class="col-sm-6"> <div class="form-group"> <select class="form-control" id="groupField"> <option></option> @foreach (var attr in Model.AttributeList.Where(n => n.TypeIsPickList() || n.TypeIsStatus())) { <option value="@attr.Name">@attr.LocalizedName</option> } </select> </div> </div> </div> @*<div class="row seacher-row xms-formDropDown-Item" data-name="" data-type="picklist"> <label class="col-sm-4 text-right" for=""></label> <div class="col-sm-8"> <div class="form-group"> <select class="form-control" id="countField"> <option value="10">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option> </select> </div> </div> </div>*@ </div> <div class="row text-center"> <div class="col-sm-12"> <div class="btn btn-default btn-sm" onclick="page_common_formSearcher.closeKanban()">@app.T["cancel"]</div> <div class="btn btn-info btn-sm" onclick="page_common_formSearcher.searchKanban(); page_common_formSearcher.closeKanban();">@app.T["dialog_ok"]</div> </div> </div> </div> </div> <div class="custom-input-ctrl col-xs-8 col-sm-8 custom-input-change date-filter-section pull-right" style="min-width:455px;"> <div class="custom-btn-group" style="min-width:356px;"> <div class="btn-group btn-group-sm pull-right" id="dayfilters"> <button type="button" data-day="@DateTime.Now.ToString("yyyy-MM-dd")" style="border-radius:0; margin-left:-1px;" class="btn btn-default" onclick="DayQuery(this)">@app.T["filter_date_today"]</button> <button type="button" data-day="@DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd")" class="btn btn-default" onclick="DayQuery(this)">@app.T["filter_date_last7day"]</button> <button type="button" data-day="@DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd")" class="btn btn-default" onclick="DayQuery(this)">@app.T["filter_date_lastmonth"]</button> <button type="button" data-day="@DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd")" class="btn btn-default" onclick="DayQuery(this)">@app.T["filter_date_last3month"]</button> <button type="button" data-day="@DateTime.Now.AddMonths(-6).ToString("yyyy-MM-dd")" class="btn btn-default" onclick="DayQuery(this)">@app.T["filter_date_last6month"]</button> <button type="button" data-day="@DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd")" class="btn btn-default" onclick="DayQuery(this)">@app.T["filter_date_lastyear"]</button> <button type="button" title="刷新" class="btn btn-default" onclick="rebind()"><span class="glyphicon glyphicon-refresh"></span></button> </div> </div> <div class="custom-input-ctrl custom-input-hide filter-section pull-right"> <form action="@("/"+app.OrganizationUniqueName)/entity/gridview" id="searchForm" method="post" class="form-inline"> @Html.HiddenFor(x => x.EntityId) @Html.HiddenFor(x => x.QueryViewId) @Html.HiddenFor(x => x.SortBy) @Html.HiddenFor(x => x.SortDirection) <input type="hidden" value="1" name="page" /> <input type="hidden" name="QField" id="QField" value="@Model.QField" /> <div class="xms-form-dropdown row xms-formDropDown"> <div class="col-sm-12"> <div class="btn-group"> <div class="btn btn-default btn-sm xms-formDownInput " style="width:85px;border-radius:4px 0 0 4px;" title="@app.T["filter"]"><span class="glyphicon glyphicon-filter"></span> @app.T["filter"]</div><span class="caret" style="position: absolute;right: 10px;top: 50%;z-index:9;"></span> </div> <div class="xms-formDropDown-List container-fluid" id="searchFormSearch" style="width:336px; padding:10px;"> <div style="max-height:350px;overflow-x:hidden;overflow:auto;"> @foreach (var cell in Model.Grid.Rows[0].Cells) { var isrelated = cell.Name.IndexOf(".") > 0; var k = isrelated ? cell.Name.Split('.')[1] : cell.Name.ToLower(); var label = cell.Label; Xms.Schema.Domain.Attribute attr = null; if (!isrelated) { attr = Model.AttributeList.Find(n => n.EntityId == mainEntity.EntityId && n.Name.IsCaseInsensitiveEqual(k)); //label = attr.LocalizedName; } else { attr = Model.AttributeList.Find(n => n.EntityName.IsCaseInsensitiveEqual(cell.EntityName) && n.Name.IsCaseInsensitiveEqual(k)); //显示字段+引用字段 //var relationship = Model.RelationShipList.Find(n => n.Name.IsCaseInsensitiveEqual(cell.Name.Split('.')[0])); //label = attr.LocalizedName + "(" + relationship.ReferencingAttributeLocalizedName + ")"; } if (attr == null) { continue; } var nonePf = hasNonePermissionField ? Model.NonePermissionFields.Find(n => n.AttributeId == attr.AttributeId) : null; if (nonePf != null) { continue; } var ctrlId = isrelated ? cell.Name.Replace(".", "_") : cell.Name; <div class="row seacher-row xms-formDropDown-Item" data-name="@cell.Name" data-type="@attr.AttributeTypeName.ToLower()"> <label class="col-sm-4 text-right" for="@cell.Name">@label</label> <div class="col-sm-8"> @if (attr.TypeIsDateTime()) { <div class="form-group"> <input type="text" style="width:88px;" id="@ctrlId" class="form-control colinput input-sm datepicker" data-type="@attr.AttributeTypeName.ToLower()" autocomplete="off" name="@cell.Name" /> <span style="width:10px;">-</span> <input type="text" style="width:87px;" autocomplete="off" class="form-control colinput input-sm datepicker" name="@cell.Name" data-type="@attr.AttributeTypeName.ToLower()" /> </div> } else if (attr.TypeIsPickList() || attr.TypeIsBit() || attr.TypeIsStatus() || attr.TypeIsState()) { var itemStr = (attr.TypeIsPickList() || attr.TypeIsStatus()) ? attr.OptionSet.Items.SerializeToJson() : attr.PickLists.SerializeToJson(); <input type="text" id="@ctrlId" class="form-control colinput input-sm picklist" data-type="@attr.AttributeTypeName.ToLower()" data-name="@attr.Name" name="@cell.Name" data-items="@Html.UrlEncoder.Encode(itemStr)" /> } else if (attr.TypeIsLookUp() || attr.TypeIsCustomer() || attr.TypeIsOwner() || attr.TypeIsPrimaryKey()) { <div class="input-group input-group-sm"> <input type="text" id="@ctrlId" data-type="lookup" data-entityid="@attr.ReferencedEntityId" data-referencedentityid="@attr.ReferencedEntityId" name="@cell.Name" class="form-control colinput lookup searchLookup" /> <span class="input-group-btn"> <button type="button" name="clearBtn" class="btn btn-default ctrl-del" title="find" style="border-radius:0;"><span class="glyphicon glyphicon-remove-sign"></span></button> <button type="button" name="lookupBtn" class="btn btn-default ctrl-search" title="find" style="border-top-left-radius: 0;border-bottom-left-radius: 0;"><span class="glyphicon glyphicon-search"></span></button> </span> </div> } else if (attr.TypeIsInt() || attr.TypeIsFloat() || attr.TypeIsDecimal() || attr.TypeIsMoney()) { <div class="form-group"> <input type="text" style="width:80px;" id="@ctrlId" class="form-control colinput input-sm" data-type="@attr.AttributeTypeName.ToLower()" style="width:90px;" name="@cell.Name" value="" /> <span style="width:10px;">-</span> <input type="text" style="width:80px;" class="form-control colinput input-sm" name="@cell.Name" value="" data-type="@attr.AttributeTypeName.ToLower()" /> </div> } else { <input type="text" id="@ctrlId" class="form-control colinput input-sm" name="@cell.Name" data-type="@attr.AttributeTypeName.ToLower()" value="" /> } </div> </div> } </div> <div class="row text-center"> <div class="col-sm-12"> <div class="btn btn-default btn-sm event-bind" data-eventname="page_common_formSearcher.closeSearchC">@app.T["cancel"]</div> <div class="btn btn-default btn-sm event-bind" data-eventname="page_common_formSearcher.clearSearchFiler">@app.T["clear"]</div> <div class="btn btn-info btn-sm event-bind" id="searchFilterListBtn" data-eventname="page_common_formSearcher.closeSearchForm">@app.T["dialog_ok"]</div> <button type="reset" name="resetBtn" class="hide"></button> </div> </div> </div> </div> </div> </form> </div> </div> </div> </div> </div> <div id="kanbanview" class="hide"></div> <div id="xms-gridview-section" class="xms-gridview-section "> <div class="xms-table-navtree" id="xms-table-navtree"> </div> <div class="pos_re "> @{ var btnStr = ""; if (Model.IsShowButtons && Model.RibbonButtons.NotEmpty()) { var rowButtons = Model.RibbonButtons.Where(n => n.ShowArea == RibbonButtonArea.ListRow).ToList(); foreach (var btn in rowButtons) { btnStr += "<li><a class=\"" + btn.CssClass + " datagrid-inline-btns\" href=\"javascript: void(0)\" onclick=\"" + btn.JsAction + "\"><span class=\"" + btn.Icon + "\"></span> " + btn.Label + "</a></li>"; } } } @*<div class="xms-table-section printArea" id="xms-table-section"> <div class="data-grid-box" style="margin-right:40px;" id="datatable"> <div class="datagrid-view" id="dataGridView"></div> </div> <div class="hide" id="fozon-wrap"> <table class="table table-hover table-striped table-condensed" id="fozon-table"></table> </div> <div class="panel panel-default tableReWidth hide" id="tableReWidth" style="min-height:350px; position:relative;"> <table class="table table-hover table-striped table-condensed" data-pageurl="@app.Url" data-refresh="rebind()" data-ajax="true" data-ajaxcontainer="gridview" data-ajaxcallback="ajaxgrid_reset()" data-sortby="@Model.SortBy.ToLower()" data-sortdirection="@Model.SortDirection" data-enabledfilter="@(Model.IsEnabledFastSearch.ToString().ToLower())">*@ @*<thead> <tr> <th width="25" class="tableHeaderItem" data-width="25" style="width:25px"><input type="checkbox" name="checkall" /></th> @if (btnStr.IsNotEmpty()) { <th width="100" class="tableHeaderItem" data-width="50" style="width:50px"><a style="height: 20px;padding: 1%;cursor:default">@app.T["operation"]</a></th> } @{ var thWidth = 0; foreach (var cell in Model.Grid.Rows[0].Cells) { var isrelated = cell.Name.IndexOf(".") > 0; var k = isrelated ? cell.Name.Split('.')[1] : cell.Name.ToLower(); var label = cell.Label; var relationentityid = ""; thWidth += cell.Width; Xms.Schema.Domain.Attribute attr = null; var sortName = cell.Name; <input type="hidden" id="tableHeaderWidth" style="display:none;" value="@thWidth" /> if (!isrelated) { attr = Model.AttributeList.Find(n => n.EntityId == mainEntity.EntityId && n.Name.IsCaseInsensitiveEqual(k)); //label = attr.LocalizedName; } else { attr = Model.AttributeList.Find(n => n.EntityName.IsCaseInsensitiveEqual(cell.EntityName) && n.Name.IsCaseInsensitiveEqual(k)); //显示字段+引用字段 //var relationship = Model.RelationShipList.Find(n => n.Name.IsCaseInsensitiveEqual(cell.Name.Split('.')[0])); //label = attr.LocalizedName + "(" + relationship.ReferencingAttributeLocalizedName + ")"; //relationentityid = attr.ReferencedEntityId.ToString(); } if (attr == null) { continue; } if (attr.TypeIsLookUp()) { sortName += "Name"; } var nonePf = hasNonePermissionField ? Model.NonePermissionFields.Find(n => n.AttributeId == attr.AttributeId) : null; if (nonePf != null) { <th class="tableHeaderItem" data-label="@label" data-width="@cell.Width" data-type="@attr.AttributeTypeName" style="width:@(cell.Width+"px")"> <span class="glyphicon glyphicon-lock"></span> <span class="text-muted">@label</span> </th> } else { <th class="tableHeaderItem" data-width="@cell.Width" data-referencedentityid="@relationentityid" data-name="@sortName.ToLower()" style="width:@(cell.Width+"px")" data-label="@label" data-type="@attr.AttributeTypeName"> </th> } } } </tr> </thead> <tbody> @{ var primaryKey = Model.AttributeList.Find(n => n.EntityId == mainEntity.EntityId && n.TypeIsPrimaryKey()); var primaryField = Model.AttributeList.Find(n => n.EntityId == mainEntity.EntityId && n.IsPrimaryField == true); var hasRowCommand = Model.Grid.RowCommand.NotEmpty(); } @foreach (var item in Model.Items) { var lines = (item as IDictionary<string, object>).ToList(); //行事件 string rowBgColor = ""; if (hasRowCommand) { foreach (var rowCmd in Model.Grid.RowCommand) { if (rowCmd.ActionType == Xms.QueryView.Abstractions.Component.RowCommandActionType.SetRowBackground) { var rowFlag = rowCmd.IsTrue(lines, Model.AttributeList); if (rowFlag) { rowBgColor = (rowCmd.Action as Xms.QueryView.Abstractions.Component.SetRowBackgroundAction).Color; break; } } } } var id = lines.Find(n => n.Key.IsCaseInsensitiveEqual(primaryKey.Name)).Value; <tr data-dbclick="entityIframe('show',ORG_SERVERURL + '/entity/create?entityid=@mainEntity.EntityId&formid=@Model.TargetFormId&recordid=@id')" style="@(rowBgColor.IsNotEmpty()?"background:"+rowBgColor:"")"> <td><input type="checkbox" name="recordid" value="@id" /></td> @if (btnStr.IsNotEmpty()) { <td class="visble gridvview-btnlist"> <div class="btn-group" style="height:20px;width:100%;"> <div class="btn btn-link dropdown-toggle btn-prevent" data-toggle="dropdown" aria-expanded="false" style="height: 100%;width:100%;line-height:0.5;text-align:left;padding: 6px 0px;"> <span class="caret" style="top:-3px;"></span> </div> <ul class="dropdown-menu" role="menu" style="right:0;left:inherit;min-width: 100%;z-index: 9;"> @Html.Raw(btnStr) </ul> </div> </td> } @foreach (var cell in Model.Grid.Rows[0].Cells) { var columnName = cell.Name.ToLower(); var isrelated = columnName.IndexOf(".") > 0; var attrName = isrelated ? columnName.Split('.')[1] : columnName; Xms.Schema.Domain.Attribute attr = null; if (isrelated) { attr = Model.AttributeList.Find(n => n.EntityName.IsCaseInsensitiveEqual(cell.EntityName) && n.Name.IsCaseInsensitiveEqual(attrName)); } else { attr = Model.AttributeList.Find(n => n.EntityId == mainEntity.EntityId && n.Name.IsCaseInsensitiveEqual(attrName)); } if (attr == null) { continue; } if (attr != null && (attr.TypeIsPrimaryKey() || attr.TypeIsLookUp() || attr.TypeIsOwner())) { columnName = attr.TypeIsPrimaryKey() ? primaryField.Name : columnName += "Name"; var value = lines.Find(n => n.Key.IsCaseInsensitiveEqual(columnName)).Value; var recordid = lines.Find(n => n.Key.IsCaseInsensitiveEqual(cell.Name)).Value; <td> <div class="gridview-table-cell"> @if (attr.DisplayStyle == "link") { <a href="edit?entityid=@attr.ReferencedEntityId&recordid=@recordid" target="_blank" title="@value">@value</a> } else { @value } </div> </td> } else if (attr.TypeIsPickList() || attr.TypeIsBit() || attr.TypeIsState() || attr.TypeIsStatus()) { columnName += "Name"; var value = lines.Find(n => n.Key.IsCaseInsensitiveEqual(columnName)).Value; <td> <div class="gridview-table-cell" title="@value">@value</div> </td> } else { var value = lines.Find(n => n.Key.IsCaseInsensitiveEqual(columnName)).Value; if (value != null && (attr.TypeIsDecimal() || attr.TypeIsFloat())) { value = string.Format("{0:N" + attr.Precision + "}", value); } else if (value != null && attr.TypeIsMoney()) { value = string.Format("¥{0:N" + attr.Precision + "}", value); } else if (value != null && attr.TypeIsDateTime()) { if (attr.DataFormat.IsCaseInsensitiveEqual("yyyy/MM/dd")) { value = string.Format("{0:d}", value); } else { value = string.Format("{0:G}", value); } } else if (attr.IsPrimaryField) { value = string.Format("<a href=\"edit?entityid={0}&formid={1}&recordid={2}\" target=\"_blank\">{3}</a>", mainEntity.EntityId, Model.TargetFormId, id, value); } else if (attr.TypeIsNvarchar()) { if (attr.DataFormat == "url" && value != null && value.ToString().IsNotEmpty()) { value = string.Format("<a href=\"{0}\" title=\"新窗口打开\" target=\"_blank\"><span class=\"glyphicon glyphicon-share-alt\"></span></a>", value); } } <td><div class="gridview-table-cell @attr.AttributeTypeName.ToLower()">@Html.Raw(value)</div></td> } } @if (Model.IsShowButtons && rowButtons.NotEmpty()) { <td> @foreach (var btn in rowButtons) { <a class="@btn.CssClass " href="javascript: void(0)" onclick="@btn.JsAction"><span class="@btn.Icon"></span>@btn.Label</a> } </td> } </tr> } </tbody>*@ @*@if (Model.AggregateFields.NotEmpty() && Model.AggregationData != null) { var dd = Model.AggregationData as IDictionary<string, object>; <tfoot> <tr> <td></td> @if (btnStr.IsNotEmpty()) { <td></td> } @foreach (var c in Model.Grid.Rows[0].Cells) { var aggf = Model.AggregateFields.Find(n => n.AttributeName.IsCaseInsensitiveEqual(c.Name)); <td class="@(aggf != null ? "money" : "")"> <strong class="agg-type-wrap"><span class="agg-type-name text-muted" data-name="@(c.Name)"></span><span class="agginfo-value" data-name="@(c.Name)">@(aggf != null ? dd[c.Name.ToLower()] : "")</span></strong> </td> } </tr> </tfoot> } </table> </div> <input type="hidden" id="AggregateFields" value="@Model.AggregateFields.SerializeToJson()" />*@ <div class="panel-footer hide"> <div class="row"> <div class="col-sm-4"> @(app.T["pagination_label"].Replace("{page}", Model.Page.ToString()).Replace("{totalpages}", Model.TotalPages.ToString()).Replace("{totalitems}", Model.TotalItems.ToString())) </div> <div id="page-selection" class="col-sm-8" data-total="@Model.TotalPages" data-page="@Model.Page"></div> </div> </div> </div> </div> </div> </div> @if (Model.IsShowButtons && Model.RibbonButtons.NotEmpty() && Model.RibbonButtons.Exists(x => x.ShowArea == RibbonButtonArea.ListRow)) { <div id="gridviewItemBtnstmpl" class="hide"><ul class="btn-list">@(btnStr)</ul></div> } @if (Model.IsShowChart == true) { <div class="xms-fixed-slider clearfix"> <div class="fl"> <div class="xms-slider-ctrl " style="position:relative;z-index:100; cursor: pointer;"><img src="/content/images/chartsidelite.png" /></div> </div> <div class="fl"> <div class="menu-wrap menu-md menu-right" style="margin-top: -136px;margin-right:50px;background:#fff;"> <div class="tableResize-item tableResize-ctrl" style="position: absolute; height: 400px; right: 296px; width: 10px;" id="drag"></div> <div class="xms-slider-right" style=""> <div class="xms-slider-header"> <div class="btn-toolbar" role="toolbar" aria-label=""> <div class="btn-group" role="button" aria-label="" title="@app.T["chart"]"><em id="listchartWinBtn" class="glyphicon glyphicon-resize-horizontal"></em></div> <div class="btn-group" role="group" aria-label=""></div> <div class="btn-group" role="group" aria-label=""></div> </div> <div class="col-sm-12 row" style="padding: 0; margin: 0;"> <select id="ChartList" class="form-control"></select> </div> </div> @*<div class="col-sm-12 row" style="padding: 0; margin: 0;"> <div class="silder-right-crumb hide"> </div> </div>*@ <div class="xms-slider-content" style="margin-top:0px;" id="viewCharts"> </div> <div class="xms-slider-footer"> </div> </div> </div> </div> </div> <div class="tools-modal" id="groupsInserModal"> <div class="tools-modal-dialog"> <div class="tools-modal-content"> <div class="tools-modal-header"> <button type="button" class="close" data-dismiss="modal"> <span class="m-close-btn" aria-hidden="true" onclick="$(this).parents('.tools-modal').removeClass('active')">×</span> <span class="sr-only">Close</span> </button> <h4 class="tools-modal-title"><span class="glyphicon glyphicon-th"></span> 向下钻取</h4> </div> <div class="tools-modal-body"> <div class="form-group"> <div class="row"> <div class="col-sm-4"><label>字段</label></div> <div class="col-sm-8"><select class="groups-attributes tools-modal-control" id="groupsAttributes"></select></div> </div> </div> </div> <div class="tools-modal-footer"> <button type="button" class="btn btn-primary m-accept-btn btn-xs" id="groupsAttributesBtn">钻取</button> </div> </div> </div> </div> } <script>Xms.Page.PageContext.EntityId = '@Model.EntityId.Value'; Xms.Page.PageContext.QueryId = '@Model.QueryViewId.Value'; Xms.Page.PageContext.Scope = 'query'; Xms.Page.PageContext.TargetFormId = @(Model.TargetFormId.HasValue ? "'"+Model.TargetFormId.Value+"'" : "null");</script> @foreach (var item in jsLibs) { <script type="text/javascript" src="@item" charset="UTF-8"></script> } @if (resources.Count > 0) { <script type="text/javascript" src="@("/"+app.OrganizationUniqueName)/api/webresource?ids=@(string.Join(",", resources))" charset="UTF-8"></script> } <div id="layoutConfig" class="hide" type="text/html">@Model.QueryView.LayoutConfig.ToLower()</div> <script> /* *页面相关数据,必须暴露到全局 */ var page_Common_Info = { queryId: '@Model.QueryViewId', entityId:'@Model.EntityId.Value', queryName:'@Model.QueryView.Name', breadcrumb_url: '@app.UrlReferrer', breadcrumb_preName: '@Model.EntityList[0].LocalizedName', isviewselector: '@Model.IsEnabledViewSelector', isshowchart:'@Model.IsShowChart' } var layoutconfig = $('#layoutConfig').html(); var layoutconfigObj = JSON.parse(layoutconfig); // console.log('layoutconfigObj',layoutconfigObj) </script> <script src="~/content/js/common/charts.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="~/content/js/common/formsearcher.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="~/content/js/pages/entity.gridview.js?v=@app.PlatformSettings.VersionNumber"></script> <script> //pageWrap_Gridview.init(); $(function () { }); </script> </div>
the_stack
@model SmartAdmin.WebUI.Data.Models.Log @{ /**/ ViewData["Title"] = "系统日志"; ViewData["PageName"] = "logs_index"; ViewData["Heading"] = "<i class='fal fa-ballot-check text-primary'></i> 系统日志"; ViewData["Category1"] = "系统管理"; ViewData["PageDescription"] = ""; } @section HeadBlock { <link href="~/css/statistics/chartjs/chartjs.css" rel="stylesheet" /> <link href="~/css/formplugins/bootstrap-daterangepicker/bootstrap-daterangepicker.css" rel="stylesheet" /> <link href="~/js/easyui/themes/insdep/easyui.css" rel="stylesheet" asp-append-version="true" /> <style> #test-container { overflow-wrap: break-word; word-wrap: break-word; hyphens: auto; } </style> } <div class="row mb-2"> <div class="col-sm-12 col-md-8" style="position: relative;height:230px"> <canvas id='timebar' style="height: 100%;"></canvas> </div> <div class="col-sm-12 col-md-4" style="position: relative;height:230px"> <canvas id='levelpie' class="m-auto" style="height: 100%;"></canvas> </div> </div> <div class="row"> <div class="col-lg-12 col-xl-12"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> 系统日志 </h2> <div class="panel-toolbar"> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"><i class="fal fa-window-minimize"></i></button> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"><i class="fal fa-expand"></i></button> @*<button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"><i class="fal fa-times"></i></button>*@ </div> </div> <div class="panel-container enable-loader show"> <div class="loader"><i class="fal fa-spinner-third fa-spin-4x fs-xxl"></i></div> <div class="panel-content py-2 rounded-bottom border-faded border-left-0 border-right-0 text-muted bg-faded bg-subtlelight-fade "> <div class="row no-gutters align-items-center"> <div class="col"> <!-- 开启授权控制请参考 @@if (Html.IsAuthorize("Create") --> <div class="btn-group btn-group-sm"> <button onclick="reload()" class="btn btn-default"> <span class="fal fa-search mr-1"></span> 刷新 </button> </div> </div> </div> </div> <div class="panel-content"> <div class="table-responsive"> <table id="logs_datagrid"></table> </div> </div> </div> </div> </div> </div> @section ScriptsBlock { <script src="~/js/dependency/moment/moment.js" asp-append-version="true"></script> <script src="~/js/dependency/numeral/numeral.min.js" asp-append-version="true"></script> <script src="~/js/formplugins/bootstrap-daterangepicker/bootstrap-daterangepicker.js"></script> <script src="~/js/easyui/jquery.easyui.min.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/datagrid-filter.js" asp-append-version="true"></script> <script src="~/js/easyui/locale/easyui-lang-zh_CN.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.component.js" asp-append-version="true"></script> <script src="~/js/jquery.extend.formatter.js" asp-append-version="true"></script> <script src="~/js/plugin/jquery.serializejson/jquery.serializejson.js" asp-append-version="true"></script> <script src="~/js/statistics/chartjs/chartjs.bundle.js"></script> <script type="text/javascript"> //全屏事件 document.addEventListener('panel.onfullscreen', () => { $dg.treegrid('resize'); }); //-------NLogLevel---------// var levelfiltersource = [{ value: '', text: 'All' }]; var leveldatasource = []; levelfiltersource.push({ value: 'Debug', text: 'Debug' }); leveldatasource.push({ value: 'Debug', text: 'Debug' }); levelfiltersource.push({ value: 'Error', text: 'Error' }); leveldatasource.push({ value: 'Error', text: 'Error' }); levelfiltersource.push({ value: 'Fatal', text: 'Fatal' }); leveldatasource.push({ value: 'Fatal', text: 'Fatal' }); levelfiltersource.push({ value: 'Info', text: 'Info' }); leveldatasource.push({ value: 'Info', text: 'Info' }); levelfiltersource.push({ value: 'Trace', text: 'Trace' }); leveldatasource.push({ value: 'Trace', text: 'Trace' }); levelfiltersource.push({ value: 'Warn', text: 'Warn' }); leveldatasource.push({ value: 'Warn', text: 'Warn' }); //for datagrid Level field formatter function levelformatter(value, row, index) { let multiple = false; if (value === null || value === '' || value === undefined) { return ""; } if (multiple) { let valarray = value.split(','); let result = leveldatasource.filter(item => valarray.includes(item.value)); let textarray = result.map(x => x.text); if (textarray.length > 0) return textarray.join(","); else return value; } else { let result = leveldatasource.filter(x => x.value == value); if (result.length > 0) return result[0].text; else return value; } } //for datagrid Level field filter $.extend($.fn.datagrid.defaults.filters, { levelfilter: { init: function (container, options) { var input = $('<select class="easyui-combobox" >').appendTo(container); var myoptions = { panelHeight: 'auto', editable: false, data: levelfiltersource, onChange: function () { input.trigger('combobox.filter'); } }; $.extend(options, myoptions); input.combobox(options); input.combobox('textbox').bind('keydown', function (e) { if (e.keyCode === 13) { $(e.target).emulateTab(); } }); return input; }, destroy: function (target) { }, getValue: function (target) { return $(target).combobox('getValue'); }, setValue: function (target, value) { $(target).combobox('setValue', value); }, resize: function (target, width) { $(target).combobox('resize', width); } } }); //获取图表数据 $(async () => { var data = await $.get('/Logs/GetChartData'); console.log(data); var ctx = document.getElementById('timebar').getContext('2d'); var timebarchart = new Chart(ctx, { type: 'bar', data: { labels: Array.from(new Set(data.list.map(item => item.time))), datasets: [{ label: 'Info', data: data.list.filter(item => item.level == 'Info').map(item => item.total), backgroundColor: '#1dc9b7', //borderColor: "rgba(179,181,198,1)", //pointBorderColor: "#fff", //pointBackgroundColor: "rgba(179,181,198,1)", }, { label: 'Trace', data: data.list.filter(item => item.level == 'Trace').map(item => item.total), backgroundColor: '#2196f3', //borderColor: "rgba(179,181,198,1)", //pointBorderColor: "#fff", //pointBackgroundColor: "rgba(179,181,198,1)", }, { label: 'Debug', data: data.list.filter(item => item.level == 'Debug').map(item => item.total), backgroundColor: '#868e96', //borderColor: "rgba(179,181,198,1)", //pointBorderColor: "#fff", //pointBackgroundColor: "rgba(179,181,198,1)", }, { label: 'Warn', data: data.list.filter(item => item.level == 'Warn').map(item => item.total), backgroundColor: '#ffc241', //borderColor: "rgba(179,181,198,1)", //pointBorderColor: "#fff", //pointBackgroundColor: "rgba(179,181,198,1)", }, { label: 'Error', data: data.list.filter(item => item.level == 'Error').map(item => item.total), backgroundColor: '#fe6bb0', //borderColor: "rgba(179,181,198,1)", //pointBorderColor: "#fff", //pointBackgroundColor: "rgba(179,181,198,1)", }, { label: 'Fatal', data: data.list.filter(item => item.level == 'Fatal').map(item => item.total), backgroundColor: '#e7026e', //borderColor: "rgba(179,181,198,1)", //pointBorderColor: "#fff", //pointBackgroundColor: "rgba(179,181,198,1)", } ] }, options: { legend: { display: false }, maintainAspectRatio: false, responsive: true, tooltips: { mode: 'index', intersect: false }, title: { display: true, text: '最近3天志情况', }, scales: { xAxes: [{ stacked: true, type: "time", time: { displayFormats: { 'hour': 'H', } } }], yAxes: [{ stacked: true, ticks: { beginAtZero: true, stepSize: 20 } }] } } }); new Chart(document.getElementById("levelpie").getContext('2d'), { type: 'doughnut', data: { labels: data.group.map(item=>item.level), datasets: [{ label: "Population (millions)", backgroundColor: ["#1dc9b7", "#2196f3", "#868e96", "#ffc241", "#fe6bb0", "#e7026e"], data: data.group.map(item=>item.total) }] }, options: { maintainAspectRatio: false, responsive: false, legend: { display: true, position:'bottom'}, title: { display: true, text: '日志分类' } } }); }) //是否强制从后台取值 const REQUIRBACKEND = false; //是否开启行内编辑 const EDITINLINE = true; //上传导入参数设定 const entityname = "Log"; var log = {}; //执行导出下载Excel function exportexcel() { const filterRules = JSON.stringify($dg.datagrid('options').filterRules); //console.log(filterRules); $.messager.progress({ title: '正在执行导出!' }); let formData = new FormData(); formData.append('filterRules', filterRules); formData.append('sort', 'Id'); formData.append('order', 'asc'); $.postDownload('/Logs/ExportExcel', formData).then(res => { $.messager.progress('close'); toastr.success('导出成功!'); }).catch(err => { //console.log(err); $.messager.progress('close'); $.messager.alert('失败', err.statusText, 'error'); }); } var editIndex = undefined; //重新加载数据 function reload() { $dg.datagrid('uncheckAll'); $dg.datagrid('reload'); } //设置日志状态 function setLogState(id,index) { $.get(`/Logs/SetLogState?id=${id}`).done(res => { if (res.success) { const row = $dg.datagrid('getRows')[index]; row.IsNew = 1; row.IsNotification = 1; $dg.datagrid('updateRow', { index: index, row: { Resolved: true, } }); $dg.datagrid('refreshRow', index); } }) } function onClickRow(index, row) { const id = row.Id; if (row.Exception) { bootbox.confirm({ size:'large', title: row.Level, message: `<p> ${row.Message}</p> <p> ${row.RequestForm} </p> <p> ${row.Properties } </p> <div class="p-3 rounded bg-warning-700 text-white mt-3"> ${row.Exception} </div>`, callback: function (result) { if (result) { setLogState(id, index); } } }); } else { bootbox.confirm({ title: row.Level, message: `<p> ${row.Message}</p> <p> ${row.RequestForm} </p> <p> ${row.Properties } </p> `, callback: function (result) { if (result) { setLogState(id, index); } } }); } } //初始化定义datagrid var $dg = $('#logs_datagrid'); $(() => { //定义datagrid结构 $dg.datagrid({ rownumbers: true, checkOnSelect: false, selectOnCheck: true, idField: 'Id', sortName: 'Id', sortOrder: 'desc', remoteFilter: true, singleSelect: true, onClickRow: onClickRow, method: 'get', pagination: true, clientPaging: false, striped: true, height: 670, pageSize: 15, pageList: [15, 20, 50, 100, 500, 2000], filterRules: [{ field: 'Resolved', op: 'equal', value: 'false' }], onBeforeLoad: function () { $('.enable-loader').removeClass('enable-loader') }, columns: [[ { /*主机名*/ field: 'MachineName', title: '@Html.DisplayNameFor(model => model.MachineName)', width: 160, hidden: false, sortable: true, resizable: true }, { /*时间*/ field: 'Logged', title: '@Html.DisplayNameFor(model => model.Logged)', width: 160, align: 'right', hidden: false, formatter: datetimeformatter, sortable: true, resizable: true }, { /*级别*/ field: 'Level', title: '@Html.DisplayNameFor(model => model.Level)', width: 80, hidden: false, sortable: true, resizable: true, align: 'center', formatter: function (v) { if (v == 'Info') { return `<span class="badge badge-info">${v}</span>` } else if (v == 'Debug') { return `<span class="badge badge-secondary">${v}</span>` } else if (v == 'Trace') { return `<span class="badge badge-primary">${v}</span>` } else if (v == 'Warn') { return `<span class="badge badge-warning">${v}</span>` } else if (v == 'Error' || v == 'Fatal') { return `<span class="badge badge-danger">${v}</span>` } else { return `<span class="badge badge-light">${v}</span>` } } }, { /*信息*/ field: 'Message', title: '@Html.DisplayNameFor(model => model.Message)', width: 360, hidden: false, sortable: true, resizable: true }, { /*异常信息*/ field: 'RequestIp', title: '@Html.DisplayNameFor(model => model.RequestIp)', width: 120, hidden: false, sortable: true, resizable: true }, { /*User-Agent*/ field: 'UserAgent', title: '@Html.DisplayNameFor(model => model.UserAgent)', width: 260, hidden: false, sortable: true, resizable: true }, { /*使用账号*/ field: 'Identity', title: '@Html.DisplayNameFor(model => model.Identity)', width: 130, hidden: false, sortable: true, resizable: true }, { /*已处理*/ field: 'Resolved', title: '<span class="required">@Html.DisplayNameFor(model => model.Resolved)</span>', width: 100, align: 'center', hidden: false, formatter: booleanformatter, sortable: true, resizable: true }, @*{ /*异常信息*/ field: 'Exception', title: '@Html.DisplayNameFor(model => model.Exception)', width: 260, hidden: false, sortable: true, resizable: true }, { /*事件属性*/ field: 'Properties', title: '@Html.DisplayNameFor(model => model.Properties)', width: 260, hidden: false, sortable: true, resizable: true }, { /*日志*/ field: 'Logger', title: '@Html.DisplayNameFor(model => model.Logger)', width: 180, hidden: false, sortable: true, resizable: true }, { /*站点*/ field: 'Callsite', title: '@Html.DisplayNameFor(model => model.Callsite)', width: 180, hidden: false, sortable: true, resizable: true },*@ ]] }) .datagrid('enableFilter', [ { field: 'Level', type: 'combobox', options: { data: [ { value: 'Info', text: 'Info' }, { value: 'Trace', text: 'Trace' }, { value: 'Debug', text: 'Debug' }, { value: 'Warn', text: 'Warn' }, { value: 'Error', text: 'Error' }, { value: 'Fatal', text: 'Fatal' } ], onChange: value => { $dg.datagrid('addFilterRule', { field: 'Level', op: 'equal', value: value }); $dg.datagrid('doFilter'); } } }, { field: 'Resolved', type: 'combobox', options: { data: [ { value: 'false', text: '未处理' }, { value: 'true', text: '已处理' } ], onChange: value => { $dg.datagrid('addFilterRule', { field: 'Resolved', op: 'equal', value: value }); $dg.datagrid('doFilter'); } } }, { /*注册日期*/ field: 'Logged', type: 'dateRange', options: { onChange: value => { $dg.datagrid('addFilterRule', { field: 'RegisterDate', op: 'between', value: value }); $dg.datagrid('doFilter'); } } }, ]) .datagrid('load','/Logs/GetData'); }); </script> }
the_stack
// This script copies the files we use from Avalonia into the Modern.Forms repo. // Note this is not automatic, there are still plenty of changes that need to be // manually reverted before the result will build and can be committed. using System; using System.Collections.Generic; using System.IO; using System.Text; // Paths to the local repositories // This assumes the repositories are siblings, but you can change that here if needed // - /code // - /Avalonia // - /Modern.Forms // - /Modern.Forms.Mac.Backend string avalonia_repo_path = Path.Combine ("..", "..", "Avalonia"); string modern_forms_repo_path = ".."; string avalonia_path = Path.Combine (avalonia_repo_path, "src"); string modern_forms_path = Path.Combine (modern_forms_repo_path, "src", "Modern.Forms", "Avalonia"); CopyFile ("Avalonia.Input/Cursors.cs", "Cursors.cs"); CopyFile ("Avalonia.Base/Threading/Dispatcher.cs", "Dispatcher.cs"); CopyFile ("Avalonia.Base/Threading/DispatcherPriority.cs", "DispatcherPriority.cs"); CopyFile ("Avalonia.Visuals/Platform/IBitmapImpl.cs", "IBitmapImpl.cs"); CopyFile ("Avalonia.Input/Platform/IClipboard.cs", "IClipboard.cs"); CopyFile ("Avalonia.Input/ICloseable.cs", "ICloseable.cs"); CopyFile ("Avalonia.Base/Threading/IDispatcher.cs", "IDispatcher.cs"); CopyFile ("Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs", "IFramebufferPlatformSurface.cs"); CopyFile ("Avalonia.Input/IInputDevice.cs", "IInputDevice.cs"); CopyFile ("Avalonia.Input/IKeyboardDevice.cs", "IKeyboardDevice.cs"); CopyFile ("Avalonia.Visuals/Platform/ILockedFramebuffer.cs", "ILockedFramebuffer.cs"); CopyFile ("Avalonia.Input/IMouseDevice.cs", "IMouseDevice.cs"); CopyFile ("Avalonia.Base/Platform/IPlatformHandle.cs", "IPlatformHandle.cs"); CopyFile ("Avalonia.Base/Platform/IPlatformThreadingInterface.cs", "IPlatformThreadingInterface.cs"); CopyFile ("Avalonia.Input/IPointer.cs", "IPointer.cs"); CopyFile ("Avalonia.Input/IPointerDevice.cs", "IPointerDevice.cs"); CopyFile ("Avalonia.Controls/Platform/IPopupImpl.cs", "IPopupImpl.cs"); CopyFile ("Avalonia.Base/Platform/IRuntimePlatform.cs", "IRuntimePlatform.cs"); CopyFile ("Avalonia.Controls/Platform/IScreenImpl.cs", "IScreenImpl.cs"); CopyFile ("Avalonia.Input/Platform/IStandardCursorFactory.cs", "IStandardCursorFactory.cs"); CopyFile ("Avalonia.Controls/Platform/ISystemDialogImpl.cs", "ISystemDialogImpl.cs"); CopyFile ("Avalonia.Controls/Platform/ITopLevelImpl.cs", "ITopLevelImpl.cs"); CopyFile ("Avalonia.Controls/Platform/IWindowBaseImpl.cs", "IWindowBaseImpl.cs"); CopyFile ("Avalonia.Controls/Platform/IWindowImpl.cs", "IWindowImpl.cs"); CopyFile ("Avalonia.Controls/Platform/IWindowingPlatform.cs", "IWindowingPlatform.cs"); CopyFile ("Avalonia.Visuals/Platform/IWriteableBitmapImpl.cs", "IWriteableBitmapImpl.cs"); CopyFile ("Avalonia.Base/Threading/JobRunner.cs", "JobRunner.cs"); CopyFile ("Avalonia.Input/Key.cs", "Key.cs"); CopyFile ("Avalonia.Input/KeyboardDevice.cs", "KeyboardDevice.cs"); CopyFile ("Avalonia.Base/Utilities/MathUtilities.cs", "MathUtilities.cs"); CopyFile ("Avalonia.Input/MouseDevice.cs", "MouseDevice.cs"); CopyFile ("Avalonia.Visuals/Platform/PixelFormat.cs", "PixelFormat.cs"); CopyFile ("Avalonia.Visuals/Media/PixelPoint.cs", "PixelPoint.cs"); CopyFile ("Avalonia.Visuals/Media/PixelRect.cs", "PixelRect.cs"); CopyFile ("Avalonia.Visuals/Media/PixelSize.cs", "PixelSize.cs"); CopyFile ("Avalonia.Base/Platform/PlatformHandle.cs", "PlatformHandle.cs"); CopyFile ("Avalonia.Visuals/Point.cs", "Point.cs"); CopyFile ("Avalonia.Input/Pointer.cs", "Pointer.cs"); CopyFile ("Avalonia.Input/Raw/RawInputEventArgs.cs", "RawInputEventArgs.cs"); CopyFile ("Avalonia.Input/Raw/RawKeyEventArgs.cs", "RawKeyEventArgs.cs"); CopyFile ("Avalonia.Input/Raw/RawPointerEventArgs.cs", "RawPointerEventArgs.cs"); CopyFile ("Avalonia.Input/Raw/RawMouseWheelEventArgs.cs", "RawMouseWheelEventArgs.cs"); CopyFile ("Avalonia.Input/Raw/RawTextInputEventArgs.cs", "RawTextInputEventArgs.cs"); CopyFile ("Avalonia.Visuals/Rect.cs", "Rect.cs"); //CopyFile ("Avalonia.Input/RuntimeInfo.cs", "RuntimeInfo.cs"); CopyFile ("Avalonia.Controls/Platform/Screen.cs", "Screen.cs"); CopyFile ("Avalonia.Controls/Screens.cs", "Screens.cs"); CopyFile ("Avalonia.Visuals/Size.cs", "Size.cs"); CopyFile ("Shared/PlatformSupport/StandardRuntimePlatform.cs", "StandardRuntimePlatform.cs"); CopyFile ("Avalonia.Controls/SystemDialog.cs", "SystemDialog.cs"); CopyFile ("Avalonia.Visuals/Thickness.cs", "Thickness.cs"); CopyFile ("Avalonia.Visuals/Vector.cs", "Vector.cs"); CopyFile ("Avalonia.Controls/WindowEdge.cs", "WindowEdge.cs"); CopyFile ("Avalonia.Controls/WindowState.cs", "WindowState.cs"); // Mac Backend CopyFile ("Avalonia.Native/AvaloniaNativePlatform.cs", "Avalonia.Mac/AvaloniaNativePlatform.cs"); CopyFile ("Avalonia.Native/AvaloniaNativePlatformExtensions.cs", "Avalonia.Mac/AvaloniaNativePlatformExtensions.cs"); CopyFile ("Avalonia.Native/CallbackBase.cs", "Avalonia.Mac/CallbackBase.cs"); CopyFile ("Avalonia.Native/ClipboardImpl.cs", "Avalonia.Mac/ClipboardImpl.cs"); CopyFile ("Avalonia.Native/Cursor.cs", "Avalonia.Mac/Cursor.cs"); CopyFile ("Avalonia.Native/DynLoader.cs", "Avalonia.Mac/DynLoader.cs"); CopyFile ("Avalonia.Native/Helpers.cs", "Avalonia.Mac/Helpers.cs"); CopyFile ("Avalonia.Native/PlatformThreadingInterface.cs", "Avalonia.Mac/PlatformThreadingInterface.cs"); CopyFile ("Avalonia.Native/PopupImpl.cs", "Avalonia.Mac/PopupImpl.cs"); CopyFile ("Avalonia.Native/ScreenImpl.cs", "Avalonia.Mac/ScreenImpl.cs"); CopyFile ("Avalonia.Native/SystemDialogs.cs", "Avalonia.Mac/SystemDialogs.cs"); CopyFile ("Avalonia.Native/WindowImpl.cs", "Avalonia.Mac/WindowImpl.cs"); CopyFile ("Avalonia.Native/WindowImplBase.cs", "Avalonia.Mac/WindowImplBase.cs"); // Windows Backend CopyFile ("Windows/Avalonia.Win32/ClipboardImpl.cs", "Avalonia.Win32/ClipboardImpl.cs"); CopyFile ("Windows/Avalonia.Win32/CursorFactory.cs", "Avalonia.Win32/CursorFactory.cs"); CopyFile ("Windows/Avalonia.Win32/FramebufferManager.cs", "Avalonia.Win32/FramebufferManager.cs"); CopyFile ("Windows/Avalonia.Win32/Input/KeyInterop.cs", "Avalonia.Win32/KeyInterop.cs"); CopyFile ("Windows/Avalonia.Win32/PlatformConstants.cs", "Avalonia.Win32/PlatformConstants.cs"); CopyFile ("Windows/Avalonia.Win32/PopupImpl.cs", "Avalonia.Win32/PopupImpl.cs"); CopyFile ("Windows/Avalonia.Win32/ScreenImpl.cs", "Avalonia.Win32/ScreenImpl.cs"); CopyFile ("Windows/Avalonia.Win32/SystemDialogImpl.cs", "Avalonia.Win32/SystemDialogImpl.cs"); CopyFile ("Windows/Avalonia.Win32/Win32Platform.cs", "Avalonia.Win32/Win32Platform.cs"); CopyFile ("Windows/Avalonia.Win32/WindowFramebuffer.cs", "Avalonia.Win32/WindowFramebuffer.cs"); CopyFile ("Windows/Avalonia.Win32/WindowImpl.cs", "Avalonia.Win32/WindowImpl.cs"); CopyFile ("Windows/Avalonia.Win32/Input/WindowsKeyboardDevice.cs", "Avalonia.Win32/WindowsKeyboardDevice.cs"); CopyFile ("Windows/Avalonia.Win32/Input/WindowsMouseDevice.cs", "Avalonia.Win32/WindowsMouseDevice.cs"); CopyFile ("Windows/Avalonia.Win32/WinScreen.cs", "Avalonia.Win32/WinScreen.cs"); CopyFile ("Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs", "Avalonia.Win32/Interop/UnmanagedMethods.cs"); // X11 Backend CopyFile ("Avalonia.X11/NativeDialogs/Gtk.cs", "Avalonia.X11/Gtk.cs"); CopyFile ("Avalonia.X11/NativeDialogs/GtkNativeFileDialogs.cs", "Avalonia.X11/GtkNativeFileDialogs.cs"); CopyFile ("Avalonia.X11/Keysyms.cs", "Avalonia.X11/Keysyms.cs"); CopyFile ("Avalonia.Base/Platform/Interop/Utf8Buffer.cs", "Avalonia.X11/Utf8Buffer.cs"); CopyFile ("Avalonia.X11/X11Atoms.cs", "Avalonia.X11/X11Atoms.cs"); CopyFile ("Avalonia.X11/X11Clipboard.cs", "Avalonia.X11/X11Clipboard.cs"); CopyFile ("Avalonia.X11/X11CursorFactory.cs", "Avalonia.X11/X11CursorFactory.cs"); CopyFile ("Avalonia.X11/X11Enums.cs", "Avalonia.X11/X11Enums.cs"); CopyFile ("Avalonia.X11/X11Exception.cs", "Avalonia.X11/X11Exception.cs"); CopyFile ("Avalonia.X11/X11Framebuffer.cs", "Avalonia.X11/X11Framebuffer.cs"); CopyFile ("Avalonia.X11/X11FramebufferSurface.cs", "Avalonia.X11/X11FramebufferSurface.cs"); CopyFile ("Avalonia.X11/X11Info.cs", "Avalonia.X11/X11Info.cs"); CopyFile ("Avalonia.X11/X11KeyTransform.cs", "Avalonia.X11/X11KeyTransform.cs"); CopyFile ("Avalonia.X11/X11Platform.cs", "Avalonia.X11/X11Platform.cs"); CopyFile ("Avalonia.X11/X11PlatformThreading.cs", "Avalonia.X11/X11PlatformThreading.cs"); CopyFile ("Avalonia.X11/X11Screens.cs", "Avalonia.X11/X11Screens.cs"); CopyFile ("Avalonia.X11/X11Structs.cs", "Avalonia.X11/X11Structs.cs"); CopyFile ("Avalonia.X11/X11Window.cs", "Avalonia.X11/X11Window.cs"); CopyFile ("Avalonia.X11/XError.cs", "Avalonia.X11/XError.cs"); CopyFile ("Avalonia.X11/XI2Manager.cs", "Avalonia.X11/XI2Manager.cs"); CopyFile ("Avalonia.X11/XIStructs.cs", "Avalonia.X11/XIStructs.cs"); CopyFile ("Avalonia.X11/XLib.cs", "Avalonia.X11/XLib.cs"); // Skia Backend CopyFile ("Skia/Avalonia.Skia/Helpers/PixelFormatHelper.cs", "Avalonia.Skia/PixelFormatHelper.cs"); CopyFile ("Skia/Avalonia.Skia/SkiaOptions.cs", "Avalonia.Skia/SkiaOptions.cs"); CopyFile ("Skia/Avalonia.Skia/SkiaPlatform.cs", "Avalonia.Skia/SkiaPlatform.cs"); CopyFile ("Skia/Avalonia.Skia/SkiaSharpExtensions.cs", "Avalonia.Skia/SkiaSharpExtensions.cs"); CopyFile ("Skia/Avalonia.Skia/WriteableBitmapImpl.cs", "Avalonia.Skia/WriteableBitmapImpl.cs"); // Mac Native Bits var native_dir = Path.Combine (avalonia_path, "..", "native", "Avalonia.Native"); var mfmb_dir = Path.Combine ("..", "..", "Modern.Forms.Mac.Backend"); DirectoryCopy (Path.Combine (native_dir, "inc"), Path.Combine (mfmb_dir, "inc"), true); DirectoryCopy (Path.Combine (native_dir, "src"), Path.Combine (mfmb_dir, "src"), true); private void CopyFile (string src, string dst) { var full_src = Path.Combine (avalonia_path, src); var full_dst = Path.Combine (modern_forms_path, dst); var text = File.ReadAllText (full_src); // Avalonia does not use nullable reference types so we disable checking for these files text = $"#nullable disable{Environment.NewLine}{Environment.NewLine}{text}"; // We do not publicly expose the Avalonia types text = text.Replace ("public class", "internal class"); text = text.Replace ("public abstract class", "internal abstract class"); text = text.Replace ("public static class", "internal static class"); text = text.Replace ("public static extern", "internal static extern"); text = text.Replace ("public enum", "internal enum"); text = text.Replace ("public interface", "internal interface"); text = text.Replace ("public struct", "internal struct"); text = text.Replace ("public readonly struct", "internal readonly struct"); text = text.Replace ("public unsafe struct", "internal unsafe struct"); // Some namespaces we do not use text = Comment (text, "using Avalonia.Animation"); text = Comment (text, "using Avalonia.Animation.Animators"); text = Comment (text, "using Avalonia.Interactivity"); text = Comment (text, "using Avalonia.Media"); text = Comment (text, "using Avalonia.OpenGL"); text = Comment (text, "using Avalonia.Rendering"); text = Comment (text, "using Avalonia.VisualTree"); text = Comment (text, "using Avalonia.X11.Glx"); text = Comment (text, "using JetBrains.Annotations"); text = Comment (text, "using System.ComponentModel.DataAnnotation"); text = Comment (text, "using System.Reactive.Disposables"); text = Comment (text, "using System.Reactive.Linq"); // We don't use Avalonia's DI text = text.Replace ("AvaloniaLocator.Current.GetService<IStandardCursorFactory>()", "AvaloniaGlobals.StandardCursorFactory"); text = text.Replace ("AvaloniaLocator.Current.GetService<IPlatformThreadingInterface>()", "AvaloniaGlobals.PlatformThreadingInterface"); text = text.Replace ("AvaloniaLocator.Current.GetService<ISystemDialogImpl>()", "AvaloniaGlobals.SystemDialogImplementation"); text = text.Replace ("AvaloniaLocator.Current.GetService<IRuntimePlatform>()", "AvaloniaGlobals.RuntimePlatform"); text = text.Replace ("AvaloniaLocator.Current?.GetService<IRuntimePlatform>()", "AvaloniaGlobals.RuntimePlatform"); // Other fixups text = Comment (text, "Contract.Requires"); text = Comment (text, "Animation.Animation.RegisterAnimator"); text = Comment (text, "[Pure]"); text = text.Replace("////using Avalonia", "//using Avalonia"); // Some Avalonia structs that are still public text = text.Replace ("internal interface ICloseable", "public interface ICloseable"); text = text.Replace ("internal readonly struct PixelPoint", "public readonly struct PixelPoint"); text = text.Replace ("internal readonly struct Point", "public readonly struct Point"); text = text.Replace ("internal readonly struct Vector", "public readonly struct Vector"); var dest_lines = CommentDiffs (text, full_dst); File.WriteAllLines (full_dst, dest_lines, Encoding.UTF8); } // We prefer to comment unused stuff so we can tell stuff we've disabled versus new stuff in diffs private string Comment (string text, string str) => text.Replace (str, "//" + str); // Try to remove stuff we've commented from the new files for easier diffs private string[] CommentDiffs (string text, string dest) { var dest_lines = File.ReadAllLines (dest); var src_lines = new List<string> (); using var sw = new StringReader (text); string s; while ((s = sw.ReadLine ()) != null) src_lines.Add (s); for (var i = 0; i < Math.Min (src_lines.Count, dest_lines.Length); i++) { if (StripWhitespace ("//" + src_lines[i]) == StripWhitespace (dest_lines[i])) src_lines[i] = dest_lines[i]; } return src_lines.ToArray (); } private string StripWhitespace (string str) => str.Replace (" ", "").Replace ("\t", ""); private static void DirectoryCopy (string sourceDirName, string destDirName, bool copySubDirs) { // Get the subdirectories for the specified directory. var dir = new DirectoryInfo (sourceDirName); if (!dir.Exists) { throw new DirectoryNotFoundException( "Source directory does not exist or could not be found: " + sourceDirName); } var dirs = dir.GetDirectories (); // If the destination directory doesn't exist, create it. if (!Directory.Exists (destDirName)) { Directory.CreateDirectory (destDirName); } // Get the files in the directory and copy them to the new location. var files = dir.GetFiles (); foreach (FileInfo file in files) { var temppath = Path.Combine (destDirName, file.Name); file.CopyTo (temppath, true); } // If copying subdirectories, copy them and their contents to new location. if (copySubDirs) { foreach (var subdir in dirs) { var temppath = Path.Combine (destDirName, subdir.Name); DirectoryCopy (subdir.FullName, temppath, copySubDirs); } } }
the_stack
<script> /* Stores all the client side resources such as strings, image URLs and constants. The portal will consume this and store it in memory. Add your strings here. */ var portalResources = { Keys: { /* Keys strings */ InstrumentationKey: "@Html.Raw(Microsoft.Store.PartnerCenter.Storefront.BusinessLogic.ApplicationDomain.Instance.TelemetryService.InstrumentationKey)" }, Strings: { /* Framework strings */ PartnerCountry: "@Html.Raw(Microsoft.Store.PartnerCenter.Storefront.BusinessLogic.ApplicationDomain.Instance.PortalLocalization.CountryIso2Code)", CurrentLocale: "@Html.Raw(Resources.Culture.Name)", Loading: "@Html.Raw(Resources.Loading)", FailedToLoadPortal: "@Html.Raw(Resources.FailedToLoadPortal)", PortalConfigurationNotFound: "@Html.Raw(Resources.PortalConfigurationNotFound)", InvalidPortalConfiguration: "@Html.Raw(Resources.InvalidPortalConfiguration)", NavigateBackTo: "@Html.Raw(Resources.NavigateBackTo)", Ellipsis: "@Html.Raw(Resources.Ellipsis)", MoreActionsTooltip: "@Html.Raw(Resources.MoreActionsTooltip)", Yes: "@Html.Raw(Resources.Yes)", No: "@Html.Raw(Resources.No)", OK: "@Html.Raw(Resources.OK)", Cancel: "@Html.Raw(Resources.Cancel)", Retry: "@Html.Raw(Resources.RetryCapital)", Next: "@Html.Raw(Resources.Next)", Back: "@Html.Raw(Resources.Back)", Add: "@Html.Raw(Resources.AddCaption)", Delete: "@Html.Raw(Resources.Delete)", Save: "@Html.Raw(Resources.Save)", Undo: "@Html.Raw(Resources.Undo)", NotificationsSummary: "@Html.Raw(Resources.NotificationsSummary)", TemplateLoadFailureMessage: "@Html.Raw(Resources.TemplateLoadFailureMessage)", TemplateLoadRetryMessage: "@Html.Raw(Resources.TemplateLoadRetryMessage)", EmptyListMessage: "@Html.Raw(Resources.EmptyListMessage)", SignOut: "@Html.Raw(Resources.Signout)", SignOutToolTipCaption: "@Html.Raw(Resources.SignOutToolTipCaption)", AccessDeniedMessage: "@Html.Raw(Resources.AccessDeniedMessage)", /* Localized Country strings */ Countries: { AD : "@Html.Raw(Resources.CountryNameAD)", AE : "@Html.Raw(Resources.CountryNameAE)", AF : "@Html.Raw(Resources.CountryNameAF)", AG : "@Html.Raw(Resources.CountryNameAG)", AI : "@Html.Raw(Resources.CountryNameAI)", AL : "@Html.Raw(Resources.CountryNameAL)", AM : "@Html.Raw(Resources.CountryNameAM)", AN : "@Html.Raw(Resources.CountryNameAN)", AO : "@Html.Raw(Resources.CountryNameAO)", AQ : "@Html.Raw(Resources.CountryNameAQ)", AR : "@Html.Raw(Resources.CountryNameAR)", AS : "@Html.Raw(Resources.CountryNameAS)", AT : "@Html.Raw(Resources.CountryNameAT)", AU : "@Html.Raw(Resources.CountryNameAU)", AW : "@Html.Raw(Resources.CountryNameAW)", AX : "@Html.Raw(Resources.CountryNameAX)", AZ : "@Html.Raw(Resources.CountryNameAZ)", BA : "@Html.Raw(Resources.CountryNameBA)", BB : "@Html.Raw(Resources.CountryNameBB)", BD : "@Html.Raw(Resources.CountryNameBD)", BE : "@Html.Raw(Resources.CountryNameBE)", BF : "@Html.Raw(Resources.CountryNameBF)", BG : "@Html.Raw(Resources.CountryNameBG)", BH : "@Html.Raw(Resources.CountryNameBH)", BI : "@Html.Raw(Resources.CountryNameBI)", BJ : "@Html.Raw(Resources.CountryNameBJ)", BL : "@Html.Raw(Resources.CountryNameBL)", BM : "@Html.Raw(Resources.CountryNameBM)", BN : "@Html.Raw(Resources.CountryNameBN)", BO : "@Html.Raw(Resources.CountryNameBO)", BQ : "@Html.Raw(Resources.CountryNameBQ)", BR : "@Html.Raw(Resources.CountryNameBR)", BS : "@Html.Raw(Resources.CountryNameBS)", BT : "@Html.Raw(Resources.CountryNameBT)", BV : "@Html.Raw(Resources.CountryNameBV)", BW : "@Html.Raw(Resources.CountryNameBW)", BY : "@Html.Raw(Resources.CountryNameBY)", BZ : "@Html.Raw(Resources.CountryNameBZ)", CA : "@Html.Raw(Resources.CountryNameCA)", CC : "@Html.Raw(Resources.CountryNameCC)", CD : "@Html.Raw(Resources.CountryNameCD)", CF : "@Html.Raw(Resources.CountryNameCF)", CG : "@Html.Raw(Resources.CountryNameCG)", CH : "@Html.Raw(Resources.CountryNameCH)", CI : "@Html.Raw(Resources.CountryNameCI)", CK : "@Html.Raw(Resources.CountryNameCK)", CL : "@Html.Raw(Resources.CountryNameCL)", CM : "@Html.Raw(Resources.CountryNameCM)", CN : "@Html.Raw(Resources.CountryNameCN)", CO : "@Html.Raw(Resources.CountryNameCO)", CR : "@Html.Raw(Resources.CountryNameCR)", CV : "@Html.Raw(Resources.CountryNameCV)", CW : "@Html.Raw(Resources.CountryNameCW)", CX : "@Html.Raw(Resources.CountryNameCX)", CY : "@Html.Raw(Resources.CountryNameCY)", CZ : "@Html.Raw(Resources.CountryNameCZ)", DE : "@Html.Raw(Resources.CountryNameDE)", DJ : "@Html.Raw(Resources.CountryNameDJ)", DK : "@Html.Raw(Resources.CountryNameDK)", DM : "@Html.Raw(Resources.CountryNameDM)", DO : "@Html.Raw(Resources.CountryNameDO)", DZ : "@Html.Raw(Resources.CountryNameDZ)", EC : "@Html.Raw(Resources.CountryNameEC)", EE : "@Html.Raw(Resources.CountryNameEE)", EG : "@Html.Raw(Resources.CountryNameEG)", ER : "@Html.Raw(Resources.CountryNameER)", ES : "@Html.Raw(Resources.CountryNameES)", ET : "@Html.Raw(Resources.CountryNameET)", FI : "@Html.Raw(Resources.CountryNameFI)", FJ : "@Html.Raw(Resources.CountryNameFJ)", FK : "@Html.Raw(Resources.CountryNameFK)", FM : "@Html.Raw(Resources.CountryNameFM)", FO : "@Html.Raw(Resources.CountryNameFO)", FR : "@Html.Raw(Resources.CountryNameFR)", GA : "@Html.Raw(Resources.CountryNameGA)", GB : "@Html.Raw(Resources.CountryNameGB)", GD : "@Html.Raw(Resources.CountryNameGD)", GE : "@Html.Raw(Resources.CountryNameGE)", GF : "@Html.Raw(Resources.CountryNameGF)", GG : "@Html.Raw(Resources.CountryNameGG)", GH : "@Html.Raw(Resources.CountryNameGH)", GI : "@Html.Raw(Resources.CountryNameGI)", GL : "@Html.Raw(Resources.CountryNameGL)", GM : "@Html.Raw(Resources.CountryNameGM)", GN : "@Html.Raw(Resources.CountryNameGN)", GP : "@Html.Raw(Resources.CountryNameGP)", GQ : "@Html.Raw(Resources.CountryNameGQ)", GR : "@Html.Raw(Resources.CountryNameGR)", GS : "@Html.Raw(Resources.CountryNameGS)", GT : "@Html.Raw(Resources.CountryNameGT)", GU : "@Html.Raw(Resources.CountryNameGU)", GW : "@Html.Raw(Resources.CountryNameGW)", GY : "@Html.Raw(Resources.CountryNameGY)", HK : "@Html.Raw(Resources.CountryNameHK)", HM : "@Html.Raw(Resources.CountryNameHM)", HN : "@Html.Raw(Resources.CountryNameHN)", HR : "@Html.Raw(Resources.CountryNameHR)", HT : "@Html.Raw(Resources.CountryNameHT)", HU : "@Html.Raw(Resources.CountryNameHU)", ID : "@Html.Raw(Resources.CountryNameID)", IE : "@Html.Raw(Resources.CountryNameIE)", IL : "@Html.Raw(Resources.CountryNameIL)", IM : "@Html.Raw(Resources.CountryNameIM)", IN : "@Html.Raw(Resources.CountryNameIN)", IO : "@Html.Raw(Resources.CountryNameIO)", IQ : "@Html.Raw(Resources.CountryNameIQ)", IS : "@Html.Raw(Resources.CountryNameIS)", IT : "@Html.Raw(Resources.CountryNameIT)", JE : "@Html.Raw(Resources.CountryNameJE)", JM : "@Html.Raw(Resources.CountryNameJM)", JO : "@Html.Raw(Resources.CountryNameJO)", JP : "@Html.Raw(Resources.CountryNameJP)", KE : "@Html.Raw(Resources.CountryNameKE)", KG : "@Html.Raw(Resources.CountryNameKG)", KH : "@Html.Raw(Resources.CountryNameKH)", KI : "@Html.Raw(Resources.CountryNameKI)", KM : "@Html.Raw(Resources.CountryNameKM)", KN : "@Html.Raw(Resources.CountryNameKN)", KR : "@Html.Raw(Resources.CountryNameKR)", KW : "@Html.Raw(Resources.CountryNameKW)", KY : "@Html.Raw(Resources.CountryNameKY)", KZ : "@Html.Raw(Resources.CountryNameKZ)", LA : "@Html.Raw(Resources.CountryNameLA)", LB : "@Html.Raw(Resources.CountryNameLB)", LC : "@Html.Raw(Resources.CountryNameLC)", LI : "@Html.Raw(Resources.CountryNameLI)", LK : "@Html.Raw(Resources.CountryNameLK)", LR : "@Html.Raw(Resources.CountryNameLR)", LS : "@Html.Raw(Resources.CountryNameLS)", LT : "@Html.Raw(Resources.CountryNameLT)", LU : "@Html.Raw(Resources.CountryNameLU)", LV : "@Html.Raw(Resources.CountryNameLV)", LY : "@Html.Raw(Resources.CountryNameLY)", MA : "@Html.Raw(Resources.CountryNameMA)", MC : "@Html.Raw(Resources.CountryNameMC)", MD : "@Html.Raw(Resources.CountryNameMD)", ME : "@Html.Raw(Resources.CountryNameME)", MF : "@Html.Raw(Resources.CountryNameMF)", MG : "@Html.Raw(Resources.CountryNameMG)", MH : "@Html.Raw(Resources.CountryNameMH)", MK : "@Html.Raw(Resources.CountryNameMK)", ML : "@Html.Raw(Resources.CountryNameML)", MM : "@Html.Raw(Resources.CountryNameMM)", MN : "@Html.Raw(Resources.CountryNameMN)", MO : "@Html.Raw(Resources.CountryNameMO)", MP : "@Html.Raw(Resources.CountryNameMP)", MQ : "@Html.Raw(Resources.CountryNameMQ)", MR : "@Html.Raw(Resources.CountryNameMR)", MS : "@Html.Raw(Resources.CountryNameMS)", MT : "@Html.Raw(Resources.CountryNameMT)", MU : "@Html.Raw(Resources.CountryNameMU)", MV : "@Html.Raw(Resources.CountryNameMV)", MW : "@Html.Raw(Resources.CountryNameMW)", MX : "@Html.Raw(Resources.CountryNameMX)", MY : "@Html.Raw(Resources.CountryNameMY)", MZ : "@Html.Raw(Resources.CountryNameMZ)", NA : "@Html.Raw(Resources.CountryNameNA)", NC : "@Html.Raw(Resources.CountryNameNC)", NE : "@Html.Raw(Resources.CountryNameNE)", NF : "@Html.Raw(Resources.CountryNameNF)", NG : "@Html.Raw(Resources.CountryNameNG)", NI : "@Html.Raw(Resources.CountryNameNI)", NL : "@Html.Raw(Resources.CountryNameNL)", NO : "@Html.Raw(Resources.CountryNameNO)", NP : "@Html.Raw(Resources.CountryNameNP)", NR : "@Html.Raw(Resources.CountryNameNR)", NU : "@Html.Raw(Resources.CountryNameNU)", NZ : "@Html.Raw(Resources.CountryNameNZ)", OM : "@Html.Raw(Resources.CountryNameOM)", PA : "@Html.Raw(Resources.CountryNamePA)", PE : "@Html.Raw(Resources.CountryNamePE)", PF : "@Html.Raw(Resources.CountryNamePF)", PG : "@Html.Raw(Resources.CountryNamePG)", PH : "@Html.Raw(Resources.CountryNamePH)", PK : "@Html.Raw(Resources.CountryNamePK)", PL : "@Html.Raw(Resources.CountryNamePL)", PM : "@Html.Raw(Resources.CountryNamePM)", PN : "@Html.Raw(Resources.CountryNamePN)", PR : "@Html.Raw(Resources.CountryNamePR)", PS : "@Html.Raw(Resources.CountryNamePS)", PT : "@Html.Raw(Resources.CountryNamePT)", PW : "@Html.Raw(Resources.CountryNamePW)", PY : "@Html.Raw(Resources.CountryNamePY)", QA : "@Html.Raw(Resources.CountryNameQA)", RE : "@Html.Raw(Resources.CountryNameRE)", RO : "@Html.Raw(Resources.CountryNameRO)", RS : "@Html.Raw(Resources.CountryNameRS)", RU : "@Html.Raw(Resources.CountryNameRU)", RW : "@Html.Raw(Resources.CountryNameRW)", SA : "@Html.Raw(Resources.CountryNameSA)", SB : "@Html.Raw(Resources.CountryNameSB)", SC : "@Html.Raw(Resources.CountryNameSC)", SE : "@Html.Raw(Resources.CountryNameSE)", SG : "@Html.Raw(Resources.CountryNameSG)", SH : "@Html.Raw(Resources.CountryNameSH)", SI : "@Html.Raw(Resources.CountryNameSI)", SJ : "@Html.Raw(Resources.CountryNameSJ)", SK : "@Html.Raw(Resources.CountryNameSK)", SL : "@Html.Raw(Resources.CountryNameSL)", SM : "@Html.Raw(Resources.CountryNameSM)", SN : "@Html.Raw(Resources.CountryNameSN)", SO : "@Html.Raw(Resources.CountryNameSO)", SR : "@Html.Raw(Resources.CountryNameSR)", SS : "@Html.Raw(Resources.CountryNameSS)", ST : "@Html.Raw(Resources.CountryNameST)", SV : "@Html.Raw(Resources.CountryNameSV)", SX : "@Html.Raw(Resources.CountryNameSX)", SZ : "@Html.Raw(Resources.CountryNameSZ)", TC : "@Html.Raw(Resources.CountryNameTC)", TD : "@Html.Raw(Resources.CountryNameTD)", TF : "@Html.Raw(Resources.CountryNameTF)", TG : "@Html.Raw(Resources.CountryNameTG)", TH : "@Html.Raw(Resources.CountryNameTH)", TJ : "@Html.Raw(Resources.CountryNameTJ)", TK : "@Html.Raw(Resources.CountryNameTK)", TL : "@Html.Raw(Resources.CountryNameTL)", TM : "@Html.Raw(Resources.CountryNameTM)", TN : "@Html.Raw(Resources.CountryNameTN)", TO : "@Html.Raw(Resources.CountryNameTO)", TR : "@Html.Raw(Resources.CountryNameTR)", TT : "@Html.Raw(Resources.CountryNameTT)", TV : "@Html.Raw(Resources.CountryNameTV)", TW : "@Html.Raw(Resources.CountryNameTW)", TZ : "@Html.Raw(Resources.CountryNameTZ)", UA : "@Html.Raw(Resources.CountryNameUA)", UG : "@Html.Raw(Resources.CountryNameUG)", UM : "@Html.Raw(Resources.CountryNameUM)", US : "@Html.Raw(Resources.CountryNameUS)", UY : "@Html.Raw(Resources.CountryNameUY)", UZ : "@Html.Raw(Resources.CountryNameUZ)", VA : "@Html.Raw(Resources.CountryNameVA)", VC : "@Html.Raw(Resources.CountryNameVC)", VE : "@Html.Raw(Resources.CountryNameVE)", VG : "@Html.Raw(Resources.CountryNameVG)", VI : "@Html.Raw(Resources.CountryNameVI)", VN : "@Html.Raw(Resources.CountryNameVN)", VU : "@Html.Raw(Resources.CountryNameVU)", WF : "@Html.Raw(Resources.CountryNameWF)", WS : "@Html.Raw(Resources.CountryNameWS)", XE : "@Html.Raw(Resources.CountryNameXE)", XJ : "@Html.Raw(Resources.CountryNameXJ)", XK : "@Html.Raw(Resources.CountryNameXK)", XS : "@Html.Raw(Resources.CountryNameXS)", YE : "@Html.Raw(Resources.CountryNameYE)", YT : "@Html.Raw(Resources.CountryNameYT)", ZA : "@Html.Raw(Resources.CountryNameZA)", ZM : "@Html.Raw(Resources.CountryNameZM)", ZW : "@Html.Raw(Resources.CountryNameZW)" }, /* Plugin strings */ Plugins: { BadInputGenericMessage: "@Html.Raw(Resources.BadInputGenericMessage)", InvalidInput: "@Html.Raw(Resources.InvalidInput)", AdminConsole: { DashboardStatusOk: "@Html.Raw(Resources.DashboardStatusOk)", DashboardStatusNotOk: "@Html.Raw(Resources.DashboardStatusNotOk)", DashboardItemConfigured: "@Html.Raw(Resources.DashboardItemConfigured)", DashboardItemNeedsConfiguration: "@Html.Raw(Resources.DashboardItemNeedsConfiguration)", DashboardLoadingError: "@Html.Raw(Resources.DashboardLoadingError)" }, AdminOfferConfiguration: { AddOfferCaption: "@Html.Raw(Resources.AddOfferCaption)", DeleteOffersCaption: "@Html.Raw(Resources.DeleteOffersCaption)", MicrosoftOfferListColumnCaption: "@Html.Raw(Resources.MicrosoftOfferListColumnCaption)", CustomizationOfferListColumnCaption: "@Html.Raw(Resources.CustomizationOfferListColumnCaption)", EmptyOfferListMessage: "@Html.Raw(Resources.EmptyOfferListMessage)", DeletingOfferMessage: "@Html.Raw(Resources.DeletingOfferMessage)", OfferAutomaticallyRenewable: "@Html.Raw(Resources.OfferAutomaticallyRenewable)", OfferManuallyRenewable: "@Html.Raw(Resources.OfferManuallyRenewable)", OfferAvailableForPurchase: "@Html.Raw(Resources.OfferAvailableForPurchase)", OfferUnavailableForPurchase: "@Html.Raw(Resources.OfferUnavailableForPurchase)", To: "@Html.Raw(Resources.To)", Seats: "@Html.Raw(Resources.Seats)", OfferDeletionConfirmation: "@Html.Raw(Resources.OfferDeletionConfirmation)", OfferDeletionFailure: "@Html.Raw(Resources.OfferDeletionFailure)", OffersFetchFailure: "@Html.Raw(Resources.OffersFetchFailure)", OffersFetchProgress: "@Html.Raw(Resources.OffersFetchProgress)", DeleteOffersPromptMessage: "@Html.Raw(Resources.DeleteOffersPromptMessage)" }, AddOrUpdateOffer: { PickOfferCaption: "@Html.Raw(Resources.PickOfferCaption)", PickOfferTooltip: "@Html.Raw(Resources.PickOfferTooltip)", SaveOfferCaption: "@Html.Raw(Resources.SaveOfferCaption)", MicrosoftOfferRetrievalErrorMessage: "@Html.Raw(Resources.MicrosoftOfferRetrievalErrorMessage)", SavingOfferMessage: "@Html.Raw(Resources.SavingOfferMessage)", UpdatingOfferMessage: "@Html.Raw(Resources.UpdatingOfferMessage)", OfferSaveSuccessMessage: "@Html.Raw(Resources.OfferSaveSuccessMessage)", OfferSaveErrorMessage: "@Html.Raw(Resources.OfferSaveErrorMessage)", SelectOfferErrorMessage: "@Html.Raw(Resources.SelectOfferErrorMessage)", Description: "@Html.Raw(Resources.Description)", Category: "@Html.Raw(Resources.Category)", Offer: "@Html.Raw(Resources.Offer)", EmptyMicrosoftOfferListMessage: "@Html.Raw(Resources.EmptyMicrosoftOfferListMessage)" }, PortalBranding: { BrandingRetrievalErrorMessage: "@Html.Raw(Resources.BrandingRetrievalErrorMessage)", BrandingRetrievalProgressMessage: "@Html.Raw(Resources.BrandingRetrievalProgressMessage)", BrandingUpdateProgressMessage: "@Html.Raw(Resources.BrandingUpdateProgressMessage)", BrandingUpdateSuccessMessage: "@Html.Raw(Resources.BrandingUpdateSuccessMessage)", ReloadPortalButtonCaption: "@Html.Raw(Resources.ReloadPortalButtonCaption)", ReloadPortalButtonTooltip: "@Html.Raw(Resources.ReloadPortalButtonTooltip)", BrandingUpdateErrorMessage: "@Html.Raw(Resources.BrandingUpdateErrorMessage)", UndoBrandingChangesTooltip: "@Html.Raw(Resources.UndoBrandingChangesTooltip)", ImagesTooLarge: "@Html.Raw(Resources.ImagesTooLarge)", InvalidAgreementUserId: "@Html.Raw(Resources.InvalidAgreementUserId)", InvalidFileType: "@Html.Raw(Resources.InvalidFileType)", InvalidOrganizationLogoUri: "@Html.Raw(Resources.InvalidOrganizationLogoUri)", InvalidHeaderImageUri: "@Html.Raw(Resources.InvalidHeaderImageUri)", InvalidPrivacyAgreementUri: "@Html.Raw(Resources.InvalidPrivacyAgreementUri)", InvalidContactUsPhone: "@Html.Raw(Resources.InvalidContactUsPhone)", InvalidContactSalesPhone: "@Html.Raw(Resources.InvalidContactSalesPhone)" }, PaymentConfiguration: { SandboxAccountTypeCaption: "@Html.Raw(Resources.SandboxAccountTypeCaption)", LiveAccountTypeCaption: "@Html.Raw(Resources.LiveAccountTypeCaption)", FetchPaymentConfigurationErrorMessage: "@Html.Raw(Resources.FetchPaymentConfigurationErrorMessage)", FetchPaymentConfigurationProgressMessage: "@Html.Raw(Resources.FetchPaymentConfigurationProgressMessage)", UpdatePaymentProgressMessage: "@Html.Raw(Resources.UpdatePaymentProgressMessage)", UpdatePaymentSuccessMessage: "@Html.Raw(Resources.UpdatePaymentSuccessMessage)", UpdatePaymentErrorMessage: "@Html.Raw(Resources.UpdatePaymentErrorMessage)", UndoUnsavedChanges: "@Html.Raw(Resources.UndoUnsavedChanges)" }, CustomerManagementConfiguration: { FetchPreApprovedCustomersErrorMessage: "@Html.Raw(Resources.FetchPreApprovedCustomersErrorMessage)", UpdatePreApprovedCustomersProgressMessage: "@Html.Raw(Resources.UpdatePreApprovedCustomersProgressMessage)", UpdatePreApprovedCustomersSuccessMessage: "@Html.Raw(Resources.UpdatePreApprovedCustomersSuccessMessage)", UpdatePreApprovedCustomersErrorMessage: "@Html.Raw(Resources.UpdatePreApprovedCustomersErrorMessage)" }, HomePage: { CouldNotRetrievePartnerOffers: "@Html.Raw(Resources.CouldNotRetrievePartnerOffers)" }, CustomerRegistrationPage: { PreparingOrderAndRedirectingMessage: "@Html.Raw(Resources.PreparingOrderAndRedirectingMessage)", CustomerRegistrationSuccessMessage: "@Html.Raw(Resources.CustomerRegistrationSuccessMessage)", CustomerRegistrationFailureMessage: "@Html.Raw(Resources.CustomerRegistrationFailureMessage)", OrderRegistrationFailureMessage: "@Html.Raw(Resources.OrderRegistrationFailureMessage)", CustomerRegistrationMessage: "@Html.Raw(Resources.CustomerRegistrationMessage)", InvalidInputErrorPrefix: "@Html.Raw(Resources.InvalidInputErrorPrefix)", DownstreamErrorPrefix: "@Html.Raw(Resources.DownstreamErrorPrefix)", DomainNotAvailable: "@Html.Raw(Resources.DomainNotAvailable)", InvalidAddress: "@Html.Raw(Resources.InvalidAddress)" }, UpdateSubscriptionPage: { PreparingOrderAndRedirectingMessage: "@Html.Raw(Resources.PreparingOrderAndRedirectingMessage)", ProratedPaymentTotalText: "@Html.Raw(Resources.ProratedPaymentTotal)", OrderUpdateFailureMessage: "@Html.Raw(Resources.OrderUpdateFailureMessage)", InvalidInputErrorPrefix: "@Html.Raw(Resources.InvalidInputErrorPrefix)", DownstreamErrorPrefix: "@Html.Raw(Resources.DownstreamErrorPrefix)", RenewSubscriptionTitleText: "@Html.Raw(Resources.RenewSubscriptionTitleCaption)", CouldNotRetrieveOffer: "@Html.Raw(Resources.CouldNotRetrieveOffer)", AddMoreSeatsTitleText: "@Html.Raw(Resources.AddMoreLicensesCaption)", PaymentTotalText: "@Html.Raw(Resources.TotalAmountCaption)" }, AddSubscriptionPage: { PreparingOrderAndRedirectingMessage: "@Html.Raw(Resources.PreparingOrderAndRedirectingMessage)", OrderAddFailureMessage: "@Html.Raw(Resources.OrderAddFailureMessage)", InvalidInputErrorPrefix: "@Html.Raw(Resources.InvalidInputErrorPrefix)", DownstreamErrorPrefix: "@Html.Raw(Resources.DownstreamErrorPrefix)" }, SubscriptionsSummaryPage: { CouldNotRetrieveSubscriptionsSummary: "@Html.Raw(Resources.CouldNotRetrieveSubscriptionsSummary)" }, CustomerAccountPage: { CouldNotRetrieveCustomerAccount: "@Html.Raw(Resources.CouldNotRetrieveCustomerAccount)" }, ProcessOrderPage: { PaymentGatewayErrorPrefix: "@Html.Raw(Resources.PaymentGatewayErrorPrefix)", CannotAddExistingSubscriptionError: "@Html.Raw(Resources.CannotAddExistingSubscriptionError)", ProcessingOrderMessage: "@Html.Raw(Resources.ProcessingOrderMessage)", OrderProcessingFailureNotification: "@Html.Raw(Resources.OrderProcessingFailureNotification)", ProcessingOrderNotification: "@Html.Raw(Resources.ProcessingOrderNotification)", ProcessingPreApprovedTxNotification: "@Html.Raw(Resources.ProcessingPreApprovedTxNotification)", PaymentReceiptFailureNotification: "@Html.Raw(Resources.PaymentReceiptFailureNotification)", OrderFailureMessage: "@Html.Raw(Resources.OrderFailureMessage)", NewCustomerProcessOrderFailureReceivingPaymentMessage: "@Html.Raw(Resources.NewCustomerProcessOrderFailureReceivingPaymentMessage)", NewCustomerOrderSuccessMessage: "@Html.Raw(Resources.NewCustomerOrderSuccessMessage)", InvalidInputErrorPrefix: "@Html.Raw(Resources.InvalidInputErrorPrefix)", DownstreamErrorPrefix: "@Html.Raw(Resources.DownstreamErrorPrefix)", ExistingCustomerProcessingOrderMessage: "@Html.Raw(Resources.ExistingCustomerProcessingOrderMessage)" }, AddSubscriptionsView: { SelectOfferErrorMessage: "@Html.Raw(Resources.SelectOfferErrorMessage)", EmptyListCaption: "@Html.Raw(Resources.EmptyListCaption)" } } }, Images: { /* Framework images */ ForwardArrow: "/Content/Images/WebPortal/forward.png", BackwardArrow: "/Content/Images/WebPortal/back.png", Tick: "/Content/Images/WebPortal/tick.png", Cross: "/Content/Images/WebPortal/cross.png", Refresh: "/Content/Images/WebPortal/refresh.png", SuccessNotification: "/Content/Images/WebPortal/notification-success.png", InfoNotification: "/Content/Images/WebPortal/notification-info.png", WarningNotification: "/Content/Images/WebPortal/notification-warning.png", ErrorNotification: "/Content/Images/WebPortal/notification-error.png", ProgressNotification: "/Content/Images/WebPortal/notification-progress.gif", Ellipsis: "/Content/Images/WebPortal/ellipsis.png", SortDescending: "/Content/Images/WebPortal/sorted-desc.png", SortAscending: "/Content/Images/WebPortal/sorted-asc.png", /* Plugin images */ Plugins: { Expenses: { ListViewTabActive: "/Content/Images/Plugins/Expenses/list-view-on.png", ListViewTabInactive: "/Content/Images/Plugins/Expenses/list-view.png", ChartViewTabActive: "/Content/Images/Plugins/Expenses/chart-view-on.png", ChartViewTabInactive: "/Content/Images/Plugins/Expenses/chart-view.png" } } } } </script>
the_stack
@model OCM.API.Common.Model.UserSubscription <script src="https://maps.googleapis.com/maps/api/js"></script> <style type="text/css"> html, body, #map { height: 100%; margin: 0; padding: 0; } </style> @using (Html.BeginForm("SubscriptionEdit", "Profile", FormMethod.Post)) { @Html.AntiForgeryToken() <div class="form"> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.ID) @Html.HiddenFor(model => model.DateCreated) @Html.HiddenFor(model => model.DateLastNotified) @Html.HiddenFor(model => model.UserID) <div class="form-group"> @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.NotificationFrequencyMins, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownListFor(model => model.NotificationFrequencyMins, (SelectList)ViewBag.NotificationFrequencyOptions, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.NotificationFrequencyMins, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.IsEnabled, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> <div class="checkbox"> @Html.CheckBoxFor(model => model.IsEnabled) @Html.ValidationMessageFor(model => model.IsEnabled, "", new { @class = "text-danger" }) </div> </div> </div> <hr /> <div class="row"> <div class="col-md-6"> <h3>Notify Me When:</h3> <div class="form-group"> @Html.LabelFor(model => model.NotifyPOIAdditions, htmlAttributes: new { @class = "control-label col-md-10" }) <div class="col-md-2"> <div class="checkbox"> @Html.CheckBoxFor(model => model.NotifyPOIAdditions) @Html.ValidationMessageFor(model => model.NotifyPOIAdditions, "", new { @class = "text-danger" }) </div> </div> </div> <div class="form-group"> @Html.LabelFor(model => model.NotifyPOIUpdates, htmlAttributes: new { @class = "control-label col-md-10" }) <div class="col-md-2"> <div class="checkbox"> @Html.CheckBoxFor(model => model.NotifyPOIUpdates) @Html.ValidationMessageFor(model => model.NotifyPOIUpdates, "", new { @class = "text-danger" }) </div> </div> </div> <div class="form-group"> @Html.LabelFor(model => model.NotifyPOIEdits, htmlAttributes: new { @class = "control-label col-md-10" }) <div class="col-md-2"> <div class="checkbox"> @Html.CheckBoxFor(model => model.NotifyPOIEdits) @Html.ValidationMessageFor(model => model.NotifyPOIEdits, "", new { @class = "text-danger" }) </div> </div> </div> <div class="form-group"> @Html.LabelFor(model => model.NotifyComments, htmlAttributes: new { @class = "control-label col-md-10" }) <div class="col-md-2"> <div class="checkbox"> @Html.CheckBoxFor(model => model.NotifyComments) @Html.ValidationMessageFor(model => model.NotifyComments, "", new { @class = "text-danger" }) </div> </div> </div> <div class="form-group"> @Html.LabelFor(model => model.NotifyMedia, htmlAttributes: new { @class = "control-label col-md-10" }) <div class="col-md-2"> <div class="checkbox"> @Html.CheckBoxFor(model => model.NotifyMedia) @Html.ValidationMessageFor(model => model.NotifyMedia, "", new { @class = "text-danger" }) </div> </div> </div> <div class="form-group"> @Html.LabelFor(model => model.NotifyEmergencyChargingRequests, htmlAttributes: new { @class = "control-label col-md-10" }) <div class="col-md-2"> <div class="checkbox"> @Html.CheckBoxFor(model => model.NotifyEmergencyChargingRequests) @Html.ValidationMessageFor(model => model.NotifyEmergencyChargingRequests, "", new { @class = "text-danger" }) </div> </div> </div> <div class="form-group"> @Html.LabelFor(model => model.NotifyGeneralChargingRequests, htmlAttributes: new { @class = "control-label col-md-10" }) <div class="col-md-2"> <div class="checkbox"> @Html.CheckBoxFor(model => model.NotifyGeneralChargingRequests) @Html.ValidationMessageFor(model => model.NotifyGeneralChargingRequests, "", new { @class = "text-danger" }) </div> </div> </div> </div> <div class="col-md-6"> <h3>Area Of Interest:</h3> <div class="row"> <div class="form-group"> <label class="control-label col-md-3">Filter By Country</label> <div class="col-md-2"> <div class="checkbox"> <input type="checkbox" name="FilterByCountry" id="filterByCountry" @(Model.CountryID != null ? "checked='checked'" : "")> </div> </div> </div> </div> <div id="locationFilterPanel"> <div class="form-group"> @Html.LabelFor(model => model.CountryID, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownList("CountryCode", (SelectList)ViewBag.CountryList, new { @class = "form-control", onchange = "updateSelectedCountry(this);" }) </div> </div> <p>You can optionally filter results to a specific geographic area within the selected country. Select 'Match Locations Near Me' then drag the search circle to set the search position:</p> <p> <div class="form-group"> <button id="initPositionSelectedCountry" type="button" class="btn btn-default">Match Specific Location In Country</button> <button id="initPositionNearMe" type="button" class="btn btn-success">Match Locations Near Me</button> <button id="clearPositionFilter" type="button" class="btn btn-warning">Clear Location Filter</button> </div> </p> <div id="map" class="map-canvas" style="height: 300px;"></div> <p>Address: <span id="full-address"></span></p> @Html.HiddenFor(model => model.CountryID) @Html.HiddenFor(model => model.Latitude) @Html.HiddenFor(model => model.Longitude) <div class="form-group"> @Html.LabelFor(model => model.DistanceKM, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.DistanceKM, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.DistanceKM, "", new { @class = "text-danger" }) </div> </div> </div> </div> </div> <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#advancedFilters"> Advanced Filters </a> </h4> </div> <div id="advancedFilters" class="panel-collapse collapse"> <div class="panel-body"> @Html.EditorFor(model => model.FilterSettings) </div> </div> </div> </div> <div class="form-actions"> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Save" class="btn btn-primary" /> </div> </div> </div> </div> } @{ var scriptVars = "var lat = " + (Model.Latitude != null ? "" + Model.Latitude : "null") + "; var lng = " + (Model.Longitude != null ? "" + Model.Longitude : "null") + "; var radius = " + (Model.DistanceKM != null ? "" + Model.DistanceKM : "null") + ";"; } <script> @scriptVars var map, marker, geocoder, geocodeTimer; var searchRadiusCircle; var centerPos = null; var MAX_RADIUS = 10000; var defaultSearchRadiusKM=100; var mapInitialised = false; var countryExtendedInfo = @Html.Raw(ViewBag.CountryExtendedInfo); ; function setPositionViaGeolocation() { navigator.geolocation.getCurrentPosition(function (position) { if (position != null) { centerPos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); updateDistance(defaultSearchRadiusKM); initializeMap(); updatePosition(centerPos, true); } }, function () { // could not geolocate, use avg country position instead if(centerPos==null){ centerPos= getPositionForSelectedCountry(); } if(centerPos!=null) { updateDistance(defaultSearchRadiusKM); initializeMap(); updatePosition(centerPos,true); } }); } function initEditor(){ if (radius==null) updateDistance(defaultSearchRadiusKM); //default to 100KM initializeMap(); $("#filterByCountry").change( function(){ if($(this).is(":checked")) { //filter by country enabled $("#locationFilterPanel").show(); setPositionViaGeolocation(); } else { //filter by country disabled $("#locationFilterPanel").hide(); $("#CountryID").val(""); $("#CountryCode").val(""); clearPositionFilter(); } }); //hide location filtering if not currently selected if ($("#CountryCode").val()=="" && $("#Latitude").val()=="") { $("#locationFilterPanel").hide(); } $("#initPositionSelectedCountry").click(function(){ if ($("#CountryCode").val!=""){ //edit location specific filtering based on selected country centerPos = getPositionForSelectedCountry(); if(centerPos!=null) { updateDistance(defaultSearchRadiusKM); initializeMap(); updatePosition(centerPos,true); } } }); $("#initPositionNearMe").click(function(){ //edit nearby location specific filtering setPositionViaGeolocation(); }); $("#clearPositionFilter").click(function(){ //reset location specific filtering clearPositionFilter(); }); } function clearPositionFilter(){ $("#Latitude").val(""); $("#Longitude").val(""); $("#DistanceKM").val(""); if (searchRadiusCircle){ searchRadiusCircle.setVisible(false); } } function initializeMap() { if (centerPos==null){ if (lat==null || lng==null){ //use country default centerPos = getPositionForSelectedCountry(); } else { centerPos = new google.maps.LatLng(lat, lng); } } if (centerPos==null) return; //setup a geocoder to use when location address at marker pos geocoder = new google.maps.Geocoder(); if (map==null){ //setup map options var mapOptions = { center: centerPos, zoom: 6 }; //create map map = new google.maps.Map(document.getElementById("map"), mapOptions); } if (searchRadiusCircle==null){ //search radius circle var searchRadius = parseFloat($("#DistanceKM").val()); var searchCircleOptions = { strokeColor: '#FF0000', strokeOpacity: 0.8, strokeWeight: 2, fillColor: '#FF0000', fillOpacity: 0.35, map: map, center: centerPos, radius: searchRadius * 1000, draggable:true }; // Add the circle for this city to the map. searchRadiusCircle = new google.maps.Circle(searchCircleOptions); //when search circle dragged, update search centre pos google.maps.event.addListener(searchRadiusCircle, 'dragend', function() { updatePosition(searchRadiusCircle.getCenter()); }); } updatePosition(centerPos); } function updatePosition(newPos, moveSearchCircle) { //var pos = distanceWidget.get('position'); centerPos = newPos; pos = newPos; if (pos != null) { $("#Latitude").val(pos.lat()); $("#Longitude").val(pos.lng()); } //perform address lookup from lat/lng if (geocodeTimer) { window.clearTimeout(geocodeTimer); } // Throttle the geo query so we don't hit the limit geocodeTimer = window.setTimeout(function () { reverseGeocodePosition(); }, 1000); if(moveSearchCircle==true) { //set maps centre if (map) map.setCenter(centerPos); if (searchRadiusCircle) { searchRadiusCircle.setCenter(centerPos); searchRadiusCircle.setVisible(true); } } } function reverseGeocodePosition() { var pos = centerPos; geocoder.geocode({ 'latLng': pos }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results!=null && results.length>1) { //got an address for this location //TODO: set country dropdown from geocoding var addressResult = results[0]; var addressComponents = addressResult.address_components; $("#full-address").html(addressResult.formatted_address); //find address component in result with type 'postal_code' for (var i = addressComponents.length - 1; i >= 0; i--) { for (var t = 0; t < addressComponents[i].types.length; t++) { if (addressComponents[i].types[t] == "country") { var countryCode = addressComponents[i].short_name; $("#CountryCode").val(countryCode); } } } } else { //no result } } }); } function updateDistance(distanceKM){ if (searchRadiusCircle!=null){ searchRadiusCircle.setRadius(distanceKM*1000); } $('#DistanceKM').val(distanceKM.toFixed(0)); } function updateDistanceListeners() { //fires when search widget distance changes /* var distance = parseFloat(distanceWidget.get('distance')); $('#DistanceKM').val(distance.toFixed(2)); $('#distance-range').val(distance.toFixed(2));*/ } function getCountryExtendedInfo(countryCode){ for(i=0;i<countryExtendedInfo.length;i++) { if (countryExtendedInfo[i].CountryCode==countryCode){ return countryExtendedInfo[i]; } } return null; } function updateSelectedCountry(){ var countryCode = $("#CountryCode").val(); if (countryCode!=""){ var countryInfo = getCountryExtendedInfo(countryCode); if (countryInfo!=null){ clearPositionFilter(); var countryCenterPos = new google.maps.LatLng( countryInfo.Latitude, countryInfo.Longitude); if (map) map.setCenter(countryCenterPos); } } } function getPositionForSelectedCountry(){ var countryCode = $("#CountryCode").val(); if (countryCode!=""){ var countryInfo = getCountryExtendedInfo(countryCode); if (countryInfo!=null){ //set maps centre return new google.maps.LatLng( countryInfo.Latitude, countryInfo.Longitude); } } } google.maps.event.addDomListener(window, 'load', initEditor); $(document).ready(function () { /*if (!Modernizr.inputtypes.range) { document.getElementById("distance-range").style.display = "none"; } else { //if distance range control changes, update text value and $("#distance-range").change( function () { var newDistance = $("#distance-range").val(); $('#DistanceKM').val(newDistance.toFixed(2)); }); }*/ //if distance textbox changes, update other related items $('#DistanceKM').keyup( function () { var newDistance = parseFloat($("#@Html.IdFor(model => model.DistanceKM)").val()); updateDistance(newDistance.toFixed(2)); } ); }); </script>
the_stack
<!DOCTYPE html> <html> <head> <title>配置服务器-初始化系统</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta charset="UTF-8" /> <!-- Bootstrap --> <link href="/assets/css/vendor/bootstrap/bootstrap.min.css" rel="stylesheet"> <link href="/lib/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"> <link href="/assets/css/minimal.css" rel="stylesheet"> <link type="text/css" rel="stylesheet" media="all" href="/assets/js/vendor/mmenu/css/jquery.mmenu.all.css" /> <link href="/lib/bootstrapvalidator/css/bootstrapValidator.min.css" rel="stylesheet"> <style> #content.full-page .inside-block h1 strong:before { width: 76px !important; } </style> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> </head> <body class="bg-1"> <div class="mask" id="mask" style="display: none;"> <div id="loader" style="width: max-content;"> <h4 style="text-align: center;color: #FFF;margin-top: 30px;" id="loaderTime"></h4> <h1 style="color: #FFF;" id="loaderInfo"></h1> <div style="color: #FFF;" id="loaderConsole"> </div> </div> </div> <!-- Wrap all page content here --> <div id="wrap"> <!-- Make page fluid --> <div class="row"> <!-- Page content --> <div id="content" class="col-md-12 full-page error"> <div class="inside-block"> <img src="/imgs/zlserver/ZLM_FISH_TRANSP.png" style="width: 230px; height: 230px;margin-top: 0px;" alt class="logo"> <h1 style="text-align: left;"><strong>初始化</strong> 配置</h1> <section class="tile color transparent-white" style="margin-top: 10px;"> <!-- tile header --> <div class="tile-header"> <h1>登录信息</h1> </div> <!-- /tile header --> <!-- tile body --> <div class="tile-body"> <form class="form-horizontal" role="form" style="margin-top: 0px;margin-bottom :0px;" id="from_dashboard"> <div class="form-group"> <label for="input04" class="col-sm-4 control-label">管理员帐号</label> <div class="col-sm-8"> <input type="text" id="account" name="account" class="form-control" id="input04" placeholder="请输入管理员帐号..."> </div> </div> <div class="form-group"> <label for="input04" class="col-sm-4 control-label">管理员密码</label> <div class="col-sm-8"> <input type="password" id="password" name="password" class="form-control" id="input04" placeholder="请输入管理员密码..."> </div> </div> <div class="form-group"> <label for="input04" class="col-sm-4 control-label">管理员密码</label> <div class="col-sm-8"> <input type="password" id="passwordAgain" name="passwordAgain" class="form-control" id="input04" placeholder="请重新输入管理员密码..."> </div> </div> </form> </div> <!-- /tile body --> </section> <!-- /tile --> <section class="tile color transparent-white" style="margin-top: 10px;"> <!-- tile header --> <div class="tile-header"> <h1>媒体服务器信息</h1> </div> <!-- /tile header --> <!-- tile body --> <div class="tile-body"> <form class="form-horizontal" role="form" style="margin-top: 0px;margin-bottom :0px;" id="form_server" name="form_dashboard"> <div class="form-group"> <label for="input04" class="col-sm-4 control-label">流媒体服务器IP</label> <div class="col-sm-8"> <input type="text" id="serverIp" name="serverIp" class="form-control" id="input04" placeholder="请输入流媒体服务器IP..."> </div> </div> <div class="form-group"> <label for="input04" class="col-sm-4 control-label">流媒体服务器端口</label> <div class="col-sm-8"> <input type="text" id="serverPort" name="serverPort" class="form-control" id="input04" placeholder="请输入流媒体服务器端口..."> </div> </div> <div class="form-group"> <label for="input04" class="col-sm-4 control-label">流媒体服务器密钥</label> <div class="col-sm-8"> <input type="text" id="serverSecret" name="serverSecret" class="form-control" id="input04" placeholder="请输入流媒体服务器密钥,本机可不填"> </div> </div> </form> </div> <!-- /tile body --> </section> <!-- /tile --> <div class="tile-body color transparent-black"> <div class="controls form-group form-footer"> <button class="btn btn-green" onclick="submitData()"><i class="fa fa-paper-plane"></i>&nbsp;&nbsp;提&nbsp;&nbsp;&nbsp;&nbsp;交</button> </div> </div> </div> </div> <!-- /Page content --> </div> </div> <!-- Wrap all page content end --> </body> <script src="/lib/signalr/dist/browser/signalr.min.js"></script> <script src="/assets/js/jquery.js"></script> <script src="/assets/js/jquery.cookie.min.js"></script> <script src="/assets/js/vendor/bootstrap/bootstrap.min.js"></script> <script type="text/javascript" src="/assets/js/vendor/mmenu/js/jquery.mmenu.min.js"></script> <script type="text/javascript" src="/assets/js/vendor/sparkline/jquery.sparkline.min.js"></script> <script type="text/javascript" src="/assets/js/vendor/nicescroll/jquery.nicescroll.min.js"></script> <script src="/assets/js/minimal.min.js"></script> <script src="/lib/bootstrapvalidator/js/bootstrapValidator.min.js"></script> <script src="/lib/bootstrap-growl/jquery.bootstrap-growl.min.js"></script> <script src="/js/site.js"></script> <script> var signalrConnection; var signalrNeedReConnection = true; $(function () { initSignalr(); $('#form_server').bootstrapValidator({ message: '媒体服务器信息验证失败', //提供输入验证图标提示 feedbackIcons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { serverIp: { message: '流媒体服务器IP验证失败', validators: { notEmpty: { message: '流媒体服务器IP不能为空' }, } }, serverPort: { message: '流媒体服务器端口验证失败', validators: { notEmpty: { message: '流媒体服务器端口不能为空' }, digits: { message: '流媒体服务器端口只能是数字' }, greaterThan: { value: 1, message: '流媒体服务器端口号不能小于1' }, lessThan: { value: 65535, message: '流媒体服务器端口号不能大于65535' } } }, serverSecret: { message: '流媒体服务器密钥验证失败', validators: { callback: { message: '仅服务器ip为127.0.0.1时密钥允许为空', callback: function (value, validator, $field) { if ($('#serverIp').val() === '127.0.0.1') return true; else if ($('#serverSecret').val() === '') return false; else return true; } }, } }, } }); $('#from_dashboard').bootstrapValidator({ message: '登录信息验证失败', //提供输入验证图标提示 feedbackIcons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { account: { message: '管理员帐号验证失败', validators: { notEmpty: { message: '管理员帐号不能为空' }, regexp: { regexp: /^[A-Za-z0-9]/i, message: '帐号只能由字母数字组成。' } } }, password: { message: '管理员密码验证失败', validators: { notEmpty: { message: '管理员密码不能为空' }, }, }, passwordAgain: { message: '管理员密码验证失败', validators: { notEmpty: { message: '管理员密码不能为空' }, callback: { message: '管理员密码不一致', callback: function (value, validator, $field) { if ($('#password').val() != $('#passwordAgain').val()) return false; else return true; } } } }, } }); }); function submitData() { // showGrowl('遇到致命错误,啊是哒是哒四大皆空结婚的卷卡式带好看见哈撒大华石达开收到哈手机看的哈手机看的户撒刀好'); $("#from_dashboard").data("bootstrapValidator").validate();//手动触发全部验证 $("#form_server").data("bootstrapValidator").validate();//手动触发全部验证 if ($("#from_dashboard").data("bootstrapValidator").isValid() && $("#form_server").data("bootstrapValidator").isValid()) { showLoader('正在配置服务器....', 60); post('/Home/Init', { Account: $('#account').val(), Password: $('#password').val(), ZLMediaServerIp: $('#serverIp').val(), ZLMediaServerPort: $('#serverPort').val(), ZLMediaServerSecret: $('#serverSecret').val(), }, function (data, status, xhr) { if (data.Flag) { showGrowl('初始化成功', 'success', 4000); setTimeout(() => { window.location.replace("/Home/Login"); }, 1000); } else { showGrowl(data.Msg, 'danger', 4000) } }, function () { showGrowl('POST请求异常。', 'danger', 3000) } ); } else { showGrowl('字段验证失败,请检查后重试', 'danger', 3000) } } function initSignalr() { signalrConnection = new signalR.HubConnectionBuilder().withUrl("/Hubs/MessageHub").build(); //Disable send button until connection is established signalrConnection.on("BrowserReceiveLoaderMessage", function (info, type) { addLoaderInfo(info, type); }); signalrConnection.on("CleanCookieAndExit", function (info, type) { signalrNeedReConnection = false; clearAllCookie(); alert('您已在另一地点打开页面,本页面已失效!'); // closeWindows(); }); signalrConnection.onclose(async () => { if (signalrNeedReConnection) { showGrowl('即时通讯连接已关闭,将重试连接!', 'danger', 2000); await startConnectSignalr(); } }); startConnectSignalr(); } async function startConnectSignalr() { try { if (signalrNeedReConnection) { await signalrConnection.start(); } } catch (err) { if (signalrNeedReConnection) { showGrowl('连接即时通讯服务失败,将在5s后重试连接!', 'danger', 2000); setTimeout(() => { startConnectSignalr(); }, 5000); } } }; </script> </html>
the_stack
@model IEnumerable<long> <style> .progress { border-radius: 0 !important; } .player-stat-icon { height: 1.5rem; width: 1.5rem; background-size: 1.5rem 1.5rem; } </style> <div class="row p-0 ml-auto mr-auto mb-4"> <div class="col-12 col-xl-10 p-0 ml-auto mr-auto p-0 pl-lg-3 pr-lg-3 "> <ul class="nav nav-tabs border-top border-bottom nav-fill" role="tablist"> @foreach (SharedLibraryCore.Dtos.ServerInfo server in ViewBag.Servers) { <li class="nav-item"> <a asp-controller="Radar" asp-action="Index" asp-route-serverId="@server.ID" class="nav-link @(server.ID == ViewBag.ActiveServerId ? "active": "")" aria-selected="@(server.ID == ViewBag.ActiveServerId ? "true": "false")"><color-code value="@server.Name" allow="@ViewBag.EnableColorCodes"></color-code></a> </li> } </ul> </div> </div> <div class="row p-0 ml-auto mr-auto col-12 col-xl-10"> <div class="p-0 pl-lg-3 pr-lg-3 m-0 col-lg-3 col-12 text-lg-right text-center player-data-left" style="opacity: 0;"> </div> <div class="pl-0 pr-0 pl-lg-3 pr-lg-3 col-lg-6 col-12 pb-4"> <div id="map_name" class="h4 text-center pb-2 pt-2 mb-0 bg-primary">&mdash;</div> <div id="map_list" style="background-size:cover; padding-bottom: 100% !important;"> <canvas id="map_canvas" style="position:absolute;"></canvas> </div> </div> <div class="p-0 pl-lg-3 pr-lg-3 m-0 col-lg-3 col-12 text-lg-left text-center player-data-right" style="opacity: 0;"> </div> </div> <!-- images used by canvas --> <img class="hide" id="hud_death" src="~/images/radar/death.png" /> @section scripts { <script defer="defer"> const textOffset = 15; let previousRadarData = undefined; let newRadarData = undefined; /************************ * IW4 * * **********************/ const weapons = {}; weapons["ak47"] = "ak47"; weapons["ak47classic"] = "icon_ak47_classic"; weapons["ak74u"] = "akd74u"; weapons["m16"] = "m16a4"; weapons["m4"] = "m4carbine"; weapons["fn2000"] = "fn2000"; weapons["masada"] = "masada"; weapons["famas"] = "famas"; weapons["fal"] = "fnfal"; weapons["scar"] = "scar_h"; weapons["tavor"] = "tavor"; weapons["mp5k"] = "mp5k"; weapons["uzi"] = "mini_uzi"; weapons["p90"] = "p90"; weapons["kriss"] = "kriss"; weapons["ump45"] = "ump45"; weapons["rpd"] = "rpd"; weapons["sa80"] = "sa80_lmg"; weapons["mg4"] = "mg4"; weapons["m240"] = "m240"; weapons["aug"] = "steyr"; weapons["barrett"] = "barrett50cal"; weapons["wa2000"] = "wa2000"; weapons["m21"] = "m14ebr"; weapons["cheytac"] = "cheytac"; weapons["dragunov"] = "dragunovsvd"; weapons["beretta"] = "m9beretta"; weapons["usp"] = "usp_45"; weapons["deserteagle"] = "desert_eagle"; weapons["deserteaglegold"] = "desert_eagle_gold"; weapons["desert"] weapons["coltanaconda"] = "colt_anaconda"; weapons["tmp"] = "mp9"; weapons["glock"] = "glock"; weapons["beretta393"] = "beretta393"; weapons["pp2000"] = "pp2000"; weapons["ranger"] = "sawed_off"; weapons["model1887"] = "model1887"; weapons["striker"] = "striker"; weapons["aa12"] = "aa12"; weapons["m1014"] = "benelli_m4"; weapons["spas12"] = "spas12"; weapons["m79"] = "m79"; weapons["rpg"] = "rpg"; weapons["at4"] = "at4"; weapons["stinger"] = "stinger"; weapons["javelin"] = "javelin"; weapons["m40a3"] = "m40a3"; weapons["none"] = "neutral"; weapons["riotshield"] = "riot_shield"; weapons["peacekeeper"] = "peacekeeper"; function drawCircle(context, x, y, color) { context.beginPath(); context.arc(x, y, 6 * stateInfo.imageScaler, 0, 2 * Math.PI, false); context.fillStyle = color; context.fill(); context.lineWidth = 0.5; context.strokeStyle = 'rgba(255, 255, 255, 0.5)'; context.closePath(); context.stroke(); } function drawLine(context, x1, y1, x2, y2, color) { context.beginPath(); context.lineWidth = '3'; context.moveTo(x1, y1); context.lineTo(x2, y2); context.closePath(); context.stroke(); } function drawTriangle(context, v1, v2, v3, color) { context.beginPath(); context.moveTo(v1.x, v1.y); context.lineTo(v2.x, v2.y); context.lineTo(v3.x, v3.y); context.closePath(); context.fillStyle = color; context.fill(); } function drawText(context, x, y, text, size, fillColor, strokeColor, alignment = 'left') { context.beginPath(); context.save(); context.font = `bold ${Math.max(12, size * stateInfo.imageScaler)}px courier new`; context.fillStyle = fillColor; context.shadowColor = strokeColor; context.shadowBlur = 4; context.textAlign = alignment; context.fillText(text, x, y); context.restore(); context.closePath(); } function drawImage(context, imgSelector, x, y, alpha = 1) { context.save(); context.globalAlpha = alpha; context.drawImage(document.getElementById(imgSelector), x - (15 * stateInfo.imageScaler), y - (15 * stateInfo.imageScaler), 32 * stateInfo.imageScaler, 32 * stateInfo.imageScaler); context.globalAlpha = 1; context.restore(); } function checkCanvasSize(canvas, context, minimap, map) { let width = Math.round(minimap.width()); if (Math.round(context.canvas.width) != width) { canvas.width(width); canvas.height(width); context.canvas.height = width; context.canvas.width = context.canvas.height; } stateInfo.imageScaler = (stateInfo.canvas.width() / 1024) stateInfo.mapScalerX = (((stateInfo.mapInfo.right * stateInfo.imageScaler) - (stateInfo.mapInfo.left * stateInfo.imageScaler)) / stateInfo.mapInfo.width); stateInfo.mapScalerY = (((stateInfo.mapInfo.bottom * stateInfo.imageScaler) - (stateInfo.mapInfo.top * stateInfo.imageScaler)) / stateInfo.mapInfo.height); stateInfo.mapScaler = (stateInfo.mapScalerX + stateInfo.mapScalerY) / 2 stateInfo.forwardDistance = 500.0; stateInfo.fovWidth = 40; } function calculateViewPosition(x, y, distance) { let nx = Math.cos(x) * Math.cos(y); let ny = Math.sin(x) * Math.cos(y); let nz = Math.sin(360.0 - y); return { x: (nx * distance) * stateInfo.mapScaler, y: (ny * distance) * stateInfo.mapScaler, z: (nz * distance) * stateInfo.mapScaler }; } function lerp(start, end, complete) { return (1 - complete) * start + complete * end; } function easeLerp(start, end, t) { let t2 = (1 - Math.cos(t * Math.PI)) / 2; return (start * (1-t2) + end * t2); } function fixRollAngles(oldAngles, newAngles) { let newX = newAngles.x; let newY = newAngles.y; let angleDifferenceX = (oldAngles.x - newAngles.x); if (angleDifferenceX > Math.PI) { newX = oldAngles.x + (Math.PI * 2) - angleDifferenceX; } else if (Math.abs(newAngles.x - oldAngles.x) > Math.PI) { newX = newAngles.x - (Math.PI * 2); } let angleDifferenceY = (oldAngles.y - newAngles.y); if (angleDifferenceY > Math.PI) { newY = oldAngles.y + (Math.PI * 2) - angleDifferenceY; } else if (Math.abs(newAngles.y - oldAngles.y) > Math.PI) { newY = newAngles.y - (Math.PI * 2); } return { x: newX, y: newY }; } function toRadians(deg) { return deg * Math.PI / 180.0; } function rotate(cx, cy, x, y, angle) { var radians = (Math.PI / 180) * angle, cos = Math.cos(radians), sin = Math.sin(radians), nx = (cos * (x - cx)) + (sin * (y - cy)) + cx, ny = (cos * (y - cy)) - (sin * (x - cx)) + cy; return { x: nx, y: ny }; } function weaponImageForWeapon(weapon) { let name = weapon.split('_')[0]; if (weapons[name] == undefined) { console.log(name); name = "none"; } return `../images/radar/hud_weapons/hud_${weapons[name]}.png`; } function updatePlayerData() { $('.player-data-left').html(''); $('.player-data-right').html(''); $.each(newRadarData, function (index, player) { if (player == null) { return; } let column = index % 2 == 0 ? $('.player-data-left') : $('.player-data-right'); column.append(`<div class="progress" style="height: 1.5rem; background-color: transparent;"> <div style="position: absolute; font-size: 1rem; left: 1.5rem;">${player.name}</div> <div class="progress-bar bg-success" role="progressbar" style="min-width: 0px; width: ${player.health}%" aria-valuenow="${player.health}" aria-valuemin="0" aria-valuemax="100"></div> <div class="progress-bar bg-danger" role="progressbar" style="min-width: 0px; border-right: 0px; width: ${100 - player.health}%" aria-valuenow="${100 - player.health}" aria-valuemin="0" aria-valuemax="100"></div> </div> <div class="d-flex flex-row flex-wrap p-2 mb-4 bg-dark border-bottom"> <div style="width: 3rem; height: 1.5rem; background-image:url(${weaponImageForWeapon(player.weapon)}); background-size: 3rem 1.5rem;" class="mr-auto text-left"> </div> <div class="player-stat-icon" style="background-image:url('/images/radar/kills.png')"></div> <div class="pr-2">${player.kills}</div> <div class="player-stat-icon" style="background-image:url('/images/radar/death.png')"></div> <div class="pr-3">${player.deaths}</div> <span class="align-self-center oi oi-target pr-1"></span> <div class="pr-3 ">${player.deaths == 0 ? player.kills.toFixed(2) : (player.kills / player.deaths).toFixed(2)}</div> <span class="align-self-center oi oi-graph pr-1"></span> <div>${ player.playTime == 0 ? '&mdash;' : Math.round(player.score / (player.playTime / 60))}</div> </div>`); }); $('.player-data-left').delay(1000).animate({opacity: 1}, 500); $('.player-data-right').delay(1000).animate({opacity: 1}, 500); } const stateInfo = { canvas: $('#map_canvas'), ctx: $('#map_canvas')[0].getContext('2d'), updateFrequency: 750, updateFrameTimeDeviation: 0, forwardDistance: undefined, fovWidth: undefined, mapInfo: undefined, mapScaler: undefined, deathIcons: {}, deathIconTime: 4000 }; function updateRadarData() { $.getJSON('@Url.Action("Data", "Radar", new { serverId = ViewBag.ActiveServerId })', function (_radarItem) { newRadarData = _radarItem; }); $.getJSON('@Url.Action("Map", "Radar", new { serverId = ViewBag.ActiveServerId })', function (_map) { stateInfo.mapInfo = _map }); $.each(newRadarData, function (index, value) { if (previousRadarData != undefined && index < previousRadarData.length) { let previous = previousRadarData[index]; // this happens when the player has first joined and we haven't gotten two snapshots yet if (value == null) { return; } if (previous == null) { previous = value; } // we don't want to treat a disconnected player snapshot as the previous else if (previous.guid == value.guid) { value.previous = previous; } // we haven't gotten a new item, it's just the old one again if (previous.id === value.id) { value.animationTime = previous.animationTime; value.previous = value; } // they died between this snapshot and last so we wanna setup the death icon if (!value.isAlive && previous.isAlive) { stateInfo.deathIcons[value.guid] = { animationTime: now, location: value.location }; } // they respawned between this snapshot and last so we don't want to show wherever the were specating from else if (value.isAlive && !previous.isAlive) { value.previous = value; } }}); // we switch out the items to previousRadarData = newRadarData; $('#map_name').html(stateInfo.mapInfo.alias); $('#map_list').css('background-image', `url(../images/radar/minimaps/compass_map_${stateInfo.mapInfo.name}@('@')2x.jpg)`); checkCanvasSize(stateInfo.canvas, stateInfo.ctx, $('#map_list'), stateInfo.mapInfo); updatePlayerData(); } function updateMap() { let ctx = stateInfo.ctx; ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); now = performance.now(); $.each(previousRadarData, function (index, value) { if (value == null) { return; } if (value.previous == null) { value.previous = value; } // this indicates we got a new snapshot to work with so we set the time based off the previous // frame deviation to have minimal interpolation skipping if (value.animationTime === undefined) { value.animationTime = now - stateInfo.updateFrameTimeDeviation; } if (!value.isAlive) { return; } const elapsedFrameTime = now - value.animationTime; const completionPercent = elapsedFrameTime / stateInfo.updateFrequency; // certain maps like estate have an off center axis of origin, so we need to account for that let rotatedPreviousLocation = rotate(stateInfo.mapInfo.centerX, stateInfo.mapInfo.centerY, value.previous.location.x, value.previous.location.y, stateInfo.mapInfo.rotation); let rotatedCurrentLocation = rotate(stateInfo.mapInfo.centerX, stateInfo.mapInfo.centerY, value.location.x, value.location.y, stateInfo.mapInfo.rotation); const startX = ((stateInfo.mapInfo.maxLeft - rotatedPreviousLocation.y) * stateInfo.mapScaler) + (stateInfo.mapInfo.left * stateInfo.imageScaler); const startY = ((stateInfo.mapInfo.maxTop - rotatedPreviousLocation.x) * stateInfo.mapScalerY) + (stateInfo.mapInfo.top * stateInfo.imageScaler); const endX = ((stateInfo.mapInfo.maxLeft - rotatedCurrentLocation.y) * stateInfo.mapScaler) + (stateInfo.mapInfo.left * stateInfo.imageScaler); const endY = ((stateInfo.mapInfo.maxTop - rotatedCurrentLocation.x) * stateInfo.mapScalerY) + (stateInfo.mapInfo.top * stateInfo.imageScaler); let teamColor = value.team == 'allies' ? 'rgb(0, 122, 204, 1)' : 'rgb(255, 69, 69)'; let fovColor = value.team == 'allies' ? 'rgba(0, 122, 204, 0.2)' : 'rgba(255, 69, 69, 0.2)'; // this takes care of moving past the roll-over point of yaw/pitch (ie 360->0) const rollAngleFix = fixRollAngles(value.previous.radianAngles, value.radianAngles); const radianLerpX = lerp(value.previous.radianAngles.x, rollAngleFix.x, completionPercent); const radianLerpY = lerp(value.previous.radianAngles.y, rollAngleFix.y, completionPercent); // this is some jankiness to get the fov to point the right direction let firstVertex = calculateViewPosition(toRadians(stateInfo.mapInfo.rotation + stateInfo.mapInfo.viewPositionRotation - 90) - radianLerpX + toRadians(stateInfo.fovWidth), radianLerpY, stateInfo.forwardDistance); let secondVertex = calculateViewPosition(toRadians(stateInfo.mapInfo.rotation + stateInfo.mapInfo.viewPositionRotation - 90) - radianLerpX - toRadians(stateInfo.fovWidth), radianLerpY, stateInfo.forwardDistance); let currentX = lerp(startX, endX, completionPercent); let currentY = lerp(startY, endY, completionPercent); // we need to calculate the distance from the center of the map so we can scale if necessary let centerX = ((stateInfo.mapInfo.maxLeft - stateInfo.mapInfo.centerY) * stateInfo.mapScaler) + (stateInfo.mapInfo.left * stateInfo.imageScaler); let centerY = ((stateInfo.mapInfo.maxTop - stateInfo.mapInfo.centerX) * stateInfo.mapScaler) + (stateInfo.mapInfo.top * stateInfo.imageScaler); // reuse lerp to scale the pixel to map ratio currentX = lerp(centerX, currentX, stateInfo.mapInfo.scaler); currentY = lerp(centerY, currentY, stateInfo.mapInfo.scaler); drawCircle(ctx, currentX, currentY, teamColor); drawTriangle(ctx, { x: currentX, y: currentY }, { x: currentX + firstVertex.x, y: currentY + firstVertex.y }, { x: currentX + secondVertex.x, y: currentY + secondVertex.y }, fovColor); drawText(ctx, currentX, currentY - (textOffset * stateInfo.imageScaler), value.name, 16, 'white', teamColor, 'center') }); const completedIcons = []; for (let key in stateInfo.deathIcons) { const icon = stateInfo.deathIcons[key]; const x = ((stateInfo.mapInfo.maxLeft - icon.location.y) * stateInfo.mapScaler) + (stateInfo.mapInfo.left * stateInfo.imageScaler); const y = ((stateInfo.mapInfo.maxTop - icon.location.x) * stateInfo.mapScaler) + (stateInfo.mapInfo.top * stateInfo.imageScaler); const elapsedFrameTime = now - icon.animationTime; const completionPercent = elapsedFrameTime / stateInfo.deathIconTime; const opacity = easeLerp(1, 0, completionPercent); drawImage(stateInfo.ctx, 'hud_death', x, y, opacity); if (completionPercent >= 1) { completedIcons.push(key); } } for (let i = 0; i < completedIcons.length; i++) { delete stateInfo.deathIcons[completedIcons[i]]; } window.requestAnimationFrame(updateMap); } $(document).ready(function () { $.getJSON('@Url.Action("Map", "Radar", new { serverId = ViewBag.ActiveServerId })', function (_map) { stateInfo.mapInfo = _map; updateRadarData(); setInterval(updateRadarData, stateInfo.updateFrequency); window.requestAnimationFrame(updateMap); }); }) </script> }
the_stack
@model WebApp.Models.Employee @{ ViewBag.Title = "员工信息"; } <!-- MAIN CONTENT --> <div id="content"> <!-- quick navigation bar --> <div class="row"> <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4"> <h1 class="page-title txt-color-blueDark"> <i class="fa fa-table fa-fw "></i> 组织架构 <span> > 员工信息 </span> </h1> </div> <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8"> </div> </div> <!-- end quick navigation bar --> <!-- widget grid --> <section id="widget-grid" class=""> <!-- row --> <div class="row"> <!-- NEW WIDGET START --> <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <!-- Widget ID (each widget will need unique ID)--> <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false" data-widget-deletebutton="false"> <!-- widget options: usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false"> data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-collapsed="true" data-widget-sortable="false" --> <header> <span class="widget-icon"> <i class="fa fa-table"></i> </span> <h2>员工信息</h2> </header> <!-- widget div--> <div> <!-- widget edit box --> <div class="jarviswidget-editbox"> <!-- This area used as dropdown edit box --> </div> <!-- end widget edit box --> <!-- widget content --> <div class="widget-body no-padding"> <div id="fakeLoader"></div> <div class="widget-body-toolbar"> <div class="row"> <div class="col-sm-8 "> <!-- 开启授权控制请参考 @@if (Html.IsAuthorize("Create") --> <div class="btn-group btn-group-sm"> <button onclick="append()" class="btn btn-default"> <i class="fa fa-plus"></i> 新增 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="removeit()" class="btn btn-default"> <i class="fa fa-trash-o"></i> 删除 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="accept()" class="btn btn-default"> <i class="fa fa-floppy-o"></i> 保存 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="reload()" class="btn btn-default"> <i class="fa fa-refresh"></i> 刷新 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="reject()" class="btn btn-default"> <i class="fa fa-ban"></i> 取消 </button> </div> <div class="btn-group btn-group-sm"> <button type="button" onclick="importexcel()" class="btn btn-default"><i class="fa fa-cloud-upload"></i> 导入数据 </button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span> <span class="sr-only">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> <li><a href="javascript:importexcel()"><i class="fa fa-file-excel-o"></i> 上传Excel </a></li> <li role="separator" class="divider"></li> <li><a href="javascript:downloadtemplate()"><i class="fa fa-download"></i> 下载模板 </a></li> </ul> </div> <div class="btn-group btn-group-sm"> <button onclick="exportexcel()" class="btn btn-default"> <i class="fa fa-file-excel-o"></i> 导出Excel </button> </div> <div class="btn-group btn-group-sm"> <button onclick="print()" class="btn btn-default"> <i class="fa fa-print"></i> 打印 </button> </div> <div class="btn-group btn-group-sm"> <button onclick="dohelp()" class="btn btn-default"> <i class="fa fa-question-circle-o"></i> 帮助 </button> </div> </div> <div class="col-sm-4 text-align-right"> <div class="btn-group btn-group-sm"> <button onclick="window.history.back()" class="btn btn-sm btn-success"> <i class="fa fa-chevron-left"></i> 返回 </button> </div> </div> </div> </div> <div class="alert alert-warning no-margin fade in"> <button class="close" data-dismiss="alert"> × </button> <i class="fa-fw fa fa-info"></i> 注意事项: </div> <!--begin datagrid-content --> <div class="table-responsive"> <table id="employees_datagrid"> </table> </div> <!--end datagrid-content --> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <!-- end widget --> </article> <!-- WIDGET END --> </div> <!-- end row --> </section> <!-- end widget grid --> <!-- file upload partial view --> @Html.Partial("_ImportWindow",new ViewDataDictionary {{ "EntityName","Employee" }}) <!-- end file upload partial view --> <!-- detail popup window --> @Html.Partial("_PopupDetailFormView",new WebApp.Models.Employee()) <!-- end detail popup window --> </div> <!-- END MAIN CONTENT --> @section Scripts { <script type="text/javascript"> //是否启用弹窗口模式新增编辑数据 const POPUPMODE = false; //是否强制从后台取值 const REQUIRBACKEND = false; //是否开启行内编辑 const EDITINLINE = false; //上传导入参数设定 const entityname = "Employee"; var employee = {}; //下载Excel导入模板 function downloadtemplate() { //默认模板路径存放位置 var url = "/FileUpload/Download?file=/ExcelTemplate/Employee.xlsx"; $.fileDownload(url) .done(() => { //console.log('file download a success!'); }) .fail(() => { $.messager.alert("错误","没有下载到导入模板[Employee.xlsx]文件!","error"); }); } //打印 function print() { $dg.datagrid('print', 'DataGrid'); } //打开Excel上传窗口 function importexcel() { $("#importwindow").window("open"); } //执行导出下载Excel function exportexcel() { var filterRules = JSON.stringify($dg.datagrid("options").filterRules); //console.log(filterRules); $.messager.progress({ title: "正在执行导出!" }); var formData = new FormData(); formData.append("filterRules", filterRules); formData.append("sort", "Id"); formData.append("order", "asc"); $.postDownload("/Employees/ExportExcel", formData).then(res => { $.messager.progress("close"); }).catch(err => { //console.log(err); $.messager.progress("close"); $.messager.alert("错误", err.statusText, "error"); }); } //显示帮助信息 function dohelp() { $.bigBox({ title: "帮助信息", content: "如有问题请联系系统管理员", color: "#3276B1", timeout: 5000, icon: "fa fa-question swing animated" }); } var editIndex = undefined; //选中记录 function onSelect(index, row) { employee = row; } //重新加载数据 function reload() { if (endEditing()) { $dg.datagrid("reload"); //$dg.datagrid("uncheckAll"); //$dg.datagrid("unselectAll"); } } //关闭编辑状态 function endEditing() { if (editIndex === undefined) { return true; } if ($dg.datagrid("validateRow", editIndex)) { var ed = $dg.datagrid("getEditor", { index: editIndex, field: "CompanyId" }); var companyname = $(ed.target).combobox("getText"); var companyid = $(ed.target).combobox("getValue"); $dg.datagrid("getRows")[editIndex]["CompanyName"] = companyname; $dg.datagrid("getRows")[editIndex]["CompanyId"] = companyid; $dg.datagrid("endEdit", editIndex); editIndex = undefined; return true; } else { return false; } } //单击列开启编辑功能 function onClickCell(index, field) { employee = $dg.datagrid('getRows')[index]; var _operates = ["_operate1", "_operate2", "_operate3", "ck"]; if (!EDITINLINE || $.inArray(field, _operates) >= 0) { return; } if (editIndex !== index) { if (endEditing()) { $dg.datagrid("selectRow", index) .datagrid("beginEdit", index); hook = true; editIndex = index; var ed = $dg.datagrid("getEditor", { index: index, field: field }); if (ed) { ($(ed.target).data("textbox") ? $(ed.target).textbox("textbox") : $(ed.target)).focus(); } } else { $dg.datagrid("selectRow", editIndex); } } } //新增记录 function append() { if (POPUPMODE) { //弹出新增窗口 showPopupCreateWindow(); } else { if (endEditing()) { //对必填字段进行默认值初始化 $dg.datagrid("insertRow", { index: 0, row: { } }); editIndex = 0; $dg.datagrid("selectRow", editIndex) .datagrid("beginEdit", editIndex); hook = true; } } } //删除编辑的行 function removeit() { if($dg.datagrid("getChecked").length > 0 ){ deletechecked(); } else { if (editIndex !== undefined) { $dg.datagrid("cancelEdit", editIndex) .datagrid("deleteRow", editIndex); editIndex = undefined; hook = true; } } } //删除选中的行 function deletechecked() { var rows = $dg.datagrid("getChecked"); if (rows.length > 0) { var id = rows.map(item => { return item.Id; }); $.messager.confirm("确认", "你确定要删除这些记录?", result => { if (result) { $.post("/Employees/DeleteCheckedAsync", { id: id }) .done(response => { if (response.success) { reload(); } else { $.messager.alert("错误", response.err,"error"); } }) .fail((jqXHR, textStatus, errorThrown) => { //console.log(errorThrown); $.messager.alert("错误", "提交错误了!" + errorThrown,"error"); }); } }); } else { $.messager.alert("提示", "请先选择要删除的记录!","question"); } } //提交保存后台数据库 function accept() { if (endEditing()) { if ($dg.datagrid("getChanges").length) { var inserted = $dg.datagrid("getChanges", "inserted"); var deleted = $dg.datagrid("getChanges", "deleted"); var updated = $dg.datagrid("getChanges", "updated"); var item = new Object(); if (inserted.length) { item.inserted = inserted; } if (deleted.length) { item.deleted = deleted; } if (updated.length) { item.updated = updated; } //console.log(JSON.stringify(item)); $.post("/Employees/SaveDataAsync", item) .done(response => { //console.log(response); if (response.success) { $.messager.alert("提示", "保存成功!","info"); $dg.datagrid("acceptChanges"); $dg.datagrid("reload"); hook = false; } else { $.messager.alert("错误", response.err ,"error"); } }) .fail((jqXHR, textStatus, errorThrown) => { //console.log(errorThrown); $.messager.alert("异常", errorThrown,"error"); }); } } } function reject() { $dg.datagrid("rejectChanges"); editIndex = undefined; } function getChanges() { var rows = $dg.datagrid("getChanges"); //console.log(rows.length + " rows are changed!"); } //弹出明细信息 function showDetailsWindow(id,row,index) { if (REQUIRBACKEND) { //console.log(index, row); $.get("/Employees/PopupEditAsync/" + id) .done(data => { //console.log(data); loadData(id,data); }) .fail((jqXHR, textStatus, errorThrown) => { $.messager.alert("错误", "获取数据异常!" + errorThrown,"error"); }); } else { loadData(id, JSON.parse(row)); } } //弹出新建窗口 function showPopupCreateWindow() { //获取初始化对象 if (REQUIRBACKEND) { $.get("/Employees/PopupCreate") .done(data => { loadData(-1,data); }) .fail((jqXHR, textStatus, errorThrown) => { $.messager.alert("错误", "初始化对象异常!" + errorThrown, "error"); }); } else { var item = { }; loadData(-1, item); } } //初始化定义datagrid var $dg = $("#employees_datagrid"); $(() => { //定义datagrid结构 $dg.datagrid({ rownumbers:true, checkOnSelect:true, selectOnCheck:true, idField:'Id', sortName:'Id', sortOrder:'desc', remoteFilter: true, singleSelect: true, onSelect: onSelect, url: '/Employees/GetDataAsync', method: 'get', onClickCell: onClickCell, pagination: true, striped:true, columns: [[ /*开启CheckBox选择功能*/ /*{ field: 'ck', checkbox: true },*/ { field: '_operate1', title:'操作', width: 60, sortable: false, resizable: true, formatter: function showdetailsformatter(value, row, index) { if(row.Id > 0){ return '<button onclick="showDetailsWindow(\'' + row.Id + '\',\'' + JSON.stringify(row).replace(/\"/g, '&quot;') + '\',' + index +')" class="btn btn-default btn-xs" title="查看明细" ><i class="fa fa-pencil-square-o"></i> </button>'; } else { return '<button class="btn btn-default btn-xs" disabled title="查看明细" ><i class="fa fa-pencil-square-o"></i> </button>'; } } }, /*{field:'Id',width:80 ,sortable:true,resizable:true }*/ { field:'Name', title:'<span class="required">@Html.DisplayNameFor(model => model.Name)</span>', width:140, editor:{ type:'textbox', options:{ prompt:'@Html.DisplayNameFor(model => model.Name)',required:true ,validType:'length[0,20]' } }, sortable:true, resizable:true }, { field:'Title', title:'@Html.DisplayNameFor(model => model.Title)', width:140, editor:{ type:'textbox', options:{ prompt:'@Html.DisplayNameFor(model => model.Title)',required:false ,validType:'length[0,30]' } }, sortable:true, resizable:true }, { field:'Sex', title:'<span class="required">@Html.DisplayNameFor(model => model.Sex)</span>', width:140, editor:{ type:'textbox', options:{ prompt:'@Html.DisplayNameFor(model => model.Sex)',required:true ,validType:'length[0,10]' } }, sortable:true, resizable:true }, { field:'Age', title:'<span class="required">@Html.DisplayNameFor(model => model.Age)</span>', width:100, align:'right', editor:{ type:'numberbox', options:{prompt:'@Html.DisplayNameFor(model => model.Age)', required:true ,precision:0 } }, formatter:numberformatter, sortable:true, resizable:true }, { field:'Brithday', title:'<span class="required">@Html.DisplayNameFor(model => model.Brithday)</span>', width:120, align:'right', editor:{ type:'datebox', options:{prompt:'@Html.DisplayNameFor(model => model.Brithday)',required:true} }, formatter:dateformatter, sortable:true, resizable:true } , { field:'IsDeleted', title:'<span class="required">@Html.DisplayNameFor(model => model.IsDeleted)</span>', width:100, align:'right', editor:{ type:'numberbox', options:{prompt:'@Html.DisplayNameFor(model => model.IsDeleted)', required:true ,precision:0 } }, formatter:numberformatter, sortable:true, resizable:true }, { field:'CompanyId', title:'<span class="required">@Html.DisplayNameFor(model => model.CompanyId)</span>', width:160, sortable:true, resizable:true, formatter:(value,row) => { return row.CompanyName; }, editor:{ type:'combobox', options:{ prompt:'@Html.DisplayNameFor(model => model.CompanyId)' , mode: 'remote', valueField:'Id', textField:'Name', method:'get', url:'/Employees/GetCompaniesAsync', required:true } } }, ]] }); $dg.datagrid("enableFilter",[ { field: "Id", type: "numberbox", op:['equal','notequal','less','lessorequal','greater','greaterorequal'] }, { field: "Age", type: "numberbox", op:['equal','notequal','less','lessorequal','greater','greaterorequal'] }, { field: "IsDeleted", type: "numberbox", op:['equal','notequal','less','lessorequal','greater','greaterorequal'] }, { field: "Brithday", type: "dateRange", options: { onChange: value => { $dg.datagrid("addFilterRule", { field: "Brithday", op: "between", value: value }); $dg.datagrid("doFilter"); } } }, { field: "CompanyId", type:"combobox", options:{ valueField:"Id", textField:"Name", method:"get", url:"/Employees/GetCompaniesAsync", onChange: value => { if (value === "" || value === null) { $dg.datagrid("removeFilterRule", "CompanyId"); } else { $dg.datagrid("addFilterRule", { field: "CompanyId", op: "equal", value: value }); } $dg.datagrid("doFilter"); } } }, ]); }); </script> <!--begin popup detailview javascript block --> <script type="text/javascript"> //load data by key var employeeid = 0; function loadData(id,data) { $("#detailswindow").window("open"); employeeid = id; $('#employee_form').form('load', data); } var $editform = $('#employee_form'); // save item function saveitem() { if ($editform.form('enableValidation').form('validate')) { var employee = $editform.serializeJSON(); var url = '/Employees/EditAsync'; //判断是新增或是修改方法 if (employee.Id <= 0 || employee.Id === null || employee.Id === '') { url = '/Employees/CreateAsync'; } var token = $('input[name="__RequestVerificationToken"]', $editform).val(); $.ajax({ type: "POST", url: url, data: { __RequestVerificationToken: token, employee:employee }, dataType: 'json', contentType: 'application/x-www-form-urlencoded; charset=utf-8' }) .done(response => { if (response.success) { $dg.datagrid('reload'); $.messager.alert("提示", "保存成功!","info"); $('#detailswindow').window("close"); } else { $.messager.alert("错误", response.err, "error"); } }) .fail((jqXHR, textStatus, errorThrown) => { $.messager.alert("异常", errorThrown,"error"); }); } } // close window function closewindow() { $('#detailswindow').window('close'); } // print form function printitem() { console.log('print.....'); } </script> <!--end popup detailview javascript block --> <script src="~/Scripts/jquery.filerupload.min.js"></script> }
the_stack
@model Sheng.WeixinConstruction.Management.Shell.Models.ShakingLotteryGiftEditViewModel @{ ViewBag.Title = "ShakingLotteryGiftEdit"; Layout = "~/Views/Shared/_LayoutBlank.cshtml"; } <script> var _mode = "create";//modify var _validator; var _campaignId = getQueryString("campaignId"); var _id = getQueryString("id"); //Gift $(document).ready(function () { $("[keyenter]").keypress(function (e) { if (e.keyCode == 13) { save(); } }); _validator = $("#form").validate({ onfocusout: false, onkeyup: false, showErrors: showValidationErrors, rules: { "txtName": "required", //"txtImageUrl": "required", "txtProbability": { required: true, number: true, digits: true, range: [0, 1000] }, "txtStock": { required: true, number: true, digits: true, range: [0, 10000] } }, messages: { "txtName": "请输入名称;", //"txtImageUrl": "请上传奖品图片;", "txtProbability": { required: "请输入概率数;", number: "概率数请输入有效整数字;", digits: "概率数请输入有效整数字;", range: "概率数请介于 0 到 1000 之间;" }, "txtStock": { required: "请输入库存;", number: "库存请输入有效整数字;", digits: "库存请输入有效整数字;", range: "库存请介于 0 到 10000 之间;" } } }); loadData(); }); function loadData() { if (_id == undefined || _id == "") { return; } _mode = "modify"; $("#btnRemove").show(); var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); $.ajax({ url: "/Api/Campaign/GetShakingLotteryGift?id=" + _id, type: "POST", dataType: "json", success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var gift = data.Data; $("#txtId").val(gift.Id); $("#txtName").val(gift.Name); $("#txtStock").val(gift.Stock); $("#txtImageUrl").val(gift.ImageUrl); $("#selectIsGift").find("option[value='" + gift.IsGift + "']").attr("selected", true); $("#txtProbability").val(gift.Probability); @if (Model.CampaignBundle.ShakingLottery.Mode == Sheng.WeixinConstruction.Infrastructure.EnumCampaign_ShakingLotteryMode.Period) { <text> $("#selectPeriod").find("option[value='" + gift.Period + "']").attr("selected", true); </text> } loadImage(); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); alert("Error: " + xmlHttpRequest.status); } }); } function save() { if (_validator.form() == false) { return; } var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); var gift = new Object(); gift.CampaignId = _campaignId; gift.Name = $("#txtName").val(); gift.Stock = $("#txtStock").val(); gift.ImageUrl = $("#txtImageUrl").val(); gift.IsGift = $("#selectIsGift").val(); gift.Probability = $("#txtProbability").val(); @if (Model.CampaignBundle.ShakingLottery.Mode == Sheng.WeixinConstruction.Infrastructure.EnumCampaign_ShakingLotteryMode.Period) { <text> gift.Period = $("#selectPeriod").val(); </text> } var url = "/Api/Campaign/CreateShakingLotteryGift"; if (_mode == "modify") { gift.Id = $("#txtId").val(); url = "/Api/Campaign/UpdateShakingLotteryGift"; } $.ajax({ url: url, type: "POST", dataType: "json", data: JSON.stringify(gift), success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { var index = parent.layer.getFrameIndex(window.name); // parent.layer.close(index); if (_mode == "create") { parent.loadDataAndCloseLayer(index); } else { parent.loadDataOnPageAndCloseLayer(index); } } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); alert("Error: " + xmlHttpRequest.status); } }); } function removeData() { var id = $("#txtId").val(); if (id == undefined || id == "") { return; } var msg = "是否确认删除?<br/>删除奖品时会连同已中得该奖品的中奖记录一并删除!" var confirmLayerIndex = layer.confirm(msg, { btn: ['确认', '取消'], //按钮 shade: [0.4, '#393D49'], title: false, closeBtn: false, shift: _layerShift }, function () { layer.close(confirmLayerIndex); var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); $.ajax({ url: "/Api/Campaign/RemoveShakingLotteryGift?id=" + id, type: "POST", dataType: "json", success: function (data, status, jqXHR) { if (data.Success) { var index = parent.layer.getFrameIndex(window.name); parent.loadDataOnPageAndCloseLayer(index); } else { layer.closeAll(); layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.closeAll(); alert("Error: " + xmlHttpRequest.status); } }); }); } function changePage(url) { window.location.href = url + "?campaignId=" + _campaignId + "&id=" + _id; } function cancel() { var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 parent.layer.close(index); //再执行关闭 } function loadImage() { $("#image").attr("src", $("#txtImageUrl").val()); } function uploadFile() { __showFileUpload(getUploadResult); } function getUploadResult(fileServiceAddress, result) { var url = fileServiceAddress + result.Data.StoreFilePath; $("#txtImageUrl").val(url); loadImage(); } function removeImage() { $("#txtImageUrl").val(""); loadImage(); } </script> <div style="margin-left:20px; margin-right:20px; margin-top:20px;"> <span id="spanTitle" class="font_black_24">奖品</span> </div> <div style=" background-color:#ccc; margin-left:20px; margin-right:20px; margin-top:10px; height:1px;"> </div> <div style=" position:absolute; overflow:auto ;margin-top:25px;left:30px; right:30px; bottom:60px; top:50px; "> <form id="form"> <input type="hidden" id="txtId"/> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="36">中奖:</td> <td> <select id="selectIsGift" name="selectIsGift" class="input_16" style="width:200px;"> <option value="true">是</option> <option value="false">否</option> </select> </td> </tr> <tr> <td></td> <td valign="top"> <div class="font_gray_13" style="width: 96%; margin-bottom: 10px;"> 选择否表示此项目为没有中奖,可在概率数中指定没有中奖的概率。如果在活动中(或周期模式的周期中)没有设置为“否”的特殊“奖品”, 则相当于摇奖必中(在有库存的情况下)。 </div> </td> </tr> <tr> <td width="110" height="36">名称:</td> <td><input id="txtName" name="txtName" type="text" class="input_16" maxlength="50" style="width:96%; " /></td> </tr> @if (Model.CampaignBundle.ShakingLottery.Mode == Sheng.WeixinConstruction.Infrastructure.EnumCampaign_ShakingLotteryMode.Period) { <tr> <td width="110" height="36">所属周期:</td> <td> <select id="selectPeriod" name="selectPeriod" class="input_16" style="width:96%; "> <option value="" selected></option> @foreach (var item in Model.PeriodList) { <option value="@item.Id">@item.Name</option> } </select> </td> </tr> } <tr> <td height="36">库存:</td> <td><input id="txtStock" name="txtStock" type="text" class="input_16" maxlength="4" style="width:96%; " /></td> </tr> <tr> <td valign="top"> <div style="margin-top:5px;"> 图片: </div> </td> <td valign="top"> <div class="divBorder_gray" style="margin-bottom:5px;width:96%;"> <div style="padding:5px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="120"><img id="image" src="" alt="" style="max-width:300px;" /></td> <td align="right"> <input id="txtImageUrl" name="txtImageUrl" type="hidden" class="input_16" style="width:96%; " maxlength="500" keyenter /> <a href="javascript:void(0)" onclick="uploadFile()">上传新图片</a><br /> <a href="javascript:void(0)" onclick="removeImage()">删除图片</a> </td> </tr> </table> </div> </div> </td> </tr> <tr> <td height="36">概率数:</td> <td><input id="txtProbability" name="txtProbability" type="text" class="input_16" maxlength="4" style="width:96%; " /></td> </tr> <tr> <td></td> <td valign="top"> <div class="font_gray_13" style="width: 96%; margin-bottom: 10px;"> 输入一个整数表示此奖品的中奖概率分数,分母为所有奖品的概率数之和。 </div> </td> </tr> </table> </form> </div> <div style=" background-color:#ccc; position:absolute; bottom:55px; left:20px;right:20px; height:1px;"> </div> <div style="position:absolute; bottom:15px; left:20px;right:20px;"> <div style="float:left;"> <input name="btnRemove" type="button" class="btn_red" id="btnRemove" value="删 除" style="display:none" onclick="removeData()" /> </div> <div style="float:right"> <input name="btnSave" type="button" class="btn_blue" id="btnSave" value="保 存" onclick="save()" /> <input name="btnCancel" type="button" class="btn_blue" id="btnCancel" value="取 消" onclick="cancel()" /> </div> <div style="clear:both"> </div> </div> @Helpers.FileUpload()
the_stack
@{ Layout = "_LayoutH"; @model Wms_material } <div id="app" v-cloak> <form class="form-horizontal" onsubmit="return false"> <div class="box-body"> <div class="form-group"> <label class="col-sm-2 control-label">物料编号</label> <div class="col-sm-10"> <input class="form-control" v-model="MaterialNo" v-focus type="text"> </div> </div> @*<div class="form-group"> <label class="col-sm-2 control-label">物料名称</label> <div class="col-sm-10"> <input class="form-control" v-model="MaterialName" type="text"> </div> </div>*@ <yl-input lable="物料名称" v-model="MaterialName"></yl-input> @await Component.InvokeAsync("Dict", YL.Utils.Pub.PubDictType.material.ToString()) @await Component.InvokeAsync("Dict", YL.Utils.Pub.PubDictType.unit.ToString()) @await Component.InvokeAsync("Warehouse") <div class="form-group"> <label class="form-label col-sm-2">所属库区</label> <div class="col-sm-10"> <select class="form-control" v-model="ReservoirAreaId" size="1"> <option value="">请选择</option> <template v-for="item in rlist"> <option :value="item.value">{{item.name}}</option> </template> </select> </div> </div> <div class="form-group"> <label class="form-label col-sm-2">所属货架</label> <div class="col-sm-10"> <select class="form-control" v-model="StoragerackId" size="1"> <option value="">请选择</option> <template v-for="item in slist"> <option :value="item.value">{{item.name}}</option> </template> </select> </div> </div> <yl-input lable="安全库存" id="Qty" v-model="Qty"></yl-input> <yl-input lable="有效期(天)" id="ExpiryDate" v-model="ExpiryDate"></yl-input> @*<div class="form-group"> <label class="col-sm-2 control-label">有效期(天)</label> <div class="col-sm-10"> <input class="form-control" id="ExpiryDate" v-model="ExpiryDate" type="text"> </div> </div>*@ <div class="form-group"> <label class="col-sm-2 control-label">备注</label> <div class="col-sm-10"> <textarea v-model.trim="Remark" class="form-control" rows="3" placeholder="备注...100个字符以内"></textarea> <p class="textarea-numberbar"><em class="textarea-length">{{count}}</em>/100</p> </div> </div> </div> <div class="box-footer"> <div class="pull-right box-tools"> <input v-on:click="addL" class="btn btn-primary radius" type="submit" v-model="submit"> </div> </div> </form> </div> @section scripts{ <script type="text/x-template" id="yl-select"> <div class="form-group"> <label class="form-label col-sm-2">{{lable}}</label> <div class="col-sm-10"> <select class="form-control" v-bind:value="value" v-on="inputListeners" size="1"> <option value="">{{option}}</option> <template v-for="item in list"> <option :value="item.value">{{item.name}}</option> </template> </select> </div> </div> </script> <script type="text/x-template" id="yl-input"> <div class="form-group"> <label class="form-label col-sm-2">{{lable}}</label> <div class="col-sm-10"> <input :id="id" class="form-control" type="text" v-bind:value="value" v-on="inputListeners"> </div> </div> </script> <script> //v-on:input="$emit('input', $event.target.value)" var app = new Vue({ el: "#app", data: { submit: "添加", Remark: "@Model.Remark", MaterialId:"@Model.MaterialId", MaterialNo:"@Model.MaterialNo", MaterialName: "@Model.MaterialName", MaterialType: "@Model.MaterialType", Unit: "@Model.Unit", Qty: "@Model.Qty", ExpiryDate: "@Model.ExpiryDate", WarehouseId: "@Model.WarehouseId", ReservoirAreaId: "@Model.ReservoirAreaId", StoragerackId:"@Model.StoragerackId", rlist: [],//库区 slist: []//货架 }, computed: { count: function () { return this.strLength(this.Remark, false); } }, watch: { WarehouseId: function () { var _self = this; _self.loadL(_self.WarehouseId,1); }, ReservoirAreaId: function () { var _self = this; _self.loadL(_self.ReservoirAreaId,2); }, Qty: function () { var _self = this; if (!yui.isRealNum2(_self.Qty)) { layer.tips('请输入正整数', '#Qty', { tips: [1, '#78BA32'] }); _self.Qty = ""; } }, ExpiryDate: function () { var _self = this; if (!yui.isRealNum2(_self.ExpiryDate)) { layer.tips('请输入正整数', '#ExpiryDate', { tips: [1, '#78BA32'] }); _self.ExpiryDate = ""; } } }, mounted: function () { var _self = this; _self.$nextTick(function () { if (_self.WarehouseId.length > 1) { _self.loadL(_self.WarehouseId, 1); } if (_self.ReservoirAreaId.length > 1) { //console.info(_self.ReservoirAreaId); _self.loadL(_self.ReservoirAreaId, 2); } }); }, methods: { loadL: function (id,type) { var _self = this; if (type === 1) { yui.$axiosget('/StorageRack/GetReservoirarea2?id=' + id).then(function (response) { _self.rlist = response.data; }); } else { yui.$axiosget('/StorageRack/GetStoragerack?id=' + id).then(function (response) { _self.slist = response.data; }); } }, addL: function () { var _self = this; if (_self.MaterialNo.length <= 0) { layer.msg("物料编号不能为空", { icon: 2 }); return false; } if (_self.MaterialName.length <= 0) { layer.msg("物料名称不能为空", { icon: 2 }); return false; } if (_self.MaterialType.length <= 0) { layer.msg("请选择物料分类", { icon: 2 }); return false; } if (_self.Unit.length <= 0) { layer.msg("请选择单位类别", { icon: 2 }); return false; } if (_self.WarehouseId.length <= 0) { layer.msg("请选择仓库", { icon: 2 }); return false; } if (_self.ReservoirAreaId.length <= 0) { layer.msg("请选择库区", { icon: 2 }); return false; } if (_self.StoragerackId.length <= 0) { layer.msg("请选择货架", { icon: 2 }); return false; } if (_self.Qty.length <= 0 || _self.Qty<=0) { layer.msg("安全库存必须大于0", { icon: 2 }); return false; } if (_self.ExpiryDate.length <= 0 || _self.ExpiryDate <= 0) { layer.msg("有效期天数必须大于0", { icon: 2 }); return false; } var index = layer.load(1, { shade: [0.1, '#fff'] //0.1透明度的白色背景 }); var data = { id: _self.MaterialId, MaterialNo: _self.MaterialNo, MaterialName: _self.MaterialName, MaterialType: _self.MaterialType, Unit: _self.Unit, WarehouseId: _self.WarehouseId, ReservoirAreaId: _self.ReservoirAreaId, StoragerackId: _self.StoragerackId, Remark: _self.Remark, Qty: _self.Qty, ExpiryDate: _self.ExpiryDate }; yui.$axiospostform('/Material/AddOrUpdate', data) .then(function (response) { if (response.data.Item1 === 101) { layer.tips(response.data.Item2, '.layui-layer-setwin', { tips: [1, '#3595CC'], time: 3000 }); layer.close(index); return false; } if (response.data.Item1) { layer.msg(response.data.Item2, { icon: 1, time: 1000 }); setTimeout(function () { yui.layer_close3(); }, 500); } else { layer.msg(response.data.Item2 || errorMsg, { icon: 5 }); } layer.close(index); }) .catch(function (error) { layer.close(index); }); } } }); </script> }
the_stack
$(function() { // Helper function for vertically aligning DOM elements // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ $.fn.vAlign = function() { return this.each(function(i){ var ah = $(this).height(); var ph = $(this).parent().height(); var mh = (ph - ah) / 2; $(this).css('margin-top', mh); }); }; $.fn.stretchFormtasticInputWidthToParent = function() { return this.each(function(i){ var p_width = $(this).closest("form").innerWidth(); var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10); var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10); $(this).css('width', p_width - p_padding - this_padding); }); }; $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent(); // Vertically center these paragraphs // Parent may need a min-height for this to work.. $('ul.downplayed li div.content p').vAlign(); // When a sandbox form is submitted.. $("form.sandbox").submit(function(){ var error_free = true; // Cycle through the forms required inputs $(this).find("input.required").each(function() { // Remove any existing error styles from the input $(this).removeClass('error'); // Tack the error style on if the input is empty.. if ($(this).val() == '') { $(this).addClass('error'); $(this).wiggle(); error_free = false; } }); return error_free; }); }); function clippyCopiedCallback(a) { $('#api_key_copied').fadeIn().delay(1000).fadeOut(); // var b = $("#clippy_tooltip_" + a); // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() { // b.attr("title", "copy to clipboard") // }, // 500)) } // Logging function that accounts for browsers that don't have window.console function log() { if (window.console) console.log.apply(console,arguments); } // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913) if (Function.prototype.bind && console && typeof console.log == "object") { [ "log","info","warn","error","assert","dir","clear","profile","profileEnd" ].forEach(function (method) { console[method] = this.bind(console[method], console); }, Function.prototype.call); } var Docs = { shebang: function() { // If shebang has an operation nickname in it.. // e.g. /docs/#!/words/get_search var fragments = $.param.fragment().split('/'); fragments.shift(); // get rid of the bang switch (fragments.length) { case 1: // Expand all operations for the resource and scroll to it // log('shebang resource:' + fragments[0]); var dom_id = 'resource_' + fragments[0]; Docs.expandEndpointListForResource(fragments[0]); $("#"+dom_id).slideto({highlight: false}); break; case 2: // Refer to the endpoint DOM element, e.g. #words_get_search // log('shebang endpoint: ' + fragments.join('_')); // Expand Resource Docs.expandEndpointListForResource(fragments[0]); $("#"+dom_id).slideto({highlight: false}); // Expand operation var li_dom_id = fragments.join('_'); var li_content_dom_id = li_dom_id + "_content"; // log("li_dom_id " + li_dom_id); // log("li_content_dom_id " + li_content_dom_id); Docs.expandOperation($('#'+li_content_dom_id)); $('#'+li_dom_id).slideto({highlight: false}); break; } }, toggleEndpointListForResource: function(resource) { var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints'); if (elem.is(':visible')) { Docs.collapseEndpointListForResource(resource); } else { Docs.expandEndpointListForResource(resource); } }, // Expand resource expandEndpointListForResource: function(resource) { var resource = Docs.escapeResourceName(resource); if (resource == '') { $('.resource ul.endpoints').slideDown(); return; } $('li#resource_' + resource).addClass('active'); var elem = $('li#resource_' + resource + ' ul.endpoints'); elem.slideDown(); }, // Collapse resource and mark as explicitly closed collapseEndpointListForResource: function(resource) { var resource = Docs.escapeResourceName(resource); $('li#resource_' + resource).removeClass('active'); var elem = $('li#resource_' + resource + ' ul.endpoints'); elem.slideUp(); }, expandOperationsForResource: function(resource) { // Make sure the resource container is open.. Docs.expandEndpointListForResource(resource); if (resource == '') { $('.resource ul.endpoints li.operation div.content').slideDown(); return; } $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { Docs.expandOperation($(this)); }); }, collapseOperationsForResource: function(resource) { // Make sure the resource container is open.. Docs.expandEndpointListForResource(resource); $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { Docs.collapseOperation($(this)); }); }, escapeResourceName: function(resource) { return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@@\[\\\]\^`{|}~]/g, "\\$&"); }, expandOperation: function(elem) { elem.slideDown(); }, collapseOperation: function(elem) { elem.slideUp(); } }; (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0; function program1(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.produces; stack1 = foundHelper || depth0.produces; stack2 = helpers.each; tmp1 = self.program(2, program2, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.noop; stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n"; return buffer;} function program2(depth0,data) { var buffer = "", stack1; buffer += "\n <option value=\""; stack1 = depth0; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "this", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\">"; stack1 = depth0; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "this", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</option>\n "; return buffer;} function program4(depth0,data) { return "\n <option value=\"application/json\">application/json</option>\n";} buffer += "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n"; foundHelper = helpers.produces; stack1 = foundHelper || depth0.produces; stack2 = helpers['if']; tmp1 = self.program(1, program1, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(4, program4, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n</select>\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; function program1(depth0,data) { var buffer = "", stack1; buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: "; foundHelper = helpers.apiVersion; stack1 = foundHelper || depth0.apiVersion; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "apiVersion", { hash: {} }); } buffer += escapeExpression(stack1) + "\n "; return buffer;} buffer += "\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "; foundHelper = helpers.basePath; stack1 = foundHelper || depth0.basePath; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "basePath", { hash: {} }); } buffer += escapeExpression(stack1) + "\n "; foundHelper = helpers.apiVersion; stack1 = foundHelper || depth0.apiVersion; stack2 = helpers['if']; tmp1 = self.program(1, program1, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.noop; stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "]</h4>\n </div>\n</div>\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; function program1(depth0,data) { var buffer = "", stack1; buffer += "\n <h4>Implementation Notes</h4>\n <p>"; foundHelper = helpers.notes; stack1 = foundHelper || depth0.notes; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "notes", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</p>\n "; return buffer;} function program3(depth0,data) { return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"content-type\" />\n ";} function program5(depth0,data) { return "\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n ";} function program7(depth0,data) { return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Error Status Codes</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";} function program9(depth0,data) { return "\n ";} function program11(depth0,data) { return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n ";} buffer += "\n <ul class='operations' >\n <li class='"; foundHelper = helpers.httpMethod; stack1 = foundHelper || depth0.httpMethod; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); } buffer += escapeExpression(stack1) + " operation' id='"; foundHelper = helpers.resourceName; stack1 = foundHelper || depth0.resourceName; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.nickname; stack1 = foundHelper || depth0.nickname; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.httpMethod; stack1 = foundHelper || depth0.httpMethod; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.number; stack1 = foundHelper || depth0.number; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); } buffer += escapeExpression(stack1) + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"; foundHelper = helpers.resourceName; stack1 = foundHelper || depth0.resourceName; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); } buffer += escapeExpression(stack1) + "/"; foundHelper = helpers.nickname; stack1 = foundHelper || depth0.nickname; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.httpMethod; stack1 = foundHelper || depth0.httpMethod; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.number; stack1 = foundHelper || depth0.number; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); } buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">"; foundHelper = helpers.httpMethod; stack1 = foundHelper || depth0.httpMethod; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); } buffer += escapeExpression(stack1) + "</a>\n </span>\n <span class='path'>\n <a href='#!/"; foundHelper = helpers.resourceName; stack1 = foundHelper || depth0.resourceName; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); } buffer += escapeExpression(stack1) + "/"; foundHelper = helpers.nickname; stack1 = foundHelper || depth0.nickname; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.httpMethod; stack1 = foundHelper || depth0.httpMethod; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.number; stack1 = foundHelper || depth0.number; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); } buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">"; foundHelper = helpers.path; stack1 = foundHelper || depth0.path; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "path", { hash: {} }); } buffer += escapeExpression(stack1) + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"; foundHelper = helpers.resourceName; stack1 = foundHelper || depth0.resourceName; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); } buffer += escapeExpression(stack1) + "/"; foundHelper = helpers.nickname; stack1 = foundHelper || depth0.nickname; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.httpMethod; stack1 = foundHelper || depth0.httpMethod; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.number; stack1 = foundHelper || depth0.number; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); } buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">"; foundHelper = helpers.summary; stack1 = foundHelper || depth0.summary; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "summary", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"; foundHelper = helpers.resourceName; stack1 = foundHelper || depth0.resourceName; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.nickname; stack1 = foundHelper || depth0.nickname; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.httpMethod; stack1 = foundHelper || depth0.httpMethod; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); } buffer += escapeExpression(stack1) + "_"; foundHelper = helpers.number; stack1 = foundHelper || depth0.number; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); } buffer += escapeExpression(stack1) + "_content' style='display:none'>\n "; foundHelper = helpers.notes; stack1 = foundHelper || depth0.notes; stack2 = helpers['if']; tmp1 = self.program(1, program1, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.noop; stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; foundHelper = helpers.responseClass; stack1 = foundHelper || depth0.responseClass; stack2 = helpers['if']; tmp1 = self.program(3, program3, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.noop; stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n "; foundHelper = helpers.parameters; stack1 = foundHelper || depth0.parameters; stack2 = helpers['if']; tmp1 = self.program(5, program5, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.noop; stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; foundHelper = helpers.errorResponses; stack1 = foundHelper || depth0.errorResponses; stack2 = helpers['if']; tmp1 = self.program(7, program7, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.noop; stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; foundHelper = helpers.isReadOnly; stack1 = foundHelper || depth0.isReadOnly; stack2 = helpers['if']; tmp1 = self.program(9, program9, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(11, program11, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; function program1(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.isFile; stack1 = foundHelper || depth0.isFile; stack2 = helpers['if']; tmp1 = self.program(2, program2, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(4, program4, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program2(depth0,data) { var buffer = "", stack1; buffer += "\n <input type=\"file\" name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'/>\n "; return buffer;} function program4(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; stack2 = helpers['if']; tmp1 = self.program(5, program5, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(7, program7, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program5(depth0,data) { var buffer = "", stack1; buffer += "\n <textarea class='body-textarea' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'>"; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); } buffer += escapeExpression(stack1) + "</textarea>\n "; return buffer;} function program7(depth0,data) { var buffer = "", stack1; buffer += "\n <textarea class='body-textarea' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'></textarea>\n <br />\n <div class=\"content-type\" />\n "; return buffer;} function program9(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; stack2 = helpers['if']; tmp1 = self.program(10, program10, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(12, program12, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program10(depth0,data) { var buffer = "", stack1; buffer += "\n <input class='parameter' minlength='0' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "' placeholder='' type='text' value='"; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); } buffer += escapeExpression(stack1) + "'/>\n "; return buffer;} function program12(depth0,data) { var buffer = "", stack1; buffer += "\n <input class='parameter' minlength='0' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "' placeholder='' type='text' value=''/>\n "; return buffer;} buffer += "<td class='code'>"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "</td>\n<td>\n\n "; foundHelper = helpers.isBody; stack1 = foundHelper || depth0.isBody; stack2 = helpers['if']; tmp1 = self.program(1, program1, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(9, program9, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n\n</td>\n<td>"; foundHelper = helpers.description; stack1 = foundHelper || depth0.description; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td>"; foundHelper = helpers.paramType; stack1 = foundHelper || depth0.paramType; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; function program1(depth0,data) { return "\n ";} function program3(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; stack2 = helpers['if']; tmp1 = self.program(4, program4, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(6, program6, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program4(depth0,data) { return "\n ";} function program6(depth0,data) { return "\n <option selected=\"\" value=''></option>\n ";} function program8(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.isDefault; stack1 = foundHelper || depth0.isDefault; stack2 = helpers['if']; tmp1 = self.program(9, program9, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(11, program11, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program9(depth0,data) { var buffer = "", stack1; buffer += "\n <option value='"; foundHelper = helpers.value; stack1 = foundHelper || depth0.value; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); } buffer += escapeExpression(stack1) + "'>"; foundHelper = helpers.value; stack1 = foundHelper || depth0.value; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); } buffer += escapeExpression(stack1) + " (default)</option>\n "; return buffer;} function program11(depth0,data) { var buffer = "", stack1; buffer += "\n <option value='"; foundHelper = helpers.value; stack1 = foundHelper || depth0.value; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); } buffer += escapeExpression(stack1) + "'>"; foundHelper = helpers.value; stack1 = foundHelper || depth0.value; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); } buffer += escapeExpression(stack1) + "</option>\n "; return buffer;} buffer += "<td class='code'>"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "</td>\n<td>\n <select class='parameter' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'>\n "; foundHelper = helpers.required; stack1 = foundHelper || depth0.required; stack2 = helpers['if']; tmp1 = self.program(1, program1, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(3, program3, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; foundHelper = helpers.allowableValues; stack1 = foundHelper || depth0.allowableValues; stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.descriptiveValues); stack2 = helpers.each; tmp1 = self.program(8, program8, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.noop; stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n </select>\n</td>\n<td>"; foundHelper = helpers.description; stack1 = foundHelper || depth0.description; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td>"; foundHelper = helpers.paramType; stack1 = foundHelper || depth0.paramType; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; function program1(depth0,data) { var buffer = "", stack1; buffer += "\n <textarea class='body-textarea' readonly='readonly' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'>"; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); } buffer += escapeExpression(stack1) + "</textarea>\n "; return buffer;} function program3(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; stack2 = helpers['if']; tmp1 = self.program(4, program4, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(6, program6, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program4(depth0,data) { var buffer = "", stack1; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); } buffer += escapeExpression(stack1) + "\n "; return buffer;} function program6(depth0,data) { return "\n (empty)\n ";} buffer += "<td class='code'>"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "</td>\n<td>\n "; foundHelper = helpers.isBody; stack1 = foundHelper || depth0.isBody; stack2 = helpers['if']; tmp1 = self.program(1, program1, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(3, program3, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n</td>\n<td>"; foundHelper = helpers.description; stack1 = foundHelper || depth0.description; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td>"; foundHelper = helpers.paramType; stack1 = foundHelper || depth0.paramType; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; function program1(depth0,data) { var buffer = "", stack1; buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'>"; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); } buffer += escapeExpression(stack1) + "</textarea>\n "; return buffer;} function program3(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; stack2 = helpers['if']; tmp1 = self.program(4, program4, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(6, program6, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program4(depth0,data) { var buffer = "", stack1; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); } buffer += escapeExpression(stack1) + "\n "; return buffer;} function program6(depth0,data) { return "\n (empty)\n ";} buffer += "<td class='code required'>"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "</td>\n<td>\n "; foundHelper = helpers.isBody; stack1 = foundHelper || depth0.isBody; stack2 = helpers['if']; tmp1 = self.program(1, program1, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(3, program3, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n</td>\n<td>"; foundHelper = helpers.description; stack1 = foundHelper || depth0.description; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td>"; foundHelper = helpers.paramType; stack1 = foundHelper || depth0.paramType; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; function program1(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.isFile; stack1 = foundHelper || depth0.isFile; stack2 = helpers['if']; tmp1 = self.program(2, program2, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(4, program4, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program2(depth0,data) { var buffer = "", stack1; buffer += "\n <input type=\"file\" name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'/>\n "; return buffer;} function program4(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; stack2 = helpers['if']; tmp1 = self.program(5, program5, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(7, program7, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program5(depth0,data) { var buffer = "", stack1; buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'>"; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); } buffer += escapeExpression(stack1) + "</textarea>\n "; return buffer;} function program7(depth0,data) { var buffer = "", stack1; buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'></textarea>\n <br />\n <div class=\"content-type\" />\n "; return buffer;} function program9(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.isFile; stack1 = foundHelper || depth0.isFile; stack2 = helpers['if']; tmp1 = self.program(10, program10, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(12, program12, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program10(depth0,data) { var buffer = "", stack1; buffer += "\n <input class='parameter' class='required' type='file' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'/>\n "; return buffer;} function program12(depth0,data) { var buffer = "", stack1, stack2; buffer += "\n "; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; stack2 = helpers['if']; tmp1 = self.program(13, program13, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(15, program15, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} function program13(depth0,data) { var buffer = "", stack1; buffer += "\n <input class='parameter required' minlength='1' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value='"; foundHelper = helpers.defaultValue; stack1 = foundHelper || depth0.defaultValue; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); } buffer += escapeExpression(stack1) + "'/>\n "; return buffer;} function program15(depth0,data) { var buffer = "", stack1; buffer += "\n <input class='parameter required' minlength='1' name='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value=''/>\n "; return buffer;} buffer += "<td class='code required'>"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "</td>\n<td>\n "; foundHelper = helpers.isBody; stack1 = foundHelper || depth0.isBody; stack2 = helpers['if']; tmp1 = self.program(1, program1, data); tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(9, program9, data); stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n</td>\n<td>\n <strong>"; foundHelper = helpers.description; stack1 = foundHelper || depth0.description; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</strong>\n</td>\n<td>"; foundHelper = helpers.paramType; stack1 = foundHelper || depth0.paramType; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; buffer += "<div class='heading'>\n <h2>\n <a href='#!/"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "' onclick=\"Docs.toggleEndpointListForResource('"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "');\">/"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "</a>\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "' id='endpointListTogger_"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'\n onclick=\"Docs.toggleEndpointListForResource('"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='"; foundHelper = helpers.url; stack1 = foundHelper || depth0.url; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "url", { hash: {} }); } buffer += escapeExpression(stack1) + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } buffer += escapeExpression(stack1) + "_endpoint_list' style='display:none'>\n\n</ul>\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; buffer += "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n "; foundHelper = helpers.signature; stack1 = foundHelper || depth0.signature; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"; foundHelper = helpers.sampleJSON; stack1 = foundHelper || depth0.sampleJSON; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "sampleJSON", { hash: {} }); } buffer += escapeExpression(stack1) + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n"; return buffer;}); })(); (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; buffer += "<td width='15%' class='code'>"; foundHelper = helpers.code; stack1 = foundHelper || depth0.code; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "code", { hash: {} }); } buffer += escapeExpression(stack1) + "</td>\n<td>"; foundHelper = helpers.reason; stack1 = foundHelper || depth0.reason; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "reason", { hash: {} }); } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</td>\n\n"; return buffer;}); })(); // Generated by CoffeeScript 1.4.0 (function() { var ContentTypeView, HeaderView, MainView, OperationView, ParameterView, ResourceView, SignatureView, StatusCodeView, SwaggerUi, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; SwaggerUi = (function(_super) { __extends(SwaggerUi, _super); function SwaggerUi() { return SwaggerUi.__super__.constructor.apply(this, arguments); } SwaggerUi.prototype.dom_id = "swagger_ui"; SwaggerUi.prototype.options = null; SwaggerUi.prototype.api = null; SwaggerUi.prototype.headerView = null; SwaggerUi.prototype.mainView = null; SwaggerUi.prototype.initialize = function(options) { var _this = this; if (options == null) { options = {}; } if (options.dom_id != null) { this.dom_id = options.dom_id; delete options.dom_id; } if (!($('#' + this.dom_id) != null)) { $('body').append('<div id="' + this.dom_id + '"></div>'); } this.options = options; this.options.success = function() { return _this.render(); }; this.options.progress = function(d) { return _this.showMessage(d); }; this.options.failure = function(d) { return _this.onLoadFailure(d); }; this.headerView = new HeaderView({ el: $('#header') }); return this.headerView.on('update-swagger-ui', function(data) { return _this.updateSwaggerUi(data); }); }; SwaggerUi.prototype.updateSwaggerUi = function(data) { this.options.discoveryUrl = data.discoveryUrl; this.options.apiKey = data.apiKey; return this.load(); }; SwaggerUi.prototype.load = function() { var _ref; if ((_ref = this.mainView) != null) { _ref.clear(); } this.headerView.update(this.options.discoveryUrl, this.options.apiKey); return this.api = new SwaggerApi(this.options); }; SwaggerUi.prototype.render = function() { var _this = this; this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...'); this.mainView = new MainView({ model: this.api, el: $('#' + this.dom_id) }).render(); this.showMessage(); switch (this.options.docExpansion) { case "full": Docs.expandOperationsForResource(''); break; case "list": Docs.collapseOperationsForResource(''); } if (this.options.onComplete) { this.options.onComplete(this.api, this); } return setTimeout(function() { return Docs.shebang(); }, 400); }; SwaggerUi.prototype.showMessage = function(data) { if (data == null) { data = ''; } $('#message-bar').removeClass('message-fail'); $('#message-bar').addClass('message-success'); return $('#message-bar').html(data); }; SwaggerUi.prototype.onLoadFailure = function(data) { var val; if (data == null) { data = ''; } $('#message-bar').removeClass('message-success'); $('#message-bar').addClass('message-fail'); val = $('#message-bar').html(data); if (this.options.onFailure != null) { this.options.onFailure(data); } return val; }; return SwaggerUi; })(Backbone.Router); window.SwaggerUi = SwaggerUi; HeaderView = (function(_super) { __extends(HeaderView, _super); function HeaderView() { return HeaderView.__super__.constructor.apply(this, arguments); } HeaderView.prototype.events = { 'click #show-pet-store-icon': 'showPetStore', 'click #show-wordnik-dev-icon': 'showWordnikDev', 'click #explore': 'showCustom', 'keyup #input_baseUrl': 'showCustomOnKeyup', 'keyup #input_apiKey': 'showCustomOnKeyup' }; HeaderView.prototype.initialize = function() {}; HeaderView.prototype.showPetStore = function(e) { return this.trigger('update-swagger-ui', { discoveryUrl: "http://petstore.swagger.wordnik.com/api/api-docs.json", apiKey: "special-key" }); }; HeaderView.prototype.showWordnikDev = function(e) { return this.trigger('update-swagger-ui', { discoveryUrl: "http://api.wordnik.com/v4/resources.json", apiKey: "" }); }; HeaderView.prototype.showCustomOnKeyup = function(e) { if (e.keyCode === 13) { return this.showCustom(); } }; HeaderView.prototype.showCustom = function(e) { if (e != null) { e.preventDefault(); } return this.trigger('update-swagger-ui', { discoveryUrl: $('#input_baseUrl').val(), apiKey: $('#input_apiKey').val() }); }; HeaderView.prototype.update = function(url, apiKey, trigger) { if (trigger == null) { trigger = false; } $('#input_baseUrl').val(url); $('#input_apiKey').val(apiKey); if (trigger) { return this.trigger('update-swagger-ui', { discoveryUrl: url, apiKey: apiKey }); } }; return HeaderView; })(Backbone.View); MainView = (function(_super) { __extends(MainView, _super); function MainView() { return MainView.__super__.constructor.apply(this, arguments); } MainView.prototype.initialize = function() {}; MainView.prototype.render = function() { var resource, _i, _len, _ref; $(this.el).html(Handlebars.templates.main(this.model)); _ref = this.model.apisArray; for (_i = 0, _len = _ref.length; _i < _len; _i++) { resource = _ref[_i]; this.addResource(resource); } return this; }; MainView.prototype.addResource = function(resource) { var resourceView; resourceView = new ResourceView({ model: resource, tagName: 'li', id: 'resource_' + resource.name, className: 'resource' }); return $('#resources').append(resourceView.render().el); }; MainView.prototype.clear = function() { return $(this.el).html(''); }; return MainView; })(Backbone.View); ResourceView = (function(_super) { __extends(ResourceView, _super); function ResourceView() { return ResourceView.__super__.constructor.apply(this, arguments); } ResourceView.prototype.initialize = function() {}; ResourceView.prototype.render = function() { var operation, _i, _len, _ref; $(this.el).html(Handlebars.templates.resource(this.model)); this.number = 0; _ref = this.model.operationsArray; for (_i = 0, _len = _ref.length; _i < _len; _i++) { operation = _ref[_i]; this.addOperation(operation); } return this; }; ResourceView.prototype.addOperation = function(operation) { var operationView; operation.number = this.number; operationView = new OperationView({ model: operation, tagName: 'li', className: 'endpoint' }); $('.endpoints', $(this.el)).append(operationView.render().el); return this.number++; }; return ResourceView; })(Backbone.View); OperationView = (function(_super) { __extends(OperationView, _super); function OperationView() { return OperationView.__super__.constructor.apply(this, arguments); } OperationView.prototype.events = { 'submit .sandbox': 'submitOperation', 'click .submit': 'submitOperation', 'click .response_hider': 'hideResponse', 'click .toggleOperation': 'toggleOperationContent' }; OperationView.prototype.initialize = function() {}; OperationView.prototype.render = function() { var contentTypeModel, contentTypeView, isMethodSubmissionSupported, param, responseSignatureView, signatureModel, statusCode, _i, _j, _len, _len1, _ref, _ref1; isMethodSubmissionSupported = jQuery.inArray(this.model.httpMethod, this.model.supportedSubmitMethods()) >= 0; if (!isMethodSubmissionSupported) { this.model.isReadOnly = true; } $(this.el).html(Handlebars.templates.operation(this.model)); if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') { signatureModel = { sampleJSON: this.model.responseSampleJSON, isParam: false, signature: this.model.responseClassSignature }; responseSignatureView = new SignatureView({ model: signatureModel, tagName: 'div' }); $('.model-signature', $(this.el)).append(responseSignatureView.render().el); } else { $('.model-signature', $(this.el)).html(this.model.responseClass); } contentTypeModel = { isParam: false }; if (this.model.supportedContentTypes) { contentTypeModel.produces = this.model.supportedContentTypes; } if (this.model.produces) { contentTypeModel.produces = this.model.produces; } contentTypeView = new ContentTypeView({ model: contentTypeModel }); $('.content-type', $(this.el)).append(contentTypeView.render().el); _ref = this.model.parameters; for (_i = 0, _len = _ref.length; _i < _len; _i++) { param = _ref[_i]; this.addParameter(param); } _ref1 = this.model.errorResponses; for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { statusCode = _ref1[_j]; this.addStatusCode(statusCode); } return this; }; OperationView.prototype.addParameter = function(param) { var paramView; paramView = new ParameterView({ model: param, tagName: 'tr', readOnly: this.model.isReadOnly }); return $('.operation-params', $(this.el)).append(paramView.render().el); }; OperationView.prototype.addStatusCode = function(statusCode) { var statusCodeView; statusCodeView = new StatusCodeView({ model: statusCode, tagName: 'tr' }); return $('.operation-status', $(this.el)).append(statusCodeView.render().el); }; OperationView.prototype.submitOperation = function(e) { var bodyParam, consumes, error_free, form, headerParams, invocationUrl, isFileUpload, isFormPost, map, o, obj, param, paramContentTypeField, responseContentTypeField, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4, _this = this; if (e != null) { e.preventDefault(); } form = $('.sandbox', $(this.el)); error_free = true; form.find("input.required").each(function() { var _this = this; $(this).removeClass("error"); if (jQuery.trim($(this).val()) === "") { $(this).addClass("error"); $(this).wiggle({ callback: function() { return $(_this).focus(); } }); return error_free = false; } }); if (error_free) { map = {}; _ref = form.serializeArray(); for (_i = 0, _len = _ref.length; _i < _len; _i++) { o = _ref[_i]; if ((o.value != null) && jQuery.trim(o.value).length > 0) { map[o.name] = o.value; } } isFileUpload = form.children().find('input[type~="file"]').size() !== 0; isFormPost = false; consumes = "application/json"; if (this.model.consumes && this.model.consumes.length > 0) { consumes = this.model.consumes[0]; } else { _ref1 = this.model.parameters; for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { o = _ref1[_j]; if (o.paramType === 'form') { isFormPost = true; consumes = false; } } if (isFileUpload) { consumes = false; } else if (this.model.httpMethod.toLowerCase() === "post" && isFormPost === false) { consumes = "application/json"; } } if (isFileUpload) { bodyParam = new FormData(); _ref2 = this.model.parameters; for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { param = _ref2[_k]; if ((param.paramType === 'body' || 'form') && param.name !== 'file' && param.name !== 'File' && (map[param.name] != null)) { bodyParam.append(param.name, map[param.name]); } } $.each(form.children().find('input[type~="file"]'), function(i, el) { return bodyParam.append($(el).attr('name'), el.files[0]); }); console.log(bodyParam); } else if (isFormPost) { bodyParam = new FormData(); _ref3 = this.model.parameters; for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { param = _ref3[_l]; if (map[param.name] != null) { bodyParam.append(param.name, map[param.name]); } } } else { bodyParam = null; _ref4 = this.model.parameters; for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) { param = _ref4[_m]; if (param.paramType === 'body') { bodyParam = map[param.name]; } } } log("bodyParam = " + bodyParam); headerParams = null; invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true); log('submitting ' + invocationUrl); $(".request_url", $(this.el)).html("<pre>" + invocationUrl + "</pre>"); $(".response_throbber", $(this.el)).show(); obj = { type: this.model.httpMethod, url: invocationUrl, headers: headerParams, data: bodyParam, contentType: consumes, dataType: 'json', processData: false, error: function(xhr, textStatus, error) { return _this.showErrorStatus(xhr, textStatus, error); }, success: function(data) { return _this.showResponse(data); }, complete: function(data) { return _this.showCompleteStatus(data); } }; paramContentTypeField = $("td select[name=contentType]", $(this.el)).val(); if (paramContentTypeField) { obj.contentType = paramContentTypeField; } log('content type = ' + obj.contentType); if (!(obj.data || (obj.type === 'GET' || obj.type === 'DELETE')) && obj.contentType === !"application/x-www-form-urlencoded") { obj.contentType = false; } log('content type is now = ' + obj.contentType); responseContentTypeField = $('.content > .content-type > div > select[name=contentType]', $(this.el)).val(); if (responseContentTypeField) { obj.headers = obj.headers != null ? obj.headers : {}; obj.headers.accept = responseContentTypeField; } jQuery.ajax(obj); return false; } }; OperationView.prototype.hideResponse = function(e) { if (e != null) { e.preventDefault(); } $(".response", $(this.el)).slideUp(); return $(".response_hider", $(this.el)).fadeOut(); }; OperationView.prototype.showResponse = function(response) { var prettyJson; prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>"); return $(".response_body", $(this.el)).html(escape(prettyJson)); }; OperationView.prototype.showErrorStatus = function(data) { return this.showStatus(data); }; OperationView.prototype.showCompleteStatus = function(data) { return this.showStatus(data); }; OperationView.prototype.formatXml = function(xml) { var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len; reg = /(>)(<)(\/*)/g; wsexp = /[ ]*(.*)[ ]+\n/g; contexp = /(<.+>)(.+\n)/g; xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2'); pad = 0; formatted = ''; lines = xml.split('\n'); indent = 0; lastType = 'other'; transitions = { 'single->single': 0, 'single->closing': -1, 'single->opening': 0, 'single->other': 0, 'closing->single': 0, 'closing->closing': -1, 'closing->opening': 0, 'closing->other': 0, 'opening->single': 1, 'opening->closing': 0, 'opening->opening': 1, 'opening->other': 1, 'other->single': 0, 'other->closing': -1, 'other->opening': 0, 'other->other': 0 }; _fn = function(ln) { var fromTo, j, key, padding, type, types, value; types = { single: Boolean(ln.match(/<.+\/>/)), closing: Boolean(ln.match(/<\/.+>/)), opening: Boolean(ln.match(/<[^!?].*>/)) }; type = ((function() { var _results; _results = []; for (key in types) { value = types[key]; if (value) { _results.push(key); } } return _results; })())[0]; type = type === void 0 ? 'other' : type; fromTo = lastType + '->' + type; lastType = type; padding = ''; indent += transitions[fromTo]; padding = ((function() { var _j, _ref, _results; _results = []; for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) { _results.push(' '); } return _results; })()).join(''); if (fromTo === 'opening->closing') { return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n'; } else { return formatted += padding + ln + '\n'; } }; for (_i = 0, _len = lines.length; _i < _len; _i++) { ln = lines[_i]; _fn(ln); } return formatted; }; OperationView.prototype.showStatus = function(data) { var code, pre, response_body; try { code = $('<code />').text(JSON.stringify(JSON.parse(data.responseText), null, 2)); pre = $('<pre class="json" />').append(code); } catch (error) { code = $('<code />').text(this.formatXml(data.responseText)); pre = $('<pre class="xml" />').append(code); } response_body = pre; $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>"); $(".response_body", $(this.el)).html(response_body); $(".response_headers", $(this.el)).html("<pre>" + data.getAllResponseHeaders() + "</pre>"); $(".response", $(this.el)).slideDown(); $(".response_hider", $(this.el)).show(); $(".response_throbber", $(this.el)).hide(); return hljs.highlightBlock($('.response_body', $(this.el))[0]); }; OperationView.prototype.toggleOperationContent = function() { var elem; elem = $('#' + Docs.escapeResourceName(this.model.resourceName) + "_" + this.model.nickname + "_" + this.model.httpMethod + "_" + this.model.number + "_content"); if (elem.is(':visible')) { return Docs.collapseOperation(elem); } else { return Docs.expandOperation(elem); } }; return OperationView; })(Backbone.View); StatusCodeView = (function(_super) { __extends(StatusCodeView, _super); function StatusCodeView() { return StatusCodeView.__super__.constructor.apply(this, arguments); } StatusCodeView.prototype.initialize = function() {}; StatusCodeView.prototype.render = function() { var template; template = this.template(); $(this.el).html(template(this.model)); return this; }; StatusCodeView.prototype.template = function() { return Handlebars.templates.status_code; }; return StatusCodeView; })(Backbone.View); ParameterView = (function(_super) { __extends(ParameterView, _super); function ParameterView() { return ParameterView.__super__.constructor.apply(this, arguments); } ParameterView.prototype.initialize = function() {}; ParameterView.prototype.render = function() { var contentTypeModel, contentTypeView, signatureModel, signatureView, template; if (this.model.paramType === 'body') { this.model.isBody = true; } if (this.model.dataType === 'file') { this.model.isFile = true; } template = this.template(); $(this.el).html(template(this.model)); signatureModel = { sampleJSON: this.model.sampleJSON, isParam: true, signature: this.model.signature }; if (this.model.sampleJSON) { signatureView = new SignatureView({ model: signatureModel, tagName: 'div' }); $('.model-signature', $(this.el)).append(signatureView.render().el); } else { $('.model-signature', $(this.el)).html(this.model.signature); } contentTypeModel = { isParam: false }; if (this.model.supportedContentTypes) { contentTypeModel.produces = this.model.supportedContentTypes; } if (this.model.produces) { contentTypeModel.produces = this.model.produces; } contentTypeView = new ContentTypeView({ model: contentTypeModel }); $('.content-type', $(this.el)).append(contentTypeView.render().el); return this; }; ParameterView.prototype.template = function() { if (this.model.isList) { return Handlebars.templates.param_list; } else { if (this.options.readOnly) { if (this.model.required) { return Handlebars.templates.param_readonly_required; } else { return Handlebars.templates.param_readonly; } } else { if (this.model.required) { return Handlebars.templates.param_required; } else { return Handlebars.templates.param; } } } }; return ParameterView; })(Backbone.View); SignatureView = (function(_super) { __extends(SignatureView, _super); function SignatureView() { return SignatureView.__super__.constructor.apply(this, arguments); } SignatureView.prototype.events = { 'click a.description-link': 'switchToDescription', 'click a.snippet-link': 'switchToSnippet', 'mousedown .snippet': 'snippetToTextArea' }; SignatureView.prototype.initialize = function() {}; SignatureView.prototype.render = function() { var template; template = this.template(); $(this.el).html(template(this.model)); this.switchToDescription(); this.isParam = this.model.isParam; if (this.isParam) { $('.notice', $(this.el)).text('Click to set as parameter value'); } return this; }; SignatureView.prototype.template = function() { return Handlebars.templates.signature; }; SignatureView.prototype.switchToDescription = function(e) { if (e != null) { e.preventDefault(); } $(".snippet", $(this.el)).hide(); $(".description", $(this.el)).show(); $('.description-link', $(this.el)).addClass('selected'); return $('.snippet-link', $(this.el)).removeClass('selected'); }; SignatureView.prototype.switchToSnippet = function(e) { if (e != null) { e.preventDefault(); } $(".description", $(this.el)).hide(); $(".snippet", $(this.el)).show(); $('.snippet-link', $(this.el)).addClass('selected'); return $('.description-link', $(this.el)).removeClass('selected'); }; SignatureView.prototype.snippetToTextArea = function(e) { var textArea; if (this.isParam) { if (e != null) { e.preventDefault(); } textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode)); if ($.trim(textArea.val()) === '') { return textArea.val(this.model.sampleJSON); } } }; return SignatureView; })(Backbone.View); ContentTypeView = (function(_super) { __extends(ContentTypeView, _super); function ContentTypeView() { return ContentTypeView.__super__.constructor.apply(this, arguments); } ContentTypeView.prototype.initialize = function() {}; ContentTypeView.prototype.render = function() { var template; template = this.template(); $(this.el).html(template(this.model)); this.isParam = this.model.isParam; if (this.isParam) { $('label[for=contentType]', $(this.el)).text('Parameter content type:'); } else { $('label[for=contentType]', $(this.el)).text('Response Content Type'); } return this; }; ContentTypeView.prototype.template = function() { return Handlebars.templates.content_type; }; return ContentTypeView; })(Backbone.View); }).call(this);
the_stack
@{ ViewBag.Title = "CategoryList"; Layout = "~/Views/Shared/_Admin.cshtml"; } @Html.Partial("JqgridInit") <script src="~/Content/Js/jquery.slimscroll.min.js"></script> <script src="~/Content/Js/jquery.easy-pie-chart.min.js"></script> <script src="~/Content/Js/jquery.sparkline.min.js"></script> <script src="~/Content/Js/flot/jquery.flot.min.js"></script> <script src="~/Content/Js/flot/jquery.flot.pie.min.js"></script> <script src="~/Content/Js/flot/jquery.flot.resize.min.js"></script> <div id="piechart-placeholder"></div> <script> $(function () { $(".page-header h1 span,#currentpart").html("产品"); $(".page-header h1 small span").html("分类管理"); $(".nav-list>li:eq(1)").addClass("active").siblings().removeClass("active"); $(".nav-list>li:eq(1)>ul>li:eq(2)").addClass("active").siblings().removeClass("active"); jQuery("#list2").jqGrid({ url: '/Product/GetAllCategorys', datatype: "json", // colNames: ['Actions', 'ProductId', '产品', '分类', '品牌', '规格', '莎莎价格','卓越价格','卡莱价格','万宁价格','屈臣氏价格','药店价格','其他','时间'], colNames: ['操作', 'CategoryId', '分类', '产品数', '备注', '更新时间'], colModel: [ { name: 'myac', index: '操作', width: 60, fixed: true, sortable: false, resize: false, formatter: 'actions', formatoptions: { keys: true, delOptions: { recreateForm: true, beforeShowForm: beforeDeleteCallback, },//改变原来的样式 msg: '您确定要删除这条记录?</span> } // name: 'act', index: 'act', width: 75, sortable: false }, { name: 'CategoryId', index: 'Id', hidden: true, editable: true }, { name: 'CategoryName', index: 'CategoryName', editable: true, editrules: { required: true } }, { name: 'ProductCount', index: 'ProductCount', editable: false }, { name: 'Description', index: 'Description', editable: true, edittype: 'textarea' }, { name: 'ModifyTime', index: '更新时间', width: 200, formatter: 'date', formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s', searchoptions: { sopt: ['eq', 'ne', 'cn'] } } } ], rowNum: 10, rowList: [10, 20, 30], sortorder: "asc", pager: '#pager2', sortname: 'CategoryName', viewrecords: true, caption: "分类明细", autowidth: true, multiselect: true, height: 180, gridComplete: function () { var icons = $(".ui-icon-trash");//隐藏删除键 icons.hide(); //var ids = jQuery("#list2").jqGrid('getDataIDs'); //for (var i = 0; i < ids.length; i++) { // be = "<span class='ui-icon ui-icon-pencil'></span>";//修改 // se = "<span class='ui-icon ui-icon-trash'></span>";//删除 // ce = "<span class='icon-ok ui-icon'></span>";//删除 // jQuery("#list2").jqGrid('setRowData', ids[i], { act: be + se + ce }); //} }, loadComplete: function () { $("#grid-table").hide(); var table = this; enableTooltips(table); updatePagerIcons(table); }, editurl: "/Product/EditCategory", //无效!!!! serializeDelData: function (postdata) { var rowdata = jQuery('#list2').getRowData(postdata.id); return { id: postdata.id, oper: postdata.oper, user: rowdata }; } //edit del }); jQuery("#list2").jqGrid('navGrid', '#pager2', { edit: true, editicon: 'icon-pencil blue', add: true, addicon: 'icon-plus-sign purple', del: false, delicon: 'icon-trash red', search: true, searchicon: 'icon-search orange', refresh: true, refreshicon: 'icon-refresh green', view: false, viewicon: 'icon-zoom-in grey', }, { //eidt url: '/Product/Edit', mtype: 'POST', afterSubmit: function (xhr, postdata) { var id = $("#list2").jqGrid('getGridParam', 'selrow'); jQuery("#list2").jqGrid('setRowData', id, postdata); }, closeAfterEdit: true, closeOnEscape: true }, { //add recreateForm: true, url: '/Product/CreateCategory', mtype: 'POST', afterSubmit: function (xhr, postdata) { var id = $("#list2").jqGrid('getGridParam', 'selrow'); jQuery("#list2").jqGrid('addRowData', postdata.Id, postdata); return [true, 'successfule!', false]; }, closeAfterAdd: true }, { //delete recreateForm: true, url: '/Product/Delete', mtype: 'POST', beforeShowForm: function (e) { var form = $(e[0]); if (form.data('styled')) return false; form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />'); styleDeleteForm(form); form.data('styled', true); return true; }, afterSubmit: function (xhr, postdata) { var consoleDlg = $("#list2"); var selectedRowIds = $("#list2").jqGrid("getGridParam", "selarrrow"); var len = selectedRowIds.length; for (var i = 0; i < len ; i++) { $("#list2").jqGrid("delRowData", selectedRowIds[0]); } }, closeAfterDel: true }, { //search }, { //view } ); //添加注释 function enableTooltips(table) { $('.navtable .ui-pg-button').tooltip({ container: 'body' }); $(table).find('.ui-pg-div').tooltip({ container: 'body' }); } function beforeDeleteCallback(e) { var form = $(e[0]); if (form.data('styled')) return false; form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />'); styleDeleteForm(form); form.data('styled', true); return true; } //修改 删除form的样式 function styleDeleteForm(form) { var buttons = form.next().find('.EditButton .fm-button'); buttons.addClass('btn btn-sm').find('[class*="-icon"]').remove();//ui-icon, s-icon buttons.eq(0).addClass('btn-danger').prepend('<i class="icon-trash"></i>'); buttons.eq(1).prepend('<i class="icon-remove"></i>'); } //更新分页图标 function updatePagerIcons() { var replacement = { 'ui-icon-seek-first': 'icon-double-angle-left bigger-140', 'ui-icon-seek-prev': 'icon-angle-left bigger-140', 'ui-icon-seek-next': 'icon-angle-right bigger-140', 'ui-icon-seek-end': 'icon-double-angle-right bigger-140' }; $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () { var icon = $(this); var $class = $.trim(icon.attr('class').replace('ui-icon', '')); if ($class in replacement) icon.attr('class', 'ui-icon ' + replacement[$class]); }); var x = $("#pager2_left").find("#coco"); if (x.length == 0) { $("#pager2_left table tbody>tr").prepend("<td class='ui-pg-button ui-corner-all' title data-original-title='Remove a row'><div id='coco' class='ui-pg-div'>" + "<span class='ui-icon icon-trash blue'></span></div></td>"); } } //绑定事件 执行删除 $("#pager2_left table tbody>tr").on("click", '#coco', function () { var selectedRowIds = $("#list2").jqGrid("getGridParam", "selarrrow"); var len = selectedRowIds.length; if (len != 0) { if (confirm("确定要删除选中项?")) { for (var i = 0; i < len; i++) { var rowData = $("#list2").jqGrid('getRowData', selectedRowIds[i]); $.post('/Product/DeletCategory', { id: rowData.CategoryId }, function (data) { $("#list2").jqGrid("delRowData", selectedRowIds[0]); }); } } } else { $.infoShow("未勾选", 0); } }); var placeholder = $('#piechart-placeholder').css({ 'width': '90%', 'min-height': '150px' }); function drawPieChart(placeholder, data, position) { $.plot(placeholder, data, { series: { pie: { show: true, tilt: 0.8, highlight: { opacity: 0.25 }, stroke: { color: '#fff', width: 2 }, startAngle: 2 } }, legend: { show: true, position: position || "ne", labelBoxBorderColor: null, margin: [-30, 15] }, grid: { hoverable: true, clickable: true } }); } $.post("/Product/GetChartData", function (cdata) { drawPieChart(placeholder, cdata); }); var $tooltip = $("<div class='tooltip top in'><div class='tooltip-inner'></div></div>").hide().appendTo('body'); var previousPoint = null; placeholder.on('plothover', function (event, pos, item) { if (item) { if (previousPoint != item.seriesIndex) { previousPoint = item.seriesIndex; var tip = item.series['label'] + " : " + item.series['percent'] + '%'; $tooltip.show().children(0).text(tip); } $tooltip.css({ top: pos.pageY + 10, left: pos.pageX + 10 }); } else { $tooltip.hide(); previousPoint = null; } }); }); </script>
the_stack
#tool nuget:?package=mdoc&version=5.8.3 #tool nuget:?package=xunit.runner.console&version=2.4.1 #tool nuget:?package=vswhere&version=2.8.4 using System.Linq; using System.Net.Http; using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Xml; using System.Xml.Linq; using SharpCompress.Common; using SharpCompress.Readers; using Mono.ApiTools; using NuGet.Packaging; using NuGet.Versioning; DirectoryPath ROOT_PATH = MakeAbsolute(Directory(".")); #load "cake/shared.cake" #load "cake/native-shared.cake" var SKIP_EXTERNALS = Argument ("skipexternals", "") .ToLower ().Split (new [] { ',' }, StringSplitOptions.RemoveEmptyEntries); var SKIP_BUILD = Argument ("skipbuild", false); var PACK_ALL_PLATFORMS = Argument ("packall", Argument ("PackAllPlatforms", false)); var BUILD_ALL_PLATFORMS = Argument ("buildall", Argument ("BuildAllPlatforms", false)); var PRINT_ALL_ENV_VARS = Argument ("printAllEnvVars", false); var UNSUPPORTED_TESTS = Argument ("unsupportedTests", ""); var THROW_ON_TEST_FAILURE = Argument ("throwOnTestFailure", true); var NUGET_DIFF_PRERELEASE = Argument ("nugetDiffPrerelease", false); var COVERAGE = Argument ("coverage", false); var CHROMEWEBDRIVER = Argument ("chromedriver", EnvironmentVariable ("CHROMEWEBDRIVER")); var PLATFORM_SUPPORTS_VULKAN_TESTS = (IsRunningOnWindows () || IsRunningOnLinux ()).ToString (); var SUPPORT_VULKAN_VAR = Argument ("supportVulkan", EnvironmentVariable ("SUPPORT_VULKAN") ?? PLATFORM_SUPPORTS_VULKAN_TESTS); var SUPPORT_VULKAN = SUPPORT_VULKAN_VAR == "1" || SUPPORT_VULKAN_VAR.ToLower () == "true"; var MDocPath = Context.Tools.Resolve ("mdoc.exe"); DirectoryPath DOCS_PATH = MakeAbsolute(ROOT_PATH.Combine("docs/SkiaSharpAPI")); var PREVIEW_LABEL = Argument ("previewLabel", EnvironmentVariable ("PREVIEW_LABEL") ?? "preview"); var FEATURE_NAME = EnvironmentVariable ("FEATURE_NAME") ?? ""; var BUILD_NUMBER = Argument ("buildNumber", EnvironmentVariable ("BUILD_NUMBER") ?? "0"); var GIT_SHA = Argument ("gitSha", EnvironmentVariable ("GIT_SHA") ?? ""); var GIT_BRANCH_NAME = Argument ("gitBranch", EnvironmentVariable ("GIT_BRANCH_NAME") ?? ""). Replace ("refs/heads/", ""); var GIT_URL = Argument ("gitUrl", EnvironmentVariable ("GIT_URL") ?? ""); var PREVIEW_NUGET_SUFFIX = string.IsNullOrEmpty (BUILD_NUMBER) ? $"{PREVIEW_LABEL}" : $"{PREVIEW_LABEL}.{BUILD_NUMBER}"; var PREVIEW_FEED_URL = Argument ("previewFeed", "https://pkgs.dev.azure.com/xamarin/public/_packaging/SkiaSharp/nuget/v3/index.json"); var TRACKED_NUGETS = new Dictionary<string, Version> { { "SkiaSharp", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.Linux", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.Linux.NoDependencies", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.NanoServer", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.WebAssembly", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.Android", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.iOS", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.MacCatalyst", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.macOS", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.Tizen", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.tvOS", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.UWP", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.watchOS", new Version (1, 57, 0) }, { "SkiaSharp.NativeAssets.Win32", new Version (1, 57, 0) }, { "SkiaSharp.Views", new Version (1, 57, 0) }, { "SkiaSharp.Views.Desktop.Common", new Version (1, 57, 0) }, { "SkiaSharp.Views.Gtk2", new Version (1, 57, 0) }, { "SkiaSharp.Views.Gtk3", new Version (1, 57, 0) }, { "SkiaSharp.Views.WindowsForms", new Version (1, 57, 0) }, { "SkiaSharp.Views.WPF", new Version (1, 57, 0) }, { "SkiaSharp.Views.Forms", new Version (1, 57, 0) }, { "SkiaSharp.Views.Forms.WPF", new Version (1, 57, 0) }, { "SkiaSharp.Views.Forms.GTK", new Version (1, 57, 0) }, { "SkiaSharp.Views.Uno", new Version (1, 57, 0) }, { "SkiaSharp.Views.WinUI", new Version (1, 57, 0) }, { "SkiaSharp.Views.Maui.Core", new Version (1, 57, 0) }, { "SkiaSharp.Views.Maui.Controls", new Version (1, 57, 0) }, { "SkiaSharp.Views.Maui.Controls.Compatibility", new Version (1, 57, 0) }, { "SkiaSharp.Views.Blazor", new Version (1, 57, 0) }, { "HarfBuzzSharp", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.Android", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.iOS", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.Linux", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.MacCatalyst", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.macOS", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.Tizen", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.tvOS", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.UWP", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.watchOS", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.WebAssembly", new Version (1, 0, 0) }, { "HarfBuzzSharp.NativeAssets.Win32", new Version (1, 0, 0) }, { "SkiaSharp.HarfBuzz", new Version (1, 57, 0) }, { "SkiaSharp.Vulkan.SharpVk", new Version (1, 57, 0) }, }; var PREVIEW_ONLY_NUGETS = new List<string> { "SkiaSharp.Views.Maui.Core", "SkiaSharp.Views.Maui.Controls", "SkiaSharp.Views.Maui.Controls.Compatibility", "SkiaSharp.Views.WinUI", "SkiaSharp.Views.Blazor", }; Information("Source Control:"); Information($" {"PREVIEW_LABEL".PadRight(30)} {{0}}", PREVIEW_LABEL); Information($" {"FEATURE_NAME".PadRight(30)} {{0}}", FEATURE_NAME); Information($" {"BUILD_NUMBER".PadRight(30)} {{0}}", BUILD_NUMBER); Information($" {"GIT_SHA".PadRight(30)} {{0}}", GIT_SHA); Information($" {"GIT_BRANCH_NAME".PadRight(30)} {{0}}", GIT_BRANCH_NAME); Information($" {"GIT_URL".PadRight(30)} {{0}}", GIT_URL); #load "cake/msbuild.cake" #load "cake/UtilsManaged.cake" #load "cake/externals.cake" #load "cake/UpdateDocs.cake" #load "cake/samples.cake" Task ("__________________________________") .Description ("__________________________________________________"); //////////////////////////////////////////////////////////////////////////////////////////////////// // EXTERNALS - the native C and C++ libraries //////////////////////////////////////////////////////////////////////////////////////////////////// // this builds all the externals Task ("externals") .Description ("Build all external dependencies.") .IsDependentOn ("externals-native"); //////////////////////////////////////////////////////////////////////////////////////////////////// // LIBS - the managed C# libraries //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("libs") .Description ("Build all managed assemblies.") .WithCriteria(!SKIP_BUILD) .IsDependentOn ("externals") .Does (() => { // build the managed libraries var platform = ""; if (!BUILD_ALL_PLATFORMS) { if (IsRunningOnWindows ()) { platform = ".Windows"; } else if (IsRunningOnMacOs ()) { platform = ".Mac"; } else if (IsRunningOnLinux ()) { platform = ".Linux"; } } var net6 = $"./source/SkiaSharpSource{platform}-net6.slnf"; var netfx = $"./source/SkiaSharpSource{platform}-netfx.slnf"; if (FileExists (net6) || FileExists (netfx)) { if (FileExists (net6)) RunMSBuild (net6, properties: new Dictionary<string, string> { { "BuildingForNet6", "true" } }); if (FileExists (netfx)) RunMSBuild (netfx, properties: new Dictionary<string, string> { { "BuildingForNet6", "false" } }); } else { RunMSBuild ($"./source/SkiaSharpSource{platform}.sln"); } // assemble the mdoc docs EnsureDirectoryExists ("./output/docs/mdoc/"); RunProcess (MDocPath, new ProcessSettings { Arguments = $"assemble --out=\"./output/docs/mdoc/SkiaSharp\" \"{DOCS_PATH}\" --debug", }); CopyFileToDirectory ("./docs/SkiaSharp.source", "./output/docs/mdoc/"); }); //////////////////////////////////////////////////////////////////////////////////////////////////// // TESTS - some test cases to make sure it works //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("tests") .Description ("Run all tests.") .IsDependentOn ("tests-netfx") .IsDependentOn ("tests-netcore") .IsDependentOn ("tests-android") .IsDependentOn ("tests-ios"); Task ("tests-netfx") .Description ("Run all Full .NET Framework tests.") .IsDependentOn ("externals") .Does (() => { var failedTests = 0; void RunDesktopTest (string arch) { RunMSBuild ("./tests/SkiaSharp.Desktop.Tests.sln", platform: arch == "AnyCPU" ? "Any CPU" : arch); // SkiaSharp.Tests.dll try { RunTests ($"./tests/SkiaSharp.Desktop.Tests/bin/{arch}/{CONFIGURATION}/SkiaSharp.Tests.dll", arch == "x86"); } catch { failedTests++; } // SkiaSharp.Vulkan.Tests.dll if (SUPPORT_VULKAN) { try { RunTests ($"./tests/SkiaSharp.Vulkan.Desktop.Tests/bin/{arch}/{CONFIGURATION}/SkiaSharp.Vulkan.Tests.dll", arch == "x86"); } catch { failedTests++; } } } CleanDirectories ($"{PACKAGE_CACHE_PATH}/skiasharp*"); CleanDirectories ($"{PACKAGE_CACHE_PATH}/harfbuzzsharp*"); if (IsRunningOnWindows ()) { RunDesktopTest ("x86"); RunDesktopTest ("x64"); } else if (IsRunningOnMacOs ()) { RunDesktopTest ("AnyCPU"); } else if (IsRunningOnLinux ()) { RunDesktopTest ("x64"); } if (failedTests > 0) { if (THROW_ON_TEST_FAILURE) throw new Exception ($"There were {failedTests} failed tests."); else Warning ($"There were {failedTests} failed tests."); } }); Task ("tests-netcore") .Description ("Run all .NET Core tests.") .IsDependentOn ("externals") .Does (() => { var failedTests = 0; CleanDirectories ($"{PACKAGE_CACHE_PATH}/skiasharp*"); CleanDirectories ($"{PACKAGE_CACHE_PATH}/harfbuzzsharp*"); // SkiaSharp.NetCore.Tests.csproj try { RunNetCoreTests ("./tests/SkiaSharp.NetCore.Tests/SkiaSharp.NetCore.Tests.csproj"); } catch { failedTests++; } // SkiaSharp.Vulkan.NetCore.Tests.csproj if (SUPPORT_VULKAN) { try { RunNetCoreTests ("./tests/SkiaSharp.Vulkan.NetCore.Tests/SkiaSharp.Vulkan.NetCore.Tests.csproj"); } catch { failedTests++; } } if (failedTests > 0) { if (THROW_ON_TEST_FAILURE) throw new Exception ($"There were {failedTests} failed tests."); else Warning ($"There were {failedTests} failed tests."); } if (COVERAGE) { RunCodeCoverage ("./tests/**/Coverage/**/*.xml", "./output/coverage"); } }); Task ("tests-android") .Description ("Run all Android tests.") .IsDependentOn ("externals") .Does (() => { var failedTests = 0; CleanDirectories ($"{PACKAGE_CACHE_PATH}/skiasharp*"); CleanDirectories ($"{PACKAGE_CACHE_PATH}/harfbuzzsharp*"); // SkiaSharp.Android.Tests.csproj try { // build the solution to copy all the files RunMSBuild ("./tests/SkiaSharp.Android.Tests.sln", configuration: "Debug"); // package the app FilePath csproj = "./tests/SkiaSharp.Android.Tests/SkiaSharp.Android.Tests.csproj"; RunMSBuild (csproj, targets: new [] { "SignAndroidPackage" }, platform: "AnyCPU", configuration: "Debug"); // run the tests DirectoryPath results = "./output/logs/testlogs/SkiaSharp.Android.Tests"; RunCake ("./cake/xharness-android.cake", "Default", new Dictionary<string, string> { { "project", MakeAbsolute(csproj).FullPath }, { "configuration", "Debug" }, { "exclusive", "true" }, { "results", MakeAbsolute(results).FullPath }, { "verbosity", "diagnostic" }, }); } catch { failedTests++; } if (failedTests > 0) { if (THROW_ON_TEST_FAILURE) throw new Exception ($"There were {failedTests} failed tests."); else Warning ($"There were {failedTests} failed tests."); } }); Task ("tests-ios") .Description ("Run all iOS tests.") .IsDependentOn ("externals") .Does (() => { var failedTests = 0; CleanDirectories ($"{PACKAGE_CACHE_PATH}/skiasharp*"); CleanDirectories ($"{PACKAGE_CACHE_PATH}/harfbuzzsharp*"); // SkiaSharp.iOS.Tests.csproj try { // build the solution to copy all the files RunMSBuild ("./tests/SkiaSharp.iOS.Tests.sln", configuration: "Debug"); // package the app FilePath csproj = "./tests/SkiaSharp.iOS.Tests/SkiaSharp.iOS.Tests.csproj"; RunMSBuild (csproj, properties: new Dictionary<string, string> { { "BuildIpa", "true" } }, platform: "iPhoneSimulator", configuration: "Debug"); // run the tests DirectoryPath results = "./output/logs/testlogs/SkiaSharp.iOS.Tests"; RunCake ("./cake/xharness-ios.cake", "Default", new Dictionary<string, string> { { "project", MakeAbsolute(csproj).FullPath }, { "configuration", "Debug" }, { "exclusive", "true" }, { "results", MakeAbsolute(results).FullPath }, }); } catch { failedTests++; } if (failedTests > 0) { if (THROW_ON_TEST_FAILURE) throw new Exception ($"There were {failedTests} failed tests."); else Warning ($"There were {failedTests} failed tests."); } }); Task ("tests-wasm") .Description ("Run WASM tests.") .IsDependentOn ("externals-wasm") .Does (() => { var failedTests = 0; RunMSBuild ("./tests/SkiaSharp.Wasm.Tests.sln"); var pubDir = "./tests/SkiaSharp.Wasm.Tests/bin/publish/"; RunNetCorePublish("./tests/SkiaSharp.Wasm.Tests/SkiaSharp.Wasm.Tests.csproj", pubDir); IProcess serverProc = null; try { serverProc = RunAndReturnProcess(PYTHON_EXE, new ProcessSettings { Arguments = "server.py", WorkingDirectory = pubDir, }); DotNetCoreRun("./utils/WasmTestRunner/WasmTestRunner.csproj", "--output=\"./tests/SkiaSharp.Wasm.Tests/TestResults/\" " + (string.IsNullOrEmpty(CHROMEWEBDRIVER) ? "" : $"--driver=\"{CHROMEWEBDRIVER}\" ") + "--verbose " + "\"http://127.0.0.1:8000/\" "); } catch { failedTests++; } finally { serverProc?.Kill(); } if (failedTests > 0) { if (THROW_ON_TEST_FAILURE) throw new Exception ($"There were {failedTests} failed tests."); else Warning ($"There were {failedTests} failed tests."); } }); //////////////////////////////////////////////////////////////////////////////////////////////////// // SAMPLES - the demo apps showing off the work //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("samples-generate") .Description ("Generate and zip the samples directory structure.") .Does (() => { EnsureDirectoryExists ("./output/"); // create the interactive archive Zip ("./interactive", "./output/interactive.zip"); // create the samples archive CreateSamplesDirectory ("./samples/", "./output/samples/"); Zip ("./output/samples/", "./output/samples.zip"); // create the preview samples archive CreateSamplesDirectory ("./samples/", "./output/samples-preview/", PREVIEW_NUGET_SUFFIX); Zip ("./output/samples-preview/", "./output/samples-preview.zip"); }); Task ("samples") .Description ("Build all samples.") .IsDependentOn ("samples-generate") .Does(() => { var isLinux = IsRunningOnLinux (); var isMac = IsRunningOnMacOs (); var isWin = IsRunningOnWindows (); var buildMatrix = new Dictionary<string, bool> { { "android", isMac || isWin }, { "gtk", isLinux || isMac }, { "ios", isMac }, { "macos", isMac }, { "tvos", isMac }, { "uwp", isWin }, { "winui", isWin }, { "wapproj", isWin }, { "msix", isWin }, { "watchos", isMac }, { "wpf", isWin }, }; var platformMatrix = new Dictionary<string, string> { { "ios", "iPhone" }, { "tvos", "iPhoneSimulator" }, { "uwp", "x86" }, { "winui", "x64" }, { "wapproj", "x64" }, { "watchos", "iPhoneSimulator" }, { "xamarin.forms.mac", "iPhone" }, { "xamarin.forms.windows", "x86" }, }; void BuildSample (FilePath sln) { var platform = sln.GetDirectory ().GetDirectoryName ().ToLower (); var name = sln.GetFilenameWithoutExtension (); var slnPlatform = name.GetExtension (); if (!string.IsNullOrEmpty (slnPlatform)) { slnPlatform = slnPlatform.ToLower (); } if (!buildMatrix.ContainsKey (platform) || buildMatrix [platform]) { string buildPlatform = null; if (!string.IsNullOrEmpty (slnPlatform)) { if (platformMatrix.ContainsKey (platform + slnPlatform)) { buildPlatform = platformMatrix [platform + slnPlatform]; } } if (string.IsNullOrEmpty (buildPlatform) && platformMatrix.ContainsKey (platform)) { buildPlatform = platformMatrix [platform]; } Information ($"Building {sln} ({platform})..."); RunNuGetRestorePackagesConfig (sln); RunMSBuild (sln, platform: buildPlatform); } else { Information ($"Skipping {sln} ({platform})..."); } } // build the newly migrated samples CleanDirectories ($"{PACKAGE_CACHE_PATH}/skiasharp*"); CleanDirectories ($"{PACKAGE_CACHE_PATH}/harfbuzzsharp*"); // TODO: Docker seems to be having issues on the old DevOps agents // // copy all the packages next to the Dockerfile files // var dockerfiles = GetFiles ("./output/samples/**/Dockerfile"); // foreach (var dockerfile in dockerfiles) { // CopyDirectory (OUTPUT_NUGETS_PATH, dockerfile.GetDirectory ().Combine ("packages")); // } // // build the run.ps1 (typically for Dockerfiles) // var runs = GetFiles ("./output/samples/**/run.ps1"); // foreach (var run in runs) { // RunProcess ("pwsh", new ProcessSettings { // Arguments = run.FullPath, // WorkingDirectory = run.GetDirectory (), // }); // } // build solutions locally var actualSamples = PREVIEW_ONLY_NUGETS.Count > 0 ? "samples-preview" : "samples"; var solutions = GetFiles ($"./output/{actualSamples}/**/*.sln"); Information ("Solutions found:"); foreach (var sln in solutions) { Information (" " + sln); } foreach (var sln in solutions) { // might have been deleted due to a platform build and cleanup if (!FileExists (sln)) continue; var name = sln.GetFilenameWithoutExtension (); var slnPlatform = name.GetExtension (); if (string.IsNullOrEmpty (slnPlatform)) { // this is the main solution var variants = GetFiles (sln.GetDirectory ().CombineWithFilePath (name) + ".*.sln"); if (!variants.Any ()) { // there is no platform variant BuildSample (sln); // delete the built sample CleanDirectories (sln.GetDirectory ().FullPath); } else { // skip as there is a platform variant } } else { // this is a platform variant slnPlatform = slnPlatform.ToLower (); var shouldBuild = (isLinux && slnPlatform == ".linux") || (isMac && slnPlatform == ".mac") || (isWin && slnPlatform == ".windows"); if (shouldBuild) { BuildSample (sln); // delete the built sample CleanDirectories (sln.GetDirectory ().FullPath); } else { // skip this as this is not the correct platform } } } CleanDirectory ("./output/samples/"); DeleteDirectory ("./output/samples/", new DeleteDirectorySettings { Recursive = true, Force = true }); CleanDirectory ("./output/samples-preview/"); DeleteDirectory ("./output/samples-preview/", new DeleteDirectorySettings { Recursive = true, Force = true }); }); //////////////////////////////////////////////////////////////////////////////////////////////////// // NUGET - building the package for NuGet.org //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("nuget") .Description ("Pack all NuGets.") .IsDependentOn ("nuget-normal") .IsDependentOn ("nuget-special"); Task ("nuget-normal") .Description ("Pack all NuGets (build all required dependencies).") .IsDependentOn ("libs") .Does (() => { var platform = ""; if (!PACK_ALL_PLATFORMS) { if (IsRunningOnWindows ()) { platform = "windows"; } else if (IsRunningOnMacOs ()) { platform = "macos"; } else if (IsRunningOnLinux ()) { platform = "linux"; } } void RemovePlatforms (XDocument xdoc) { var files = xdoc.Root .Elements ("files") .Elements ("file"); foreach (var file in files.ToArray ()) { // remove the files that aren't available var nuspecPlatform = file.Attribute ("platform"); if (!string.IsNullOrEmpty (nuspecPlatform?.Value)) { nuspecPlatform.Remove (); if (!string.IsNullOrEmpty (platform)) { // handle the platform builds if (!nuspecPlatform.Value.Split (',').Contains (platform)) { file.Remove (); } } } // copy the src attribute and set it for the target if there is none already if (string.IsNullOrEmpty (file.Attribute ("target")?.Value)) { file.Add (new XAttribute ("target", file.Attribute ("src").Value)); } // make sure all the paths have the correct slash if (IsRunningOnWindows ()) { file.Attribute ("src").Value = file.Attribute ("src").Value.Replace ("/", "\\"); file.Attribute ("target").Value = file.Attribute ("target").Value.Replace ("/", "\\"); } } } void SetVersion (XDocument xdoc, string suffix) { var metadata = xdoc.Root.Element ("metadata"); var id = metadata.Element ("id"); var version = metadata.Element ("version"); // <version> if (id != null && version != null) { var v = GetVersion (id.Value); if (!string.IsNullOrEmpty (v)) { if (id.Value.StartsWith("SkiaSharp") || id.Value.StartsWith("HarfBuzzSharp")) v += suffix; version.Value = v; } } // <repository> var repository = metadata.Element ("repository"); if (repository == null) { repository = new XElement ("repository"); metadata.Add (repository); } repository.SetAttributeValue ("type", "git"); repository.SetAttributeValue ("url", GIT_URL); repository.SetAttributeValue ("branch", GIT_BRANCH_NAME); repository.SetAttributeValue ("commit", GIT_SHA); // <version> if (id != null && version != null) { var v = GetVersion (id.Value); if (!string.IsNullOrEmpty (v)) { if (id.Value.StartsWith("SkiaSharp") || id.Value.StartsWith("HarfBuzzSharp")) v += suffix; version.Value = v; } } // <dependency> var dependencies = metadata .Elements ("dependencies") .Elements ("dependency"); var groupDependencies = metadata .Elements ("dependencies") .Elements ("group") .Elements ("dependency"); foreach (var package in dependencies.Union (groupDependencies)) { var depId = package.Attribute ("id"); var depVersion = package.Attribute ("version"); if (depId != null && depVersion != null) { var v = GetVersion (depId.Value); if (!string.IsNullOrEmpty (v)) { if (depId.Value.StartsWith("SkiaSharp") || depId.Value.StartsWith("HarfBuzzSharp")) v += suffix; depVersion.Value = v; } else { v = GetVersion (depId.Value, "release"); if (!string.IsNullOrEmpty (v)) depVersion.Value = v; } } } } DeleteFiles ("./output/*/nuget/*.nuspec"); foreach (var nuspec in GetFiles ("./nuget/*.nuspec")) { var xdoc = XDocument.Load (nuspec.FullPath); var metadata = xdoc.Root.Element ("metadata"); var id = metadata.Element ("id").Value; if (id.StartsWith ("_")) continue; var dir = id; if (id.Contains(".NativeAssets.")) { dir = id.Substring(0, id.IndexOf(".NativeAssets.")); } var preview = ""; if (!string.IsNullOrEmpty (FEATURE_NAME)) { preview += $"-featurepreview-{FEATURE_NAME}"; } else { preview += $"-{PREVIEW_LABEL}"; } if (!string.IsNullOrEmpty (BUILD_NUMBER)) { preview += $".{BUILD_NUMBER}"; } RemovePlatforms (xdoc); var outDir = $"./output/{dir}/nuget"; EnsureDirectoryExists (outDir); if (!PREVIEW_ONLY_NUGETS.Contains (id)) { SetVersion (xdoc, ""); xdoc.Save ($"{outDir}/{id}.nuspec"); } SetVersion (xdoc, $"{preview}"); xdoc.Save ($"{outDir}/{id}.prerelease.nuspec"); // the placeholders FileWriteText ($"{outDir}/_._", ""); // the legal CopyFile ("./LICENSE.txt", $"{outDir}/LICENSE.txt"); CopyFile ("./External-Dependency-Info.txt", $"{outDir}/THIRD-PARTY-NOTICES.txt"); } EnsureDirectoryExists ($"{OUTPUT_NUGETS_PATH}"); DeleteFiles ($"{OUTPUT_NUGETS_PATH}/*.nupkg"); foreach (var nuspec in GetFiles ("./output/*/nuget/*.nuspec")) { string symbolsFormat = null; // *.NativeAssets.* are special as they contain just native code if (nuspec.FullPath.Contains(".NativeAssets.")) symbolsFormat = "symbols.nupkg"; PackageNuGet (nuspec, OUTPUT_NUGETS_PATH, symbolsFormat: symbolsFormat); } // copy & move symbols to a special location to avoid signing EnsureDirectoryExists ($"{OUTPUT_SYMBOLS_NUGETS_PATH}"); DeleteFiles ($"{OUTPUT_SYMBOLS_NUGETS_PATH}/*.nupkg"); MoveFiles ($"{OUTPUT_NUGETS_PATH}/*.snupkg", OUTPUT_SYMBOLS_NUGETS_PATH); MoveFiles ($"{OUTPUT_NUGETS_PATH}/*.symbols.nupkg", OUTPUT_SYMBOLS_NUGETS_PATH); // setup validation options var options = new Xamarin.Nuget.Validator.NugetValidatorOptions { Copyright = "© Microsoft Corporation. All rights reserved.", Author = "Microsoft", Owner = "Microsoft", NeedsProjectUrl = true, NeedsLicenseUrl = true, ValidateRequireLicenseAcceptance = true, ValidPackageNamespace = new [] { "SkiaSharp", "HarfBuzzSharp" }, }; var nupkgFiles = GetFiles ($"{OUTPUT_NUGETS_PATH}/*.nupkg"); Information ("Found ({0}) Nuget's to validate", nupkgFiles.Count ()); foreach (var nupkgFile in nupkgFiles) { Verbose ("Verifiying Metadata of {0}", nupkgFile.GetFilename ()); var result = Xamarin.Nuget.Validator.NugetValidator.Validate(MakeAbsolute(nupkgFile).FullPath, options); if (!result.Success) { Information ("Metadata validation failed for: {0} \n\n", nupkgFile.GetFilename ()); Information (string.Join("\n ", result.ErrorMessages)); throw new Exception ($"Invalid Metadata for: {nupkgFile.GetFilename ()}"); } else { Information ("Metadata validation passed for: {0}", nupkgFile.GetFilename ()); } } }); Task ("nuget-special") .Description ("Pack all special NuGets.") .IsDependentOn ("nuget-normal") .Does (() => { EnsureDirectoryExists ($"{OUTPUT_SPECIAL_NUGETS_PATH}"); DeleteFiles ($"{OUTPUT_SPECIAL_NUGETS_PATH}/*.nupkg"); // get a list of all the version number variants var versions = new List<string> (); if (!string.IsNullOrEmpty (PREVIEW_LABEL) && PREVIEW_LABEL.StartsWith ("pr.")) { var v = $"0.0.0-{PREVIEW_LABEL}"; if (!string.IsNullOrEmpty (BUILD_NUMBER)) v += $".{BUILD_NUMBER}"; versions.Add (v); } else { if (!string.IsNullOrEmpty (GIT_SHA)) { var v = $"0.0.0-commit.{GIT_SHA}"; if (!string.IsNullOrEmpty (BUILD_NUMBER)) v += $".{BUILD_NUMBER}"; versions.Add (v); } if (!string.IsNullOrEmpty (GIT_BRANCH_NAME)) { var v = $"0.0.0-branch.{GIT_BRANCH_NAME.Replace ("/", ".")}"; if (!string.IsNullOrEmpty (BUILD_NUMBER)) v += $".{BUILD_NUMBER}"; versions.Add (v); } } // get a list of all the nuspecs to pack var specials = new Dictionary<string, string> (); var nativePlatforms = GetDirectories ("./output/native/*") .Select (d => d.GetDirectoryName ()) .ToArray (); if (nativePlatforms.Length > 0) { specials[$"_NativeAssets"] = $"native"; foreach (var platform in nativePlatforms) { specials[$"_NativeAssets.{platform}"] = $"native/{platform}"; } } if (GetFiles ("./output/nugets/*.nupkg").Count > 0) { specials[$"_NuGets"] = $"nugets"; specials[$"_NuGetsPreview"] = $"nugets"; specials[$"_Symbols"] = $"nugets-symbols"; specials[$"_SymbolsPreview"] = $"nugets-symbols"; } foreach (var pair in specials) { var id = pair.Key; var path = pair.Value; var nuspec = $"./output/{path}/{id}.nuspec"; DeleteFiles ($"./output/{path}/*.nuspec"); foreach (var packageVersion in versions) { // update the version var fn = id.StartsWith ("_NativeAssets.") ? "_NativeAssets" : id; var xdoc = XDocument.Load ($"./nuget/{fn}.nuspec"); var metadata = xdoc.Root.Element ("metadata"); metadata.Element ("version").Value = packageVersion; metadata.Element ("id").Value = id; if (id == "_NativeAssets") { // handle the root package var dependencies = metadata.Element ("dependencies"); foreach (var platform in nativePlatforms) { dependencies.Add (new XElement ("dependency", new XAttribute ("id", $"_NativeAssets.{platform}"), new XAttribute ("version", packageVersion))); } } else if (id.StartsWith ("_NativeAssets.")) { // handle the dependencies var platform = id.Substring (id.IndexOf (".") + 1); var files = xdoc.Root.Element ("files"); files.Add (new XElement ("file", new XAttribute ("src", $"**"), new XAttribute ("target", $"tools/{platform}"))); } xdoc.Save (nuspec); PackageNuGet (nuspec, OUTPUT_SPECIAL_NUGETS_PATH, true); } DeleteFiles ($"./output/{path}/*.nuspec"); } }); //////////////////////////////////////////////////////////////////////////////////////////////////// // DOCS - creating the xml, markdown and other documentation //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("update-docs") .Description ("Regenerate all docs.") .IsDependentOn ("docs-api-diff") .IsDependentOn ("docs-update-frameworks") .IsDependentOn ("docs-format-docs"); //////////////////////////////////////////////////////////////////////////////////////////////////// // CLEAN - remove all the build artefacts //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("clean") .Description ("Clean up.") .IsDependentOn ("clean-externals") .IsDependentOn ("clean-managed"); Task ("clean-managed") .Description ("Clean up (managed only).") .Does (() => { CleanDirectories ("./binding/*/bin"); CleanDirectories ("./binding/*/obj"); DeleteFiles ("./binding/*/project.lock.json"); CleanDirectories ("./samples/*/*/bin"); CleanDirectories ("./samples/*/*/obj"); CleanDirectories ("./samples/*/*/AppPackages"); CleanDirectories ("./samples/*/*/*/bin"); CleanDirectories ("./samples/*/*/*/obj"); DeleteFiles ("./samples/*/*/*/project.lock.json"); CleanDirectories ("./samples/*/*/*/AppPackages"); CleanDirectories ("./samples/*/*/packages"); CleanDirectories ("./tests/**/bin"); CleanDirectories ("./tests/**/obj"); CleanDirectories ("./tests/**/artifacts"); DeleteFiles ("./tests/**/project.lock.json"); CleanDirectories ("./source/*/*/bin"); CleanDirectories ("./source/*/*/obj"); DeleteFiles ("./source/*/*/project.lock.json"); CleanDirectories ("./source/*/*/Generated Files"); CleanDirectories ("./source/packages"); DeleteFiles ("./nuget/*.prerelease.nuspec"); if (DirectoryExists ("./output")) DeleteDirectory ("./output", new DeleteDirectorySettings { Recursive = true, Force = true }); }); //////////////////////////////////////////////////////////////////////////////////////////////////// // DEFAULT - target for common development //////////////////////////////////////////////////////////////////////////////////////////////////// Task ("----------------------------------") .Description ("--------------------------------------------------"); Task ("Default") .Description ("Build all managed assemblies and external dependencies.") .IsDependentOn ("externals") .IsDependentOn ("libs"); Task ("Everything") .Description ("Build, pack and test everything.") .IsDependentOn ("externals") .IsDependentOn ("libs") .IsDependentOn ("nuget") .IsDependentOn ("tests") .IsDependentOn ("samples"); //////////////////////////////////////////////////////////////////////////////////////////////////// // BUILD NOW //////////////////////////////////////////////////////////////////////////////////////////////////// RunTarget (TARGET);
the_stack
///////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// var Target = Argument("target", "Default"); var Configuration = Argument("configuration", "Release"); // VERSION INFORMATION var BuildNumber = EnvironmentVariable("BUILD_NUMBER"); var Version = System.IO.File.ReadAllText("../VERSION"); var VersionSuffix = ""; // VARIOUS DIRECTORIES var BinariesDirectory = "./build/bin/" + Configuration; var OutputDirectory = "./build/out/" + Configuration; // GIT SPECIFIC VARIABLES var GitHubToken = EnvironmentVariable("GITHUB_TOKEN"); var GitBranch = EnvironmentVariable("BUILD_VCS_BRANCH"); var GitCommitish = EnvironmentVariable("BUILD_VCS_NUMBER"); var GitHubRepository = "hadouken/hadouken"; // CHOCOLATEY var ChocoApiKey = EnvironmentVariable("CHOCOLATEY_API_KEY"); public string RunCommand(string executable, string args) { IEnumerable<string> output; var exitCode = StartProcess(executable, new ProcessSettings { Arguments = args, RedirectStandardOutput = true }, out output); if (exitCode == 0) { return output.First(); } return string.Empty; } public string ToJson(object obj) { return new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(obj); } public T FromJson<T>(string json) { return new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<T>(json); } Task("Clean") .Does(() => { CleanDirectories(new[] { BinariesDirectory, BinariesDirectory + "/js/plugins", BinariesDirectory + "/js/rpc", OutputDirectory, "./build/" + Configuration, "./build/wixobj" }); }); Task("Prepare-Version-Suffix") .WithCriteria(() => GitBranch != "master") .Does(() => { if(string.IsNullOrEmpty(GitBranch)) { GitBranch = RunCommand("git", "rev-parse --abbrev-ref HEAD"); } if (GitBranch == "master") return; if (!string.IsNullOrEmpty(BuildNumber)) { VersionSuffix = "-build" + BuildNumber; } else { VersionSuffix = "-local"; } }); Task("Get-Git-Revision") .WithCriteria(() => string.IsNullOrEmpty(GitCommitish)) .OnError(exception => { GitCommitish = "<norev>"; }) .Does(() => { GitCommitish = RunCommand("git", "log -1 --format=%H") ?? "<norev>"; }); Task("Restore-NuGet-Packages") .Does(() => { NuGetInstallFromConfig("./packages.config", new NuGetInstallSettings { ExcludeVersion = true, OutputDirectory = "./libs" }); }); Task("Generate-CMake-Project") .Does(() => { CreateDirectory("build"); var cmakeExitCode = StartProcess("cmake", new ProcessSettings { Arguments = "../../ -G \"Visual Studio 12\" -T \"v120\"", WorkingDirectory = "./build" }); if(cmakeExitCode != 0) { throw new CakeException("CMake failed to execute."); } }); Task("Compile") .IsDependentOn("Restore-NuGet-Packages") .IsDependentOn("Generate-CMake-Project") .IsDependentOn("Get-Git-Revision") .Does(() => { MSBuild("./build/hadouken.sln", s => { s.Configuration = Configuration; }); }); Task("Output") .IsDependentOn("Compile") .Does(() => { // Copy JS files CopyFiles(GetFiles("../js/*.js"), BinariesDirectory + "/js"); CopyFiles(GetFiles("../js/plugins/*.js"), BinariesDirectory + "/js/plugins"); CopyFiles(GetFiles("../js/rpc/*.js"), BinariesDirectory + "/js/rpc"); // Pack and copy webui IEnumerable<FilePath> webui = GetFiles("../webui/LICENS*"); webui = webui.Union(GetFiles("../webui/*.css")); webui = webui.Union(GetFiles("../webui/*.js")); webui = webui.Union(GetFiles("../webui/*.html")); webui = webui.Union(GetFiles("../webui/images/*.gif")); webui = webui.Union(GetFiles("../webui/images/*.png")); webui = webui.Union(GetFiles("../webui/lang/*.js")); Zip("../webui/", BinariesDirectory + "/webui.zip", webui); // Copy relevant dist files var distFiles = new [] { "../dist/win32/hadouken.json.template" }; CopyFiles(distFiles, BinariesDirectory); }); Task("Create-Zip-Package") .IsDependentOn("Output") .Does(() => { IEnumerable<FilePath> files = GetFiles(BinariesDirectory + "/*.dll"); files = files.Union(GetFiles(BinariesDirectory + "/*.exe")); files = files.Union(GetFiles(BinariesDirectory + "/*.template")); files = files.Union(GetFiles(BinariesDirectory + "/js/*.js")); files = files.Union(GetFiles(BinariesDirectory + "/js/plugins/*.js")); files = files.Union(GetFiles(BinariesDirectory + "/js/rpc/*.js")); files = files.Union(GetFiles(BinariesDirectory + "/webui.zip")); Zip(BinariesDirectory, OutputDirectory + "/hadouken-" + Version + VersionSuffix + ".zip", files); }); Task("Create-Pdb-Package") .IsDependentOn("Output") .Does(() => { var pdbFiles = GetFiles(BinariesDirectory + "/*.pdb"); Zip(BinariesDirectory, OutputDirectory + "/hadouken-" + Version + VersionSuffix + ".symbols.zip", pdbFiles); }); Task("Create-Msi-Package") .IsDependentOn("Output") .Does(() => { var commitish = (GitCommitish.Length > 7) ? GitCommitish.Substring(0, 7) : GitCommitish; WiXCandle("./installer/**/*.wxs", new CandleSettings { Defines = new Dictionary<string, string> { { "BinDir", BinariesDirectory }, { "BuildConfiguration", Configuration }, { "BuildVersion", Version }, { "GitCommitish", commitish } }, Extensions = new [] { "WixFirewallExtension", "./tools/msiext-1.4/WixExtensions/WixSystemToolsExtension.dll" }, OutputDirectory = "./build/wixobj", ToolPath = "./libs/WiX.Toolset/tools/wix/candle.exe" }); WiXLight("./build/wixobj/*.wixobj", new LightSettings { Extensions = new [] { "WixUtilExtension", "WixFirewallExtension", "./tools/msiext-1.4/WixExtensions/WixSystemToolsExtension.dll" }, OutputFile = OutputDirectory + "/hadouken-" + Version + VersionSuffix + ".msi", ToolPath = "./libs/WiX.Toolset/tools/wix/light.exe", RawArguments = "-spdb -loc \"installer/lang/en-us.wxl\"" }); }); Task("Create-Chocolatey-Package") .IsDependentOn("Create-Msi-Package") .Does(() => { var transformed = TransformTextFile("./chocolatey/tools/chocolateyInstall.ps1.template", "%{", "}") .WithToken("File", "hadouken-" + Version + VersionSuffix + ".msi") .WithToken("Version", Version) .ToString(); System.IO.File.WriteAllText("./chocolatey/tools/chocolateyInstall.ps1", transformed); var packSettings = new NuGetPackSettings { BasePath = "./chocolatey", OutputDirectory = OutputDirectory, Version = Version + VersionSuffix }; NuGetPack("./chocolatey/hadouken.nuspec", packSettings); }); Task("Generate-Checksum-File") .IsDependentOn("Create-Zip-Package") .IsDependentOn("Create-Pdb-Package") .IsDependentOn("Create-Msi-Package") .Does(() => { var checksums = new Dictionary<string, string>(); foreach (var file in GetFiles(OutputDirectory + "/*.*")) { var hash = CalculateFileHash(file, HashAlgorithm.MD5); checksums.Add(file.GetFilename().ToString(), hash.ToHex()); } System.IO.File.WriteAllText(OutputDirectory + "/checksums.json", ToJson(checksums)); }); Task("Publish-Release") .Does(() => { var data = ToJson(new { tag_name = "v" + Version + VersionSuffix, target_commitish = GitCommitish, name = "Hadouken " + Version + VersionSuffix, prerelease = !string.IsNullOrEmpty(VersionSuffix) }); using(var client = new System.Net.WebClient()) { client.Headers.Add("Accept", "application/vnd.github.v3+json"); client.Headers.Add("Authorization", "token " + GitHubToken); client.Headers.Add("User-Agent", "Hadouken-Deployment-Agent"); var response = client.UploadString("https://api.github.com/repos/" + GitHubRepository + "/releases", data); var responseObject = FromJson<IDictionary<string, object>>(response); var uploadUrlTemplate = responseObject["upload_url"].ToString(); Information("Release created... Publishing files."); var toPublish = new [] { OutputDirectory + "/checksums.json", OutputDirectory + "/hadouken-" + Version + VersionSuffix + ".msi", OutputDirectory + "/hadouken-" + Version + VersionSuffix + ".symbols.zip", OutputDirectory + "/hadouken-" + Version + VersionSuffix + ".zip" }; foreach (var file in toPublish) { client.Headers["Content-Type"] = "application/octet-stream"; var fileName = System.IO.Path.GetFileName(file); var uploadUrl = uploadUrlTemplate.Replace("{?name}", "?name=" + fileName); var uploadResponse = client.UploadData(uploadUrl, System.IO.File.ReadAllBytes(file)); Information("File {0} published to GitHub.", fileName); } } // Publish nupkg to chocolatey var pushSettings = new NuGetPushSettings { ApiKey = ChocoApiKey, Source = "https://chocolatey.org/" }; NuGetPush(OutputDirectory + "/hadouken." + Version + VersionSuffix + ".nupkg", pushSettings); }); Task("Default") .IsDependentOn("Clean") .IsDependentOn("Prepare-Version-Suffix") .IsDependentOn("Compile") .IsDependentOn("Output") .IsDependentOn("Create-Zip-Package") .IsDependentOn("Create-Pdb-Package") .IsDependentOn("Create-Msi-Package") .IsDependentOn("Create-Chocolatey-Package") .IsDependentOn("Generate-Checksum-File"); Task("Publish") .IsDependentOn("Default") .IsDependentOn("Publish-Release"); ////////////////////////////////////////////////////////////////////// // EXECUTION ////////////////////////////////////////////////////////////////////// RunTarget(Target);
the_stack
////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// Task("Cake.Common.IO.FileAliases.CopyFileToDirectory") .Does(() => { // Given var sourcePath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/CopyFileToDirectory/source"); var targetPath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/CopyFileToDirectory/target"); var sourceFile = sourcePath.CombineWithFilePath("test.file"); var targetFile = targetPath.CombineWithFilePath("test.file"); EnsureDirectoriesExist(new DirectoryPath[] { sourcePath, targetPath }); EnsureFileExist(sourceFile); // When CopyFileToDirectory(sourceFile, targetPath); // Then Assert.True(System.IO.File.Exists(targetFile.FullPath)); }); Task("Cake.Common.IO.FileAliases.CopyFile") .Does(() => { // Given var path = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/CopyFile"); var sourceFile = path.CombineWithFilePath("source.txt"); var targetFile = path.CombineWithFilePath("target.txt"); EnsureDirectoryExist(path); EnsureFileExist(sourceFile); // When CopyFile(sourceFile, targetFile); // Then Assert.True(System.IO.File.Exists(targetFile.FullPath)); }); Task("Cake.Common.IO.FileAliases.CopyFiles.Pattern") .Does(() => { // Given var sourcePath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/Pattern/CopyFiles/source"); var targetPath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/Pattern/CopyFiles/target"); var sourceFiles = new FilePath[] { sourcePath.CombineWithFilePath("Cake.txt"), sourcePath.CombineWithFilePath("Cake.Common.txt"), sourcePath.CombineWithFilePath("Cake.Core.txt"), sourcePath.CombineWithFilePath("Cake.NuGet.txt"), sourcePath.CombineWithFilePath("Autofac.txt"), sourcePath.CombineWithFilePath("Mono.CSharp.txt"), sourcePath.CombineWithFilePath("NuGet.Core.txt") }; var targetCopyFiles = new FilePath[] { targetPath.CombineWithFilePath("Cake.txt"), targetPath.CombineWithFilePath("Cake.Common.txt"), targetPath.CombineWithFilePath("Cake.Core.txt"), targetPath.CombineWithFilePath("Cake.NuGet.txt") }; var targetDontCopyFiles = new FilePath[] { targetPath.CombineWithFilePath("Autofac.txt"), targetPath.CombineWithFilePath("Mono.CSharp.txt"), targetPath.CombineWithFilePath("NuGet.Core.txt") }; EnsureDirectoriesExist(new DirectoryPath[] { sourcePath, targetPath }); EnsureFilesExist(sourceFiles); // When CopyFiles(sourcePath.FullPath + "/Cake.*", targetPath); // Then Assert.True(AllExist(targetCopyFiles)); Assert.False(AnyExist(targetDontCopyFiles)); }); Task("Cake.Common.IO.FileAliases.CopyFiles.FilePaths") .Does(() => { // Given var sourcePath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/CopyFiles/FilePaths/source"); var targetPath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/CopyFiles/FilePaths/target"); var sourceFiles = new FilePath[] { sourcePath.CombineWithFilePath("Cake.txt"), sourcePath.CombineWithFilePath("Cake.Common.txt"), sourcePath.CombineWithFilePath("Cake.Core.txt"), sourcePath.CombineWithFilePath("Cake.NuGet.txt") }; var targetFiles = new FilePath[] { targetPath.CombineWithFilePath("Cake.txt"), targetPath.CombineWithFilePath("Cake.Common.txt"), targetPath.CombineWithFilePath("Cake.Core.txt"), targetPath.CombineWithFilePath("Cake.NuGet.txt") }; EnsureDirectoriesExist(new DirectoryPath[] { sourcePath, targetPath }); EnsureFilesExist(sourceFiles); // When CopyFiles(sourceFiles, targetPath); // Then Assert.True(AllExist(targetFiles)); }); Task("Cake.Common.IO.FileAliases.CopyFiles.Strings") .Does(() => { // Given var sourcePath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/CopyFiles/Strings/source"); var targetPath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/CopyFiles/Strings/target"); var sourceFiles = new FilePath[] { sourcePath.CombineWithFilePath("Cake.txt"), sourcePath.CombineWithFilePath("Cake.Common.txt"), sourcePath.CombineWithFilePath("Cake.Core.txt"), sourcePath.CombineWithFilePath("Cake.NuGet.txt") }; var sourceStrings = sourceFiles.Select(file=>file.FullPath).ToArray(); var targetFiles = new FilePath[] { targetPath.CombineWithFilePath("Cake.txt"), targetPath.CombineWithFilePath("Cake.Common.txt"), targetPath.CombineWithFilePath("Cake.Core.txt"), targetPath.CombineWithFilePath("Cake.NuGet.txt") }; EnsureDirectoriesExist(new DirectoryPath[] { sourcePath, targetPath }); EnsureFilesExist(sourceFiles); // When CopyFiles(sourceStrings, targetPath); // Then Assert.True(AllExist(targetFiles)); }); Task("Cake.Common.IO.FileAliases.DeleteFiles.Pattern") .Does(() => { // Given var path = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/DeleteFiles/Pattern"); var deleteFiles = new FilePath[] { path.CombineWithFilePath("Cake.txt"), path.CombineWithFilePath("Cake.Common.txt"), path.CombineWithFilePath("Cake.Core.txt"), path.CombineWithFilePath("Cake.NuGet.txt") }; var keepFiles = new FilePath[] { path.CombineWithFilePath("Autofac.txt"), path.CombineWithFilePath("Mono.CSharp.txt"), path.CombineWithFilePath("NuGet.Core.txt") }; EnsureDirectoryExist(path); EnsureFilesExist(deleteFiles.Concat(keepFiles)); // When DeleteFiles(path.FullPath + "/Cake.*"); // Then Assert.False(AnyExist(deleteFiles)); Assert.True(AllExist(keepFiles)); }); Task("Cake.Common.IO.FileAliases.DeleteFiles.FilePaths") .Does(() => { // Given var path = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/DeleteFiles/FilePaths"); var deleteFiles = new FilePath[] { path.CombineWithFilePath("Cake.txt"), path.CombineWithFilePath("Cake.Common.txt"), path.CombineWithFilePath("Cake.Core.txt"), path.CombineWithFilePath("Cake.NuGet.txt") }; var keepFiles = new FilePath[] { path.CombineWithFilePath("Autofac.txt"), path.CombineWithFilePath("Mono.CSharp.txt"), path.CombineWithFilePath("NuGet.Core.txt") }; EnsureDirectoryExist(path); EnsureFilesExist(deleteFiles.Concat(keepFiles)); // When DeleteFiles(deleteFiles); // Then Assert.False(AnyExist(deleteFiles)); Assert.True(AllExist(keepFiles)); }); Task("Cake.Common.IO.FileAliases.DeleteFile") .Does(() => { // Given var path = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/DeleteFile"); var file = path.CombineWithFilePath("file.txt"); EnsureDirectoryExist(path); EnsureFileExist(file); // When DeleteFile(file); // Then Assert.False(System.IO.File.Exists(file.FullPath)); }); Task("Cake.Common.IO.FileAliases.FileExists") .Does(() => { // Given var path = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/FileExists"); var file = path.CombineWithFilePath("file.txt"); EnsureDirectoryExist(path); EnsureFileExist(file); // When var result = FileExists(file); // Then Assert.True(result); }); Task("Cake.Common.IO.FileAliases.FileSize") .Does(() => { // Given var path = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/FileSize"); var file = path.CombineWithFilePath("file.txt"); var message = "FileSizeTestData"; var expect = Encoding.UTF8.GetByteCount(message + Environment.NewLine); EnsureDirectoryExist(path); EnsureFileExist(file, message); // When var result = FileSize(file); // Then Assert.Equal(expect, result); }); Task("Cake.Common.IO.FileAliases.MoveFileToDirectory") .Does(() => { // Given var sourcePath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/MoveFileToDirectory/source"); var targetPath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/MoveFileToDirectory/target"); var sourceFile = sourcePath.CombineWithFilePath("test.file"); var targetFile = targetPath.CombineWithFilePath("test.file"); EnsureDirectoriesExist(new DirectoryPath[] { sourcePath, targetPath }); EnsureFileExist(sourceFile); // When MoveFileToDirectory(sourceFile, targetPath); // Then Assert.True(System.IO.File.Exists(targetFile.FullPath)); Assert.False(System.IO.File.Exists(sourceFile.FullPath)); }); Task("Cake.Common.IO.FileAliases.MoveFiles.Pattern") .Does(() => { // Given var sourcePath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/Pattern/MoveFiles/source"); var targetPath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/Pattern/MoveFiles/target"); var sourceMoveFiles = new FilePath[] { sourcePath.CombineWithFilePath("Cake.txt"), sourcePath.CombineWithFilePath("Cake.Common.txt"), sourcePath.CombineWithFilePath("Cake.Core.txt"), sourcePath.CombineWithFilePath("Cake.NuGet.txt") }; var sourceDontMoveFiles = new FilePath[] { sourcePath.CombineWithFilePath("Autofac.txt"), sourcePath.CombineWithFilePath("Mono.CSharp.txt"), sourcePath.CombineWithFilePath("NuGet.Core.txt") }; var targetMoveFiles = new FilePath[] { targetPath.CombineWithFilePath("Cake.txt"), targetPath.CombineWithFilePath("Cake.Common.txt"), targetPath.CombineWithFilePath("Cake.Core.txt"), targetPath.CombineWithFilePath("Cake.NuGet.txt") }; var targetDontMoveFiles = new FilePath[] { targetPath.CombineWithFilePath("Autofac.txt"), targetPath.CombineWithFilePath("Mono.CSharp.txt"), targetPath.CombineWithFilePath("NuGet.Core.txt") }; EnsureDirectoriesExist(new DirectoryPath[] { sourcePath, targetPath }); EnsureFilesExist(sourceMoveFiles.Union(sourceDontMoveFiles)); // When MoveFiles(sourcePath.FullPath + "/Cake.*", targetPath); // Then Assert.False(AnyExist(sourceMoveFiles)); Assert.True(AllExist(sourceDontMoveFiles)); Assert.True(AllExist(targetMoveFiles)); Assert.False(AnyExist(targetDontMoveFiles)); }); Task("Cake.Common.IO.FileAliases.MoveFiles.FilePaths") .Does(() => { // Given var sourcePath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/MoveFiles/FilePaths/source"); var targetPath = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/MoveFiles/FilePaths/target"); var sourceFiles = new FilePath[] { sourcePath.CombineWithFilePath("Cake.txt"), sourcePath.CombineWithFilePath("Cake.Common.txt"), sourcePath.CombineWithFilePath("Cake.Core.txt"), sourcePath.CombineWithFilePath("Cake.NuGet.txt") }; var targetFiles = new FilePath[] { targetPath.CombineWithFilePath("Cake.txt"), targetPath.CombineWithFilePath("Cake.Common.txt"), targetPath.CombineWithFilePath("Cake.Core.txt"), targetPath.CombineWithFilePath("Cake.NuGet.txt") }; EnsureDirectoriesExist(new DirectoryPath[] { sourcePath, targetPath }); EnsureFilesExist(sourceFiles); // When MoveFiles(sourceFiles, targetPath); // Then Assert.False(AnyExist(sourceFiles)); Assert.True(AllExist(targetFiles)); }); Task("Cake.Common.IO.FileAliases.MoveFile") .Does(() => { // Given var path = Paths.Temp.Combine("./Cake.Common.IO.FileAliases/MoveFile"); var sourceFile = path.CombineWithFilePath("source.txt"); var targetFile = path.CombineWithFilePath("target.txt"); EnsureDirectoryExist(path); EnsureFileExist(sourceFile); // When MoveFile(sourceFile, targetFile); // Then Assert.False(System.IO.File.Exists(sourceFile.FullPath)); Assert.True(System.IO.File.Exists(targetFile.FullPath)); }); ////////////////////////////////////////////////////////////////////////////// Task("Cake.Common.IO.FileAliases") .IsDependentOn("Cake.Common.IO.FileAliases.CopyFileToDirectory") .IsDependentOn("Cake.Common.IO.FileAliases.CopyFile") .IsDependentOn("Cake.Common.IO.FileAliases.CopyFiles.Pattern") .IsDependentOn("Cake.Common.IO.FileAliases.CopyFiles.FilePaths") .IsDependentOn("Cake.Common.IO.FileAliases.CopyFiles.Strings") .IsDependentOn("Cake.Common.IO.FileAliases.DeleteFiles.Pattern") .IsDependentOn("Cake.Common.IO.FileAliases.DeleteFiles.FilePaths") .IsDependentOn("Cake.Common.IO.FileAliases.DeleteFile") .IsDependentOn("Cake.Common.IO.FileAliases.FileExists") .IsDependentOn("Cake.Common.IO.FileAliases.FileSize") .IsDependentOn("Cake.Common.IO.FileAliases.MoveFileToDirectory") .IsDependentOn("Cake.Common.IO.FileAliases.MoveFiles.Pattern") .IsDependentOn("Cake.Common.IO.FileAliases.MoveFiles.FilePaths") .IsDependentOn("Cake.Common.IO.FileAliases.MoveFile");
the_stack
@model Piranha.Models.Manager.PageModels.EditModel @using Piranha.Extend; @using Piranha.Models.Manager.PageModels; @section Head { <script type="text/javascript" src="~/res.ashx/areas/manager/content/js/jquery.form.js"></script> <script type="text/javascript" src="~/res.ashx/areas/manager/content/js/jquery.regions.js"></script> <script type="text/javascript" src="~/res.ashx/areas/manager/content/js/jquery.attachment.js"></script> <script type="text/javascript" src="~/res.ashx/areas/manager/content/js/jquery.media.dialog.js"></script> <script type="text/javascript" src="~/res.ashx/areas/manager/content/js/jquery.comments.js"></script> <script type="text/javascript" src="~/res.ashx/areas/manager/content/js/ext/jquery.equalheights.js"></script> @Html.Partial("~/Areas/Manager/Views/Shared/Partial/TinyMCE.cshtml") <script type="text/javascript"> var folderId = ""; var deletemsg = "@Piranha.Resources.Page.MessageDeleteConfirm"; $(document).ready(function () { // UI Stuff $("#Page_Title").focus(); $('.first-row .box').equalHeights(); @if (Model.Action == EditModel.ActionType.ATTACHMENTS) { <text> $('#btn_attachments').click(); </text> } $("#Page_ParentId").change(function () { var page_id = $("#Page_Id").val(); var page_parentid = $("#org_parentid").val(); var page_seqno = $("#Page_Seqno").val(); var parentid = $("#Page_ParentId").val(); var site_tree = $("#Page_SiteTreeInternalId").val(); $.get("@Url.Action("siblings")?page_id=" + page_id + "&page_parentid=" + page_parentid + "&page_seqno=" + page_seqno + "&parentid=" + parentid + "&site_tree=" + site_tree, function (data) { $("#div-seqno").html(data); }); }); $('#Page_GroupId').change(function() { var page_id = $("#Page_Id").val(); var group_id = $(this).val(); $.get("@Url.Action("grouplist")?page_id=" + page_id + "&group_id=" + group_id, function(data) { $("#disable-groups").html(data); }); }); $('#btnMove').click(function () { $('#placement-edit').slideToggle('fast'); $(this).toggleClass('active'); return false; }); new piranha.comment('@Model.Page.Id', 'comment-notification', 'pnl-comments .inner'); new piranha.media('btn_attach', 'boxContent', function (a) { // Store folder id so we can open the same folder next time. folderId = a.ParentId; // Add the attachment $("#tbl-attachments").append( '<tr data-id="' + a.Id + '">' + '<td><img src="' + a.ThumbnailUrl + '/50" /></td>' + '<td>' + a.DisplayName + '</td>' + '<td>' + a.Type + '</td>' + '<td class="buttons three">' + '<a class="icon up marg"></a>' + '<a class="icon down marg"></a>' + '<a class="icon delete"></a></td>' + '</tr>'); }); $(".toolbar .delete").click(function () { return confirm(deletemsg); }); }); // // Hides all editors on the page. This callback is called from jquery.attachments.js // function hideEditors() { $("#pageregions .input, #globalregions .input").hide(); $("#regionbuttons button").removeClass("active"); $("#attachments").hide(); $("#regions .region-body").hide(); $("#regionbuttons button").removeClass("active"); $("#attachments").hide(); } // // This callback is called from jquery.attachments.js before form submit. // function addAttachmentData(index, val) { $("#attachment_data").append( '<input id="Page_Attachments_' + index + '_" name="Page.Attachments[' + index + ']" type="hidden" value="' + $(val).attr("data-id") + '" />'); } </script> } @section Toolbar { @Html.Partial("Partial/Tabs") <div class="toolbar"> <div class="inner"> <ul> <li><a class="save submit">@Piranha.Resources.Global.ToolbarSaveDraft</a></li> @if (!Model.Page.IsNew && !Model.Page.IsBlock) { <li><a href="@Piranha.WebPages.WebPiranha.GetSiteUrl()@Url.GetPermalink(Model.Page.Permalink, true)" target="preview" class="preview">@Piranha.Resources.Global.ToolbarPreview</a></li> } @if (User.HasAccess("ADMIN_PAGE_PUBLISH")) { <li><a class="publish">@(Model.Page.Published == DateTime.MinValue ? Piranha.Resources.Global.ToolbarPublish : Piranha.Resources.Global.ToolbarUpdate)</a></li> } @if (Model.Page.Published > DateTime.MinValue && !Model.IsSite && User.HasAccess("ADMIN_PAGE_PUBLISH")) { <li><a href="@Url.Action("unpublish", new { id = Model.Page.Id })" class="unpublish">@Piranha.Resources.Global.ToolbarUnpublish</a></li> } @if (Model.Page.Published > DateTime.MinValue && Model.Page.Updated > Model.Page.LastPublished) { <li><a href="@Url.Action("revert", new { id = Model.Page.Id })" class="revert">@Piranha.Resources.Global.ToolbarRevert</a></li> } @if (!Model.Page.IsNew && Model.CanDelete && !Model.IsSite && User.HasAccess("ADMIN_PAGE_PUBLISH")) { <li><a href="@Url.Action("delete", new { id = Model.Page.Id })" class="delete">@Piranha.Resources.Global.ToolbarDelete</a></li> } @if (String.IsNullOrEmpty(ViewBag.ReturnUrl)) { <li><a href="@Url.Action("index", new { id = Model.Page.Id })" class="back">@Piranha.Resources.Global.ToolbarBack</a></li> } else { <li><a href="@ViewBag.ReturnUrl" class="back">@Piranha.Resources.Global.ToolbarBack</a></li> } <li><a href="@Url.Action("edit", new { id = Model.Page.Id })" class="refresh">@Piranha.Resources.Global.ToolbarReload</a></li> @Piranha.WebPages.Hooks.Manager.Toolbar.Render(Url, Model) </ul> <div class="clear"></div> </div> </div> } @{ Html.BeginForm("edit", (string)ViewContext.RouteData.Values["Controller"]) ; } <div> @Html.HiddenFor(m => m.Page.IsNew) @Html.HiddenFor(m => m.Page.SiteTreeId) @Html.HiddenFor(m => m.Page.SiteTreeInternalId) @Html.HiddenFor(m => m.Page.OriginalId) @Html.HiddenFor(m => m.Page.Id) @Html.HiddenFor(m => m.Page.IsDraft) @Html.HiddenFor(m => m.Page.Permalink) @Html.HiddenFor(m => m.Page.TemplateId) @Html.HiddenFor(m => m.Page.PermalinkId) @Html.HiddenFor(m => m.Page.Permalink) @Html.HiddenFor(m => m.Page.IsBlock) @Html.HiddenFor(m => m.Page.Created) @Html.HiddenFor(m => m.Page.Updated) @Html.HiddenFor(m => m.Page.Published) @Html.HiddenFor(m => m.Page.LastPublished) @Html.HiddenFor(m => m.Page.CreatedBy) @Html.HiddenFor(m => m.Page.UpdatedBy) @Html.HiddenFor(m => m.Permalink.IsNew) @Html.HiddenFor(m => m.Permalink.Id) @Html.HiddenFor(m => m.Permalink.NamespaceId) @Html.HiddenFor(m => m.Permalink.Type) @Html.HiddenFor(m => m.Permalink.Created) @Html.HiddenFor(m => m.Permalink.CreatedBy) @if (Model.IsSite) { @Html.HiddenFor(m => m.Page.Title) @Html.HiddenFor(m => m.Page.ParentId) @Html.HiddenFor(m => m.Page.Seqno) @Html.HiddenFor(m => m.Permalink.Name) } @if (!Piranha.Application.Current.IsMvc) { @Html.HiddenFor(m => m.Page.PageView) } @Html.Hidden("returl", (string)ViewBag.ReturnUrl) <input type="hidden" id="draft" name="draft" value="true" /> <input type="hidden" id="org_parentid" value="@Model.Page.ParentId" /> </div> <div class="first-row"> <div class="@(!String.IsNullOrEmpty(Model.Template.Preview.ToString()) ? "grid_9" : "grid_12")"> <div class="box"> <div class="title"><h2>@Piranha.Resources.Global.Information</h2></div> <div class="inner"> @if (!Model.IsSite) { <ul class="form"> <li>@Html.LabelFor(m => m.Page.Title) <div class="input"> @Html.TextBoxFor(m => m.Page.Title)</div> @Html.ValidationMessageFor(m => m.Page.Title) </li> @if (!Model.Page.IsBlock) { <li>@Html.LabelFor(m => m.Page.NavigationTitle) <div class="input"> @Html.TextBoxFor(m => m.Page.NavigationTitle, new { @placeholder = Piranha.Resources.Global.Optional })</div> @Html.ValidationMessageFor(m => m.Page.NavigationTitle) </li> } <li class="protected">@Html.LabelFor(m => m.Page.Permalink) @if (Model.Permalink != null && !String.IsNullOrEmpty(Model.Permalink.Name)) { <p>@Piranha.WebPages.WebPiranha.GetSiteUrl()@Url.GetPermalink(Model.Permalink.Name)</p> } else { <p><i>@Piranha.Resources.Page.PermalinkDescription</i></p> } <div class="input"> @Html.TextBoxFor(m => m.Permalink.Name)</div> @Html.ValidationMessageFor(m => m.Permalink) <a class="locked"></a> </li> <li> <label>@Piranha.Resources.Global.Placement</label> <button class="btn right" id="btnMove">@Piranha.Resources.Global.Move</button> @if (!Model.Page.IsStartpage) { <p>@Piranha.Resources.Global.PlacementPage <strong>@(Model.Page.Seqno > 1 ? @Piranha.Resources.Global.PlacementAfter : @Piranha.Resources.Global.PlacementBelow)</strong> &quot;@Model.PlaceRef&quot;</p> } else { <p>@Piranha.Resources.Global.PlacementStart</p> } <div id="placement-edit" style="display:none"> @Html.LabelFor(m => m.Page.ParentId) <div class="input"> <select id="Page_ParentId" name="Page.ParentId"> @foreach (var p in Model.Parents) { <option value="@p.Id"@(p.IsSelected ? " selected=selected" : "")> @Html.Raw(p.Title)</option> } </select> </div> @Html.LabelFor(m => m.Page.Seqno) <div class="input" id="div-seqno"> <select id="Page_Seqno" name="Page.Seqno"> @foreach (var s in Model.Siblings) { <option value="@s.Seqno"@(s.IsSelected ? " selected=selected" : "")>@s.Title</option> } </select> </div> </div> </li> </ul> } else { <ul class="form"> <li> @Html.LabelFor(m => m.SiteTree.MetaTitle, Piranha.Resources.SiteTree.MetaTitle) <div class="input"> @Html.TextBoxFor(m => m.SiteTree.MetaTitle) @if (String.IsNullOrEmpty(Model.SiteTree.MetaTitle)) { <span class="notification">@Piranha.Resources.Page.KeywordsNotification</span> } </div> </li> <li> @Html.LabelFor(m => m.SiteTree.MetaDescription, Piranha.Resources.SiteTree.MetaDescription) <div class="input"> @Html.TextAreaFor(m => m.SiteTree.MetaDescription, new { @rows = 5 }) @if (String.IsNullOrEmpty(Model.SiteTree.MetaDescription)) { <span class="notification">@Piranha.Resources.Page.DescriptionNotification</span> } </div> </li> </ul> } </div> </div> </div> @if (!String.IsNullOrEmpty(Model.Template.Preview.ToString())) { <div class="grid_3"> <div class="box pagetemplate"> <div class="title"><h2>@(!Model.IsSite ? Model.Template.Name : Model.SiteTree.Name)</h2></div> <div class="inner"> <div class="edit @(Model.Page.IsBlock ? "block" : "")"> @Model.Template.Preview </div> </div> </div> </div> } </div> <div> <div class="grid_12"> <div class="box main-content"> <table> <tr> <td class="tools"> <ul> <li class="btn-content @(Model.Action != EditModel.ActionType.SEO ? "active" : "")"><a href="#" data-id="pnl-content">@Piranha.Resources.Global.Content</a></li> @if (!Model.IsSite && !Model.Page.IsBlock) { <li class="btn-settings @(Model.Action == EditModel.ActionType.SEO ? "active" : "")"><a href="#" data-id="pnl-settings">@Piranha.Resources.Global.Settings</a></li> } @if (Model.Properties.Count > 0) { <li class="btn-properties"><a href="#" data-id="pnl-properties">@Piranha.Resources.Global.Properties</a></li> } @if (Model.EnableComments) { <li class="btn-comments"> @{ var count = Model.Comments.Where(c => c.Status == Piranha.Entities.Comment.CommentStatus.New).Count() ; } <span @(count == 0 ? "style=display:none" : "") id="comment-notification" class="notification">@count</span> <a href="#" data-id="pnl-comments">@Piranha.Resources.Global.Comments</a> </li> } @foreach (var ext in Model.Extensions) { <li> <a href="#"@(ExtensionManager.Current.GetIconPathByType(ext.Type) != "" ? "style=background-image:url('" + Url.Content(ExtensionManager.Current.GetIconPathByType(ext.Type)) + "')" : "") data-id="pnl-@ExtensionManager.Current.GetInternalIdByType(ext.Type).ToLower()"> @ExtensionManager.Current.GetNameByType(ext.Type) </a> </li> } </ul> </td> <td> <div id="pnl-content" class="main content-editor @(Model.Action != EditModel.ActionType.SEO ? "" : "hidden")"> <div class="title"> <div id="regionbuttons" class="buttons"> @for (int n = 0; n < Model.Regions.Count; n++) { <button id="@Html.Raw("btn_" + Model.Regions[n].InternalId)" class="btn@(n > 0 ? "" : " active") region">@Model.Regions[n].Name</button> } <button id="btn_attachments" class="btn@(Model.Regions.Count == 0 ? " active" : "")">@Piranha.Resources.Page.Attachments</button> </div> <h2 id="section-title">@Piranha.Resources.Global.Content</h2> </div> <div class="inner"> @if (Model.Regions.Count > 0) { <div id="regions"> @Html.EditorFor(m => m.Regions) </div> } <div id="attachments" @(Model.Regions.Count > 0 ? "style=display:none" : "")> @Html.Partial("Partial/Attachments") </div> </div> </div> @if (!Model.IsSite) { <div id="pnl-settings" class="main @(Model.Action == EditModel.ActionType.SEO ? "" : "hidden")"> <div class="title"><h2>@Piranha.Resources.Global.Settings</h2></div> <div class="inner"> <ul class="form"> <li> @Html.LabelFor(m => m.Page.GroupId) <div class="input"> @Html.DropDownListFor(m => m.Page.GroupId, Model.Groups) </div> @Html.LabelFor(m => m.Page.DisabledGroups) <div id="disable-groups" class="block"> @{ var dGroups = Model.Groups.Where(g => g.Value != Guid.Empty.ToString()).ToList(); } @Html.Partial("Partial/GroupList", new Piranha.Models.Manager.PageModels.GroupListModel() { Groups = Model.DisableGroups, Page = Model.Page }) </div> </li> <li> @Html.LabelFor(m => m.Page.IsHidden) <p>@Html.CheckBoxFor(m => m.Page.IsHidden) (@Piranha.Resources.Page.HiddenDescription)</p> </li> <li> @Html.LabelFor(m => m.Page.Keywords) <div class="input"> @Html.TextBoxFor(m => m.Page.Keywords, new { @placeholder = Piranha.Resources.Global.Optional }) @if (Model.Action == EditModel.ActionType.SEO && String.IsNullOrEmpty(Model.Page.Keywords)) { <span class="notification">@Piranha.Resources.Page.KeywordsNotification</span> } </div> @Html.ValidationMessageFor(m => m.Page.Keywords) </li> <li> @Html.LabelFor(m => m.Page.Description) <div class="input"> @Html.TextAreaFor(m => m.Page.Description, new { @rows = 3, @placeholder = Piranha.Resources.Global.Optional }) @if (Model.Action == EditModel.ActionType.SEO && String.IsNullOrEmpty(Model.Page.Description)) { <span class="notification">@Piranha.Resources.Page.DescriptionNotification</span> } </div> @Html.ValidationMessageFor(m => m.Page.Description) </li> @if (Model.Template.ShowController) { <li> @Html.LabelFor(m => m.Page.PageController, Piranha.Application.Current.IsMvc ? Piranha.Resources.Page.Route : Piranha.Resources.Page.Template) <div class="input"> @Html.TextBoxFor(m => m.Page.PageController, new { @placeholder = !String.IsNullOrEmpty(Model.Template.Controller) ? Model.Template.Controller : "Page" }) </div> @Html.ValidationMessageFor(m => m.Page.PageController) </li> } @if (Piranha.Application.Current.IsMvc && Model.Template.ShowView) { <li> @Html.LabelFor(m => m.Page.PageView) <div class="input"> @Html.TextBoxFor(m => m.Page.PageView, new { @placeholder = !String.IsNullOrEmpty(Model.Template.View) ? Model.Template.View : "Index" }) </div> @Html.ValidationMessageFor(m => m.Page.PageView) </li> } @if (Model.Template.ShowRedirect) { <li> @Html.LabelFor(m => m.Page.PageRedirect) <div class="input"> @Html.TextBoxFor(m => m.Page.PageRedirect, new { @placeholder = !String.IsNullOrEmpty(Model.Template.Redirect) ? Model.Template.Redirect : Piranha.Resources.Global.Optional }) </div> @Html.ValidationMessageFor(m => m.Page.PageRedirect) </li> } </ul> </div> </div> } @if (Model.Properties.Count > 0) { <div id="pnl-properties" class="main hidden"> <div class="title"><h2>@Piranha.Resources.Global.Properties</h2></div> <div class="inner"> <ul class="form"> @for (int n = 0; n < Model.Properties.Count; n++) { <li>@Html.LabelFor(m => m.Properties[n], Model.Properties[n].Name) @Html.HiddenFor(m => m.Properties[n].Id) @Html.HiddenFor(m => m.Properties[n].IsDraft) @Html.HiddenFor(m => m.Properties[n].ParentId) @Html.HiddenFor(m => m.Properties[n].Name) @Html.HiddenFor(m => m.Properties[n].Created) @Html.HiddenFor(m => m.Properties[n].CreatedBy) @Html.HiddenFor(m => m.Properties[n].IsNew) <div class="input"> @Html.TextBoxFor(m => m.Properties[n].Value)</div> </li> } </ul> </div> </div> } @if (Model.EnableComments) { <div id="pnl-comments" class="main content-editor hidden"> <div class="title"><h2>@Piranha.Resources.Global.Comments</h2></div> <div class="inner region-body"> @Html.Partial("~/Areas/Manager/Views/Comment/List.cshtml", Model.Comments) </div> </div> } @Html.EditorFor(m => m.Extensions) </td> </tr> </table> </div> </div> </div> <div class="grid_3 hidden"> @if (!Model.Page.IsNew) { <div class="box expandable"> <div class="title"><h2>@Piranha.Resources.Global.Versioning</h2></div> <div class="inner optional"> <ul class="list"> <li>@Piranha.Resources.Global.LastPublished <small class="right"> @(Model.Page.LastPublished > DateTime.MinValue ? Model.Page.LastPublished.ToShortDateString() : "")</small></li> <li>@Piranha.Resources.Global.Published <small class="right"> @(Model.Page.Published > DateTime.MinValue ? Model.Page.Published.ToShortDateString() : "")</small></li> <li>@Piranha.Resources.Global.Updated <small class="right">@Model.Page.Updated.ToShortDateString()</small></li> <li>@Piranha.Resources.Global.Created <small class="right">@Model.Page.Created.ToShortDateString()</small></li> </ul> </div> </div> } </div> @{ Html.EndForm() ; } @section Foot { <div id="boxContent" class="floatbox"> <div class="bg"></div> <div class="box" style="min-width: 510px;min-height:260px;"> </div> </div> }
the_stack
@inject I_Api_Helper apiHelper; @using puck.core.Models; @model List<string> @{ var models = apiHelper.AllModels(inclusive: true); var dic = new Dictionary<string, Dictionary<string, List<string>>>(); foreach (var s in Model) { var nkv = s.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); string typeName = nkv[0]; string groupName = nkv[1]; string FieldName = nkv[2]; if (!dic.Keys.Contains(typeName)) { dic[typeName] = new Dictionary<string, List<string>>(); } if (!dic[typeName].ContainsKey(groupName)) { dic[typeName][groupName] = new List<string>(); } if (!dic[typeName][groupName].Contains(FieldName)) { dic[typeName][groupName].Add(FieldName); } } } <div class="fieldgroups"> <ul class="p-0"> <li> <select> @foreach (var m in models) { <option value="@m.Name">@ApiHelper.FriendlyClassName(ApiHelper.ConcreteType(m))</option> } </select> </li> <li> <input placeholder="group name..." class="groupname" /> </li> <li> <button class="add btn btn-light">add group</button> </li> </ul> @{ var typeGroupProp = new List<Tuple<string, string, string>>(); var friendlyName = new Dictionary<string, string>(); var typeChain = new Dictionary<string, string>(); var fullNameToAssemblyName = new Dictionary<string, string>(); } @foreach (var m in models) { var typesChain = ApiHelper.BaseTypes(ApiHelper.ConcreteType(m)); typesChain.Add(m); var cb = ApiHelper.ConcreteType(m); var props = cb.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly); if (!friendlyName.ContainsKey(m.Name)) { friendlyName.Add(m.Name, ApiHelper.FriendlyClassName(cb)); } if (!typeChain.ContainsKey(m.Name)) { typeChain.Add(m.Name, string.Join(",", typesChain.Select(x => x.Name))); } if (!fullNameToAssemblyName.ContainsKey(m.Name)) { fullNameToAssemblyName.Add(m.Name, m.AssemblyQualifiedName); } foreach (var prop in props) { var groupName = "default"; if (dic.ContainsKey(m.Name) && dic[m.Name].Any(x => x.Value.Contains(prop.Name))) { //group name groupName = dic[m.Name].Where(x => x.Value.Contains(prop.Name)).FirstOrDefault().Key; } typeGroupProp.Add(new Tuple<string, string, string>(m.Name, groupName, prop.Name)); } } <div class="type"> </div> <div class="interfaces"> <div data-group="" class="group"> <h3></h3> </div> <div data-inherited="" data-field="" class="field "></div> </div> </div> <div class="clearboth"></div> <script type="text/javascript"> onAfterDom(function () { var container = $(".fieldgroups"); var interfaces = function (c) { return container.find(".interfaces ."+c).clone(); } var propertyName = function (i) { return "@ViewData.ModelMetadata.PropertyName"; } var chain = []; @{ foreach(var x in typeChain.ToList()){ @Html.Raw(string.Format("chain['{0}']='{1}';", x.Key, x.Value)) } } var friendlyName = []; @{ foreach(var x in friendlyName.ToList()){ @Html.Raw(string.Format("friendlyName['{0}']='{1}';", x.Key, x.Value)) } } var fullNameToAssemblyName = []; @{ foreach(var x in fullNameToAssemblyName.ToList()){ @Html.Raw(string.Format("fullNameToAssemblyName['{0}']='{1}';", x.Key, x.Value)) } } var typeGroupProp = []; @{ var visitedType = new List<string>(); var visitedTypeGroup = new List<string>(); foreach(var item in typeGroupProp){ if(!visitedType.Contains(item.Item1)){ visitedType.Add(item.Item1); @Html.Raw(string.Format("typeGroupProp['{0}']=[];",item.Item1)); } if(!visitedTypeGroup.Contains(item.Item1+item.Item2)){ visitedTypeGroup.Add(item.Item1+item.Item2); @Html.Raw(string.Format("typeGroupProp['{0}']['{1}']=[];",item.Item1,item.Item2)); } @Html.Raw(string.Format("typeGroupProp['{0}']['{1}'].push('{2}');",item.Item1,item.Item2,item.Item3)); } } //console.log("typeGroupProps %o",typeGroupProp); var drawType = function (type) { container.find(".type .group").remove(); var name = friendlyName[type]; var typeChain = chain[type].split(","); var groupAndProps = []; for (var i = 0; i < typeChain.length; i++) { var fullName = typeChain[i]; var assemblyName = fullNameToAssemblyName[fullName]; //console.log("fullnameL %o assemblyNameL %o",fullName,assemblyName); for (var group in typeGroupProp[fullName]) { if (isFunction(typeGroupProp[fullName][group])) continue; if (groupAndProps[group] == undefined) { groupAndProps[group] = []; } //console.log("group %o", group); for(var ii=0;ii<typeGroupProp[fullName][group].length;ii++){ var item = typeGroupProp[fullName][group][ii]; groupAndProps[group].push({ name: item, inherited: type != fullName }); } } } for (var group in groupAndProps) { if (isFunction(groupAndProps[group])) continue; var elGroup = interfaces("group").attr("data-group",group); elGroup.find("h3").html(group); //console.log("groupandprops[%o] %o",group,groupAndProps[group]); var grp = groupAndProps[group]; for (var i = 0; i < grp.length; i++) { var obj = grp[i]; var elField = interfaces("field"); elField.attr({ "data-field": obj.name, "data-inherited": obj.inherited }).html(obj.name); elGroup.append(elField); } container.find(".type").append(elGroup); } container.find(".type div.group").sortable({ cursorAt: { top: 0, left: 0 }, connectWith: ".group", items: ".field[data-inherited='false']", update: function (e, ui) { setValue(); } }); container.find(".type .field[data-inherited='false']").each(function () { initTouch(this); }); } //console.log("select last val: %o", container.find("select option:last").val()); drawType(container.find("select option:nth-child(1)").val()); var setValue = function () { var tname = container.find("select").val(); container.find("input:hidden").remove(); typeGroupProp[tname] = []; container.find(".type .group").each(function (ii) { var group = $(this); var gname = group.attr("data-group"); group.find(".field[data-inherited='false']").each(function (iii) { if (typeGroupProp[tname][gname] == undefined) { typeGroupProp[tname][gname] = []; } var field = $(this); var fname = field.attr("data-field"); typeGroupProp[tname][gname].push(fname); }); }); for (var type in typeGroupProp) { if (isFunction(typeGroupProp[type])) continue; for (var group in typeGroupProp[type]) { if (isFunction(typeGroupProp[type][group]) || group == "default") continue; for (var i = 0; i < typeGroupProp[type][group].length; i++) { var prop = typeGroupProp[type][group][i]; if (isFunction(prop)) continue; var val = type + ":" + group + ":" + prop; //console.log(val); container.append( '<input name="' + propertyName() + '" type="hidden" value="' + val + '"/>' ); } } } } container.find("select").change(function () { var val = $(this).val(); drawType(val); }); container.find("button.add").click(function (e) { e.preventDefault(); var c = container.find("div.type:visible"); var gn = container.find("input.groupname").val(); if (!gn.isEmpty() && c.find("[data-group='" + gn + "']").length == 0) { var elGroup=interfaces("group").attr({ "data-group": gn }); elGroup.find("h3").html(gn); c.append( elGroup.sortable({ cursorAt: { top: 0, left: 0 }, connectWith: ".group", items: ".field[data-inherited='false']", update: function (e, ui) { setValue(); } }) ); } setValue(); }); setValue(); }); </script> <style> .fieldgroups .interfaces { display: none; } </style>
the_stack
@model IEnumerable<SmartAdmin.Domain.Models.CodeItem> @{ ViewBag.Title = "键值对维护"; ViewData["PageName"] = "codeitems_index"; ViewData["Heading"] = "<i class='fal fa-code text-primary'></i> 键值对维护"; ViewData["Category1"] = "系统管理"; ViewData["PageDescription"] = "当有新增/修改记录后,请执行【更新javascript】才会最终生效"; } @section HeadBlock { <link href="~/js/easyui/themes/insdep/easyui.css" rel="stylesheet" asp-append-version="true" /> } <div class="row"> <div class="col-lg-12 col-xl-12"> <div id="panel-1" class="panel"> <div class="panel-hdr"> <h2> 键值对维护 </h2> <div class="panel-toolbar"> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"><i class="fal fa-window-minimize"></i></button> <button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"><i class="fal fa-expand"></i></button> @*<button class="btn btn-panel bg-transparent fs-xl w-auto h-auto rounded-0" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"><i class="fal fa-times"></i></button>*@ </div> </div> <div class="panel-container show"> <div class="panel-container enable-loader show"> <div class="loader"><i class="fal fa-spinner-third fa-spin-4x fs-xxl"></i></div> <div class="panel-content py-2 rounded-bottom border-faded border-left-0 border-right-0 text-muted bg-faded "> <div class="row no-gutters align-items-center"> <div class="col"> <!-- 开启授权控制请参考 @@if (Html.IsAuthorize("Create") --> <div class="btn-group btn-group-sm"> <button name="searchbutton" onclick="reloadData()" class="btn btn-default"> <span class="fal fa-search mr-1"></span> 查询 </button> </div> <div class="btn-group"> <button name="updatejsbutton" onclick="updatejavascript()" class="btn btn-sm btn-primary"> <i class="fal fa-code-commit"></i> 更新JS脚本 </button> </div> <div class="btn-group btn-group-sm"> <button name="appendbutton" onclick="appendData()" class="btn btn-default"> <span class="fal fa-plus mr-1"></span> 新增 </button> </div> <div class="btn-group btn-group-sm"> <button name="deletebutton" disabled onclick="removeData()" class="btn btn-default"> <span class="fal fa-times mr-1"></span> 删除 </button> </div> <div class="btn-group btn-group-sm"> <button name="savebutton" disabled onclick="acceptChanges()" class="btn btn-default"> <span class="fal fa-save mr-1"></span> 保存 </button> </div> <div class="btn-group btn-group-sm"> <button name="cancelbutton" disabled onclick="rejectChanges()" class="btn btn-default"> <span class="fal fa-ban mr-1"></span> 取消 </button> </div> <div class="btn-group btn-group-sm hidden-xs"> <button name="importbutton" type="button" onclick="importExcel.upload()" class="btn btn-default"><span class="fal fa-cloud-upload mr-1"></span> 导入 </button> <button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="sr-only">Toggle Dropdown</span> </button> <div class="dropdown-menu"> <button name="downloadbutton" type="button" class="dropdown-item js-waves-on" href="javascript:importExcel.downloadtemplate()"><span class="fal fa-download"></span> 下载模板 </button> </div> </div> <div class="btn-group btn-group-sm "> <button name="exportbutton" onclick="exportexcel()" class="btn btn-default"> <span class="fal fa-file-excel mr-1"></span> 导出 </button> </div> </div> </div> </div> <div class="panel-content"> <div class="table-responsive"> <table id="codeitems_datagrid"></table> </div> </div> </div> </div> </div> </div> @await Component.InvokeAsync("ImportExcel", new ImportExcelOptions { entity = "CodeItem", folder = "CodeItems", url = "/CodeItems", tpl = "CodeItem.xlsx", callback= "reloadData()" }) @section ScriptsBlock { <script src="~/js/dependency/moment/moment.js" asp-append-version="true"></script> <script src="~/js/dependency/numeral/numeral.min.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.min.js" asp-append-version="true"></script> <script src="~/js/easyui/plugins/datagrid-filter.js" asp-append-version="true"></script> <script src="~/js/easyui/locale/easyui-lang-zh_CN.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.component.js" asp-append-version="true"></script> <script src="~/js/jquery.extend.formatter.js" asp-append-version="true"></script> <script src="~/js/jquery.custom.extend.js" asp-append-version="true"></script> <script src="~/js/plugin/jquery.serializejson/jquery.serializejson.js" asp-append-version="true"></script> <script type="text/javascript"> //全屏事件 document.addEventListener('panel.onfullscreen', () => { $dg.treegrid('resize'); }); var entityname = "CodeItem"; //更新javascript function updatejavascript() { $.post("/CodeItems/UpdateJavascript", null, function (response) { if (response.success) { $.messager.alert("提示", "更新成功!"); } }, "json").fail(function (response) { $.messager.alert("错误", "提交错误了!", "error"); }); } //执行Excel到处下载 function exportexcel() { var filterRules = JSON.stringify($dg.datagrid("options").filterRules); //console.log(filterRules); $.messager.progress({ title: "正在执行导出!" }); var formData = new FormData(); formData.append("filterRules", filterRules); formData.append("sort", "Id"); formData.append("order", "asc"); $.postDownload("/CodeItems/ExportExcel", formData, function (fileName) { $.messager.progress("close"); console.log(fileName); }) } //datagrid 增删改查操作 var $dg = $("#codeitems_datagrid"); var editIndex = undefined; function reloadData() { $dg.datagrid('uncheckAll'); $dg.datagrid('reload'); } var prevcodetype = ""; var prevdescription = ""; function endEditing() { if (editIndex === undefined) { return true; } if ($dg.datagrid("validateRow", editIndex)) { $dg.datagrid("endEdit", editIndex); var row = $dg.datagrid("getRows")[editIndex]; prevcodetype = row.CodeType; prevdescription = row.Description; editIndex = undefined; return true; } else { return false; } } function onClickCell(index, field) { var _operates = ["_operate1", "_operate2", "_operate3", "ck"]; if ($.inArray(field, _operates) >= 0) { return; } if (editIndex !== index) { if (endEditing()) { $dg.datagrid("selectRow", index) .datagrid("beginEdit", index); var ed = $dg.datagrid("getEditor", { index: index, field: field }); if (ed) { ($(ed.target).data("textbox") ? $(ed.target).textbox("textbox") : $(ed.target)).focus(); } editIndex = index; } else { $dg.datagrid("selectRow", editIndex); } } } function appendData() { if (endEditing()) { $dg.datagrid("insertRow", { index: 0, row: { CodeType: prevcodetype, Description: prevdescription, IsDisabled: 0 } }); editIndex = 0; $dg.datagrid("selectRow", editIndex) .datagrid("beginEdit", editIndex); } } function removeData() { if ($dg.datagrid('getChecked').length <= 0 ) { if (editIndex == undefined) { return } $dg.datagrid("cancelEdit", editIndex) .datagrid("deleteRow", editIndex); editIndex = undefined; } else { deletechecked(); } } //删除该行 function deletechecked() { const id = $dg.datagrid('getChecked').map(item => { return item.Id; }); if (id.length > 0) { $.messager.confirm('确认', `你确定要删除这 <span class='badge badge-icon position-relative'>${id.length} </span> 行记录?`, result => { if (result) { $.post('/CodeItems/DeleteChecked', { id: id }) .done(response => { if (response.success) { toastr.error(`成功删除[${id.length}]行记录`); reloadData(); } else { $.messager.alert('错误', response.err, 'error'); } }) .fail((jqXHR, textStatus, errorThrown) => { $.messager.alert('异常', `${jqXHR.status}: ${jqXHR.statusText} `, 'error'); }); } }); } else { $.messager.alert('提示', '请先选择要删除的记录!', 'question'); } } function acceptChanges() { if (endEditing()) { if ($dg.datagrid("getChanges").length > 0) { const inserted = $dg.datagrid('getChanges', 'inserted').map(item => { item.TrackingState = 1; return item; }); const updated = $dg.datagrid('getChanges', 'updated').map(item => { item.TrackingState = 2 return item; }); const deleted = $dg.datagrid('getChanges', 'deleted').map(item => { item.TrackingState = 3 return item; }); //过滤已删除的重复项 const changed = inserted.concat(updated.filter(item => { return !deleted.includes(item); })).concat(deleted); $.post("/CodeItems/SaveData", { codeitems: changed }, function (response) { //console.log(response); if (response.success) { toastr.success('保存成功'); $dg.datagrid('acceptChanges'); reloadData(); } else { $.messager.alert('错误', response.err, 'error'); } }, "json").fail(function (response) { $.messager.alert('错误', response.err, 'error'); }); } } } function rejectChanges() { $dg.datagrid("rejectChanges"); editIndex = undefined; } function getChanges() { var rows = $dg.datagrid("getChanges"); } //显示帮助信息 function dohelp() { } //datagrid 开启筛选功能 $(function () { $dg.datagrid({ rownumbers: true, checkOnSelect: false, selectOnCheck: false, idField: 'Id', sortName: 'Id', sortOrder: 'desc', remoteFilter: true, singleSelect: true, method: 'get', onClickCell: onClickCell, height: 670, pageSize: 15, pageList: [15, 20, 50, 100, 500, 2000], pagination: true, clientPaging: false, striped: true, onBeforeLoad: function () { $('.enable-loader').removeClass('enable-loader') }, onLoadSuccess: function (data) { editIndex = undefined; $("button[name*='deletebutton']").prop('disabled', true); $("button[name*='cancelbutton']").prop('disabled', true); $("button[name*='savebutton']").prop('disabled', true); }, onCheck: function () { $("button[name*='deletebutton']").prop('disabled', false); }, onBeforeEdit: function (index, row) { $("button[name*='deletebutton']").prop('disabled', false); $("button[name*='cancelbutton']").prop('disabled', false); $("button[name*='savebutton']").prop('disabled', false); row.editing = true; $(this).datagrid('refreshRow', index); }, frozenColumns: [[ /*开启CheckBox选择功能*/ { field: 'ck', checkbox: true }, ]], columns: [[ { field: 'CodeType', width: 140, editor: { type: 'textbox', options: { prompt: '代码名称', required: true, validType: ['length[0,20]', 'regex[\'^[A-Za-z0-9]+$\',\'必须是字母\']'] } }, sortable: true, resizable: true, title: '@Html.DisplayNameFor(model => model.CodeType)' }, { field: 'Code', width: 140, editor: { type: 'textbox', options: { prompt: '值', required: true, validType: 'length[0,50]' } }, sortable: true, resizable: true, title: '@Html.DisplayNameFor(model => model.Code)' }, { field: 'Text', width: 140, editor: { type: 'textbox', options: { prompt: '显示', required: true, validType: 'length[0,50]' } }, sortable: true, resizable: true, title: '@Html.DisplayNameFor(model => model.Text)' }, { field: 'Multiple', width: 140, editor: { type: 'checkboxeditor', options: { id:'edit_Multiple', prompt: '是否支持多选', required: true } }, sortable: true, resizable: true, formatter: booleanformatter, title: '@Html.DisplayNameFor(model => model.Multiple)' }, { field: 'Description', width: 140, editor: { type: 'textbox', options: { prompt: '描述', required: true, validType: 'length[0,128]' } }, sortable: true, resizable: true, title: '@Html.DisplayNameFor(model => model.Description)' }, { field: 'IsDisabled', title: '@Html.DisplayNameFor(model => model.IsDisabled)', width: 100, align: 'center', editor: { type: 'combobox', options: { panelHeight:'auto', data: [{ value: '0', text: '未禁用' }, { value: '1', text: '已禁用' }], prompt: '是否禁用', required: true } }, sortable: true, resizable: true, formatter: checkboxformatter } ]] }) .datagrid("enableFilter", [ { field: "IsDisabled", type: "combobox", options: { panelHeight: 'auto', data: [ { value: '', text: 'All' }, { value: '0', text: '未禁用' }, { value: '1', text: '已禁用' } ], onChange: value => { if (value == '') { $dg.datagrid('removeFilterRule', 'IsDisabled'); } else { $dg.datagrid('addFilterRule', { field: 'IsDisabled', op: 'equal', value: value }); } $dg.datagrid('doFilter'); } } }, { field: "Multiple", type: "booleanfilter", } ]) .datagrid('load', '/CodeItems/GetData'); }); </script> }
the_stack
@model Sheng.WeixinConstruction.Management.Shell.Models.MemberViewModel @{ ViewBag.MainMenu = "Member"; ViewBag.LeftMenu = "Member"; ViewBag.Title = "会员管理"; Layout = "~/Views/Shared/_Layout.cshtml"; } <style type="text/css"> .divGroupItem { padding-top: 7px; padding-bottom: 7px; } .divGroupItem:hover { cursor: pointer; background-color: #eeeeee; color: #ff6a00; } </style> <script language="javascript"> var _currentGroupGuid; //当前分组的GroupId var _currentGroupId = -1; //分组 var _groupList; //当前页 var _currentPage = 1; $(document).ready(function () { if (_online == false) return; loadMemberGroupList(); loadMemberList(); $("[keyenter]").keypress(function (e) { if (e.keyCode == 13) { loadMemberList(); } }); $('#selectMemberGroupList').change(function () { var groupId = $(this).children('option:selected').val(); if (groupId < 0) { return; } moveMemberToGroup(groupId); $(this).val("-1"); }); }); function selectMemberGroup(groupGuid, groupId, groupName) { _currentGroupGuid = groupGuid; _currentGroupId = groupId; if (groupId <= 100) { $("#aRenameMemberGroup").hide(); $("#aRemoveMemberGroup").hide(); } else { $("#aRenameMemberGroup").show(); $("#aRemoveMemberGroup").show(); } //黑名单 if (groupId == 1) { $("#btnBlockMember").val("移出黑名单"); } else { $("#btnBlockMember").val("加入黑名单"); } //已取消关注 if (groupId == -2) { $("#btnBlockMember").hide(); $("#selectMemberGroupList").hide(); } else { $("#btnBlockMember").show(); $("#selectMemberGroupList").show(); } $("#spanCurrentGroupName").html(groupName); loadMemberList(); renderGroupList(); } function loadMemberGroupList() { var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); $.ajax({ url: "/Api/Member/GetMemberGroupList", type: "POST", dataType: "json", success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { _groupList = data.Data; renderGroupList(); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); alert("Error: " + xmlHttpRequest.status); } }); } function renderGroupList() { //下拉框 $("#selectMemberGroupList").empty(); $("#selectMemberGroupList").append("<option value='-1'>添加到</option>"); $.each(_groupList, function (idx, obj) { if (obj.GroupId == 1) return; $("#selectMemberGroupList").append("<option value='" + obj.GroupId + "'>" + obj.Name + "</option>"); }); //右侧选择 var gettpl = document.getElementById('memberGroupListTemplate').innerHTML; laytpl(gettpl).render(_groupList, function (html) { document.getElementById('divMemberGroupListContainer').innerHTML = html; fitTable(); }); } function loadMemberList(targetPage) { var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); var args = new Object(); args.Page = targetPage || 1; args.GroupId = _currentGroupId; args.NickName = $("#txtSearch_NickName").val(); args.MobilePhone = $("#txtSearch_Mobile").val(); $.ajax({ url: "/Api/Member/GetMemberList", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { var resultObj = data.Data; _currentPage = resultObj.Page; // alert(JSON.stringify(resultObj)); var gettpl = document.getElementById('memberListTableTemplate').innerHTML; laytpl(gettpl).render(resultObj.ItemList, function (html) { document.getElementById('divTableBodyContainer').innerHTML = html; fitTable(); }); laypage({ skin: 'yahei', cont: document.getElementById('divPagingContainer'), pages: resultObj.TotalPage, //总页数 curr: resultObj.Page, //当前页 groups: 7, //连续显示分页数 jump: function (obj, first) { if (!first) { //点击跳页触发函数自身,并传递当前页:obj.curr loadMemberList(obj.curr); } } }); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); alert("Error: " + xmlHttpRequest.status); } }); } function loadDataOnPageAndCloseLayer(layerIndex) { layer.close(layerIndex); loadMemberList(_currentPage); } function scrollHeader() { //TODO:divTableBodyContainer.scrollLeft // alert(divTableBodyContainer.scrollLeft); var ml = 0 - divTableBodyContainer.scrollLeft; document.getElementById("tableHeader").style.cssText = "margin-left:" + ml + "px;"; } function fitTable() { $("#tableBody").width($("#tableHeader").width()); $("#tableHeader tr:first").each(function (n, value) { $(this).find("td").each(function (n, value) { $("#tableBody tr:first td:eq(" + n + ")").width(value.width) }); }); } function syncUserList() { var confirmLayerIndex = layer.confirm("用户列表是自动保持与微信后台同步的,但您也可以在修改了服务器配置,或临时停止了微信后台的服务器配置之后,手动同步用户列表,是否立即开始同步?", { btn: ['确认', '取消'], //按钮 shade: [0.4, '#393D49'], title: false, closeBtn: false, shift: _layerShift }, function () { layer.close(confirmLayerIndex); var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); $.ajax({ url: "/Api/Settings/SyncMember", type: "POST", dataType: "json", success: function (data, status, jqXHR) { // alert(data); layer.close(loadLayerIndex); if (data.Success) { $("#divSyncUserList").html("<span>正在同步用户列表...</span>"); layerAlert("服务器正在同步您的用户列表;<br/>您无需停留在此页面等待,这一任务是服务器自动执行的。"); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); alert("Error: " + xmlHttpRequest.status); } }); }); } //0、46、64、96、132数值可选,0代表640*640正方形头像 function fitHeadImage(url, size) { if (url == undefined || url == null || url == "") return ""; url = url.substr(0, url.length - 1); url = url + size; return url; } function createMemberGroup() { layer.open({ type: 2, area: ['500px', '190px'], //宽高 closeBtn: false, title: "", shift: _layerShift, content: 'MemberGroupEdit' }); } function modifyMemberGroup() { layer.open({ type: 2, area: ['500px', '190px'], //宽高 closeBtn: false, title: "", shift: _layerShift, content: 'MemberGroupEdit?id=' + _currentGroupGuid }); } function removeMemberGroup() { var confirmLayerIndex = layer.confirm("是否确认删除该分组?", { btn: ['确认', '取消'], //按钮 shade: [0.4, '#393D49'], title: false, closeBtn: false, shift: _layerShift }, function () { layer.close(confirmLayerIndex); var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); $.ajax({ url: "/Api/Member/RemoveMemberGroup?id=" + _currentGroupGuid, type: "POST", dataType: "json", success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { selectMemberGroup("", -1, "全部用户"); loadMemberGroupList(); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); alert("Error: " + xmlHttpRequest.status); } }); }); } function moveMemberToGroup(groupId) { if (groupId < 0) return; var args = new Object(); args.OpenIdList = new Array(); var n = 0; $("#tableBody input").each(function (index, element) { if ($(element).is(':checked')) { // alert($(element).attr("attention")); if ($(element).attr("attention") == "true") { args.OpenIdList[n] = $(element).attr("openid"); n++; } } }); if (args.OpenIdList.length == 0) { layerAlert("请选择会员。"); return; } args.GroupId = groupId; var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); $.ajax({ url: "/Api/Member/MoveMemberListToGroup", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { loadMemberList(_currentPage); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); alert("Error: " + xmlHttpRequest.status); } }); } function blockMember() { if (_currentGroupId == 1) { moveMemberToGroup(0); } else { var confirmLayerIndex = layer.confirm("加入黑名单后,你将无法接收粉丝发来的消息,且该粉丝无法接收到群发消息。确认加入黑名单?", { btn: ['确认', '取消'], //按钮 shade: [0.4, '#393D49'], title: false, closeBtn: false, shift: _layerShift }, function () { layer.close(confirmLayerIndex); moveMemberToGroup(1); }); } } function loadMemberGroupListAndCloseLayer(layerIndex,groupName) { layer.close(layerIndex); if (groupName != undefined && groupName != null) { $("#spanCurrentGroupName").html(groupName); } loadMemberGroupList(); } function showInfo(id) { layer.open({ type: 2, area: ['600px', '100%'], //宽高 closeBtn: false, title: "", shift: _layerShift, content: 'MemberInfo?id=' + id }); } </script> <script id="memberGroupListTemplate" type="text/html"> <div class="divGroupItem" onclick="selectMemberGroup('',-1, '全部用户')" {{# if(_currentGroupId == -1){ }} style="background-color:#eeeeee;" {{# } }}> 全部用户 </div> {{# for(var i = 0, len = d.length; i < len; i++){ }} {{# if(d[i].GroupId == 1){continue;} }} <div class="divGroupItem" onclick="selectMemberGroup('{{ d[i].Id }}',{{ d[i].GroupId }},'{{ d[i].Name }}')" {{# if(d[i].GroupId == _currentGroupId){ }} style="background-color:#eeeeee;" {{# } }}> <div style="margin-left:20px;">{{ d[i].Name }}</div> </div> {{# } }} <div class="divGroupItem" onclick="selectMemberGroup('', 1, '黑名单')" {{# if(_currentGroupId == 1){ }} style="background-color:#eeeeee;" {{# } }}> <div>黑名单</div> </div> <div class="divGroupItem" onclick="selectMemberGroup('', -2, '已取消关注')" {{# if(_currentGroupId == -2){ }} style="background-color:#eeeeee;" {{# } }}> <div>已取消关注</div> </div> </script> <script id="memberListTableTemplate" type="text/html"> <table id="tableBody" border="0" cellspacing="0" cellpadding="0"> {{# for(var i = 0, len = d.length; i < len; i++){ }} {{# var headimg = fitHeadImage(d[i].Headimgurl,46) }} <tr> <td height="50" align="left"><input type="checkbox" value="{{ d[i].Id }}" openid="{{ d[i].OpenId }}" attention="{{ d[i].Attention }}" /></td> <td><img src="{{headimg}}" /></td> @*onclick="showOrderDetail('{{ d[i].Id }}')"*@ <td><a href="javascript:void(0)" onclick="showInfo('{{ d[i].Id }}')">{{ d[i].NickName }}</a></td> <td>{{ d[i].CardNumber }}</td> <td> {{# if(d[i].Name != null){ }} {{d[i].Name}} {{# } }} </td> <td> {{# if(d[i].Sex == 1){ }} 男 {{# }else if(d[i].Sex == 2){ }} 女 {{# }else if(d[i].Sex == 0){ }} 未知 {{# } }} </td> <td> {{# if(d[i].MobilePhone != null){ }} {{d[i].MobilePhone}} {{# } }} </td> <td>{{ d[i].Point }}</td> <td>{{ d[i].CashAccount/100 }}</td> <td>{{ d[i].City }}</td> <td> {{# if(d[i].Attention == true){ }} {{ d[i].SubscribeTime }} {{# }else{ }} 已取消关注 {{# } }} </td> </tr> {{# } }} </table> </script> <div id="divContentTips"> 查询当前关注公众号或之前关注过公众号的会员,并管理他们的会员卡级别和积分、现金账户。 </div> <div style="margin-top:10px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#F6F6F6"> <div style="padding:10px;"> <table width="100%" border="0" cellspacing="0" cellpadding="8"> <tr> <td width="60">昵称:</td> <td width="220"> <input name="txtSearch_NickName" type="text" class="input_16" style="width:200px;" id="txtSearch_NickName" maxlength="30" keyenter /></td> <td width="80">手机号码:</td> <td width="220"><input name="txtSearch_Mobile" type="text" class="input_16" style="width:200px;" id="txtSearch_Mobile" maxlength="30" keyenter /></td> <td> <span style=" margin-top:20px;"> <input name="btnSearch" type="button" class="btn_blue" id="btnSearch" value="查询" onclick="loadMemberList()" /> </span> </td> <td align="right"> <div id="divSyncUserList"> @if (Model.DomainContext.SynchronizingUserList) { <span>正在同步用户列表...</span> } else { <input name="btnSyncUserList" type="button" class="btn_blue" id="btnSyncUserList" value="同步用户列表" onclick="syncUserList()" /> } </div> </td> </tr> </table> </div> </td> </tr> <tr style="height:5px;background-image:url(Images/searchArea_bottom.jpg);background-repeat: repeat-x;"> <td></td> </tr> </table> </div> <div style="margin-top:20px;"> <div style="float:left; line-height:30px;" class="font_black_18"> <span id="spanCurrentGroupName">全部用户</span> </div> <div style="float:left;margin-left:10px;line-height:30px;"> <a id="aRenameMemberGroup" href="javascript:void(0)" onclick="modifyMemberGroup()" class="a_blue_15" style="display:none">重命名</a> </div> <div style="float:left;margin-left:10px;line-height:30px;"> <a id="aRemoveMemberGroup" href="javascript:void(0)" onclick="removeMemberGroup()" class="a_blue_15" style="display:none">删除</a> </div> <div style="float:left;margin-left:30px;"> <select id="selectMemberGroupList" name="selectMemberGroupList" class="input_16" style="min-width:100px;"> <option>添加到</option> </select> </div> <div style="float:left;margin-left:20px;"> <input name="btnBlockMember" type="button" class="btn_white" id="btnBlockMember" value="加入黑名单" onclick="blockMember()" /> </div> <div style="float:right"> <input name="btnSearch" type="button" class="btn_blue" id="btnSearch" value="新建分组" onclick="createMemberGroup()" /> </div> <div style="clear:both"></div> </div> <div style="margin-top:20px;"> <div style="position:absolute; right:240px; left:0px;"> <div> <div style="overflow:hidden; padding-left:20px;" class="tableHeader"> <table id="tableHeader" border="0" cellspacing="0" cellpadding="0" width="1455" height="47"> <tr> <td width="35"></td> <td width="80"></td> <td width="220">微信昵称</td> <td width="220">会员卡号</td> <td width="140">姓名</td> <td width="80">性别</td> <td width="170">手机号码</td> <td width="80">积分</td> <td width="100">现金余额</td> <td width="140">城市</td> <td width="200">关注时间</td> </tr> </table> </div> <div style=" margin-top:10px"> <!--div必须要设置height,否则滚动条出不来--> <div id="divTableBodyContainer" style="overflow:auto; height:100%;; padding-left:20px;" onscroll="scrollHeader()"> </div> </div> </div> <div style="height:1px; margin-top:5px; background-color:#cccccc"> </div> <div id="divPagingContainer" style=" margin-top:20px; margin-bottom:20px;text-align:right; "> </div> </div> <div style="float:right; width:200px; right:0px;"> <div id="divMemberGroupListContainer"> </div> @*<div class="divGroupItem"> <div style="margin-left:20px;">默认组</div> </div> <div class="divGroupItem"> <div style="margin-left:20px;">星标组</div> </div> <div class="divGroupItem" style="background-color:#eeeeee;"> <div style="margin-left:20px;">新建组</div> </div> <div class="divGroupItem"> <div>黑名单</div> </div>*@ </div> </div>
the_stack
@model BlogPostSliderViewModel <style> .carousel-inner .item.left.active { transform: translateX(-33%); } .carousel-inner .item.right.active { transform: translateX(33%); } .carousel-inner .item.next { transform: translateX(33%) } .carousel-inner .item.prev { transform: translateX(-33%) } .carousel-inner .item.right, .carousel-inner .item.left { transform: translateX(0); } .carousel-control.left, .carousel-control.right { background-image: none; } </style> <div> @if (Model != null) { var interval = Model.Interval * 1000; if (Model.IsAutoScroll == false) { interval = 0; } if (string.IsNullOrWhiteSpace(Model.HeaderText) == false) { <h2 style="margin-left:auto; margin-right:auto; text-align:center; padding-top:20px;">@Model.HeaderText</h2> <hr style="margin-top:0px; margin-bottom:5px;" /> } if (Model.DisplayPost == 1) { <div id="nccImageSlider" class="carousel slide" data-ride="carousel" data-interval="@interval"> @if (Model.ShowBottomNav == true) { <ol class="carousel-indicators"> @{var i = 0; } @foreach (var item in Model.PostList) { if (i == 0) { <li data-target="#nccImageSlider" data-slide-to="@i" class="active"></li> } else { <li data-target="#nccImageSlider" data-slide-to="@i"></li> } i++; } </ol> } <div class="carousel-inner" role="listbox"> @{var activeClass = "active"; } @foreach (var item in Model.PostList) { var postDetails = item.PostDetails.Where(x => x.Language == CurrentLanguage).FirstOrDefault(); if (postDetails == null) { postDetails = item.PostDetails.FirstOrDefault(); } if (postDetails != null) { <div class="item @activeClass"> <img src="@item.ThumImage" alt="Ncc Slider Image" class="img-responsive" width="100%" style="margin:0 auto;"> <div class="carousel-caption" role="option"> <h2>@Html.Raw(postDetails.Title)</h2> <p>@Html.Raw(postDetails.MetaDescription)</p> <a href="/Post/@postDetails.Slug" class="btn btn-primary">@_T["Read More"]</a> </div> </div> } activeClass = ""; } </div> @if (Model.ShowSideNav == true) { <a class="left carousel-control" href="#nccImageSlider" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#nccImageSlider" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> } </div> } else if (Model.DisplayPost > 1) { @*<div style="height:400px; overflow:hidden;"> <div class="ccParent" id="ccParrent"> @{var i = 1;} @foreach (var item in Model.PostList) { var postDetails = item.PostDetails.Where(x => x.Language == CurrentLanguage).FirstOrDefault(); if (postDetails == null) { postDetails = item.PostDetails.FirstOrDefault(); } if (postDetails != null) { <div class="ccChild" id="ccChild_@i"> <div style="text-align:center; margin-left:5px; margin-right:5px; padding-bottom:10px; box-shadow: 5px 5px #EEE;"> <img src="@item.ThumImage" width="100%" height="200px" /> <h4 style="height:20px; overflow:hidden;"><strong>@Html.Raw(postDetails.Title)</strong></h4> <hr style="margin-top:0px;margin-bottom:5px;" /> <p style="height:80px; overflow:hidden;">@Html.Raw(postDetails.MetaDescription)</p> <a href="/Post/@postDetails.Slug" class="btn btn-primary">@_T["Read More"]</a> </div> </div> } i++; } </div> @if (Model.ShowSideNav == true) { <a class="left carousel-control" href="#nccImageSlider" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#nccImageSlider" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> } </div>*@ <div class="container"> <div class="carousel slide" id="nccMultiCarousel"> <div class="carousel-inner"> @{var activeClass = "active"; var i = 1;} @foreach (var item in Model.PostList) { var postDetails = item.PostDetails.Where(x => x.Language == CurrentLanguage).FirstOrDefault(); if (postDetails == null) { postDetails = item.PostDetails.FirstOrDefault(); } if (postDetails != null) { <div class="item @activeClass"> <div class="col-md-4" style="padding:3px;"> <div style="text-align: center; border:solid 1px #EEE; margin-bottom: 5px;"> <img src="@item.ThumImage" class="img-responsive"> <div style="padding:5px;"> <h4 style="height:20px; overflow:hidden;"><strong>@Html.Raw(postDetails.Title)</strong></h4> <hr style="margin-top:0px;margin-bottom:5px;" /> <p style="height:80px; overflow:hidden;">@Html.Raw(postDetails.MetaDescription)</p> <a href="/Post/@postDetails.Slug" class="btn btn-primary">@_T["Read More"]</a> </div> </div> </div> </div> } activeClass = ""; i++; } </div> @if (Model.ShowSideNav == true) { <a class="left carousel-control" href="#nccMultiCarousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a> <a class="right carousel-control" href="#nccMultiCarousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a> } </div> </div> <script> $('#nccMultiCarousel').carousel({ interval: @(Model.Interval*1000) }) $('.carousel .item').each(function () { var next = $(this).next(); if (!next.length) { next = $(this).siblings(':first'); } next.children(':first-child').clone().appendTo($(this)); if (next.next().length > 0) { next.next().children(':first-child').clone().appendTo($(this)); } else { $(this).siblings(':first').children(':first-child').clone().appendTo($(this)); } }); </script> } } </div> @*<script> var cci = 1; var myVar = setInterval(myTimer, 3000); function myTimer() { console.log("ccChild_" + cci); var parrent = document.getElementById("ccParrent"); var myNode = document.getElementById("ccChild_" + cci); var temp = myNode; myNode.remove(); //$("#ccChild_" + cci).slideUp(1000,function () { // $(this).animate({ "margin-right": '+=200' }); // $(this).remove(); //}); parrent.appendChild(temp); cci++; if (cci >@Model.TotalPost) { cci = 1; } } $(document).ready(function () { }); </script>*@
the_stack
@*@model Senparc.Weixin.MP.Helpers.JsSdkUiPackage*@ @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>设备对接能力测试(蓝牙)</title> <script src="https://lib.sinaapp.com/js/jquery/1.10.2/jquery-1.10.2.js"></script> <script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script> //wx.ready(function () { // //初始化设备库 // wx.invoke('openWXDeviceLib', { 'connType': 'blue' }, function (res) { // console.log('openWXDeviceLib', res); // alert(res.err_msg); // }); // //关闭设备库 // wx.invoke('closeWXDeviceLib', { 'connType': 'lan' }, function (res) { // alert('closeWXDeviceLib', res); // }); // //获取设备信息 // wx.invoke('getWXDeviceInfos', { 'connType': 'blue' }, function (res) { // alert('getWXDeviceInfos', res); // }); //}); //$('.deviceItem').click(function (deviceId) { // // 发送数据给设备 // wx.invoke('connectWXDevice', { 'deviceId': deviceId, 'connType': 'blue' }, function (res) { // console.log('connectWXDevice', res); // }); //}); //$('#open').click(function () { //}); //$('#close').click(function () { //}); //function sendCommand(state, deviceId) { // var data; // switch (state) { // case 'open': // data = 'xxx1'; // break; // case 'close': // data = 'xxx2'; // break; // default: // } // alert(data); // wx.invoke('sendDataToWXDevice', { 'deviceId': connectedDeviceInfo.deviceId, 'connType': 'blue', 'base64Data': data }, function (res) { // console.log('sendDataToWXDevice', res); // alert(res); // }); //} //初始化库结束 //点击获取设备按钮的函数 开始 $(function() { loadXMLDoc(); var connectedDeviceInfo; wx.ready(function() { //初始化设备库 wx.invoke('openWXDeviceLib', { 'connType': 'blue' }, function(res) { console.log('openWXDeviceLib', res); my_openWXDeviceLib(res); }); //事件绑定 wx.invoke('onWXDeviceBindStateChange', function(res) { mlog('微信客户端设备绑定状态改变事件:' + JSON.stringify(res)); }); wx.invoke('onWXDeviceStateChange', function(res) { mlog('设备连接状态变化:' + JSON.stringify(res)); }); wx.invoke('onWXDeviceBluetoothStateChange', function(res) { mlog('手机蓝牙状态改变:' + JSON.stringify(res)); }); }); $("#connectWXDevice").on("click", function(e) { //连接设备 wx.invoke('connectWXDevice', { 'connType': 'blue', 'deviceId': connectedDeviceInfo.deviceId }, function(res) { mlog("连接设备返回结果:" + JSON.stringify(res)); }); }); $("#disconnectWXDevice").on("click", function(e) { //关闭设备连接 wx.invoke('disconnectWXDevice', { 'connType': 'blue', 'deviceId': connectedDeviceInfo.deviceId }, function(res) { mlog("连接设备返回结果:" + JSON.stringify(res)); }); }); $("#CallGetWXrefresh").on("click", function(e) { //获取设备信息 wx.invoke('getWXDeviceInfos', { 'connType': 'blue' }, function(res) { mlog("获取设备信息返回:" + JSON.stringify(res)); mlog("获取设备信息:" + res.deviceInfos); connectedDeviceInfo = res.deviceInfos[0]; }); }); $("#getWXDeviceTicket").on("click", function(e) { //获取操作凭证 var type = $("#type").val(); alert(type); wx.invoke('getWXDeviceTicket', { 'deviceId': connectedDeviceInfo.deviceId, 'type': type, 'connType': 'blue' }, function(res) { mlog("获取操作凭证返回结果:" + JSON.stringify(res)); }); }); $('#CallCloseWXrefresh').on("click", function(e) { //2. 关闭微信设备 wx.invoke('closeWXDeviceLib', { 'connType': 'blue' }, function(res) { console.log('closeWXDeviceLib', res); mlog("关闭设备返回:" + res.err_msg); }); }); $('#CallSendWXData').on("click", function(e) { //3.发送数据给设备 wx.invoke('sendDataToWXDevice', { 'deviceId': connectedDeviceInfo.deviceId, 'connType': 'blue', 'base64Data': 'aGVsbG93b3JsZA==' }, function(res) { console.log('sendDataToWXDevice', res); mlog("关闭设备返回:" + res.err_msg); }); }); //更新设备接口 @*$("#updateDevice").on("click", function(e) { $.post("https://api.weixin.qq.com/device/authorize_device?access_token=" + '@TempData["AccessToken"]', { device_num: 1, device_list: [ { id: 38424, mac: 'A81B6AAA0F12', connect_protocol: 3, auth_key: "", close_strategy: 1, conn_strategy: 1, crypt_method: 0, auth_ver: 0, manu_mac_pos: -1, ser_mac_pos: -2, ble_simple_protocol: 1 } ], op_type: 1 }, function(data) { //回调函数中对返回值进行一系列操作 alert(data); }); });*@ }); //初始化 微信硬件jsapi库 function loadXMLDoc() { var appId = jQuery("#appId").text(); var timestamp = jQuery("#timestamp").text(); var nonceStr = jQuery("#nonceStr").text(); var signature = jQuery("#signature").text(); wx.config({ beta: true, debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 @*appId: '@Model.AppId', // 必填,公众号的唯一标识 timestamp: '@Model.Timestamp', // 必填,生成签名的时间戳 nonceStr: '@Model.NonceStr', // 必填,生成签名的随机串 signature: '@Model.Signature',// 必填,签名*@ jsApiList: [ 'openWXDeviceLib', 'closeWXDeviceLib', 'getWXDeviceInfos', 'getWXDeviceBindTicket', 'getWXDeviceUnbindTicket', 'startScanWXDevice', 'stopScanWXDevice', 'connectWXDevice', 'disconnectWXDevice', 'sendDataToWXDevice', 'onWXDeviceBindStateChange', 'onWXDeviceStateChange', 'onScanWXDeviceResult', 'onReceiveDataFromWXDevice', 'onWXDeviceBluetoothStateChange', ] }); //alert("初始化库结束"); } function my_openWXDeviceLib(res) { var x = 0; mlog("打开设备返回:" + res.err_msg); if (res.err_msg == 'openWXDeviceLib:ok') { if (res.bluetoothState == 'off') { mlog("未开启蓝牙", "亲,使用前请先打开手机蓝牙!"); $("#lbInfo").innerHTML = "1.请打开手机蓝牙"; $("#lbInfo").css({ color: "red" }); x = 1; //isOver(); }; if (res.bluetoothState == 'unauthorized') { mlog("出错啦", "亲,请授权微信蓝牙功能并打开蓝牙!"); $("#lbInfo").html("1.请授权蓝牙功能"); $("#lbInfo").css({ color: "red" }); x = 1; //isOver(); }; if (res.bluetoothState == 'on') { //mlog("太着急啦","亲,请查看您的设备是否打开!"); $("#lbInfo").html("1.蓝牙已打开,未找到设备"); $("#lbInfo").css({ color: "red" }); //$("#lbInfo").attr(("style", "background-color:#000"); x = 0; //isOver(); }; } else { $("#lbInfo").html("1.微信蓝牙打开失败"); x = 1; mlog("微信蓝牙状态", "亲,请授权微信蓝牙功能并打开蓝牙!"); } return x; //0表示成功 1表示失败 } //打印日志 function mlog(m) { var log = $('#logtext').html(); log=log+m+'\r\n'; //log = m; $('#logtext').html(log); } /*************************************************************** * 显示提示信息 ***************************************************************/ </script> </head> <body> <h2 style="color: white;background-color: green;text-align: center;background-position: center;">蓝牙设备</h2> <div class="page"> <div class="bd spacing"> <div class="weui_cells weui_cells_form"> @*<div class="weui_cell"> <div class="weui_cell_hd"><label class="weui_label" style="width: auto;">当前设备:&nbsp</label></div> <div class="weui_cell_bd weui_cell_primary"> <label id="lbdeviceid" class="weui_label" style="width: auto;"></label> </div> </div> <div class="weui_cell"> <div class="weui_cell_hd"><label class="weui_label" style="width: auto;">状态信息:&nbsp</label></div> <div class="weui_cell_bd weui_cell_primary"> <label id="lbInfo" class="weui_label" style="width: auto;"></label> </div> </div>*@ <div class="weui_cell"> <div class="weui_cell_hd"><label class="weui_label">操作日志: </label></div> <div class="weui_cell_bd weui_cell_primary"> <textarea id="logtext" class="weui_textarea" placeholder="日志" style="width:100%;height:200px;"></textarea> </div> </div> </div> <div class="weui_btn_area weui"> <button class="weui_btn weui_btn weui_btn_warn" id="CallGetWXrefresh">获取设备</button><br> </div> <div class="weui_btn_area weui"> <button class="weui_btn weui_btn weui_btn_warn" id="connectWXDevice">连接设备</button><br> </div> <div class="weui_btn_area weui"> <button class="weui_btn weui_btn weui_btn_warn" id="disconnectWXDevice">断开连接</button><br> </div> <div class="weui_btn_area weui"> <button class="weui_btn weui_btn weui_btn_warn" id="CallCloseWXrefresh">关闭设备</button><br> </div> <div class="weui_btn_area weui"> <select id="type"> <option value="1">绑定设备</option> <option value="2">解绑设备</option> </select> <button class="weui_btn weui_btn weui_btn_warn" id="getWXDeviceTicket">获取凭证</button><br> </div> <div class="weui_btn_area weui"> <button class="weui_btn weui_btn weui_btn_warn" id="CallSendWXData">发送数据</button><br> </div> <div> <button class="weui_btn weui_btn weui_btn_warn" id="updateDevice">更新设备</button><br> </div> </div> </div> </body> </html>
the_stack
@******************************************************************************************************* // GraphMeasurements.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/15/2016 - J. Ritchie Carroll // Generated original version of source code. // //****************************************************************************************************** // To use in an ASP.NET project, include a GraphMeasurements.cshtml view with following content: // // @using GSF.Web // @section StyleSheets{@Html.Raw(ViewBag.StyleSheetsSection?.ToString())} // @Html.RenderResource("GSF.Web.Shared.Views.GraphMeasurements.cshtml") // @section Scripts{@Html.Raw(ViewBag.ScriptsSection?.ToString())} // //****************************************************************************************************** // To use in a self-hosted web project, include a GraphMeasurements.cshtml view with following content: // // @using GSF.Web.Model // @using <MyAppNameSpace>.Model // @inherits ExtendedTemplateBase<AppModel> // @section StyleSheets{@Html.Raw(ViewBag.StyleSheetsSection.ToString())} // @{Layout = "Layout.cshtml";} // @Html.RenderResource("GSF.Web.Shared.Views.GraphMeasurements.cshtml") // @section Scripts{@Html.Raw(ViewBag.ScriptsSection.ToString())} //*****************************************************************************************************@ @* ReSharper disable RedundantUsingDirective *@ @* ReSharper disable Html.PathError *@ @* ReSharper disable InlineOutVariableDeclaration *@ @* ReSharper disable UnknownCssClass *@ @* ReSharper disable CoercedEqualsUsing *@ @using System.Collections.Generic @using System.Net.Http @using GSF @using GSF.Web @using GSF.Web.Model @using GSF.Web.Shared @inherits ExtendedTemplateBase @{ //Layout = "Layout.cshtml"; ViewBag.Title = "Graph Measurements"; ViewBag.SetFullWidth = true; HttpRequestMessage request = ViewBag.Request; Dictionary<string, string> parameters = request.QueryParameters(); string showMenu; parameters.TryGetValue("ShowMenu", out showMenu); if (string.IsNullOrEmpty(showMenu)) { showMenu = "true"; } ViewBag.ShowMenu = showMenu.ParseBoolean(); } @section StyleSheets { <link href="@Resources.Root/Shared/Content/jquery-ui.css" rel="stylesheet"> <style> html { overflow-x: hidden; height: 100%; } body { overflow-x: hidden; overflow-y: hidden; height: 100%; } .list-group { padding-left: 0; margin-left: 0; } .list-group-item { padding-left: 0; margin-left: 0; } .panel-body { padding: 0; } .panel-heading { padding: 0; } ul.nowrap { overflow: auto; } li.nowrap { white-space: nowrap; } #messageBlock { width: 300px; margin: 0 auto; text-align: center } .ui-resizable-e { right: 2px; border-left-width: 8px; border-left-style: double; border-left-color: #C8C8C8; } .modal-dialog { width: 850px; margin: 2rem auto; } /* Collapsible button style */ .btn-collapsible.btn { color: rgb(255, 255, 255); padding-bottom: 0; margin-left: -8px; font-family: "Glyphicons Halflings"; font-size: 8pt; height: 22px; } /* Collapsible button icon when content is shown - arrow down */ .btn-collapsible.btn:after { content: "\e114"; } /* Collapsible button icon when content is hidden - arrow right */ .btn-collapsible.btn.collapsed:after { content: "\e080"; } .glyphicon-spin { -webkit-animation: spin 1.25s infinite linear; -moz-animation: spin 1.25s infinite linear; -o-animation: spin 1.25s infinite linear; animation: spin 1.25s infinite linear; } @@-moz-keyframes spin { 0% { -moz-transform: rotate(0); } 100% { -moz-transform: rotate(359deg); } } @@-webkit-keyframes spin { 0% { -webkit-transform: rotate(0); } 100% { -webkit-transform: rotate(359deg); } } @@-o-keyframes spin { 0% { -o-transform: rotate(0); } 100% { -o-transform: rotate(359deg); } } @@keyframes spin { 0% { -webkit-transform: rotate(0); transform: rotate(0); } 100% { -webkit-transform: rotate(359deg); transform: rotate(359deg); } } </style> } @section Scripts { <script src="@Resources.Root/Shared/Scripts/jquery-ui.js"></script> <script src="@Resources.Root/Shared/Scripts/jquery.subscriber.js"></script> <script src="@Resources.Root/Shared/Scripts/flot/jquery.flot.min.js"></script> <script src="@Resources.Root/Shared/Scripts/flot/jquery.flot.crosshair.min.js"></script> <script src="@Resources.Root/Shared/Scripts/flot/jquery.flot.navigate.min.js"></script> <script src="@Resources.Root/Shared/Scripts/flot/jquery.flot.resize.min.js"></script> <script src="@Resources.Root/Shared/Scripts/flot/jquery.flot.selection.min.js"></script> <script src="@Resources.Root/Shared/Scripts/flot/jquery.flot.time.min.js"></script> <script src="@Resources.Root/Shared/Scripts/flot/jquery.flot.axislabels.min.js"></script> <script src="@Resources.Root/Shared/Scripts/angular.js"></script> <script src="@Resources.Root/Shared/Scripts/jstorage.js"></script> <script> // Need to define a global function to reset the filter so // that it can be called by the click handler for a global button var resetFilter; (function ($) { var plot; var plotData = []; const graphMeasurements = angular.module('GraphMeasurements', []); var root = "@Resources.Root"; // Logs messages to an array so they can be // observed on demand in the JavaScript console function log(obj) { const max = 500; if (window.log === undefined) window.log = []; window.log.push(obj); if (window.log.length > max) window.log.splice(0, window.log.length - max); } // Removes invalid characters from an identifier // so it can be used as an ID in HTML function cleanIdentifier(identifier) { if (identifier == null) return ""; return identifier.replace(/[!"#$%&'()*+,.\/:;<=>?@@[\\\]^`{|}~]/g, "-"); } // Builds the plot upon which the chart will be displayed function buildPlot() { plot = $.plot("#placeholder", plotData, { series: { shadowSize: 0 }, yaxes: [ { show: true, position: "left", axisLabel: "Frequency" }, { show: true, position: "left", axisLabel: "Voltage" }, { show: true, position: "right", axisLabel: "Current" }, { show: true, position: "right", axisLabel: "Angle" }, { show: true, position: "right", axisLabel: "Analog Data" } ], xaxis: { mode: "time", timeformat: "%H:%M:%S", timezone: "browser" }, legend: { show: true, container: $('#legend'), noColumns: 1, margin: 5 } }); } // Builds the stats modal for the device with the given acronym function buildModal(acronym) { $("#modals").append('<div id="' + acronym + '"></div>'); let html = '<div id="mod' + acronym + '" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="confirm-modal" aria-hidden="true">'; html += '<div class="modal-dialog">'; html += '<div class="modal-content">'; html += '<div class="modal-header">'; html += '<a class="close" data-dismiss="modal">×</a>'; html += '<h4>' + acronym + ' Statistics</h4>'; html += '</div>'; html += '<div class="modal-body" style="height: 300px; overflow-y: scroll" >'; html += '<table id="stat' + acronym + '" class="table" style="font-size: x-small">'; html += '<thead>Run-time Statistics:<thead />'; html += '<tr><th style="text-align: center; white-space: nowrap">Stat ID</th><th>Statistic</th><th style="text-align: center">Value</th><th>TimeTag</th></tr>'; html += '</table>'; html += '</div>'; html += '<div class="modal-footer">'; html += '<span class="btn" data-dismiss="modal">Close</span>'; // close button html += '</div>'; // footer html += '</div>'; // modalWindow $('#' + acronym).html(html); $("#mod" + acronym).modal({ 'show': false }); } // Explicitly sets heights of various components on // the page to take up available screen space function resizeElements() { const sidebar = $("#sidebar"); const sidebarExpanded = sidebar.hasClass("in"); const sidebarHeight = $(window).innerHeight() - sidebar.offset().top - 20; const chartHeight = sidebarExpanded ? sidebarHeight - 40 : $(window).innerHeight() - 180; if (!sidebar.hasClass("init-width")) { sidebar.addClass("init-width"); sidebar.width($(window).innerWidth() * 0.20); } sidebar.height(sidebarHeight); $("#placeholder").height(chartHeight); $("#graphContainer").css({ "top": (sidebarExpanded ? -sidebar.height() : 0) + "px" }); $("#graphContainer").css({ "left": (sidebarExpanded ? sidebar.width() + 30 : 0) + "px" }); $("#graphContainer").width($(window).innerWidth() - (sidebarExpanded ? sidebar.width() + 80 : $("#collapseSidebarBtn").outerWidth() + 20)); $(".ui-resizable-e").height(sidebar.prop("scrollHeight")); } // Loads settings from local storage and prepares // callback functions for the initial page load function loadSettings($scope) { $scope.dataPoints = 300; $scope.selections = []; if ($.jStorage.get("dataPoints") !== null) $scope.dataPoints = $.jStorage.get("dataPoints"); if ($.jStorage.get("selections") !== null) $scope.selections = $.jStorage.get("selections"); $scope.deviceCallbacks = {}; $scope.measurementCallbacks = {}; $.each($scope.selections, function (_, selection) { $scope.deviceCallbacks[selection.device] = function (deviceMetadata) { const identifier = cleanIdentifier(deviceMetadata.acronym); $("#dd" + identifier).removeClass("collapse"); deviceMetadata.updateMeasurements(); } $scope.measurementCallbacks[selection.signalid] = function (measurementMetadata) { const cleanID = cleanIdentifier(measurementMetadata.id); $("#cb" + cleanID).prop("checked", true); updateFilter($scope, true, measurementMetadata); } }); $('#datapoints').val($scope.dataPoints); } function measurementChecked($scope, signalID) { if (signalID) { const selections = $.jStorage.get("selections"); if (selections) { for (let i = 0; i < selections.length; i++) { if (selections[i].signalid == signalID) return true; } } } return false; } // Updates the subscription filter for the data subscriber function updateFilter($scope, checked, measurementMetadata) { if (!hubIsConnected) return; if (checked) { $scope.selectedMeasurements[measurementMetadata.signalid] = { selection: { device: measurementMetadata.deviceacronym, signalid: measurementMetadata.signalid }, plotData: { label: measurementMetadata.pointtag + " - " + measurementMetadata.signalacronym, yaxis: measurementMetadata.YAxis, data: [] } }; } else { delete $scope.selectedMeasurements[measurementMetadata.signalid]; } const selectedIDs = Object.keys($scope.selectedMeasurements); if (selectedIDs.length > 0) { const filterStr = selectedIDs.join(";"); $scope.dataSubscriber.subscribe({ FilterExpression: filterStr }); } else { $scope.dataSubscriber.unsubscribe(); } plotData = Object.keys($scope.selectedMeasurements) .map(function (key) { return $scope.selectedMeasurements[key].plotData; }); plot.setData(plotData); plot.setupGrid(); plot.draw(); $scope.selections = Object.keys($scope.selectedMeasurements) .map(function (key) { return $scope.selectedMeasurements[key].selection; }); $.jStorage.set("selections", $scope.selections); } // Queries metadata for the measurements associated with the given device function getMeasurements($scope, deviceMetadata) { if (!hubIsConnected) return; $scope.dataSubscriber.getMetadata("MeasurementDetail", "DeviceAcronym = '" + deviceMetadata.acronym + "' AND SignalAcronym <> 'STAT'") .fail(e => showErrorMessage(e, null, true)) .done(function (data) { data.sort(function (m1, m2) { function signalIndex (measurementMetadata) { const matches = measurementMetadata.signalreference.match(/[0-9]+$/); if (matches === null) return 0; return Number(matches[0]); } function pointID (measurementMetadata) { return Number(measurementMetadata.id.split(':')[1]); } const comparisons = []; comparisons.push({ m1: m1.signalacronym, m2: m2.signalacronym }); comparisons.push({ m1: signalIndex(m1), m2: signalIndex(m2) }); comparisons.push({ m1: pointID(m1), m2: pointID(m2) }); for (let i = 0; i < comparisons.length; i++) { const comparison = comparisons[i]; if (comparison.m1 < comparison.m2) return -1; if (comparison.m1 > comparison.m2) return 1; } return 0; }); $.each(data, function (_, measurementMetadata) { if (measurementMetadata.signalacronym === "FREQ") measurementMetadata.YAxis = 1; else if (measurementMetadata.signalacronym === "VPHM") measurementMetadata.YAxis = 2; else if (measurementMetadata.signalacronym === "IPHM") measurementMetadata.YAxis = 3; else if (measurementMetadata.signalacronym.endsWith("PHA")) measurementMetadata.YAxis = 4; else measurementMetadata.YAxis = 5; }); deviceMetadata.measurements = data; $scope.$apply(); // Handle the callbacks for automatic measurement auto-selection $.each(data, function (_, measurementMetadata) { const callback = $scope.measurementCallbacks[measurementMetadata.signalid]; if (callback !== undefined) callback(measurementMetadata); }); }); } // Queries metadata for all statistics and // the modals to display stat information function getStatistics($scope) { $scope.dataSubscriber.getMetadata("MeasurementDetail", "SignalAcronym = 'STAT'") .fail(e => showErrorMessage(e, null, true)) .done(function (data) { data.sort(function (m1, m2) { function category(measurementMetadata) { const matches = measurementMetadata.signalreference.match(/!([^-]+)-ST[0-9]+$/); if (matches === null) return null; return matches[1]; } function signalIndex(measurementMetadata) { const matches = measurementMetadata.signalreference.match(/[0-9]+$/); if (matches === null) return null; return Number(matches[0]); } const comparisons = []; comparisons.push({ m1: category(m1), m2: category(m2) }); comparisons.push({ m1: signalIndex(m1), m2: signalIndex(m2) }); for (let i = 0; i < comparisons.length; i++) { const comparison = comparisons[i]; if (comparison.m1 < comparison.m2) return -1; if (comparison.m1 > comparison.m2) return 1; } return 0; }); $.each(data, function (_, measurementMetadata) { if (measurementMetadata.enabled == true) { const stat = { deviceAcronym: measurementMetadata.deviceacronym, id: measurementMetadata.signalid, signalReference: measurementMetadata.signalreference, value: null, timestamp: null, description: measurementMetadata.description }; $scope.statLookup[measurementMetadata.signalid] = stat; if (measurementMetadata.deviceacronym !== null) { const splitSignalReference = measurementMetadata.signalreference.split("!"); const statIdentifier = splitSignalReference[splitSignalReference.length - 1]; $('#stat' + $scope.cleanIdentifier(measurementMetadata.deviceacronym)).append('<tr><td style="text-align: center">' + statIdentifier + '</td><td id="des' + measurementMetadata.signalid + '">' + measurementMetadata.description + '</td><td style="text-align: center"><span id="val' + measurementMetadata.signalid + '" >' + stat.value + '</span></td><td style="white-space: nowrap"><span id="time' + measurementMetadata.signalid + '" >' + stat.timestamp + '</span></td></tr>'); } } }); $scope.$apply(); $("#imgDIRECT_CONNECTED").hide(); $("#btnDIRECT_CONNECTED").hide(); $scope.statSubscriber.connect(); // Handle the callbacks for automatic measurement auto-selection $.each($scope.deviceData, function (_, parent) { $.each(parent.devices, function (_, deviceMetadata) { const callback = $scope.deviceCallbacks[deviceMetadata.acronym]; if (callback !== undefined) callback(deviceMetadata); }); }); }); } // Queries metadata for all devices to fill in the measurement // selection control on the left side of the page function getDevices($scope) { $scope.dataSubscriber.getMetadata("DeviceDetail", null, "Acronym") .fail(e => showErrorMessage(e, null, true)) .done(function (data) { var parents = {}; var parentAcronyms = []; $.each(data, function (_, deviceMetadata) { var parentAcronym = deviceMetadata.parentacronym; if (parentAcronym === "") parentAcronym = "DIRECT_CONNECTED"; var parent = parents[parentAcronym]; if (parent == null) { parent = parents[parentAcronym] = { parent: parentAcronym, devices: [] }; if (parentAcronym !== "DIRECT_CONNECTED") parentAcronyms.push(parentAcronym); buildModal(parentAcronym); } deviceMetadata.updateMeasurements = function () { if (deviceMetadata.measurements != null) return; getMeasurements($scope, deviceMetadata); } if (parent != null) parent.devices.push(deviceMetadata); buildModal($scope.cleanIdentifier(deviceMetadata.acronym)); }); parentAcronyms.sort(); if (parents["DIRECT_CONNECTED"] !== undefined) parentAcronyms.splice(0, 0, "DIRECT_CONNECTED"); $scope.deviceData = parentAcronyms.map(function (acronym) { return parents[acronym]; }); getStatistics($scope); showGraphMessage("Metadata load succeeded for " + data.length + " devices.", false, 10000); }); } // Updates the plot data to display the latest values in the chart function updatePlotData($scope, measurements) { $.each(measurements, function (_, measurement) { const selectedMeasurement = $scope.selectedMeasurements[measurement.signalid]; if (selectedMeasurement == null) return; selectedMeasurement.plotData.data.push([measurement.timestamp, measurement.value]); }); $.each(plotData, function (_, plotData) { const data = plotData.data; if (data.length > $scope.dataPoints) data.splice(0, data.length - $scope.dataPoints); }); plot.setData(plotData); plot.setupGrid(); plot.draw(); } // Updates the stat data to display the latest values in the modals function updateStatData($scope, measurements) { $.each(measurements, function (_, measurement) { const stat = $scope.statLookup[measurement.signalid]; if (stat == null) return; stat.value = measurement.value; stat.timestamp = measurement.timestamp; if (stat.deviceAcronym !== null) { if ($('#des' + measurement.signalid).text().indexOf("Boolean") >= 0) $('#val' + measurement.signalid).text(Boolean(measurement.value)); else $('#val' + measurement.signalid).text(measurement.value); $('#time' + measurement.signalid).text(new Date(measurement.timestamp).formatDate(DateTimeFormat)); if (/!(IS-ST8|SUB-ST1|PMU-ST4)$/.test(stat.signalReference)) { if (stat.value !== null && (stat.value === true || stat.value !== 0)) $('#img' + cleanIdentifier(stat.deviceAcronym)).attr("src", root + "/Shared/Images/StatusLights/Small/greenlight.png"); else $('#img' + cleanIdentifier(stat.deviceAcronym)).attr("src", root + "/Shared/Images/StatusLights/Small/redlight.png"); } } }); $scope.$apply(); } // Resets subscription state and initializes the subscribers from scratch - // this happens every time the SignalR hub reconnects so we can refresh our state function initializeSubscribers($scope) { loadSettings($scope); $scope.dataSubscriber = $.subscriber(); $scope.statSubscriber = $.subscriber(); $scope.selectedMeasurements = {}; $scope.statLookup = {}; $scope.measurementChecked = function (signalID) { return measurementChecked($scope, signalID); } $scope.updateFilter = function (checked, measurementMetadata) { updateFilter($scope, checked, measurementMetadata); } $scope.dataSubscriber.connectionEstablished = function () { showGraphMessage("Loading subscription metadata...", true); $scope.dataSubscriber.sendCommand("MetadataRefresh") .fail(e => showErrorMessage(e, null, true)); } $scope.dataSubscriber.metadataReceived = function () { getDevices($scope); } $scope.dataSubscriber.newMeasurements = function (measurements) { updatePlotData($scope, measurements); } $scope.dataSubscriber.statusMessage = function (message) { log("Data subscription: " + message); } $scope.dataSubscriber.processException = function (exception) { showErrorMessage("Data subscription: " + exception.Message); } $scope.statSubscriber.connectionEstablished = function () { $scope.statSubscriber.subscribe({ FilterExpression: "FILTER ActiveMeasurements WHERE SignalType = 'STAT'" }); } $scope.statSubscriber.newMeasurements = function (measurements) { updateStatData($scope, measurements); } $scope.statSubscriber.statusMessage = function (message) { log("Stat subscription: " + message); } $scope.statSubscriber.processException = function (exception) { showErrorMessage("Stat subscription: " + exception.Message); } $scope.dataSubscriber.connect(); } // Sets ups the angular controller for the graph measurements page // ReSharper disable once UnusedLocals const MeasurementsCtrl = graphMeasurements.controller("MeasurementsCtrl", function ($scope) { resetFilter = function () { $("input[type=checkbox]").prop("checked", false); $scope.selectedMeasurements = {}; $scope.dataSubscriber.unsubscribe(); plotData = []; plot.setData(plotData); plot.setupGrid(); plot.draw(); $scope.selections = []; $.jStorage.set("selections", null); } $scope.cleanIdentifier = function (identifier) { return cleanIdentifier(identifier); } $scope.cleanPointTag = function (metadata) { return cleanIdentifier(metadata.pointtag); } // function called to update settings on change from the inputs $scope.updateDataPoints = function () { $.jStorage.set("dataPoints", $scope.dataPoints); }; $scope.formatDate = function (date) { return new Date(date).formatDate(DateTimeFormat); } $(window).on("hubConnected", function (event) { initializeSubscribers($scope); }); if (hubIsConnected) initializeSubscribers($scope); }); // Fix heights when error messages are displayed $(window).on("messageVisibiltyChanged", function (event) { setTimeout(function () { resizeElements(); }, 200); }); function showGraphMessage(message, showWorkingIcon, timeout) { if (isEmpty(message)) { $("#message").text(""); $("#workingIcon").hide(); } else { $("#message").text(message); if (showWorkingIcon !== undefined) { if (showWorkingIcon) $("#workingIcon").show(); else $("#workingIcon").hide(); } } if (timeout !== undefined) setTimeout(() => showGraphMessage(""), timeout); } // Handles initial page load $(document).ready(function () { // Set heights before we build the plot // so that we don't attempt to place a // chart in an element with zero height resizeElements(); buildPlot(); $(window).resize(resizeElements); const sidebar = $("#sidebar"); sidebar.resizable({ handles: "e" }); $(".ui-resizable-e").height(sidebar.prop("title", "Resize areas")); new ResizeObserver(function () { resizeElements(); }).observe(sidebar[0]); sidebar.on("shown.bs.collapse", function () { resizeElements(); $("#collapseSidebarBtn").prop("title", "Expand measurement selection section..."); }); sidebar.on("hidden.bs.collapse", function () { resizeElements(); $("#collapseSidebarBtn").prop("title", "Collapse measurement selection section..."); }); }); })(jQuery); </script> } <span class="glyphicon glyphicon-refresh pre-cache"></span> <div class="container-fluid"> <div class="row"> <div ng-app="GraphMeasurements" ng-controller="MeasurementsCtrl"> <div id="sidebar" class="col-md-3 collapse in" style="overflow-x: auto; resize: horizontal " role="navigation"> <div class="panel-group"> <div class="panel panel-default"> <div class="panel-heading" style="padding: 5px"> <h4 class="panel-title"> <a data-toggle="collapse" href="#collapse1">Settings</a> </h4> </div> <div id="collapse1" class="panel-collapse collapse" style="margin: 5px"> <label for="datapoints">Number of Data Points to Plot:</label> <input type="number" id="datapoints" ng-model="dataPoints" ng-change="updateDataPoints()" class="form-control" /> </div> </div> </div> <div class="panel-group"> <div class="panel panel-default"> <div class="panel-heading" style="padding: 5px"> <h4 class="panel-title"> <a data-toggle="collapse" href="#collapse2">Legend</a> </h4> </div> <div id="collapse2" class="panel-collapse collapse" style="margin: 5px"> <div id="legend" style="overflow-y: scroll"> <table> <tr ng-repeat="x in legend"><td>{{x}}</td></tr> </table> </div> </div> </div> </div> <div ng-repeat="parentDevice in deviceData" class="panel-group"> <div class="panel panel-default"> <div class="panel-heading"> <div class="panel-title"> <img id="img{{parentDevice.parent}}" src="@Resources.Root/Shared/Images/StatusLights/Small/greylight.png" style="padding-left: 6px" /> <button class="btn btn-link btn-sm" style="font-size: x-small;" data-toggle="collapse" data-parent="#devicelist" data-target="#dd{{parentDevice.parent}}">{{parentDevice.parent}}</button> <button id="btn{{parentDevice.parent}}" class="btn btn-xs badge pull-right" data-toggle="modal" data-target="#mod{{parentDevice.parent}}" style="font-size: xx-small; margin: 5px 15px 0 0">Stats</button> </div> </div> <div class="panel-body"> <div id="dd{{parentDevice.parent}}" class="panel-collapse collapse in"> <ul class="list-group nowrap" id="parent{{parentDevice.parent}}"> <li class="list-group-item nowrap" ng-repeat="deviceMetadata in parentDevice.devices"> <img id="img{{cleanIdentifier(deviceMetadata.acronym)}}" src="@Resources.Root/Shared/Images/StatusLights/Small/greylight.png" style="padding-left: 5px" /> <button class="btn btn-link btn-sm" style="font-size: x-small;" title="{{deviceMetadata.name}}" data-toggle="collapse" data-target="#dd{{cleanIdentifier(deviceMetadata.acronym)}}" ng-click="deviceMetadata.updateMeasurements()">{{deviceMetadata.acronym}}</button> <button id="btn{{cleanIdentifier(deviceMetadata.acronym)}}" class="btn btn-xs badge" data-toggle="modal" data-target="#mod{{cleanIdentifier(deviceMetadata.acronym)}}" style="font-size: xx-small;">Stats</button> <div id="dd{{cleanIdentifier(deviceMetadata.acronym)}}" class="collapse"> <table class="table" style="width: 15%; font-size: x-small;" id="tb{{cleanIdentifier(deviceMetadata.acronym)}}"> <tr><th></th><th>ID</th><th>Stream</th><th>Signal</th><th></th></tr> <tr title="{{measurementMetadata.description}}" ng-repeat="measurementMetadata in deviceMetadata.measurements"> <td> <input type="checkbox" id="cb{{cleanIdentifier(measurementMetadata.id)}}" value="{{measurementMetadata.id}}#{{measurementMetadata.signalid}}" ng-model="checked" ng-init="checked=measurementChecked(measurementMetadata.signalid)" ng-change="updateFilter(checked, measurementMetadata)" /> </td> <td>{{measurementMetadata.id.split(':')[1]}}</td> <td>{{cleanPointTag(measurementMetadata)}}</td> <td>{{measurementMetadata.signalacronym}}</td> </tr> </table> </div> </li> </ul> </div> </div> </div> </div> </div> </div> <div id="graphContainer" class="col-md-9 content" style="height: 100%"> <div class="pull-left"> <button id="collapseSidebarBtn" type="button" class="btn btn-primary btn-xs btn-collapsible" data-toggle="collapse" data-target="#sidebar" title="Collapse measurement selection section..."></button> <button type="button" class="btn btn-primary btn-xs" onclick="resetFilter()">Clear Signals</button> </div> <div id="messageBlock"> <span id="message">Initializing data subscriptions...</span>&nbsp;&nbsp;<span id="workingIcon" class="glyphicon glyphicon-refresh glyphicon-spin"></span> </div> <br /> <div id="graphWrapper" class="text-center" style="height: 100%"> <div id="placeholder" style="width: 100%; height: 100px"></div> </div> </div> </div> </div> <div id="modals"> </div> @{ ViewBag.StyleSheetsSection = RenderSection("StyleSheets").ToString(); ViewBag.ScriptsSection = RenderSection("Scripts").ToString(); }
the_stack
@model Piranha.Models.Manager.PageModels.ListModel @section Head { <style type="text/css"> ul.sites { float: left; margin-left: 10px; margin-right: 0; margin-bottom: 0; } ul.sites li a.selected { border: 0 none; padding: 10px 20px 6px; } </style> <script type="text/javascript"> function addPage() { $('#page-templates').show(); $('#block-templates').hide(); floatBox.show('boxTemplates'); return false; } // // Sets all hidden fields before submit function preSubmit(parentid, seqno, pages, blocktypes) { $("#ParentId").val(parentid); $("#Seqno").val(seqno); if (pages) { $('#page-templates').show(); $('#block-header').show(); } else { $('#page-templates').hide(); $('#block-header').hide(); } if (blocktypes == '') { $('#block-templates').hide(); } else { // Show all blocks $('#block-templates .templates').removeClass('one'); $('#block-templates .templates').show(); var visible = 0; // Hide disabled blocks $.each($('#block-templates .templates'), function (i, e) { var id = $(e).attr('data-templateid'); if (blocktypes.indexOf(id) == -1) $(e).hide(); else visible++; }); if (visible == 1) $('#block-templates .templates').addClass('one'); $('#block-templates').show(); } floatBox.show('boxTemplates'); return false; } var deletemsg = "@Piranha.Resources.Page.MessageDeleteConfirm"; function formatSitemap() { $.each($(".sitemap li:visible"), function (i, e) { if (i % 2 == 1) $(this).addClass("odd"); else $(this).removeClass("odd"); }); } var currmove; $(document).ready(function () { formatSitemap(); // Handle the site tree $(".sitemap .action").click(function () { var li = $(this).parent().parent(); li.toggleClass("collapsed"); li.toggleClass("expanded"); formatSitemap(); }); // Set the selected template id $(".templates").click(function () { $("#TemplateId").val($(this).attr("data-templateid")); $("form").submit(); }); // Set the original id $(".copy-page").live('click', function () { $("#OriginalId").val($(this).attr("data-id")); $("form").submit(); }); $(".delete").click(function () { return confirm(deletemsg); }); // Setup page list var options = { listClass: 'list-js', searchId: 'search', valueNames: ['title', 'template', 'updated', 'created'] }; new List('list', options); // Setup page copy list var copyoptions = { listClass: 'copy-list-js', searchId: 'page-search', maxVisibleItemsCount: 5000, valueNames: ['copypage-title', 'copypage-template', 'copypage-siteid'] }; new List('page-list', copyoptions); @if (!Model.IsSeoList) { <text> // Switch between list/tree $("#search").keyup(function () { if ($(this).val() != "") { $(".sitemap").hide(); $("#list").show(); } else { $("#list").hide(); $(".sitemap").show(); } }); </text> } }); function bindMove() { $(".move .title a").click(function () { if ($(this).parent().parent().hasClass("expanded")) alert("move: " + currmove + " below: " + $(this).parent().parent().attr("id")); else alert("move: " + currmove + " after: " + $(this).parent().parent().attr("id")); return false; }); } </script> <!-- Restyle the list a bit to match tree --> <style type="text/css"> table.list th:first-child, table.list tbody td:first-child > * { padding-left: 30px; } </style> } @section Toolbar { @Html.Partial("Partial/Tabs") <div class="toolbar"> <div class="inner"> <ul> <li><a onclick="return addPage()" class="add">@Piranha.Resources.Global.ToolbarAdd</a></li> @if (Model.ActiveSite != "DEFAULT_SITE") { <li><a href="@Url.Action("site", new { id = Model.ActiveSite.ToLower() })" class="refresh">@Piranha.Resources.Global.ToolbarReload</a></li> } else { <li><a href="@Url.Action("index")" class="refresh">@Piranha.Resources.Global.ToolbarReload</a></li> } @if (Model.SitePage[Model.ActiveSiteId] != Guid.Empty) { <li> <a href="@Url.Action("edit", new { @id = Model.SitePage[Model.ActiveSiteId] })" class="edit-site">@Piranha.Resources.Page.EditSite</a> @if (Model.SiteWarnings[Model.ActiveSiteId] > 0) { <span class="notification">@Model.SiteWarnings[Model.ActiveSiteId]</span> } </li> } @if (Model.TotalSiteWarnings[Model.ActiveSiteId] > 0) { <li> <a href="@Url.Action("seo", new { @id = Model.ActiveSite.ToLower() })" class="seo">SEO</a> <span class="notification">@Model.TotalSiteWarnings[Model.ActiveSiteId]</span> </li> } @Piranha.WebPages.Hooks.Manager.Toolbar.Render(Url, Model) </ul> <button class="search" title="@Piranha.Resources.Global.ToolbarSearch"></button>@Html.TextBox("search") <div class="clear"></div> </div> </div> } <div class="grid_12"> @using (Html.BeginForm("insert", (string)ViewContext.RouteData.Values["Controller"])) { @Html.Hidden("TemplateId", Model.Templates.Count == 1 ? Model.Templates[0].Id : Guid.Empty) @Html.Hidden("ParentId") @Html.Hidden("Seqno", Model.NewSeqno) @Html.Hidden("SiteTree", Model.ActiveSite) @Html.Hidden("OriginalId") if (Model.SiteTrees.Count > 1) { <div> <ul class="sites tabs"> @foreach (var site in Model.SiteTrees) { <li> <a href="@Url.Action("site", "page", new { @id = site.InternalId.ToLower() })" @(site.InternalId == Model.ActiveSite ? "class=selected" : "")>@site.Name</a> </li> } </ul> <div class="clear"></div> </div> } <ul class="sitemap" @(Model.IsSeoList ? "style=display:none" : "")> @if (!Model.IsSeoList) { <li class="header"> <span class="buttons"></span> <span class="date">@Piranha.Resources.Global.Created</span> <span class="date">@Piranha.Resources.Global.Updated</span> <span class="type">@Piranha.Resources.Global.Type</span> <span class="title">@Piranha.Resources.Global.Title</span> </li> @Html.Partial(@"~/Areas/Manager/Views/Page/Partial/SiteTree.cshtml", new Piranha.Models.Manager.PageModels.SitemapModel() { Pages = Model.SiteMap, Templates = Model.Templates }) } </ul> <table id="list" class="list" @(!Model.IsSeoList ? "style=display:none" : "")> <thead> <tr> <th><span class="sort asc" data-sort="title">@Piranha.Resources.Global.Title</span></th> <th style="width:200px"><span class="sort" data-sort="template">@Piranha.Resources.Global.Type</span></th> <th class="date"><span class="sort" data-sort="updated">@Piranha.Resources.Global.Updated</span></th> <th class="date"><span class="sort" data-sort="created">@Piranha.Resources.Global.Created</span></th> <th></th> </tr> </thead> <tbody class="list-js"> @foreach (var page in Model.Pages) { <tr@(page.Updated > page.LastPublished ? " class=draft" : "")> <td class="title"><a href="@Url.Action("edit", new { id = page.Id })@Html.Raw(Model.IsSeoList ? "?action=seo" : "")"> @(!String.IsNullOrEmpty(page.NavigationTitle) ? page.NavigationTitle : page.Title) <div class="list-info"> @Html.Raw(page.LastPublished == DateTime.MinValue ? "<span class=info-unpublished></span>" : (page.Updated > page.LastPublished ? "<span class=info-draft></span>" : "")) @Html.Raw(page.OriginalId != Guid.Empty ? "<span class=info-copy></span>" : "") @Html.Raw(Model.IsSeoList ? "<span class=notification>" + Model.PageWarnings[page.Id].ToString() + "</span>" : "") </div> </a></td> <td class="template">@page.TemplateName</td> <td class="updated">@page.Updated.ToString("yyyy-MM-dd")</td> <td class="created">@page.Created.ToString("yyyy-MM-dd")</td> <td class="buttons three"> <button class="icon add-after marg" title="@Piranha.Resources.Page.ListAddAfter" onclick="return preSubmit('@page.ParentId', @(page.Seqno + 1))" type="submit"></button> <button class="icon add-below marg" title="@Piranha.Resources.Page.ListAddBelow" onclick="return preSubmit('@page.Id', 1)" type="submit"></button> @if (page.Pages.Count == 0 && User.HasAccess("ADMIN_PAGE_PUBLISH")) { <a href="@Url.Action("delete", "page", new { id = page.Id })" title="@Piranha.Resources.Page.ListDelete" class="icon delete"></a> } </td> </tr> } </tbody> <tfoot> <tr> <td colspan="5"></td> </tr> </tfoot> </table> } </div> @section Foot { <div id="boxTemplates" class="floatbox"> <div class="bg"></div> <div class="box"> <div class="title"> <ul class="box-tabs"> <li class="selected"><a href="#create-new">@Piranha.Resources.Page.PopupTypeTitle</a></li> <li><a href="#create-copy">@Piranha.Resources.Page.CreateCopy</a></li> </ul> <a class="close-btn right" data-id="boxTemplates"></a> <div class="clear"></div> </div> <div id="create-new" class="inner"> <div id="page-templates"> @foreach (var template in Model.Templates.Where(t => !t.IsBlock)) { <div class="templates @(Model.Templates.Count > 6 ? "compressed" : (Model.Templates.Count == 1 ? "one" : "")) left" data-templateid="@template.Id"> <h3>@template.Name</h3> <div class="preview"> @template.Preview </div> <p>@template.Description</p> </div> } </div> <div class="clear"></div> @if (Model.Templates.Where(t => t.IsBlock).Count() > 0) { <div id="block-templates"> <h4 id="block-header" style="font-weight:bold;border-bottom: solid 1px #ddd;padding:0 0 5px 15px">Blocks</h4> @foreach (var template in Model.Templates.Where(t => t.IsBlock)) { <div class="templates @(Model.Templates.Count > 6 ? "compressed" : (Model.Templates.Count == 1 ? "one" : "")) left" data-templateid="@template.Id"> <h3>@template.Name</h3> <div class="preview"> @template.Preview </div> <p>@template.Description</p> </div> } </div> <div class="clear"></div> } </div> <div id="create-copy" class="inner hidden" style="width:660px;max-height:460px;overflow:scroll;"> <ul class="form" style="position:fixed;width:645px"> <li><label>Search</label> <div class="input"><input type="text" id="page-search" /></div> </li> </ul> <table class="list" id="page-list" style="margin-top:34px;"> <thead> <tr> <th><span class="sort asc" data-sort="copypage-title">@Piranha.Resources.Global.Title</span></th> <th><span class="sort" data-sort="copypage-template">@Piranha.Resources.Global.Type</span></th> <th><span class="sort" data-sort="copypage-siteid">Site tree</span></th> </tr> </thead> <tbody class="copy-list-js"> @foreach (var page in Model.AllPages) { <tr> <td class="copypage-title"><a class="copy-page" data-id="@page.Id" href="#"> @(!String.IsNullOrEmpty(page.NavigationTitle) ? page.NavigationTitle : page.Title)</a></td> <td class="copypage-template">@page.TemplateName</td> <td class="copypage-siteid">@page.SiteTreeName</td> </tr> } </tbody> </table> </div> </div> </div> }
the_stack
@using Orchard.Utility.Extensions; @model Orchard.Taxonomies.ViewModels.LocalizedTaxonomiesViewModel @{ Script.Require("jQuery"); var Taxonomyprefix = ((ViewData)).TemplateInfo.HtmlFieldPrefix.Replace('.', '_'); using (Script.Foot()) { <script type="text/javascript"> //<![CDATA[ $(document).ready(function () { var pageurl = '@Url.Action("GetTaxonomy", "LocalizedTaxonomy", new { area = "Orchard.Taxonomies" })'; function filterTaxonomyCulture(culture) { $.ajax({ url: pageurl, data: { contentTypeName: '@Model.ContentType', taxonomyFieldName: '@Model.FieldName', contentId: @Model.Id, culture: culture }, success: function (html) { $(".taxonomy-wrapper[data-id-prefix='@Taxonomyprefix']").replaceWith(html); $(".taxonomy-wrapper[data-id-prefix='@Taxonomyprefix'] legend").expandoControl(function (controller) { return controller.nextAll(".expando"); }, { collapse: true, remember: false }); @if (Model.Setting.Autocomplete) { <text> var createTermCheckbox = function($wrapper, tag, checked) { var $ul = $("ul.terms", $wrapper); var singleChoice = $(".terms-editor", $wrapper).data("singlechoice"); var namePrefix = $wrapper.data("name-prefix"); var idPrefix = $wrapper.data("id-prefix"); var nextIndex = $("li", $ul).length; var id = isNaN(tag.value) ? -nextIndex : tag.value; var checkboxId = idPrefix + "_Terms_" + nextIndex + "__IsChecked"; var checkboxName = namePrefix + ".Terms[" + nextIndex + "].IsChecked"; var radioName = namePrefix + ".SingleTermId"; var checkboxHtml = "<input type=\"checkbox\" value=\"" + (checked ? "true\" checked=\"checked\"" : "false") + " data-term=\"" + tag.label + "\" data-term-identity=\"" + tag.label.toLowerCase() + "\" id=\"" + checkboxId + "\" name=\"" + checkboxName + "\" />"; var radioHtml = "<input type=\"radio\" value=\"" + id + (checked ? "\" checked=\"checked\"" : "\"") + " data-term=\"" + tag.label + "\" data-term-identity=\"" + tag.label.toLowerCase() + "\" id=\"" + checkboxId + "\" name=\"" + radioName + "\" />"; var inputHtml = singleChoice ? radioHtml : checkboxHtml; var $li = $("<li>" + inputHtml + "<input type=\"hidden\" value=\"" + id + "\" id=\"" + idPrefix + "_Terms_" + nextIndex + "__Id" + "\" name=\"" + namePrefix + ".Terms[" + nextIndex + "].Id" + "\" />" + "<input type=\"hidden\" value=\"" + tag.label + "\" id=\"" + idPrefix + "_Terms_" + nextIndex + "__Name" + "\" name=\"" + namePrefix + ".Terms[" + nextIndex + "].Name" + "\" />" + "<label class=\"forcheckbox\" for=\"" + checkboxId + "\">" + tag.label + "</label>" + "</li>").hide(); if (checked && singleChoice) { $("input[type='radio']", $ul).removeAttr("checked"); $("input[type='radio'][name$='IsChecked']", $ul).val("false"); } $ul.append($li); $li.fadeIn(); }; /* Event handlers **********************************************************************/ var onTagsChanged = function(tagLabelOrValue, action, tag) { if (tagLabelOrValue == null) return; var $input = this.appendTo; var $wrapper = $input.parents("fieldset:first"); var $tagIt = $("ul.tagit", $wrapper); var singleChoice = $(".terms-editor", $wrapper).data("singlechoice"); var $terms = $("ul.terms", $wrapper); var initialTags = $(".terms-editor", $wrapper).data("selected-terms"); if (singleChoice && action == "added") { $tagIt.tagit("fill", tag); } $terms.empty(); var tags = $tagIt.tagit("tags"); $(tags).each(function(index, tag) { createTermCheckbox($wrapper, tag, true); }); // Add any tags that are no longer selected but were initially on page load. // These are required to be posted back so they can be removed. var removedTags = $.grep(initialTags, function(initialTag) { return $.grep(tags, function(tag) { return tag.value === initialTag.value }).length === 0 }); $(removedTags).each(function(index, tag) { createTermCheckbox($wrapper, tag, false); }); $(".no-terms", $wrapper).hide(); }; var renderAutocompleteItem = function(ul, item) { var label = item.label; for (var i = 0; i < item.levels; i++) { label = "<span class=\"gap\">&nbsp;</span>" + label; } var li = item.disabled ? "<li class=\"disabled\"></li>" : "<li></li>"; return $(li) .data("item.autocomplete", item) .append($("<a></a>").html(label)) .appendTo(ul); }; /* Initialization **********************************************************************/ $(".terms-editor").each(function() { var selectedTerms = $(this).data("selected-terms"); var autocompleteUrl = $(this).data("autocomplete-url"); var $tagit = $("> ul", this).tagit({ tagSource: function(request, response) { var termsEditor = $(this.element).parents(".terms-editor"); $.getJSON(autocompleteUrl, { taxonomyId: termsEditor.data("taxonomy-id"), leavesOnly: termsEditor.data("leaves-only"), query: request.term }, function(data, status, xhr) { response(data); }); }, initialTags: selectedTerms, triggerKeys: ['enter', 'tab'], // default is ['enter', 'space', 'comma', 'tab'] but we remove comma and space to allow them in the terms allowNewTags: $(this).data("allow-new-terms"), tagsChanged: onTagsChanged, caseSensitive: false, minLength: 0, sortable: true }).data("ui-tagit"); $tagit.input.autocomplete().data("ui-autocomplete")._renderItem = renderAutocompleteItem; $tagit.input.autocomplete().on("autocompletefocus", function(event, ui) { event.preventDefault(); }); }); </text> } /////////////////////////// } }).fail(function () { alert("@T("Loading taxonomy fail, Retry")"); }); } $("#Localization_SelectedCulture").on('change', function () { var optionSelected = $("option:selected", this); filterTaxonomyCulture($("#Localization_SelectedCulture").val()); }); $("#Localization_SelectedCulture").trigger("change"); }); //]]> </script> } }
the_stack
@******************************************************************************************************* // PagedViewModel.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 - J. Ritchie Carroll // Generated original version of source code. // //*****************************************************************************************************@ @using System.Net.Http @using System.Text @using GSF @using GSF.Web @using GSF.Web.Model @using GSF.Web.Shared @inherits ExtendedTemplateBase @{ // ReSharper disable NotResolvedInText DataContext dataContext = ViewBag.DataContext; string resourcesRoot = Url.Content("~" + Resources.Root); if (dataContext == null) { throw new ArgumentNullException("ViewBag.DataContext", "DataContext was not defined in ViewBag, cannot render PagedViewModel"); } if (ViewBag.HeaderColumns == null) { throw new ArgumentNullException("ViewBag.HeaderColumns", "HeaderColumns was not defined in ViewBag, cannot render PagedViewModel"); } if (ViewBag.PageControlScripts == null) { ViewBag.PageControlScripts = new StringBuilder(); } bool includeScripts = true; if (ViewBag.IncludeScripts != null) { includeScripts = (bool)ViewBag.IncludeScripts; } // Setup page control scripts StringBuilder pageControlScripts = ViewBag.PageControlScripts; pageControlScripts.AppendFormat(@" <script> $(""#titleText"").html(""{0}: <span data-bind='text: recordCount'>calculating...</span>""); </script> ", ViewBag.RecordsTitle ?? "Records" ); if (includeScripts) { pageControlScripts.AppendFormat(@" <script src=""{0}/Shared/Scripts/knockout.js""></script> <script src=""{0}/Shared/Scripts/knockout.mapping.js""></script> <script src=""{0}/Shared/Scripts/knockout.validation.js""></script> <script src=""{0}/Shared/Scripts/knockout.reactor.js?ver=1.4.2""></script> <script src=""{0}/Shared/Scripts/knockout.observableDictionary.js""></script> <script src=""{0}/Shared/Scripts/js.cookie.js""></script> <script src=""{0}/Shared/Scripts/gsf.web.knockout.js""></script> <script src=""{0}/Model/Scripts/bootstrap-toolkit.js""></script> <script src=""{0}/Model/Scripts/bootstrap-datepicker.js""></script> <script src=""{0}/Model/Scripts/pagedViewModel.js""></script> ", resourcesRoot); } pageControlScripts.Append(@" <script> $(function() { $(""#clearSortOrder"").click(function() { viewModel.updateSortOrder(viewModel.defaultSortField, viewModel.defaultSortAscending); }); "); // Check for optional page behaviors // Hide the add new button bool hideAddNewButton = ViewBag.HideAddNewButton ?? false; // Hide export to CSV button bool hideExportCSVButton = ViewBag.HideExportCSVButton ?? false; // Define label for export CSV button string exportCSVLabel = (ViewBag.ExportCSVLabel ?? "Export&nbsp;CSV").Replace(" ", "&nbsp;"); // Hide unauthorized controls as disallowed by Edit/AddNew/Delete roles - otherwise unauthorized controls will be disabled bool hideUnauthorizedControls = ViewBag.HideUnauthorizedControls ?? false; bool hidePaginationButtons = ViewBag.HidePaginationButtons ?? false; HttpRequestMessage request = ViewBag.Request; string baseURL = request.RequestUri.AbsolutePath; // Auto pop-up add new dialog string routeID = ViewBag.RouteID; bool autoShowAddNew = routeID.ToNonNullString().Equals("AddNew", StringComparison.OrdinalIgnoreCase); bool showIsDeletedToggleLink = false; bool showingDeletedRecords = false; // Check for existence of ShowDeleted property to control toggle link visibility if (ViewBag.ShowDeleted != null) { showIsDeletedToggleLink = true; showingDeletedRecords = Convert.ToBoolean(ViewBag.ShowDeleted); } // Get current allowed create / update / delete states for user - default to none. // Note that overriding view bag settings will only affect UI, back end security // will still be applicable bool canEdit = ViewBag.CanEdit ?? false; bool canAddNew = ViewBag.CanAddNew ?? false; bool canDelete = ViewBag.CanDelete ?? false; // Check if search filter should be enabled for page bool showSearchFilter = ViewBag.ShowSearchFilter ?? false; // Allow custom foreach bindings for page records string pageRecordsForEachBinding = ""; if (ViewBag.PageRecordsForEachBinding != null) { pageRecordsForEachBinding = ", " + ViewBag.PageRecordsForEachBinding; } } @functions { string RemoveSpaces(string value) { return value.RemoveWhiteSpace().RemoveInvalidFileNameCharacters(); } string RenderSortScript(string fieldName, bool ascending) { const string ScriptFormat = @" $(""#sort{0} #{1}"").click(function() {{ viewModel.updateSortOrder(""{0}"", {2}); }}); "; return string.Format(ScriptFormat, fieldName, ascending ? "asc" : "desc", ascending.ToString().ToLower()); } } @helper WriteFieldHeader(StringBuilder pageControlScripts, string fieldName, string labelName = null, string classes = null) { if (string.IsNullOrEmpty(fieldName)) { <th class="@Raw(classes ?? "text-center")" nowrap>@Raw(labelName ?? "")</th> } else { <th class="@Raw(classes ?? "text-center")" id="sort@(fieldName)" nowrap>@Raw(labelName ?? fieldName)&nbsp; <div class="btn-group-vertical btn-group-sort"> <button type="button" class="btn" id="asc" title="Sort&nbsp;ascending..." data-bind="css: {'btn-primary': isSortOrder('@fieldName', true)}, enable: dataHubIsConnected"><span class="glyphicon glyphicon-chevron-up"></span></button> <button type="button" class="btn" id="desc" title="Sort&nbsp;descending..." data-bind="css: {'btn-primary': isSortOrder('@fieldName', false)}, enable: dataHubIsConnected"><span class="glyphicon glyphicon-chevron-down"></span></button> </div> </th> pageControlScripts.Append(RenderSortScript(fieldName, true)); pageControlScripts.Append(RenderSortScript(fieldName, false)); } } @helper SearchFilter() { @* Make sure to use single quotes in this function: *@ <div class='form-group' style='margin: 0'> <div class='right-inner-addon'> <i class='glyphicon glyphicon-search'></i> <input class='form-control' type='search' id='searchFilter' placeholder='Search' /> </div> </div> } @if (showSearchFilter) { <div style="display: none" search-header></div> } <div class="well well-dynamic-content" id="contentWell" content-fill-height> <div class="table-responsive" id="responsiveTableDiv"> <table class="table table-condensed table-hover" id="recordsTable"> <thead> <tr> @foreach (string[] headerColumn in ViewBag.HeaderColumns) { @WriteFieldHeader(pageControlScripts, headerColumn[0], headerColumn[1], headerColumn[2]) } <th class="text-center"> <button type="button" class="btn btn-link btn-xs" style="line-height: 1.1" id="clearSortOrder" data-bind="enable: dataHubIsConnected">Clear<br />Sort</button> </th> </tr> </thead> <tbody data-bind="foreach: {data: pageRecords@(Raw(pageRecordsForEachBinding))}"> <tr style="visibility: hidden" id="recordRow"@Raw(ViewBag.ShowDeleted ?? false ? string.Format(" data-bind=\"css: {{'danger': {0}}}\"", ViewBag.IsDeletedField) : "")> @Raw(ViewBag.BodyRows) </tr> </tbody> </table> <div id="loadingDataLabel"> Loading&nbsp;&nbsp;<span class="glyphicon glyphicon-refresh glyphicon-spin"></span> </div> </div> <div class="pull-right" id="pageControlsRow"> @if (!hideExportCSVButton || (!hideAddNewButton && (canAddNew || !hideUnauthorizedControls))) { if (!hideAddNewButton && (canAddNew || !hideUnauthorizedControls)) { <button type="button" class="btn btn-sm btn-primary pull-right" id="addRecordButton" @Raw(canAddNew ? "data-bind=\"enable: dataHubIsConnected\"" : "disabled")> <span class="glyphicon glyphicon-plus"></span>&nbsp;&nbsp;Add&nbsp;New </button> } if (!hideExportCSVButton) { <span class="pull-right">&nbsp;</span> <a role="button" class="btn btn-sm btn-default pull-right" id="exportCSVButton" hub-dependent> <span class="glyphicon glyphicon-download"></span>&nbsp;&nbsp;@Raw(exportCSVLabel) </a> <a id="exportCSVLink" download hidden></a> } <br /> <hr class="half-break" /> } @if (!hidePaginationButtons) { <div class="btn-group btn-group-sm"> <button type="button" class="btn btn-default" id="firstPageButton" data-bind="css: {'disabled': onFirstPage()}, enable: dataHubIsConnected() && !onFirstPage()"><span class="glyphicon glyphicon-backward"></span></button> <button type="button" class="btn btn-default" id="previousPageButton" data-bind="css: {'disabled': onFirstPage()}, enable: dataHubIsConnected() && !onFirstPage()"><span class="glyphicon glyphicon-triangle-left"></span></button> </div> <input type="number" class="content input-sm" style="padding: 0 0 0 5px; width: 55px" id="selectedPage" data-bind="numeric, textInput: currentPage, enable: dataHubIsConnected" value="1"> <span>&nbsp;of&nbsp;</span> <span data-bind="text: totalPages">1</span> <span>&nbsp;</span> <div class="btn-group btn-group-sm"> <button type="button" class="btn btn-default" id="nextPageButton" data-bind="css: {'disabled': onLastPage()}, enable: dataHubIsConnected() && !onLastPage()"><span class="glyphicon glyphicon-triangle-right"></span></button> <button type="button" class="btn btn-default" id="lastPageButton" data-bind="css: {'disabled': onLastPage()}, enable: dataHubIsConnected() && !onLastPage()"><span class="glyphicon glyphicon-forward"></span></button> </div> } </div> </div> <div id="addNewEditDialog" class="modal fade" role="dialog"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header" data-bind="css: {'modal-readonly': recordMode()===RecordMode.View}"> <button type="button" class="close" id="dismissDialogButton">&times;</button> <h4 class="modal-title"> <span data-bind="visible: recordMode()===RecordMode.View">View</span> <span data-bind="visible: recordMode()===RecordMode.Edit">Edit</span> <span data-bind="visible: recordMode()===RecordMode.AddNew">Add New</span> @(ViewBag.AddNewEditTitle ?? GSF.StringExtensions.ToSingular(ViewBag.Title ?? "")) </h4> </div> <div class="modal-body auto-height" data-bind="with: currentRecord, validationOptions: {messageTemplate: 'validationMessageTemplate'}, css: {'modal-readonly': recordMode()===RecordMode.View}"> <form role="form"> @Raw(ViewBag.AddNewEditDialog) </form> </div> <div class="modal-footer" data-bind="css: {'modal-readonly': recordMode()===RecordMode.View}"> <em data-bind="visible: unassignedFieldCount() > 0 || validationErrors() > 0"> <span data-bind="visible: unassignedFieldCount() > 0">Missing <span data-bind="text: unassignedFieldCount"></span> required field<span data-bind="visible: unassignedFieldCount() > 1">s</span></span> <span data-bind="visible: unassignedFieldCount() > 0 && validationErrors() > 0"> and </span> <span data-bind="visible: validationErrors() > 0"><span data-bind="text: validationErrors()"></span> validation error<span data-bind="visible: validationErrors() > 1">s</span></span> ... </em> @if (canEdit || !hideUnauthorizedControls) { <button type="button" class="btn btn-info" data-bind="visible: recordMode()===RecordMode.View@(Raw(canEdit ? ", enable: dataHubIsConnected" : ""))" id="editRecordButton"@Raw(canEdit ? "" : " disabled")>Edit</button> } @if (canEdit || canAddNew || !hideUnauthorizedControls) { <button type="submit" class="btn btn-primary" data-dismiss="modal" data-bind="visible: recordMode()!==RecordMode.View@(Raw(canEdit || canAddNew ? ", disable: unassignedFieldCount() > 0 || validationErrors() > 0 || !dataHubIsConnected()" : ""))" id="saveRecordButton"@Raw(canEdit || canAddNew ? "" : " disabled")>Save</button> } <button type="button" class="btn btn-default" id="cancelRecordButton">Cancel</button> </div> </div> </div> </div> @{ if (autoShowAddNew) { pageControlScripts.Append(@" // Add new pop-up requested via URL parameter setTimeout(viewModel.addPageRecord, 250); "); } if (showIsDeletedToggleLink) { if (showingDeletedRecords) { pageControlScripts.AppendFormat(@" $(""#titleText"").append(""<br/><div style='margin-top: 3px' class='small text-center'><a href='{0}'>Hide Deleted</a></div>""); ", baseURL); } else { pageControlScripts.AppendFormat(@" $(""#titleText"").append(""<br/><div style='margin-top: 3px' class='small text-center'><a href='{0}?ShowDeleted'>Show Deleted</a></div>""); ", baseURL); } } if (showSearchFilter) { pageControlScripts.AppendFormat(@" $(""#pageHeader"").append(""{0}""); var searchFilterTimeout = null; $(""#searchFilter"").on(""keyup"", function (e) {{ const searchText = $(""#searchFilter"").val(); if(searchFilterTimeout != null) clearTimeout(searchFilterTimeout); searchFilterTimeout = setTimeout(function(){{ searchFilterTimeout = null; if (searchText.length === 0) {{ viewModel.filterText = """"; viewModel.queryPageRecords(); }} else {{ viewModel.filterText = searchText; viewModel.queryPageRecords(); }} }}, 500); }}); ", Raw(SearchFilter().ToString().RemoveDuplicateWhiteSpace().Replace("\r\n", ""))); } pageControlScripts.AppendFormat(@" $(""#addRecordButton"").click(function() {{ viewModel.addPageRecord(); }}); $(""#editRecordButton"").click(function() {{ viewModel.recordMode(RecordMode.Edit); }}); $(""#saveRecordButton"").click(function() {{ viewModel.savePageRecord(); }}); $(""#cancelRecordButton"").click(function() {{ viewModel.cancelPageRecord(); }}); $(""#dismissDialogButton"").click(function() {{ viewModel.cancelPageRecord(); }}); $(""#addNewEditDialog"").modal({{show: false, backdrop: ""static"", keyboard: false}}); $(""#exportCSVButton"").click(function() {{ if (!hubIsConnected) return; dataHub.getConnectionID().done(function(connectionID) {{ $(""#exportCSVLink"").attr(""href"", ""{0}/Model/Handlers/CsvDownloadHandler.ashx"" + ""?ModelName="" + encodeURIComponent(viewModel.modelName) + ""&HubName="" + encodeURIComponent(viewModel.hubName) + ""&ConnectionID="" + encodeURIComponent(connectionID) + ""&FilterText="" + encodeURIComponent(viewModel.filterText) + ""&SortField="" + encodeURIComponent(viewModel.sortField()) + ""&SortAscending="" + encodeURIComponent(viewModel.sortAscending()) + ""&ShowDeleted={1}&ParentKeys={2}""); $(""#exportCSVLink"")[0].click(); }}). fail(function(error) {{ showErrorMessage(error); }}); }}); $(window).on(""beforeunload"", function() {{ if ($(""#addNewEditDialog"").hasClass(""in"") && viewModel.isDirty()) return ""There are unsaved changes to this record.""; return undefined; }}); }}); ", resourcesRoot, ViewBag.ShowDeleted ?? false, WebExtensions.UrlEncode((ViewBag.ParentKeys ?? "").ToString()) ); pageControlScripts.AppendFormat(@" viewModel.canEdit({0}); viewModel.canAddNew({1}); viewModel.canDelete({2}); viewModel.initialFocusField = ""{3}""; viewModel.pageName = ""{4}"";", canEdit.ToString().ToLower(), canAddNew.ToString().ToLower(), canDelete.ToString().ToLower(), dataContext.InitialFocusField, RemoveSpaces(ViewBag.Title) ); if (dataContext.FieldValueInitializers.Count > 0) { pageControlScripts.AppendFormat(@" $(viewModel).on(""newRecord"", function(event, newRecord) {{ // Set initial field values"); foreach (Tuple<string, string> initialValueScript in dataContext.FieldValueInitializers) { pageControlScripts.AppendFormat("\r\n newRecord.{0} = {1};", initialValueScript.Item1, initialValueScript.Item2); } pageControlScripts.Append("\r\n });"); } if (dataContext.DefinedDateFields.Count > 0) { pageControlScripts.AppendFormat(@" $(viewModel).on(""beforeEdit"", function(event, observableRecord) {{ // Convert date objects to strings"); foreach (string dateField in dataContext.DefinedDateFields) { pageControlScripts.AppendFormat("\r\n observableRecord.{0}(notNull(observableRecord.{0}()).formatDate(DateFormat));", dateField); } pageControlScripts.Append("\r\n });"); pageControlScripts.AppendFormat(@" $(viewModel).on(""beforeSave"", function(event, observableRecord) {{ // Convert date strings back to date objects before serialization"); foreach (string dateField in dataContext.DefinedDateFields) { pageControlScripts.AppendFormat("\r\n observableRecord.{0}(observableRecord.{0}().toDate());", dateField); } pageControlScripts.Append("\r\n });"); } if (dataContext.FieldValidationParameters.Count > 0) { pageControlScripts.Append("\r\n\r\n viewModel.setApplyValidationParameters(function() {"); foreach (KeyValuePair<string, Tuple<string, string>> fieldValidation in dataContext.FieldValidationParameters) { pageControlScripts.AppendFormat("\r\n {0}.extend({{ pattern: {{ message: \"{1}\", params: \"{2}\" }} }});", fieldValidation.Key, fieldValidation.Value.Item2.JavaScriptEncode(), fieldValidation.Value.Item1.JavaScriptEncode()); } pageControlScripts.Append("\r\n });"); } pageControlScripts.Append(@" $(""#addNewEditDialog"").on(""shown.bs.modal"", function() { $(""#addNewEditDialog .input-group.date"").datepicker({ todayBtn: ""linked"", enableOnReadonly: false, autoclose: true });"); if (dataContext.ReadonlyHotLinkFields.Count > 0) { foreach (Tuple<string, string, string, bool> readonlyHotLinkField in dataContext.ReadonlyHotLinkFields) { pageControlScripts.AppendLine(); if (readonlyHotLinkField.Item4) { pageControlScripts.AppendFormat("\r\n $(\"#{0}\").after(\"<div id=\\\"{1}\\\" tabindex=\\\"0\\\" class=\\\"form-control readonly textarea\\\" data-bind=\\\"html: renderHotLinks(notNull({2}())), visible: viewModel.recordMode()===RecordMode.View\\\"></div>\");", readonlyHotLinkField.Item1, readonlyHotLinkField.Item2, readonlyHotLinkField.Item3); pageControlScripts.AppendFormat("\r\n $(\"#{0}\").height($(\"#{1}\").height());", readonlyHotLinkField.Item2, readonlyHotLinkField.Item1); } else { pageControlScripts.AppendFormat("\r\n $(\"#{0}\").after(\"<div id=\\\"{1}\\\" tabindex=\\\"0\\\" class=\\\"form-control readonly inputtext\\\" data-bind=\\\"html: renderHotLinks(notNull({2}())), visible: viewModel.recordMode()===RecordMode.View\\\"></div>\");", readonlyHotLinkField.Item1, readonlyHotLinkField.Item2, readonlyHotLinkField.Item3); } pageControlScripts.AppendFormat("\r\n ko.applyBindings(viewModel.currentRecord, $(\"#{0}\")[0]);", readonlyHotLinkField.Item2); } } pageControlScripts.Append("\r\n });"); pageControlScripts.Append(@" </script>"); }
the_stack
@model SmartAdmin.Domain.Models.RoleMenu @{ ViewData["Title"] = "角色授权"; ViewData["PageName"] = "rolemenus_index"; ViewData["Heading"] = "<i class='fal fa-users text-primary'></i> 角色授权"; ViewData["Category1"] = "系统管理"; ViewData["PageDescription"] = ""; } @section HeadBlock { <link href="~/js/easyui/themes/insdep/easyui.css" rel="stylesheet" asp-append-version="true" /> } <div class="row"> <div class="col-md-3"> <div class="card border m-auto m-lg-0"> <div class="card-header bg-trans-gradient py-2 pr-2 d-flex align-items-center flex-wrap"> <!-- we wrap header title inside a span tag with utility padding --> <div class="card-title text-white">角色</div> </div> <ul class="list-group list-group-flush "> @foreach (var item in ViewBag.Roles) { <li class="list-group-item d-flex justify-content-between align-items-center"> <div class="mr-auto align-self-center">@item.RoleName</div> <div class="mr-3 mb-3 align-self-center"><span class="badge badge-icon badge-pill">@item.Count</span></div> </li> } </ul> </div> </div> <div class="col-md-9"> <div class="card border m-auto m-lg-0"> <div class="card-header bg-trans-gradient py-2 pr-2 d-flex align-items-center flex-wrap"> <!-- we wrap header title inside a span tag with utility padding --> <div class="card-title text-white">角色</div> <button id="savebutton" class="btn btn-sm btn-primary ml-auto waves-effect waves-themed"> <span class="fal fa-save mr-1"></span> 保存 </button> </div> <div class="card-body enable-loader"> <div class="loader"><i class="fal fa-spinner-third fa-spin-4x fs-xxl"></i></div> <div class="table-responsive"> <table id="menu-tree" style="width:auto;height:auto"> </table> </div> </div> </div> </div> </div> @section ScriptsBlock { <script src="~/js/dependency/moment/moment.js" asp-append-version="true"></script> <script src="~/js/easyui/jquery.easyui.min.js" asp-append-version="true"></script> <script src="~/js/easyui/locale/easyui-lang-zh_CN.js" asp-append-version="true"></script> <script src="~/js/plugin/jquery.serializejson/jquery.serializejson.js" asp-append-version="true"></script> <script type="text/javascript"> //上传导入参数设定 var selectedrole = {}; function formatcreatecheckbox(val, row) { var disabled = row.Url == "#" ? 'disabled ' : ''; var checked = val == true && row.Url != "#" ? 'checked ' : ''; return "<input type=\"checkbox\" name=\"op\" value=" + val + " " + checked + disabled + " onClick=ckClick(" + JSON.stringify(row) + ",'create',this) >"; } function formateditcheckbox(val, row) { var disabled = row.Url == "#" ? 'disabled ' : ''; var checked = val == true && row.Url != "#" ? 'checked' : ''; return "<input type=\"checkbox\" name=\"op\" value=" + val + " " + checked + disabled + " onClick=ckClick(" + JSON.stringify(row) + ",'edit',this) >"; } function formatimportcheckbox(val, row) { var disabled = row.Url == "#" ? 'disabled ' : ''; var checked = val == true && row.Url != "#" ? 'checked' : ''; return "<input type=\"checkbox\" name=\"op\" value=" + val + " " + checked + disabled + " onClick=ckClick(" + JSON.stringify(row) + ",'import',this) >"; } function formatdeletecheckbox(val, row) { var disabled = row.Url == "#" ? 'disabled ' : ''; var checked = val == true && row.Url != '#' ? 'checked' : ''; return "<input type=\"checkbox\" name=\"op\" value=" + val + " " + checked + disabled + " onClick=ckClick(" + JSON.stringify(row) + ",'delete',this) >"; } function formatexportcheckbox(val, row) { var disabled = row.Url == "#" ? 'disabled ' : ''; var checked = val == true && row.Url != '#' ? 'checked' : ''; return "<input type=\"checkbox\" name=\"op\" value=" + val + " " + checked + disabled + " onClick=ckClick(" + JSON.stringify(row) + ",'export',this) >"; } function formatpoint1checkbox(val, row) { var disabled = row.Url == "#" ? 'disabled ' : ''; var checked = val == true && row.Url != '#' ? 'checked' : ''; return "<input type=\"checkbox\" name=\"op\" value=" + val + " " + checked + disabled + " onClick=ckClick(" + JSON.stringify(row) + ",'point1',this) >"; } function formatpoint2checkbox(val, row) { var disabled = row.Url == "#" ? 'disabled ' : ''; var checked = val == true && row.Url != '#' ? 'checked' : ''; return "<input type=\"checkbox\" name=\"op\" value=" + val + " " + checked + disabled + " onClick=ckClick(" + JSON.stringify(row) + ",'point2',this) >"; } function formatpoint3checkbox(val, row) { var disabled = row.Url == "#" ? 'disabled ' : ''; var checked = val == true && row.Url != '#' ? 'checked' : ''; return "<input type=\"checkbox\" name=\"op\" value=" + val + " " + checked + disabled + " onClick=ckClick(" + JSON.stringify(row) + ",'point3',this) >"; } function ckClick(row, name, element) { if (name == 'create') { $('#menu-tree').treegrid('update', { id: row.Id, row: { Create: element.checked, } }); } if (name == 'edit') { $('#menu-tree').treegrid('update', { id: row.Id, row: { Edit: element.checked, } }); } if (name == 'delete') { $('#menu-tree').treegrid('update', { id: row.Id, row: { Delete: element.checked, } }); } if (name == 'import') { $('#menu-tree').treegrid('update', { id: row.Id, row: { Import: element.checked, } }); } if (name == 'export') { $('#menu-tree').treegrid('update', { id: row.Id, row: { Export: element.checked, } }); } if (name == 'point1') { $('#menu-tree').treegrid('update', { id: row.Id, row: { FunctionPoint1: element.checked, } }); } if (name == 'point2') { $('#menu-tree').treegrid('update', { id: row.Id, row: { FunctionPoint2: element.checked, } }); } if (name == 'point3') { $('#menu-tree').treegrid('update', { id: row.Id, row: { FunctionPoint3: element.checked, } }); } } function onUnselect(row) { var data = $('#menu-tree').treegrid('getChildren', row.Id); $.each(data, function (index, row) { $('#menu-tree').treegrid('unselect', row.Id); }) } function onSelect(row) { var data = $('#menu-tree').treegrid('getChildren', row.Id); $.each(data, function (index, row) { $('#menu-tree').treegrid('select', row.Id); }) //var parent = $('#menu-tree').treegrid('getParent', row.Id); //var selections = $('#menu-tree').treegrid('getSelections'); //$('#menu-tree').treegrid('select', parent.Id); } $(function () { $('#savebutton').attr('disabled', true); $('#menu-tree').treegrid( { iconCls: 'icon-ok', rownumbers: true, animate: true, singleSelect: false, fitColumns: true, url: '/RoleMenus/GetMenuList', method: 'get', idField: 'Id', treeField: 'Title', pagination: false, checkOnSelect: true, onSelect: onSelect, onUnselect: onUnselect, onBeforeLoad: function () { $('.enable-loader').removeClass('enable-loader') }, columns: [[ { field: 'ck', checkbox: true }, { field: 'Title', width: 180, title: '菜单名称' }, { field: 'Code', width: 80, title: '序号' }, { field: 'Url', width: 120, title: 'Url' } , { field: 'Create', width: 70, title: '新增', formatter: formatcreatecheckbox }, { field: 'Edit', width: 70, title: '编辑', formatter: formateditcheckbox }, { field: 'Delete', width: 70, title: '删除', formatter: formatdeletecheckbox } , { field: 'Import', width: 70, title: '导入', formatter: formatimportcheckbox } , { field: 'Export', width: 70, title: '导出', formatter: formatexportcheckbox }, { field: 'FunctionPoint1', width: 70, title: '功能点1', formatter: formatpoint1checkbox }, { field: 'FunctionPoint2', width: 70, title: '功能点2', formatter: formatpoint2checkbox }, { field: 'FunctionPoint3', width: 70, title: '功能点3', formatter: formatpoint3checkbox } ]] } ); $('.list-group-item').click(function () { $('.list-group-item').removeClass('active'); $(this).addClass('active'); $currenitem = $(this); //console.log($currenitem.children("div:eq(0)")); selectedrole = $(this).children("div:eq(0)").text(); $('#savebutton').attr("disabled", false) //console.log($(this).children("span:eq(1)").text()); $('#menu-tree').treegrid('loading') $.get('/RoleMenus/GetMenus', { roleName: selectedrole }, function (data, status, q) { $('#menu-tree').treegrid('uncheckAll'); $.each(data, function (index, item) { $('#savebutton').attr('disabled', false); $('#menu-tree').treegrid('checkRow', item.MenuId); $('#menu-tree').treegrid('update', { id: item.MenuId, row: { Import: item.Import, Create: item.Create, Edit: item.Edit, Delete: item.Delete, Export: item.Export, FunctionPoint1: item.FunctionPoint1, FunctionPoint2: item.FunctionPoint2, FunctionPoint3: item.FunctionPoint3 } }); }) $('#menu-tree').treegrid('loaded') }); }); function save() { var selectednodes = $('#menu-tree').treegrid('getSelections'); var list = []; $.each(selectednodes, function (i, data) { if (selectedrole.length > 0) { var item = { 'RoleName': selectedrole, 'MenuId': data.Id, 'Create': data.Create, 'Edit': data.Edit, 'Delete': data.Delete, 'Import': data.Import, 'Export': data.Export, 'FunctionPoint1': data.FunctionPoint1, 'FunctionPoint2': data.FunctionPoint2, 'FunctionPoint3': data.FunctionPoint3, }; list.push(item); } }); //console.log(list); if (selectedrole.length > 0 && list.length > 0) { $.messager.progress({ title: '请等待', msg: '正在保存数据...' }); $.post('/RoleMenus/Submit', { selectmenus: list }, function (data, status, q) { $.messager.progress('close'); $.messager.alert('提示', '保存成功', 'info', function () { location.reload(); }); }); } else { $.messager.alert('提示', '请选择需要授权的角色'); } } $('#savebutton').click(function () { save(); }) }); </script> }
the_stack
@using Elect.Web.DataTable.Models.Constants @using Elect.Web.DataTable.Utils.DataTableModelUtils @using Elect.Web.IUrlHelperUtils @using Newtonsoft.Json.Linq @model Elect.Web.DataTable.Models.DataTableModel <script type="text/javascript"> $(function() { var $table = $('#@Model.Id'); var $dataTable = null; @{ // Handle Default Values for Options Model.IsDevelopMode = Model.IsDevelopMode ?? false; Model.IsAutoWidthColumn = Model.IsAutoWidthColumn ?? true; Model.IsResponsive = Model.IsResponsive ?? false; Model.IsEnableColVis = Model.IsEnableColVis ?? true; Model.IsSaveState = Model.IsSaveState ?? true; Model.IsScrollX = Model.IsScrollX ?? true; Model.IsEnableColReorder = Model.IsEnableColReorder ?? true; Model.IsShowFooter = Model.IsShowFooter ?? false; Model.IsShowPageSize = Model.IsShowPageSize ?? true; Model.IsShowGlobalSearchInput = Model.IsShowGlobalSearchInput ?? true; Model.IsUseTableTools = Model.IsUseTableTools ?? true; Model.IsHideHeader = Model.IsHideHeader ?? false; Model.IsUseColumnFilter = Model.IsUseColumnFilter ?? true; Model.IsDeferRender = Model.IsDeferRender ?? true; var options = new JObject { [PropertyConstants.Sorting] = new JRaw(Model.GetColumnSortDefine()), [PropertyConstants.IsProcessing] = false, [PropertyConstants.IsServerSide] = true, [PropertyConstants.IsFilter] = Model.IsShowGlobalSearchInput, [PropertyConstants.Dom] = Model.Dom, [PropertyConstants.IsResponsive] = Model.IsResponsive, [PropertyConstants.IsAutoWidth] = Model.IsAutoWidthColumn, [PropertyConstants.AjaxSource] = Model.AjaxUrl, [PropertyConstants.ColumnDefine] = new JRaw(Model.GetColumnDefine()), [PropertyConstants.SearchCols] = Model.GetColumnSearchableDefine(), [PropertyConstants.DeferRender] = Model.IsDeferRender, [PropertyConstants.LengthMenuDefine] = Model.LengthMenu != null ? new JRaw(Model.LengthMenu) : new JRaw(string.Empty), [PropertyConstants.Language] = new JObject { [PropertyConstants.SearchSelector] = "_INPUT_", [PropertyConstants.LengthMenuSelector] = "_MENU_", [PropertyConstants.SearchPlaceholder] = "Search...", [PropertyConstants.LengthMenu] = "Display _MENU_ records", [PropertyConstants.Info] = "Displaying _START_ - _END_ of _TOTAL_ records", [PropertyConstants.InfoEmpty] = "Empty", [PropertyConstants.InfoFiltered] = "(filtered from _MAX_ records)", [PropertyConstants.Paginate] = new JObject { [PropertyConstants.First] = "<<", [PropertyConstants.Previous] = "<", [PropertyConstants.Next] = ">", [PropertyConstants.Last] = ">>", }, }, [PropertyConstants.ScrollX] = Model.IsScrollX == true, // Scroll X when witdh not enough [PropertyConstants.StateSave] = Model.IsSaveState == true, // Save last state [PropertyConstants.ColReorder] = Model.IsEnableColReorder == true, // Enable re-order col }; // Default Size if (Model.PageSize.HasValue) { options[PropertyConstants.DisplayLength] = Model.PageSize; } // Language Code if (!string.IsNullOrWhiteSpace(Model.LanguageCode)) { options[PropertyConstants.LanguageCode] = new JRaw(Model.LanguageCode); } // Draw Call back function if (!string.IsNullOrWhiteSpace(Model.DrawCallbackFunctionName)) { options[PropertyConstants.FnDrawCallback] = new JRaw(Model.DrawCallbackFunctionName); } // Footer Call back function if (!string.IsNullOrWhiteSpace(Model.FooterCallbackFunctionName)) { options[PropertyConstants.FnFooterCallback] = new JRaw(Model.FooterCallbackFunctionName); } // Server Request options[PropertyConstants.FnServerData] = new JRaw( "function(sSource, aoData, fnCallback) { " + (Model.IsDevelopMode == true ? $" console.log('[DataTable {Model.Id}] URL: ', sSource);" : string.Empty) + (Model.IsDevelopMode == true ? $" console.log('[DataTable {Model.Id}] Request: ', aoData);" : string.Empty) + " var ajaxOptions = { 'dataType': 'json', 'type': 'POST', 'url': sSource, 'data': aoData, 'success': fnCallback};" + (Model.IsDevelopMode == true ? "ajaxOptions['success'] = function(data){" + $" console.log('[DataTable {Model.Id}] Response', data);" + " if(fnCallback && typeof fnCallback === 'function'){" + " fnCallback(data)" + " }" + "};" : string.Empty) + ((Model.IsEnableColReorder != true) ? string.Empty : "var currDt = $dataTable || this;" + "aoData.push({name: '" + PropertyConstants.ColReorderIndexs + "',value: currDt.api().colReorder.order()});") + (string.IsNullOrWhiteSpace(Model.BeforeSendFunctionName) ? string.Empty : $"{Model.BeforeSendFunctionName}(aoData);") + (string.IsNullOrWhiteSpace(Model.AjaxErrorHandler) ? string.Empty : "ajaxOptions['error'] = " + Model.AjaxErrorHandler + "; ") + " $.ajax(ajaxOptions);" + "}"); // Tools if (Model.IsUseTableTools == true) { options[PropertyConstants.TableTools] = new JRaw("{ 'sSwfPath': '" + Url.AbsoluteContent("https://cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/swf/copy_csv_xls_pdf.swf") + "' }"); var tools = Model.IsEnableColVis == true ? "{extend: 'colvis', text: 'Columns', clasName: ''}," : string.Empty; //tools += "'copy', 'excel', 'csv', 'pdf', 'print'"; options[PropertyConstants.Buttons] = new JRaw($"[{tools}]"); } // Additional Option if (Model.AdditionalOptions.Any()) { foreach (var jsOption in Model.AdditionalOptions) { options[jsOption.Key] = new JRaw(jsOption.Value); } } } var dataTableOptions = @Html.Raw(options.ToString(Newtonsoft.Json.Formatting.Indented)); // Save State Handle @if (Model.IsSaveState == true) { @: dataTableOptions.stateSaveParams = function(settings, data) { @: data.search.search = ""; @: for (var i = 0; i < data.columns.length; i++) { @: data.columns[i].search.search = ""; @: } @: return true; @: } @: dataTableOptions.stateSaveCallback = function(settings, data) { @: var key = 'Elect.Web.DataTable_' + settings.sInstance; @: var sData = JSON.stringify(data); @: localStorage.setItem(key, sData); @: } @: dataTableOptions.stateLoadCallback = function(settings) { @: var key = 'Elect.Web.DataTable_' + settings.sInstance; @: var sData = localStorage.getItem(key); @: var data = JSON.parse(sData); @: return data; @: } } // Draw Call back function dataTableOptions.fnDrawCallback = function(oSettings) { // Logic before run custom method @if (!string.IsNullOrWhiteSpace(Model.DrawCallbackFunctionName)) { <text> var fn = window['@Model.DrawCallbackFunctionName']; if (typeof fn === 'function') { fn(oSettings); } </text> } } // Re-order @if (Model.IsEnableColReorder == true) { <text> dataTableOptions.colReorder = { fnReorderCallback: function() { var currDt = $dataTable || this; currDt.api().draw(); } }; </text> } // Init Complete dataTableOptions.initComplete = function(settings, json) { // Logic before run custom method @if (!string.IsNullOrWhiteSpace(Model.InitCompleteFunctionName)) { <text> var fn = window['@Model.InitCompleteFunctionName']; if (typeof fn === 'function') { fn(settings, json); } </text> } }; // Init DataTable $dataTable = $table.dataTable(dataTableOptions); // Col filters @if (Model.IsUseColumnFilter == true) { <text> $dataTable.columnFilter(@Html.Raw(Model.ColumnFilterGlobalConfig)); </text> } // Responsive Resize Callback @if (Model.IsResponsive == true && !string.IsNullOrWhiteSpace(Model.ResponsiveResizeCallbackFunctionName)) { <text> $dataTable.api().on('responsive-resize', function(e, datatable, columns) { var fn = window['@Model.ResponsiveResizeCallbackFunctionName']; if (typeof fn === 'function') { fn(e, datatable, columns); } }); </text> } // Clear State Button Support @if (Model.IsSaveState == true) { <text> $dataTable.api().button().add(0, { action: function(e, dt, button, config) { dt.state.clear(); window.location.reload(); }, text: 'Reset Setting', className: 'btn' }); </text> } // Window Resize Callback window.addEventListener('resize', function(event) { $.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); }); // Get Data $dataTable.getDataAt = function(row, index) { @if (Model.IsEnableColReorder == true) { <text> var colIndexs = $dataTable.api().colReorder.order(); index = colIndexs.indexOf(index); </text> } return row[index]; } // Global Variable @if (!string.IsNullOrWhiteSpace(Model.GlobalJsVariableName)) { <text> window['@Model.GlobalJsVariableName'] = $dataTable; </text> } @if (Model.IsDevelopMode == true) { <text> console.log('[DataTable @Model.Id] Configuration', dataTableOptions); </text> } }); </script>
the_stack
@* Generator : WebPagesHelper *@ @using System.Diagnostics @using System.Web.WebPages.Scope @using System.Web.UI.WebControls @using System.Globalization @using Microsoft.Internal.Web.Utils @functions { private const string DefaultWidth = "300px"; private const string DefaultHeight = "300px"; private static readonly object _mapIdKey = new object(); private static readonly object _mapQuestApiKey = new object(); private static readonly object _bingApiKey = new object(); private static readonly object _yahooApiKey = new object(); public static string MapQuestApiKey { get { return (string)ScopeStorage.CurrentScope[_mapQuestApiKey]; } set { ScopeStorage.CurrentScope[_mapQuestApiKey] = value; } } public static string YahooApiKey { get { return (string)ScopeStorage.CurrentScope[_yahooApiKey]; } set { ScopeStorage.CurrentScope[_yahooApiKey] = value; } } public static string BingApiKey { get { return (string)ScopeStorage.CurrentScope[_bingApiKey]; } set { ScopeStorage.CurrentScope[_bingApiKey] = value; } } // allow for stubbing this static resource in tests private static Func<HttpContextBase> _getCurrentHttpContext = (Func<HttpContextBase>)(() => new HttpContextWrapper(HttpContext.Current)); internal static Func<HttpContextBase> GetCurrentHttpContext { private get { return _getCurrentHttpContext; } set { _getCurrentHttpContext = value; } } private static int MapId { get { var value = (int?)(GetCurrentHttpContext().Items[_mapIdKey]); return value.GetValueOrDefault(); } set { GetCurrentHttpContext().Items[_mapIdKey] = value; } } private static string GetMapElementId() { return "map_" + MapId; } private static string TryParseUnit(string value, string defaultValue) { if (String.IsNullOrEmpty(value)) { return defaultValue; } try { return Unit.Parse(value, CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture); } catch (ArgumentException) { return defaultValue; } } private static IHtmlString RawJS(string text) { return Raw(HttpUtility.JavaScriptStringEncode(text)); } private static IHtmlString Raw(string text) { return new HtmlString(text); } private static string GetApiKey(string apiKey, object scopeStorageKey) { if (apiKey.IsEmpty()) { return (string)ScopeStorage.CurrentScope[scopeStorageKey]; } return apiKey; } public class MapLocation { private readonly string _latitude; private readonly string _longitude; public MapLocation(string latitude, string longitude) { _latitude = latitude; _longitude = longitude; } public string Latitude { get { return _latitude; } } public string Longitude { get { return _longitude; } } } internal static string GetDirectionsQuery(string location, string latitude, string longitude, Func<string, string> encoder = null) { encoder = encoder ?? HttpUtility.UrlEncode; Debug.Assert(!(location.IsEmpty() && latitude.IsEmpty() && longitude.IsEmpty())); if (location.IsEmpty()) { return encoder(latitude + "," + longitude); } return encoder(location); } } @** Summary: Generates Html to display a Map Quest map. Parameter: key: Map Quest API key Parameter location: Address of the location to center the map at Parameter latitude: Latitude to center on. If both latitude and longitude are specified, location is ignored. Parameter longitude: Longitude to center on. If both latitude and longitude are specified, location is ignored. Parameter width: Width of the map with units such as 480px, 100% etc. Defaults to 300px. Parameter height: Height of the map with units such as 480px, 100% etc. Defaults to 300px. Parameter zoom: Initial zoom level of the map. Defaults to 7. Parameter type: Map type to display. Valid values are "map", "sat" or "hyb". Parameter showDirectionsLink: Determines if a link to get directions should be displayed when a location is specified. Defaults to true. Parameter directionsLinkText The text for the get directions link. Defaults to "Get Directions". **@ @helper GetMapQuestHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = "300px", string height = "300px", int zoom = 7, string type = "map", bool showDirectionsLink = true, string directionsLinkText = "Get Directions", bool showZoomControl = true, IEnumerable<MapLocation> pushpins = null) { key = GetApiKey(key, _mapQuestApiKey); if (key.IsEmpty()) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key"); } string mapElement = GetMapElementId(); string loc = "null"; // We want to print the value 'null' in the client if (latitude != null && longitude != null) { loc = String.Format(CultureInfo.InvariantCulture, "{{lat: {0}, lng: {1}}}", HttpUtility.JavaScriptStringEncode(latitude, addDoubleQuotes: false), HttpUtility.JavaScriptStringEncode(longitude, addDoubleQuotes: false)); } // The MapQuest key listed on their website is Url encoded to begin with. <script src="http://mapquestapi.com/sdk/js/v6.0.0/mqa.toolkit.js?key=@key" type="text/javascript"></script> <script type="text/javascript"> MQA.EventUtil.observe(window, 'load', function() { var map = new MQA.TileMap(document.getElementById('@mapElement'), @zoom, @Raw(loc), '@RawJS(type)'); @if (showZoomControl) { <text> MQA.withModule('zoomcontrol3', function() { map.addControl(new MQA.LargeZoomControl3(), new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT)); }); </text> } @if (!String.IsNullOrEmpty(location)) { <text> MQA.withModule('geocoder', function() { map.geocodeAndAddLocations('@RawJS(location)'); }); </text> } @if (pushpins != null) { foreach (var p in pushpins) { @: map.addShape(new MQA.Poi({lat:@RawJS(p.Latitude),lng:@RawJS(p.Longitude)})); } } }); </script> <div id="@mapElement" style="width:@TryParseUnit(width, DefaultWidth); height:@TryParseUnit(height, DefaultHeight);"> </div> if (showDirectionsLink) { <a class="map-link" href="http://www.mapquest.com/?q=@GetDirectionsQuery(location, latitude, longitude)">@directionsLinkText</a> } MapId++; } @** Summary: Generates Html to display Bing map. Parameter: key: Bing Maps application key Parameter location: Address of the location to center the map at Parameter latitude: Latitude to center on. If both latitude and longitude are specified, location is ignored. Parameter longitude: Longitude to center on. If both latitude and longitude are specified, location is ignored. Parameter width: Width of the map with units such as 480px, 100% etc. Defaults to 300px. Parameter height: Height of the map with units such as 480px, 100% etc. Defaults to 300px. Parameter zoom: Initial zoom level of the map. Defaults to 14. Parameter type: Map type to display. Valid values are "auto", "aerial", "birdeye", "road" and "mercator". Parameter useAdaptiveOverlay: Determines if the map overlay that adapts to the colors of the current map view is used. Defaults to true. Parameter showDirectionsLink: Determines if a link to get directions should be displayed when a location is specified. Defaults to true. Parameter directionsLinkText The text for the get directions link. Defaults to "Get Directions". **@ @helper GetBingHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 14, string type = "auto", bool useAdaptiveOverlay = true, bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) { key = GetApiKey(key, _bingApiKey); if (key.IsEmpty()) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key"); } string mapElement = GetMapElementId(); type = (type ?? "auto").ToLowerInvariant(); <script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0" type="text/javascript"></script> <script type="text/javascript"> jQuery(window).load(function() { var map = null; @if (useAdaptiveOverlay) { <text> Microsoft.Maps.loadModule('Microsoft.Maps.Overlays.Style', { callback: function () { map = new Microsoft.Maps.Map(document.getElementById("@mapElement"), { credentials: '@RawJS(key)', mapTypeId: Microsoft.Maps.MapTypeId['@RawJS(type)'], customizeOverlays: true }); </text> } else { <text> map = new Microsoft.Maps.Map(document.getElementById("@mapElement"), { credentials: '@RawJS(key)', mapTypeId: Microsoft.Maps.MapTypeId['@RawJS(type)'] }); </text> } @if (latitude != null && longitude != null) { @: map.setView({zoom: @zoom, center: new Microsoft.Maps.Location(@RawJS(latitude), @RawJS(longitude))}); } else if (location != null) { <text> map.getCredentials(function(credentials) { $.ajax({ url: 'http://dev.virtualearth.net/REST/v1/Locations/' + encodeURI('@RawJS(location)'), type: 'GET', crossDomain: true, data: { output: 'json', key: credentials }, dataType: 'jsonp', jsonp: 'jsonp', success: function(data) { if (data && data.resourceSets && data.resourceSets.length > 0 && data.resourceSets[0].resources && data.resourceSets[0].resources.length > 0) { var r = data.resourceSets[0].resources[0].point.coordinates; var loc = new Microsoft.Maps.Location(r[0], r[1]); map.setView({zoom: @zoom, center: loc}); map.entities.push(new Microsoft.Maps.Pushpin(loc, null)); } } }); }); </text> } @if (pushpins != null) { foreach(var loc in pushpins) { @: map.entities.push(new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(@RawJS(loc.Latitude), @RawJS(loc.Longitude)), null)); } } @if (useAdaptiveOverlay) { <text> } }); </text> } }); </script> <div class="map" id="@mapElement" style="position:relative; width:@TryParseUnit(width, DefaultWidth); height:@TryParseUnit(height, DefaultHeight);"> </div> if (showDirectionsLink) { // Review: Need to figure out if the link needs to be localized. <a class="map-link" href="http://www.bing.com/maps/?v=2&where1=@GetDirectionsQuery(location, latitude, longitude)">@directionsLinkText</a> } MapId++; } @** Summary: Generates Html to display a Google map. Parameter location: Address of the location to center the map at Parameter latitude: Latitude to center on. If both latitude and longitude are specified, location is ignored. Parameter longitude: Longitude to center on. If both latitude and longitude are specified, location is ignored. Parameter width: Width of the map with units such as 480px, 100% etc. Defaults to 300px. Parameter height: Height of the map with units such as 480px, 100% etc. Defaults to 300px. Parameter zoom: Initial zoom level of the map. Defaults to 14. Parameter type: Map type to display. Valid values are "ROADMAP", "HYBRID", "SATELLITE" and "TERRAIN". Parameter showDirectionsLink: Determines if a link to get directions should be displayed when a location is specified. Defaults to true. Parameter directionsLinkText The text for the get directions link. Defaults to "Get Directions". **@ @helper GetGoogleHtml(string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 14, string type = "ROADMAP", bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) { string mapElement = GetMapElementId(); type = (type ?? "ROADMAP").ToUpperInvariant(); // Map types are in upper case // Google maps does not support null centers. We'll set it to arbitrary values if they are null and only the location is provided. // These locations are somewhere around Microsoft's Redmond Campus. latitude = latitude ?? "47.652437"; longitude = longitude ?? "-122.132424"; <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> <script type="text/javascript"> $(function() { var map = new google.maps.Map(document.getElementById("@mapElement"), { zoom: @zoom, center: new google.maps.LatLng(@RawJS(latitude), @RawJS(longitude)), mapTypeId: google.maps.MapTypeId['@RawJS(type)'] }); @if (!String.IsNullOrEmpty(location)) { <text> new google.maps.Geocoder().geocode({address: '@RawJS(location)'}, function(response, status) { if (status === google.maps.GeocoderStatus.OK) { var best = response[0].geometry.location; map.panTo(best); new google.maps.Marker({map : map, position: best }); } }); </text> } @if (pushpins != null) { foreach(var loc in pushpins) { @: new google.maps.Marker({map : map, position: new google.maps.LatLng(@RawJS(loc.Latitude), @RawJS(loc.Longitude))}); } } }); </script> <div class="map" id="@mapElement" style="width:@TryParseUnit(width, DefaultWidth); height:@TryParseUnit(height, DefaultHeight);"> </div> if (showDirectionsLink) { <a class="map-link" href="http://maps.google.com/maps?q=@GetDirectionsQuery(location, latitude, longitude)">@directionsLinkText</a> } MapId++; } @** Summary: Generates Html to display a Yahoo map. Parameter: key: Yahoo application ID Parameter location: Address of the location to center the map at Parameter latitude: Latitude to center on. If both latitude and longitude are specified, location is ignored. Parameter longitude: Longitude to center on. If both latitude and longitude are specified, location is ignored. Parameter width: Width of the map with units such as 480px, 100% etc. Defaults to 300px. Parameter height: Height of the map with units such as 480px, 100% etc. Defaults to 300px. Parameter zoom: Initial zoom level of the map. Defaults to 4. Parameter type: Map type to display. Valid values are "YAHOO_MAP_SAT", "YAHOO_MAP_HYB" and "YAHOO_MAP_REG". Parameter showDirectionsLink: Determines if a link to get directions should be displayed when a location is specified. Defaults to true. Parameter directionsLinkText The text for the get directions link. Defaults to "Get Directions". **@ @helper GetYahooHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 4, string type = "YAHOO_MAP_REG", bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) { key = GetApiKey(key, _yahooApiKey); if (key.IsEmpty()) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key"); } string mapElement = GetMapElementId(); <script src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=@HttpUtility.UrlEncode(key)" type="text/javascript"></script> <script type="text/javascript"> $(function() { var map = new YMap(document.getElementById('@RawJS(mapElement)')); map.addTypeControl(); map.setMapType(@RawJS(type)); @if (latitude != null && longitude != null) { @: map.drawZoomAndCenter(new YGeoPoint(@RawJS(latitude), @RawJS(longitude)), @zoom); } else if (!String.IsNullOrEmpty(location)) { @: map.drawZoomAndCenter('@RawJS(location)', @zoom); } else { @: map.setZoomLevel(@zoom); } @if(pushpins != null) { foreach (var loc in pushpins) { @: map.addMarker(new YGeoPoint(@RawJS(loc.Latitude), @RawJS(loc.Longitude))); } } }); </script> <div id="@mapElement" style="width:@TryParseUnit(width, DefaultWidth); height:@TryParseUnit(height, DefaultHeight);"> </div> if (showDirectionsLink) { <a class="map-link" href="http://maps.yahoo.com/#q1=@GetDirectionsQuery(location, latitude, longitude, HttpUtility.UrlPathEncode)">@directionsLinkText</a> } MapId++; }
the_stack
@model Sheng.WeixinConstruction.Management.Shell.Models.PortalStyle_TemplateViewModel @{ ViewBag.MainMenu = "Portal"; ViewBag.LeftMenu = "PortalStyle"; ViewBag.Title = "微主页设置"; Layout = "~/Views/Shared/_Layout.cshtml"; } <script type="text/javascript"> var _validator; var _templateId; $(document).ready(function () { if (_online == false) return; $("[keyenter]").keypress(function (e) { if (e.keyCode == 13) { save(); } }); _validator = $("#form").validate({ onfocusout: false, onkeyup: false, showErrors: showValidationErrors, rules: { // "txtImageUrl": "required" }, messages: { // "txtImageUrl": "请选择背景图片;" } }); loadImage(); // $("#iframe").attr("src", "/Portal/PortalTemplatePreview?new=" + Math.random()); }); function iframeReady() { var templateId = $("#txtTemplateId").val(); if (templateId != "") { loadTemplate(templateId); } } function loadTemplate(id) { _templateId = id; $("#txtTemplateId").val(id); document.getElementById("iframe").contentWindow.setTemplate(id); var portalImageUrl = $("#txtImageUrl").val(); document.getElementById("iframe").contentWindow.setPortalImage(portalImageUrl); } function save() { if (_validator.form() == false) { return; } var loadLayerIndex = layer.load(0, { shade: [0.2, '#fff'] }); var args = new Object(); args.PortalImageUrl = $("#txtImageUrl").val(); if ($("#txtTemplateId").val() != "") { args.PortalPresetTemplateId = $("#txtTemplateId").val(); } else { args.PortalPresetTemplateId = null; } var url = "/Api/Portal/SavePortalStyleSettings_Template"; $.ajax({ url: url, type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { layer.close(loadLayerIndex); if (data.Success) { layerAlert("保存成功,您的设置将在几分钟之内生效。"); } else { layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); alert("Error: " + xmlHttpRequest.status); } }); } function loadImage() { //这里不可以调用 iframe,还没加载完 $("#image").attr("src", $("#txtImageUrl").val()); } function uploadFile() { __showFileUpload(getUploadResult); } function getUploadResult(fileServiceAddress, result) { var url = fileServiceAddress + result.Data.StoreFilePath; $("#txtImageUrl").val(url); loadImage(); var portalImageUrl = $("#txtImageUrl").val(); document.getElementById("iframe").contentWindow.setPortalImage(portalImageUrl); } function removeImage() { $("#txtImageUrl").val(""); loadImage(); var portalImageUrl = $("#txtImageUrl").val(); document.getElementById("iframe").contentWindow.setPortalImage(portalImageUrl); } function showPortalTemplateSelect() { //alert(0); layer.open({ type: 2, area: ['90%', '90%'], //宽高 closeBtn: false, title: "", shift: _layerShift, content: '/Portal/PortalTemplateSelect' }); } function selectTemplateResult(template, layerIndex) { if (layerIndex != undefined && layerIndex != null) { layer.close(layerIndex); } $("#spanTemplateName").html(template.Name); $("#spanDescription").html(template.Description); $("#txtImageUrl").val(template.BackgroundImageUrl); loadImage(); loadTemplate(template.Id); //$("#previewImage").attr("src", template.PreviewImageUrl); } function exportToCustom() { if (_templateId == null || _templateId == "") { layerMsg("请先选择模版。"); return; } var portalImageUrl = encodeURI($("#txtImageUrl").val()); window.location.href = "/Portal/PortalStyle_Custom?importTemplateId=" + _templateId + "&portalImageUrl=" + portalImageUrl; } </script> <style type="text/css"> /*.divBaseSettingsTitle { margin-top: 25px; margin-left: 10px; margin-right: 10px; } .divBaseSettings { margin-top: 20px; margin-left: 10px; margin-right: 10px; }*/ </style> <div id="divContentTips"> 选择一款合适的模版,再上传一副图片即可。 </div> <div style="margin-top:10px;"> 您可以在“公众号菜单”中,添加微主页菜单,也可通过微信官方后台将此 URL 添加到菜单中访问微主页。 </div> <div class="divBorder_lightgray" style="margin-top:10px;padding:10px;font-size:13px;"> http://@(ViewBag.DomainContext.AppId).wxc.shengxunwei.com/Home/Portal/@(ViewBag.Domain.Id) </div> <div> <form id="form"> <div style=" margin-top:20px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="td_ContentTab_active" style="width:200px;">基于模版</td> <td class="td_ContentTab" style="width:200px;"><a href="/Portal/PortalStyle_Custom" class="a_black_16">自定义</a></td> <td>&nbsp;</td> </tr> <tr> <td colspan="4" bgcolor="#EEEEEE" height="2"></td> </tr> </table> </div> <div style="margin-top:20px;"> <input type="hidden" id="txtTemplateId" value="@Model.Settings.PortalPresetTemplateId" /> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="330" valign="top"> <table width="286" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3"><img src="/Content/Images/iphone_top.jpg" width="286" height="74"></td> </tr> <tr> <td width="4" rowspan="2" valign="top" style="background-image: url(/Content/Images/iphone_left_b.jpg);"><img src="/Content/Images/iphone_left.jpg" width="4" height="157"></td> <td width="280" height="48" align="center" valign="top" style="background-image: url(/Content/Images/iphone_title.jpg);"> <div style="margin-top:22px;color:white;"> @ViewBag.DomainContext.Authorizer.NickName </div> </td> <td width="2" rowspan="2" valign="top" style="background-image: url(/Content/Images/iphone_right.jpg);"><img src="/Content/Images/iphone_right.jpg" width="2" height="3"></td> </tr> <tr> <td valign="top"> <iframe id="iframe" src="/Portal/PortalTemplatePreview" style="width:280px;height:450px;border:none"></iframe> </td> </tr> <tr> <td colspan="3"><img src="/Content/Images/iphone_bottom.jpg" width="286" height="67"></td> </tr> </table> </td> <td valign="top"> <div style="margin-top:0px;"> <input name="btnSave" type="button" class="btn_blue" id="btnStep2Next" value="选择模版" onclick="showPortalTemplateSelect()" /> <input name="btnSave" type="button" class="btn_blue" id="btnStep2Next" value="导入自定义" onclick="exportToCustom()" style="margin-left:10px;" /> <input name="btnSave" type="button" class="btn_blue" id="btnStep2Next" value="保存" onclick="save()" style="margin-left:20px;" /> </div> <div style="margin-top:25px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100" height="30">名称:</td> <td> <span id="spanTemplateName"> @if (Model.Settings.PortalPresetTemplate != null) { @Model.Settings.PortalPresetTemplate.Name } </span> </td> </tr> <tr> <td height="30">说明:</td> <td> <span id="spanDescription"> @if (Model.Settings.PortalPresetTemplate != null) { @Model.Settings.PortalPresetTemplate.Description } </span> </td> </tr> <tr> <td height="30">图片:</td> <td> <div class="divBorder_gray" style="margin-bottom:5px;width:96%;"> <div style="padding:5px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="120"><img id="image" alt="" style="max-height:300px;max-width:300px;" /></td> <td align="right"> <input id="txtImageUrl" name="txtImageUrl" value="@Model.Settings.PortalImageUrl" type="hidden" class="input_16" style="width:96%; " maxlength="500" keyenter /> <a href="javascript:void(0)" onclick="uploadFile()">上传新图片</a><br /> <a href="javascript:void(0)" onclick="removeImage()">删除图片</a> </td> </tr> </table> </div> </div> </td> </tr> </table> </div> <div style="margin-top:25px;color:#666666;line-height:24px;"> 想要对模版进行调整? <br /> 如果选择到了比较钟意的模版,但是想要细节上的调整,可以将模版导入“自定义”中,然后进行修改。不过这需要您稍微掌握一些前端开发技术。<br /> 如果您是职业前端开发人员,可以通过“自定义”功能自由的制作自己的微主页,不会产生任何费用。<br /> 您也可以联系我们寻求服务:电话:0550-3926191 / 18114009195 / QQ:279060597 </div> </td> </tr> </table> </div> @*<div class="divBaseSettings"> <input type="hidden" id="txtTemplateId" value="@Model.Settings.PortalPresetTemplateId" /> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="50" width="140" valign="top">模版:</td> <td valign="top"> <div class="divBorder_gray" style="width:280px"> <img id="previewImage" src="@Model.Settings.PortalPresetTemplate.PreviewImageUrl" alt="" style="max-width:280px;" /> </div> </td> </tr> <tr> <td height="50">&nbsp;</td> <td> <span id="spanTemplateName"> @if (Model.Settings.PortalPresetTemplate != null) { @Model.Settings.PortalPresetTemplate.Name } </span> - <a href="javascript:void(0)" onclick="showPortalTemplateSelect()">选择模版</a> </td> </tr> <tr> <td height="50">背景图片:</td> <td><input name="txtImageUrl" type="text" class="input_18" id="txtImageUrl" maxlength="500" value="@Model.Settings.PortalImageUrl" keyenter /></td> </tr> <tr> <td>&nbsp;</td> <td><a href="javascript:void(0)" onclick="uploadFile()">上传新图片</a></td> </tr> </table> </div> <div style="margin-top: 15px;"> <input name="btnSave" type="button" class="btn_blue" id="btnStep2Next" value="保存" onclick="save()" /> </div>*@ </form> </div> @Helpers.FileUpload()
the_stack
@page @model InboxGeneralModel @{ ViewData["Title"] = "Inbox"; ViewData["PageName"] = "page_inbox_general"; ViewData["Heading"] = "inbox"; ViewData["Category1"] = "Page Views"; ViewData["PreemptiveClass"] = "nav-function-minify layout-composed"; } @section HeadBlock { <link rel="stylesheet" media="screen, print" href="~/css/fa-solid.css"> <link rel="stylesheet" media="screen, print" href="~/css/fa-brands.css"> } <div class="d-flex flex-grow-1 p-0"> <partial name="_Menu"/> <div class="d-flex flex-column flex-grow-1 bg-white"> <div class="flex-grow-0"> <div class="d-flex align-items-center pl-2 pr-3 py-3 pl-sm-3 pr-sm-4 py-sm-4 px-lg-5 py-lg-4 border-faded border-top-0 border-left-0 border-right-0 flex-shrink-0"> <a href="javascript:void(0);" class="pl-3 pr-3 py-2 d-flex d-lg-none align-items-center justify-content-center mr-2 btn" data-action="toggle" data-class="slide-on-mobile-left-show" data-target="#js-inbox-menu"> <i class="@(Settings.Theme.IconPrefix) fa-ellipsis-v h1 mb-0 "></i> </a> <h1 class="subheader-title ml-1 ml-lg-0"> <i class="fas fa-folder-open mr-2 hidden-lg-down"></i> Inbox </h1> <div class="d-flex position-relative ml-auto" style="max-width: 23rem;"> <i class="fas fa-search position-absolute pos-left fs-lg px-3 py-2 mt-1"></i> <input type="text" class="form-control bg-subtlelight pl-6" placeholder="Filter emails"> </div> </div> <div class="d-flex flex-wrap align-items-center pl-3 pr-1 py-2 px-sm-4 px-lg-5 border-faded border-top-0 border-left-0 border-right-0"> <div class="flex-1 d-flex align-items-center"> <div class="custom-control custom-checkbox mr-2 mr-lg-2 d-inline-block"> <input type="checkbox" class="custom-control-input" id="js-msg-select-all"> <label class="custom-control-label bolder" for="js-msg-select-all"></label> </div> <a href="javascript:void(0);" class="btn btn-icon rounded-circle mr-1"> <i class="fas fa-redo fs-md"></i> </a> <a href="javascript:void(0);" class="btn btn-icon rounded-circle mr-1"> <i class="fas fa-exclamation-circle fs-md"></i> </a> <a href="javascript:void(0);" id="js-delete-selected" class="btn btn-icon rounded-circle mr-1"> <i class="fas fa-trash fs-md"></i> </a> </div> <div class="text-muted mr-1 mr-lg-3 ml-auto"> 1 - 50 <span class="hidden-lg-down"> of 135 </span> </div> <div class="d-flex flex-wrap"> <button class="btn btn-icon rounded-circle"><i class="@(Settings.Theme.IconPrefix) fa-chevron-left fs-md"></i></button> <button class="btn btn-icon rounded-circle"><i class="@(Settings.Theme.IconPrefix) fa-chevron-right fs-md"></i></button> </div> </div> </div> <div class="flex-wrap align-items-center flex-grow-1 position-relative bg-gray-50"> <div class="position-absolute pos-top pos-bottom w-100 custom-scroll"> <div class="d-flex h-100 flex-column"> <ul id="js-emails" class="notification notification-layout-2"> <li class="unread"> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-1"> <label class="custom-control-label" for="msg-1"></label> </div> <a href="#" title="starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg color-warning-500 order-3 order-lg-2"><i class="fas fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Melissa Ayre</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Re: New security codes (2)</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">8:31PM</div> </div> </li> <li class="unread"> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-2"> <label class="custom-control-label" for="msg-2"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Adison Le</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Welcome to the new portal, here is what you need to do</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">6:22PM</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-3"> <label class="custom-control-label" for="msg-3"></label> </div> <a href="#" title="starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg color-warning-500 order-3 order-lg-2"><i class="fas fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Oliver Kopyuv</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Transformer Combustion Defuser is ready</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">5:12PM</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-4"> <label class="custom-control-label" for="msg-4"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Dr. John Cook PhD</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">PWS facts for patient #3245</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">4:31PM</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-5"> <label class="custom-control-label" for="msg-5"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Sarah McBrook</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Are you coming to the after party?</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">3:43PM</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-6"> <label class="custom-control-label" for="msg-6"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Lisa Hatchensen</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">The results for bloodwork</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">2:00PM</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-7"> <label class="custom-control-label" for="msg-7"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Anothony Bezyeth</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Questions regarding accesskey</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">1:35PM</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-8"> <label class="custom-control-label" for="msg-8"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Wrapbootstrap</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Your registration is complete</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">12:59PM</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-9"> <label class="custom-control-label" for="msg-9"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Oliver Kopyuv</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Transformer Combustion Defuser is ready</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">12:12PM</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-10"> <label class="custom-control-label" for="msg-10"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Dr. John Cook PhD</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">PWS facts for patient #3245</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Yesterday</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-11"> <label class="custom-control-label" for="msg-11"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Sarah McBrook</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Are you coming to the after party?</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Yesterday</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-12"> <label class="custom-control-label" for="msg-12"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Lisa Hatchensen</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">The results for bloodwork</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Yesterday</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-13"> <label class="custom-control-label" for="msg-13"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Anothony Bezyeth</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Questions regarding accesskey</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Mar 12</div> </div> </li> <li class="unread"> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-14"> <label class="custom-control-label" for="msg-14"></label> </div> <a href="#" title="starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg color-warning-500 order-3 order-lg-2"><i class="fas fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Bloodworks Inc.</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Your results are here</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Mar 3</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-15"> <label class="custom-control-label" for="msg-15"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Oliver Kopyuv</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Transformer Combustion Defuser is ready</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Feb 28</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-16"> <label class="custom-control-label" for="msg-16"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Dr. John Cook PhD</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">PWS facts for patient #3245</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Feb 18</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-17"> <label class="custom-control-label" for="msg-17"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Sarah McBrook</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Are you coming to the after party?</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Feb 12</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-18"> <label class="custom-control-label" for="msg-18"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Lisa Hatchensen</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">The results for bloodwork</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Feb 8</div> </div> </li> <li> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-19"> <label class="custom-control-label" for="msg-19"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Anothony Bezyeth</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Questions regarding accesskey</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Feb 5</div> </div> </li> <li class="unread"> <div class="d-flex align-items-center px-3 px-sm-4 px-lg-5 py-1 py-lg-0 height-4 height-mobile-auto"> <div class="custom-control custom-checkbox mr-3 order-1"> <input type="checkbox" class="custom-control-input" id="msg-20"> <label class="custom-control-label" for="msg-20"></label> </div> <a href="#" title="Not starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0 ml-lg-0 mr-lg-4 fs-lg text-muted order-3 order-lg-2"><i class="@(Settings.Theme.IconPrefix) fa-star"></i></a> <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3"> <div class="row w-100"> <a href="/page/inboxread" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">Password reset</a> <a href="/page/inboxread" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">Your password was changed</a> </div> </div> <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">Jan 1</div> </div> </li> </ul> </div> </div> </div> </div> <partial name="_Compose"/> </div> @section ScriptsBlock { <script type="text/javascript"> // push settings with "false" save to local initApp.pushSettings("nav-function-minify layout-composed", false); // the codes below are just for example use, you may need to change the scripts according to your requirement // select all checkbox function var title = document.title, newEmailDisplayTab = function() { var count = $('#js-emails .unread').length var newTitle = title + ' (' + count + ')'; document.title = newTitle; $(".js-unread-emails-count").text(' (' + count + ')'); }, deleteEmail = function(threadID){ // delete after animation is complete threadID.animate({ height: 'toggle', opacity: 'toggle' }, '200', 'easeOutExpo', function(){ //remove email after animation is complete $(this).remove(); //update unread email count newEmailDisplayTab(); }); //we remove any tooltips (this is a bug with bootstrap where the tooltip stays on screen after removing parent) $('.tooltip').tooltip('dispose'); //uncheck master select all if( $("#js-msg-select-all").is(":checked") ) { $("#js-msg-select-all").prop('checked',false); } return this; } // select all component demo $("#js-msg-select-all").on("change", function (e) { if(this.checked) { $('#js-emails :checkbox').prop("checked",$(this).is(":checked")).closest("li").addClass("state-selected"); } else { $('#js-emails :checkbox').prop("checked",$(this).is(":checked")).closest("li").removeClass("state-selected"); } }); // add or remove state-selected class to emails when they are checked $('#js-emails :checkbox').on("change" , function () { if ($("#js-msg-select-all").is(":checked")) { $('#js-msg-select-all').prop('indeterminate', true); } if(this.checked) { $(this).closest("li").addClass("state-selected"); } else { $(this).closest("li").removeClass("state-selected"); } }); // email delete button triggers $(".js-delete-email").on('click', function() { deleteEmail( $(this).closest("li") ); }) $("#js-delete-selected").on('click', function(){ deleteEmail( $("#js-emails input:checked").closest("li") ) }); // show unread email count (once) newEmailDisplayTab(); </script> }
the_stack
@******************************************************************************************************* // RemoteConsole.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/15/2016 - J. Ritchie Carroll // Generated original version of source code. // //*****************************************************************************************************@ @using GSF.Web @using GSF.Web.Model @using GSF.Web.Shared @using System.Net.Http @inherits ExtendedTemplateBase @{ ViewBag.Title = "Remote Service Console"; } @section StyleSheets { <style> html, body { height: 100%; } .remote-console { background-color:black; padding:10px; overflow: auto; } /* Auto font resize CSS for remote console window - targeting fixed 80 char width without wrap */ @@media screen { .remote-console { font-size: 5.25px; } } @@media screen and (min-width: 430px) { .remote-console { font-size: 7px; } } @@media screen and (min-width: 470px) { .remote-console { font-size: 8px; } } @@media screen and (min-width: 515px) { .remote-console { font-size: 9px; } } @@media screen and (min-width: 550px) { .remote-console { font-size: 10px; } } @@media screen and (min-width: 600px) { .remote-console { font-size: 11px; } } @@media screen and (min-width: 635px) { .remote-console { font-size: 12px; } } @@media screen and (min-width: 685px) { .remote-console { font-size: 13px; } } @@media screen and (min-width: 725px) { .remote-console { font-size: 14px; } } </style> } @{ HttpRequestMessage request = ViewBag.Request; Dictionary<string, string> parameters = request.QueryParameters(); string filter; string command; if (!parameters.TryGetValue("filter", out filter)) { filter = "Filter -Remove 0"; } if (!parameters.TryGetValue("command", out command)) { command = ""; } } @section Scripts { <script src="@Resources.Root/Shared/Scripts/js.cookie.js")"></script> <script> const defaultRemoteConsoleEntries = 100; const minimumRemoteConsoleEntries = 10; var overRemoteConsole = false; var totalRemoteConsoleEntries = Cookies.get("totalRemoteConsoleEntries"); function scrollRemoteConsoleToBottom() { var remoteConsole = $("#remoteConsoleWindow"); remoteConsole.scrollTop(remoteConsole[0].scrollHeight); } // Register SignalR client functions before hub connection $(window).on("beforeHubConnected", function (event) { // Create a function that the hub can call to broadcast new remote console messages serviceHubClient.broadcastMessage = function (message, color) { // Html encode message var encodedMessage = $("<div />").text(message).html(); var remoteConsole = $("#remoteConsoleWindow"); remoteConsole.append("<span style='color: " + color + "'>" + encodedMessage + "</span>"); if (remoteConsole[0].childElementCount > totalRemoteConsoleEntries) remoteConsole.find(":first-child").remove(); if (!overRemoteConsole) scrollRemoteConsoleToBottom(); } }); $(function () { // Initialize default setting for total remote console entries if (totalRemoteConsoleEntries === undefined) totalRemoteConsoleEntries = defaultRemoteConsoleEntries; // Set initial text input values $("#remoteConsoleTotalEntriesTextInput").val(totalRemoteConsoleEntries.toString()); $("#remoteConsoleTotalEntriesTextInput").attr("min", minimumRemoteConsoleEntries.toString()); $("#remoteConsoleSettingsShowButton").click(function () { $("#remoteConsoleSettingsForm").toggle(); if ($("#remoteConsoleSettingsForm").is(":visible")) $("#remoteConsoleTotalEntriesTextInput").focus(); }); $("#setTotalRemoteConsoleEntriesButton").click(function () { totalRemoteConsoleEntries = parseInt($("#remoteConsoleTotalEntriesTextInput").val()); if (totalRemoteConsoleEntries < minimumRemoteConsoleEntries) totalRemoteConsoleEntries = minimumRemoteConsoleEntries; Cookies.set("totalRemoteConsoleEntries", totalRemoteConsoleEntries, { expires: 365 }); $("#remoteConsoleTotalEntriesTextInput").val(totalRemoteConsoleEntries.toString()); $("#remoteConsoleSettingsForm").hide(); }); // Prevent default form submission when user presses enter $("#remoteConsoleSettingsForm").submit(function () { return false; }); $("#remoteConsoleTotalEntriesTextInput").keyup(function (event) { if (event.keyCode === 13) $("#setTotalRemoteConsoleEntriesButton").click(); }); // Auto-hide pop-up form when user clicks outside form area $("#remoteConsoleSettingsForm").focusout(function () { if (!$("#remoteConsoleSettingsForm").is(":hover") && !$("#remoteConsoleSettingsShowButton").is(":hover")) $("#remoteConsoleSettingsForm").hide(); }); $("#remoteConsoleSettingsCloseButton").click(function () { $("#remoteConsoleSettingsForm").hide(); }); // Set the client filter to the value of the // filter parameter that came from the URL $(window).on("hubConnected", function (event) { serviceHub.sendCommand("@Raw(filter.JavaScriptEncode())").done(function () { var command = "@Raw(command.JavaScriptEncode())" if (command !== "") serviceHub.sendCommand(command); }); }); $("#remoteConsoleWindow").mouseenter(function () { $("#remoteConsolePausedLabel").show(); overRemoteConsole = true; }); $("#remoteConsoleWindow").mouseleave(function () { $("#remoteConsolePausedLabel").hide(); overRemoteConsole = false; scrollRemoteConsoleToBottom(); }); $(window).resize(function () { scrollRemoteConsoleToBottom(); }); $(window).on("onMessageVisibiltyChanged", function (event) { scrollRemoteConsoleToBottom(); }); $("#sendCommandButton").click(function () { // Call the send command method on the hub if (hubIsConnected) serviceHub.sendCommand($("#commandTextInput").val()); // Clear text box and reset focus for next command $("#commandTextInput").val("").focus(); }); $("#commandTextInput").keyup(function (event) { if (event.keyCode === 13) $("#sendCommandButton").click(); }); $("#bodyContainer").addClass("fill-height"); $("#commandTextInput").focus(); }); </script> } @{ ViewBag.StyleSheetsSection = RenderSection("StyleSheets").ToString(); ViewBag.ScriptsSection = RenderSection("Scripts").ToString(); } <div class="well" content-fill-height> <button class="btn btn-link btn-xs" id="remoteConsoleSettingsShowButton">Settings</button> <label class="small pull-right" id="remoteConsolePausedLabel" style="display: none"><small><em>Scrolling paused during mouse interaction...</em></small></label> <div class="well well-sm floating-form" id="remoteConsoleSettingsForm" style="z-index: 1000"> <form class="form-inline" role="form"> <div class="form-group form-group-sm"> <a href="#" class="close" aria-label="close" id="remoteConsoleSettingsCloseButton">&times;</a> <label for="remoteConsoleTotalEntriesTextInput">Total console entries:</label> <div class="input-group col-xs-4" style="min-width: 100px"> <input type="number" class="form-control input-sm" id="remoteConsoleTotalEntriesTextInput"> <span class="input-group-btn"> <button type="button" class="btn btn-default btn-xs input-sm" id="setTotalRemoteConsoleEntriesButton">Set</button> </span> </div> </div> </form> </div> <pre id="remoteConsoleWindow" class="small remote-console fill-height"></pre> <div class="input-group"> <input type="text" id="commandTextInput" class="form-control" placeholder="Server command..." /> <span class="input-group-btn"> <button type="button" id="sendCommandButton" class="btn btn-default" hub-dependent>Send</button> </span> </div> </div>
the_stack
@model ZLMediaServerManagent.Models.ViewDto.PowerDto @{ ViewData["Title"] = "域名和应用"; } <section class="tile color transparent-black"> <!-- tile header --> <div class="tile-header"> <h1><strong>域名和应用</strong>管理</h1> </div> <!-- /tile header --> <!-- tile body --> <div class="tile-body no-vpadding"> <div class="table-responsive"> <div class="layui-fluid" style="height:100%"> <div class="layui-row layui-col-space15"> <div class="layui-col-md6"> <div class="layui-card"> <div class="layui-card-header" style="border-bottom:1px solid rgba(0, 0, 0, 0.2);color: #FFF;">域名列表</div> <div class="layui-card-body"> <div class="layui-card-body"> <div style="padding-bottom: 10px;"> @if (Model.AddDomain) { <button class="layui-btn" data-type="add" onclick="addData('AddDomain','域名')">添加</button> } @if (Model.EditDomain) { <button class="layui-btn layui-btn-normal" data-type="edit" onclick="editDomainData()">编辑</button> } @if (Model.DeleteDomain) { <button class="layui-btn layui-btn-danger" data-type="batchdel" onclick="deleteDomainData()">删除</button> } </div> <table class="layui-hide" id="domainList" lay-filter="domainList"></table> </div> </div> </div> </div> <div class="layui-col-md6"> <div class="layui-card"> <div class="layui-card-header" style="border-bottom:1px solid rgba(0, 0, 0, 0.2);color:#FFF;">应用列表 </div> <div class="layui-card-body"> <div style="padding-bottom: 10px;"> @if (Model.AddApplication) { <button class="layui-btn" data-type="add" onclick="addData('AddApplication','应用')">添加</button> } @if (Model.EditApplication) { <button class="layui-btn layui-btn-normal" data-type="edit" onclick="editApplicationData()">编辑</button> } @if (Model.DeleteApplication) { <button class="layui-btn layui-btn-danger" data-type="batchdel" onclick="deleteApplicationData()">删除</button> } </div> <table class="layui-hide" id="applicationList" lay-filter="applicationList"></table> </div> </div> </div> </div> </div> </div> </div> </section> <script> var domainId = ''; var applicationId = ''; layui.use(['table', 'tree', 'util'], function () { var form = layui.form; var table = layui.table; var tree = layui.tree; table.render({ elem: '#domainList' , url: '/DomainAndApp/DomainAndApp/' , method: 'post' , autoSort: false , cols: [[ { type: 'checkbox' } , { field: 'Id', title: 'ID', hide: true } , { field: 'DomainName', title: '域名', sort: true } , { field: 'State', title: '状态', sort: true, templet: '#statusTemp' } , { field: 'Description', title: '描述' } , { field: 'CreateTs', title: '创建时间', sort: true } ]] , where: { Flag: true } }); table.render({ elem: '#applicationList' , url: '/DomainAndApp/DomainAndApp/' , method: 'post' , autoSort: false , cols: [[ { type: 'checkbox' } , { field: 'Id', title: 'ID', hide: true } , { field: 'AppName', title: '应用', sort: true } , { field: 'State', title: '状态', sort: true, templet: '#statusTemp' } , { field: 'Description', title: '描述' } , { field: 'CreateTs', title: '创建时间', sort: true } ]] , where: { Flag: false } }); //监听行单击事件(双击事件为:rowDouble) table.on('row(domainList)', function (obj) { var data = obj.data; domainId = data.Id; reloadApplication(); $(obj.tr).siblings().css("background-color", ""); obj.tr.css("background-color", "rgba(0, 0, 0, 0.2)"); }); table.on('row(applicationList)', function (obj) { var data = obj.data; applicationId = data.Id; $(obj.tr).siblings().css("background-color", ""); obj.tr.css("background-color", "rgba(0, 0, 0, 0.2)"); }); table.on('sort(domainList)', function (obj) { //注:sort 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值" //console.log(obj.field); //当前排序的字段名 //console.log(obj.type); //当前排序类型:desc(降序)、asc(升序)、null(空对象,默认排序) //console.log(this); //当前排序的 th 对象 //尽管我们的 table 自带排序功能,但并没有请求服务端。 //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如: table.reload('domainList', { initSort: obj //记录初始排序,如果不设的话,将无法标记表头的排序状态。 , where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式) field: obj.field //排序字段 , order: obj.type //排序方式 ,Flag:true } }); }); table.on('sort(applicationList)', function (obj) { //注:sort 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值" //console.log(obj.field); //当前排序的字段名 //console.log(obj.type); //当前排序类型:desc(降序)、asc(升序)、null(空对象,默认排序) //console.log(this); //当前排序的 th 对象 //尽管我们的 table 自带排序功能,但并没有请求服务端。 //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如: table.reload('applicationList', { initSort: obj //记录初始排序,如果不设的话,将无法标记表头的排序状态。 , where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式) field: obj.field //排序字段 , order: obj.type //排序方式 , parentId: domainId ,Flag:false } }); }); }); function addData(type, name) { if (name === "应用" && isEmpty(domainId)) { showGrowl('请先选择域名', 'danger', 3000); return; } get('/DomainAndApp/' + type, function (data, status, xhr) { if (xhr.status === 200) { var index = layer.open({ type: 1 , title: '添加' + name , closeBtn: false , shade: 0 , area: ['590px', '500px'] , id: type //设定一个id,防止重复弹出 , btnAlign: 'c' , closeBtn: 1 , moveType: 1 //拖拽模式,0或者1 , content: data , shadeClose: false //点击遮罩区域是否关闭页面 , zIndex: 1000 }); layuiWindow[type] = index; } else { showGrowl('请求失败,错误码:' + xhr.status + "," + xhr.statusText, 'danger', 4000) } }, function () { showGrowl('GET请求异常。', 'danger', 3000) } ); } function editDomainData() { if (isEmpty(domainId)) { showGrowl('请选择一行域名再编辑!', 'danger', 3000) return; } else { get('/DomainAndApp/EditDomain?domainId=' + domainId, function (data, status, xhr) { if (xhr.status === 200) { var index = layer.open({ type: 1 , title: '编辑域名' , closeBtn: false , shade: 0 , area: ['590px', '500px'] , id: 'editDomain' + domainId //设定一个id,防止重复弹出 , btnAlign: 'c' , closeBtn: 1 , moveType: 1 //拖拽模式,0或者1 , content: data , shadeClose: false //点击遮罩区域是否关闭页面 , zIndex: 1000 }); layuiWindow['editDomain' + domainId] = index; } else { showGrowl('请求失败,错误码:' + xhr.status + "," + xhr.statusText, 'danger', 4000) } }, function () { showGrowl('GET请求异常。', 'danger', 3000) } ); } } function editApplicationData() { if (isEmpty(applicationId)) { showGrowl('请选择一行应用再编辑!', 'danger', 3000) return; } else { get('/DomainAndApp/EditApplication?applicationId=' + applicationId, function (data, status, xhr) { if (xhr.status === 200) { var index = layer.open({ type: 1 , title: '编辑应用' , closeBtn: false , shade: 0 , area: ['590px', '500px'] , id: 'EditApplication' + applicationId //设定一个id,防止重复弹出 , btnAlign: 'c' , closeBtn: 1 , moveType: 1 //拖拽模式,0或者1 , content: data , shadeClose: false //点击遮罩区域是否关闭页面 , zIndex: 1000 }); layuiWindow['EditApplication' + applicationId] = index; } else { showGrowl('请求失败,错误码:' + xhr.status + "," + xhr.statusText, 'danger', 4000) } }, function () { showGrowl('GET请求异常。', 'danger', 3000) } ); } } function deleteDomainData() { var table = layui.table; var checkStatus = table.checkStatus('domainList'); if (checkStatus.data.length == 0) { showGrowl('请至少选择一行', 'danger', 3000); } else { var ids = new Array(); for (var i = 0; i < checkStatus.data.length; i++) { ids[i] = checkStatus.data[i].Id; } var index = layer.confirm('确定要删除' + ids.length + "条域名吗?", { title: '警告', btn: ['确定', '取消'] } , function () { showLoader('删除中....', 60); $.post("/DomainAndApp/DeleteDomain", { ids: ids }, function (result) { closeLoader(); layer.close(index); if (result.Flag) { reloadDomain(); layer.close(index); showGrowl('删除成功!', 'success', 3000); } else { showGrowl(result.Msg, 'danger', 4000); } }, "json"); }, function () { layer.close(index); }); } } function deleteApplicationData() { var table = layui.table; var checkStatus = table.checkStatus('applicationList'); if (checkStatus.data.length == 0) { showGrowl('请至少选择一行', 'danger', 3000); } else { var ids = new Array(); for (var i = 0; i < checkStatus.data.length; i++) { ids[i] = checkStatus.data[i].Id; } var index = layer.confirm('确定要删除' + ids.length + "条应用吗?", { title: '警告', btn: ['确定', '取消'] } , function () { showLoader('删除中....', 60); $.post("/DomainAndApp/DeleteApplication", { ids: ids }, function (result) { closeLoader(); layer.close(index); if (result.Flag) { reloadApplication(); layer.close(index); showGrowl('删除成功!', 'success', 3000); } else { showGrowl(result.Msg, 'danger', 4000); } }, "json"); }, function () { layer.close(index); }); } } function reloadDomain() { var table = layui.table; var tree = layui.tree; table.reload('domainList', { }); } function reloadApplication() { var table = layui.table; var tree = layui.tree; table.reload('applicationList', { where: { Flag: false, parentId: domainId } }); } </script> <script type="text/html" id="statusTemp"> {{#  if(d.State==200){ }} <font color="#abe879">正常</font> {{#  } else if(d.State==500) { }} <font color="red">停用</font> {{#  } }} </script>
the_stack
@{ Layout = null; } <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="~/Content/bootstrap.css" rel="stylesheet" /> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries--><!--[if lt IE 9]><script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script><script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]--> <link href="~/Content/main.css" rel="stylesheet" /> <title>ECharts Demo</title> <style type="text/css"> .dg { /** Clear list styles */ /* Auto-place container */ /* Auto-placed GUI's */ /* Line items that don't contain folders. */ /** Folder names */ /** Hides closed items */ /** Controller row */ /** Name-half (left) */ /** Controller-half (right) */ /** Controller placement */ /** Shorter number boxes when slider is present. */ /** Ensure the entire boolean and function row shows a hand */ } .dg ul { list-style: none; margin: 0; padding: 0; width: 100%; clear: both; } .dg.ac { position: fixed; top: 0; left: 0; right: 0; height: 0; z-index: 0; } .dg:not(.ac) .main { /** Exclude mains in ac so that we don't hide close button */ overflow: hidden; } .dg.main { -webkit-transition: opacity 0.1s linear; -o-transition: opacity 0.1s linear; -moz-transition: opacity 0.1s linear; transition: opacity 0.1s linear; } .dg.main.taller-than-window { overflow-y: auto; } .dg.main.taller-than-window .close-button { opacity: 1; /* TODO, these are style notes */ margin-top: -1px; border-top: 1px solid #2c2c2c; } .dg.main ul.closed .close-button { opacity: 1 !important; } .dg.main:hover .close-button, .dg.main .close-button.drag { opacity: 1; } .dg.main .close-button { /*opacity: 0;*/ -webkit-transition: opacity 0.1s linear; -o-transition: opacity 0.1s linear; -moz-transition: opacity 0.1s linear; transition: opacity 0.1s linear; border: 0; position: absolute; line-height: 19px; height: 20px; /* TODO, these are style notes */ cursor: pointer; text-align: center; background-color: #000; } .dg.main .close-button:hover { background-color: #111; } .dg.a { float: right; margin-right: 15px; overflow-x: hidden; } .dg.a.has-save > ul { margin-top: 27px; } .dg.a.has-save > ul.closed { margin-top: 0; } .dg.a .save-row { position: fixed; top: 0; z-index: 1002; } .dg li { -webkit-transition: height 0.1s ease-out; -o-transition: height 0.1s ease-out; -moz-transition: height 0.1s ease-out; transition: height 0.1s ease-out; } .dg li:not(.folder) { cursor: auto; height: 27px; line-height: 27px; overflow: hidden; padding: 0 4px 0 5px; } .dg li.folder { padding: 0; border-left: 4px solid rgba(0, 0, 0, 0); } .dg li.title { cursor: pointer; margin-left: -4px; } .dg .closed li:not(.title), .dg .closed ul li, .dg .closed ul li > * { height: 0; overflow: hidden; border: 0; } .dg .cr { clear: both; padding-left: 3px; height: 27px; } .dg .property-name { cursor: default; float: left; clear: left; width: 40%; overflow: hidden; text-overflow: ellipsis; } .dg .c { float: left; width: 60%; } .dg .c input[type=text] { border: 0; margin-top: 4px; padding: 3px; width: 100%; float: right; } .dg .has-slider input[type=text] { width: 30%; /*display: none;*/ margin-left: 0; } .dg .slider { float: left; width: 66%; margin-left: -5px; margin-right: 0; height: 19px; margin-top: 4px; } .dg .slider-fg { height: 100%; } .dg .c input[type=checkbox] { margin-top: 9px; } .dg .c select { margin-top: 5px; } .dg .cr.function, .dg .cr.function .property-name, .dg .cr.function *, .dg .cr.boolean, .dg .cr.boolean * { cursor: pointer; } .dg .selector { display: none; position: absolute; margin-left: -9px; margin-top: 23px; z-index: 10; } .dg .c:hover .selector, .dg .selector.drag { display: block; } .dg li.save-row { padding: 0; } .dg li.save-row .button { display: inline-block; padding: 0px 6px; } .dg.dialogue { background-color: #222; width: 460px; padding: 15px; font-size: 13px; line-height: 15px; } /* TODO Separate style and structure */ #dg-new-constructor { padding: 10px; color: #222; font-family: Monaco, monospace; font-size: 10px; border: 0; resize: none; box-shadow: inset 1px 1px 1px #888; word-wrap: break-word; margin: 12px 0; display: block; width: 440px; overflow-y: scroll; height: 100px; position: relative; } #dg-local-explain { display: none; font-size: 11px; line-height: 17px; border-radius: 3px; background-color: #333; padding: 8px; margin-top: 10px; } #dg-local-explain code { font-size: 10px; } #dat-gui-save-locally { display: none; } /** Main type */ .dg { color: #eee; font: 11px 'Lucida Grande', sans-serif; text-shadow: 0 -1px 0 #111; /** Auto place */ /* Controller row, <li> */ /** Controllers */ } .dg.main { /** Scrollbar */ } .dg.main::-webkit-scrollbar { width: 5px; background: #1a1a1a; } .dg.main::-webkit-scrollbar-corner { height: 0; display: none; } .dg.main::-webkit-scrollbar-thumb { border-radius: 5px; background: #676767; } .dg li:not(.folder) { background: #1a1a1a; border-bottom: 1px solid #2c2c2c; } .dg li.save-row { line-height: 25px; background: #dad5cb; border: 0; } .dg li.save-row select { margin-left: 5px; width: 108px; } .dg li.save-row .button { margin-left: 5px; margin-top: 1px; border-radius: 2px; font-size: 9px; line-height: 7px; padding: 4px 4px 5px 4px; background: #c5bdad; color: #fff; text-shadow: 0 1px 0 #b0a58f; box-shadow: 0 -1px 0 #b0a58f; cursor: pointer; } .dg li.save-row .button.gears { background: #c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat; height: 7px; width: 8px; } .dg li.save-row .button:hover { background-color: #bab19e; box-shadow: 0 -1px 0 #b0a58f; } .dg li.folder { border-bottom: 0; } .dg li.title { padding-left: 16px; background: black url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat; cursor: pointer; border-bottom: 1px solid rgba(255, 255, 255, 0.2); } .dg .closed li.title { background-image: url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==); } .dg .cr.boolean { border-left: 3px solid #806787; } .dg .cr.function { border-left: 3px solid #e61d5f; } .dg .cr.number { border-left: 3px solid #2fa1d6; } .dg .cr.number input[type=text] { color: #2fa1d6; } .dg .cr.string { border-left: 3px solid #1ed36f; } .dg .cr.string input[type=text] { color: #1ed36f; } .dg .cr.function:hover, .dg .cr.boolean:hover { background: #111; } .dg .c input[type=text] { background: #303030; outline: none; } .dg .c input[type=text]:hover { background: #3c3c3c; } .dg .c input[type=text]:focus { background: #494949; color: #fff; } .dg .c .slider { background: #303030; cursor: ew-resize; } .dg .c .slider-fg { background: #2fa1d6; } .dg .c .slider:hover { background: #3c3c3c; } .dg .c .slider:hover .slider-fg { background: #44abda; } </style> <style id="ace_editor.css"> .ace_editor { position: relative; overflow: hidden; font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; direction: ltr; text-align: left; } .ace_scroller { position: absolute; overflow: hidden; top: 0; bottom: 0; background-color: inherit; -ms-user-select: none; -moz-user-select: none; -webkit-user-select: none; user-select: none; cursor: text; } .ace_content { position: absolute; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; min-width: 100%; } .ace_dragging .ace_scroller:before { position: absolute; top: 0; left: 0; right: 0; bottom: 0; content: ''; background: rgba(250, 250, 250, 0.01); z-index: 1000; } .ace_dragging.ace_dark .ace_scroller:before { background: rgba(0, 0, 0, 0.01); } .ace_selecting, .ace_selecting * { cursor: text !important; } .ace_gutter { position: absolute; overflow: hidden; width: auto; top: 0; bottom: 0; left: 0; cursor: default; z-index: 4; -ms-user-select: none; -moz-user-select: none; -webkit-user-select: none; user-select: none; } .ace_gutter-active-line { position: absolute; left: 0; right: 0; } .ace_scroller.ace_scroll-left { box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset; } .ace_gutter-cell { padding-left: 19px; padding-right: 6px; background-repeat: no-repeat; } .ace_gutter-cell.ace_error { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg=="); background-repeat: no-repeat; background-position: 2px center; } .ace_gutter-cell.ace_warning { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg=="); background-position: 2px center; } .ace_gutter-cell.ace_info { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII="); background-position: 2px center; } .ace_dark .ace_gutter-cell.ace_info { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC"); } .ace_scrollbar { position: absolute; right: 0; bottom: 0; z-index: 6; } .ace_scrollbar-inner { position: absolute; cursor: text; left: 0; top: 0; } .ace_scrollbar-v { overflow-x: hidden; overflow-y: scroll; top: 0; } .ace_scrollbar-h { overflow-x: scroll; overflow-y: hidden; left: 0; } .ace_print-margin { position: absolute; height: 100%; } .ace_text-input { position: absolute; z-index: 0; width: 0.5em; height: 1em; opacity: 0; background: transparent; -moz-appearance: none; appearance: none; border: none; resize: none; outline: none; overflow: hidden; font: inherit; padding: 0 1px; margin: 0 -1px; text-indent: -1em; -ms-user-select: text; -moz-user-select: text; -webkit-user-select: text; user-select: text; white-space: pre !important; } .ace_text-input.ace_composition { background: inherit; color: inherit; z-index: 1000; opacity: 1; text-indent: 0; } .ace_layer { z-index: 1; position: absolute; overflow: hidden; word-wrap: normal; white-space: pre; height: 100%; width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; pointer-events: none; } .ace_gutter-layer { position: relative; width: auto; text-align: right; pointer-events: auto; } .ace_text-layer { font: inherit !important; } .ace_cjk { display: inline-block; text-align: center; } .ace_cursor-layer { z-index: 4; } .ace_cursor { z-index: 4; position: absolute; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; border-left: 2px solid; transform: translatez(0); } .ace_slim-cursors .ace_cursor { border-left-width: 1px; } .ace_overwrite-cursors .ace_cursor { border-left-width: 0; border-bottom: 1px solid; } .ace_hidden-cursors .ace_cursor { opacity: 0.2; } .ace_smooth-blinking .ace_cursor { -webkit-transition: opacity 0.18s; transition: opacity 0.18s; } .ace_editor.ace_multiselect .ace_cursor { border-left-width: 1px; } .ace_marker-layer .ace_step, .ace_marker-layer .ace_stack { position: absolute; z-index: 3; } .ace_marker-layer .ace_selection { position: absolute; z-index: 5; } .ace_marker-layer .ace_bracket { position: absolute; z-index: 6; } .ace_marker-layer .ace_active-line { position: absolute; z-index: 2; } .ace_marker-layer .ace_selected-word { position: absolute; z-index: 4; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ace_line .ace_fold { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; display: inline-block; height: 11px; margin-top: -2px; vertical-align: middle; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII="); background-repeat: no-repeat, repeat-x; background-position: center center, top left; color: transparent; border: 1px solid black; border-radius: 2px; cursor: pointer; pointer-events: auto; } .ace_dark .ace_fold { } .ace_fold:hover { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC"); } .ace_tooltip { background-color: #FFF; background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1)); background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1)); border: 1px solid gray; border-radius: 1px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); color: black; max-width: 100%; padding: 3px 4px; position: fixed; z-index: 999999; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; cursor: default; white-space: pre; word-wrap: break-word; line-height: normal; font-style: normal; font-weight: normal; letter-spacing: normal; pointer-events: none; } .ace_folding-enabled > .ace_gutter-cell { padding-right: 13px; } .ace_fold-widget { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; margin: 0 -12px 0 1px; display: none; width: 11px; vertical-align: top; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; background-position: center; border-radius: 3px; border: 1px solid transparent; cursor: pointer; } .ace_folding-enabled .ace_fold-widget { display: inline-block; } .ace_fold-widget.ace_end { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg=="); } .ace_fold-widget.ace_closed { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA=="); } .ace_fold-widget:hover { border: 1px solid rgba(0, 0, 0, 0.3); background-color: rgba(255, 255, 255, 0.2); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); } .ace_fold-widget:active { border: 1px solid rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.05); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8); } .ace_dark .ace_fold-widget { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC"); } .ace_dark .ace_fold-widget.ace_end { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg=="); } .ace_dark .ace_fold-widget.ace_closed { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg=="); } .ace_dark .ace_fold-widget:hover { box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); background-color: rgba(255, 255, 255, 0.1); } .ace_dark .ace_fold-widget:active { box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); } .ace_fold-widget.ace_invalid { background-color: #FFB4B4; border-color: #DE5555; } .ace_fade-fold-widgets .ace_fold-widget { -webkit-transition: opacity 0.4s ease 0.05s; transition: opacity 0.4s ease 0.05s; opacity: 0; } .ace_fade-fold-widgets:hover .ace_fold-widget { -webkit-transition: opacity 0.05s ease 0.05s; transition: opacity 0.05s ease 0.05s; opacity: 1; } .ace_underline { text-decoration: underline; } .ace_bold { font-weight: bold; } .ace_nobold .ace_bold { font-weight: normal; } .ace_italic { font-style: italic; } .ace_error-marker { background-color: rgba(255, 0, 0,0.2); position: absolute; z-index: 9; } .ace_highlight-marker { background-color: rgba(255, 255, 0,0.2); position: absolute; z-index: 8; } .ace_br1 { border-top-left-radius: 3px; } .ace_br2 { border-top-right-radius: 3px; } .ace_br3 { border-top-left-radius: 3px; border-top-right-radius: 3px; } .ace_br4 { border-bottom-right-radius: 3px; } .ace_br5 { border-top-left-radius: 3px; border-bottom-right-radius: 3px; } .ace_br6 { border-top-right-radius: 3px; border-bottom-right-radius: 3px; } .ace_br7 { border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; } .ace_br8 { border-bottom-left-radius: 3px; } .ace_br9 { border-top-left-radius: 3px; border-bottom-left-radius: 3px; } .ace_br10 { border-top-right-radius: 3px; border-bottom-left-radius: 3px; } .ace_br11 { border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px; } .ace_br12 { border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .ace_br13 { border-top-left-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .ace_br14 { border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .ace_br15 { border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } /*# sourceURL=ace/css/ace_editor.css */ </style> <style id="ace-tm"> .ace-tm .ace_gutter { background: #f0f0f0; color: #333; } .ace-tm .ace_print-margin { width: 1px; background: #e8e8e8; } .ace-tm .ace_fold { background-color: #6B72E6; } .ace-tm { background-color: #FFFFFF; color: black; } .ace-tm .ace_cursor { color: black; } .ace-tm .ace_invisible { color: rgb(191, 191, 191); } .ace-tm .ace_storage, .ace-tm .ace_keyword { color: blue; } .ace-tm .ace_constant { color: rgb(197, 6, 11); } .ace-tm .ace_constant.ace_buildin { color: rgb(88, 72, 246); } .ace-tm .ace_constant.ace_language { color: rgb(88, 92, 246); } .ace-tm .ace_constant.ace_library { color: rgb(6, 150, 14); } .ace-tm .ace_invalid { background-color: rgba(255, 0, 0, 0.1); color: red; } .ace-tm .ace_support.ace_function { color: rgb(60, 76, 114); } .ace-tm .ace_support.ace_constant { color: rgb(6, 150, 14); } .ace-tm .ace_support.ace_type, .ace-tm .ace_support.ace_class { color: rgb(109, 121, 222); } .ace-tm .ace_keyword.ace_operator { color: rgb(104, 118, 135); } .ace-tm .ace_string { color: rgb(3, 106, 7); } .ace-tm .ace_comment { color: rgb(76, 136, 107); } .ace-tm .ace_comment.ace_doc { color: rgb(0, 102, 255); } .ace-tm .ace_comment.ace_doc.ace_tag { color: rgb(128, 159, 191); } .ace-tm .ace_constant.ace_numeric { color: rgb(0, 0, 205); } .ace-tm .ace_variable { color: rgb(49, 132, 149); } .ace-tm .ace_xml-pe { color: rgb(104, 104, 91); } .ace-tm .ace_entity.ace_name.ace_function { color: #0000A2; } .ace-tm .ace_heading { color: rgb(12, 7, 255); } .ace-tm .ace_list { color: rgb(185, 6, 144); } .ace-tm .ace_meta.ace_tag { color: rgb(0, 22, 142); } .ace-tm .ace_string.ace_regex { color: rgb(255, 0, 0); } .ace-tm .ace_marker-layer .ace_selection { background: rgb(181, 213, 255); } .ace-tm.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px white; } .ace-tm .ace_marker-layer .ace_step { background: rgb(252, 255, 0); } .ace-tm .ace_marker-layer .ace_stack { background: rgb(164, 229, 101); } .ace-tm .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192); } .ace-tm .ace_marker-layer .ace_active-line { background: rgba(0, 0, 0, 0.07); } .ace-tm .ace_gutter-active-line { background-color: #dcdcdc; } .ace-tm .ace_marker-layer .ace_selected-word { background: rgb(250, 250, 255); border: 1px solid rgb(200, 200, 250); } .ace-tm .ace_indent-guide { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y; } /*# sourceURL=ace/css/ace-tm */ </style> <style> .error_widget_wrapper { background: inherit; color: inherit; border: none; } .error_widget { border-top: solid 2px; border-bottom: solid 2px; margin: 5px 0; padding: 10px 40px; white-space: pre-wrap; } .error_widget.ace_error, .error_widget_arrow.ace_error { border-color: #ff5a5a; } .error_widget.ace_warning, .error_widget_arrow.ace_warning { border-color: #F1D817; } .error_widget.ace_info, .error_widget_arrow.ace_info { border-color: #5a5a5a; } .error_widget.ace_ok, .error_widget_arrow.ace_ok { border-color: #5aaa5a; } .error_widget_arrow { position: absolute; border: solid 5px; border-top-color: transparent !important; border-right-color: transparent !important; border-left-color: transparent !important; top: -5px; } </style> <style> .ace_snippet-marker { -moz-box-sizing: border-box; box-sizing: border-box; background: rgba(194, 193, 208, 0.09); border: 1px dotted rgba(211, 208, 235, 0.62); position: absolute; } </style> <style> .ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line { background-color: #CAD6FA; z-index: 1; } .ace_editor.ace_autocomplete .ace_line-hover { border: 1px solid #abbffe; margin-top: -1px; background: rgba(233, 233, 253, 0.4); } .ace_editor.ace_autocomplete .ace_line-hover { position: absolute; z-index: 2; } .ace_editor.ace_autocomplete .ace_scroller { background: none; border: none; box-shadow: none; } .ace_rightAlignedText { color: gray; display: inline-block; position: absolute; right: 4px; text-align: right; z-index: -1; } .ace_editor.ace_autocomplete .ace_completion-highlight { color: #000; text-shadow: 0 0 0.01em; } .ace_editor.ace_autocomplete { width: 280px; z-index: 200000; background: #fbfbfb; color: #444; border: 1px lightgray solid; position: fixed; box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); line-height: 1.4; } </style> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @*<script src="//hm.baidu.com/hm.js?4bad1df23f079e0d12bdbef5e65b072f"></script>*@ <script src="~/Scripts/ace/ace.js"></script> <script src="~/Scripts/ace/mode-javascript.js"></script> <script src="~/Scripts/plugins/echarts/echarts.js"></script> <script src="~/Scripts/ace/javascript.js"></script> <script src="~/Scripts/ace/text.js"></script> <script src="~/Scripts/ace/ext-language_tools.js"></script> <script src="~/Scripts/dat.gui.min.js"></script> <script src="~/Scripts/lodash.js"></script> <script src="~/Scripts/plugins/echarts3/map/china.js"></script> <script src="~/Scripts/plugins/echarts3/map/world.js"></script> <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&amp;ak=ZUONbpqGBsYGXNIYHicvbAbM"></script> <script type="text/javascript" src="http://api.map.baidu.com/getscript?v=2.0&amp;ak=ZUONbpqGBsYGXNIYHicvbAbM&amp;services=&amp;t=20170118185827"></script> <script src="~/Scripts/plugins/echarts3/extension/bmap.js"></script> <script src="~/Scripts/dataTool.js"></script> <script src="~/Scripts/editor.js"></script> <script src="~/Scripts/ecStat.min.js"></script> <script src="~/Scripts/hm.js"></script> </head> <body> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" data-toggle="collapse" data-target="#navbar-collapsed" aria-expanded="false" class="navbar-toggle collapsed"><span class="sr-only">toggle</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button> <a class="navbar-brand">ECharts Demo</a> </div> <div id="navbar-collapsed" class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-left"> <li id="nav-explore"><a href="index">All Demos</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="javascript:;" onclick="downloadExample()">Download Demo</a></li> <li class="highlight"><a href="https://ecomfe.github.io/echarts-doc/public/index.html">ECharts Docs</a></li> </ul> </div> </div> </nav> <div id="main-container"> <div id="code-container" style="width: 40%;"> <div id="control-panel"> <div id="code-info"></div> <div class="control-btn-panel"><a href="javascript:;" onclick="disposeAndRun()" class="btn btn-default btn-sm">Run</a> </div> </div> <div id="code-panel" class=" ace_editor ace-tm"> <textarea class="ace_text-input" wrap="off" autocorrect="off" autocapitalize="off" spellcheck="false" style="opacity: 0; height: 14px; width: 6.59781px; left: 70.3912px; top: 14px;"></textarea> <div class="ace_gutter"> <div class="ace_layer ace_gutter-layer ace_folding-enabled" style="margin-top: 0px; height: 235px; width: 40px;"> <div class="ace_gutter-cell " style="height: 14px;">1<span class="ace_fold-widget ace_start ace_open" style="height: 14px;"></span></div> <div class="ace_gutter-cell " style="height: 14px;">2</div> <div class="ace_gutter-cell " style="height: 14px;">3</div> <div class="ace_gutter-cell " style="height: 14px;">4</div> </div> <div class="ace_gutter-active-line" style="top: 14px; height: 14px;"></div> </div> <div class="ace_scroller" style="left: 40px; right: 0px; bottom: 0px;"> <div class="ace_content" style="margin-top: 0px; width: 506px; height: 235px; margin-left: 0px;"> <div class="ace_layer ace_print-margin-layer"> <div class="ace_print-margin" style="left: 531.825px; visibility: visible;"></div> </div> <div class="ace_layer ace_marker-layer"> <div class="ace_active-line" style="height: 14px; top: 14px; left: 0; right: 0;"></div> </div> <div class="ace_layer ace_text-layer" style="padding: 0px 4px;"> <div class="ace_line" style="height: 14px"> <span class="ace_storage ace_type">var</span> <span class="ace_identifier">option</span> <span class="ace_keyword ace_operator">=</span> <span class="ace_paren ace_lparen">{</span> </div> <div class="ace_line" style="height: 14px"> </div> <div class="ace_line" style="height: 14px"> <span class="ace_paren ace_rparen">}</span> <span class="ace_punctuation ace_operator">;</span> </div> <div class="ace_line" style="height: 14px"></div> </div> <div class="ace_layer ace_marker-layer"></div> <div class="ace_layer ace_cursor-layer ace_hidden-cursors"> <div class="ace_cursor" style="left: 30.3912px; top: 14px; width: 6.59781px; height: 14px;"></div> </div> </div> </div> <div class="ace_scrollbar ace_scrollbar-v" style="display: none; width: 22px; bottom: 0px;"> <div class="ace_scrollbar-inner" style="width: 22px; height: 56px;"></div> </div> <div class="ace_scrollbar ace_scrollbar-h" style="display: none; height: 22px; left: 40px; right: 0px;"> <div class="ace_scrollbar-inner" style="height: 22px; width: 546px;"></div> </div> <div style="height: auto; width: auto; top: 0px; left: 0px; visibility: hidden; position: absolute; white-space: pre; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; overflow: hidden;"> <div style="height: auto; width: auto; top: 0px; left: 0px; visibility: hidden; position: absolute; white-space: pre; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; overflow: visible;"></div> <div style="height: auto; width: auto; top: 0px; left: 0px; visibility: hidden; position: absolute; white-space: pre; font-style: inherit; font-variant: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; overflow: visible;">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</div> </div> </div> </div> <div id="h-handler" class="handler" style="left: 40%;"></div> <div class="right-container" style="width: 60%; left: 40%;"> <div id="chart-panel" class="right-panel" _echarts_instance_="ec_1486224628245" style="-webkit-tap-highlight-color: transparent; user-select: none;"> <div style="position: relative; overflow: hidden; width: 800px; height: 217px; padding: 0px; margin: 0px; border-width: 0px;"></div> </div> </div> </div> <script> if (window !== top) { var nav = document.getElementsByClassName('navbar')[0]; nav.parentNode.removeChild(nav); document.getElementById('main-container').style.top = 0; }</script> </body> </html>
the_stack
@{ Layout = ""; } <!DOCTYPE html> <html lang="en"> <head> <!--Third party scripts and code linked to or referenced here are licensed to you by the third parties that own such code, not by Microsoft, see ASP.NET Ajax CDN Terms of Use – http://www.asp.net/ajaxlibrary/CDN.ashx.--> <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script> <script src="/bundles/xboxgeneral?v=5ugPc53cuTQDtFQCQ0UBEDFegj3-0KTEkIwIUwig_041"></script> <script src="/bundles/xboxblukai?v=_NAW9I-HH9h0UW0DNRYP0d7LInPqgli4LijFVInFhj01"></script> <script src="//nexus.ensighten.com/xbox/Bootstrap.js"></script> <!-- v 1608.8111.0.0 s OQN3CFNRq4idlm04I5eTPA== r ad27ed55-f954-4235-8fea-747cb05c1d78 --> <meta name="application-name" content="The Official Xbox 360 Website" /> <meta name="msapplication-tooltip" content="The Official Xbox 360 Website" /> <meta name="msapplication-task" content="name=My Xbox;action-uri=http://live.xbox.com?cid=jumplist:Live;icon-uri=http://nxeassets.xbox.com/shaxam/0201/30/fc/30fc9af1-e46f-4cee-b034-21a9c0c75461.ICO?v=1#xbl.ICO" /> <meta name="msapplication-task" content="name=Games + Marketplace;action-uri=http://marketplace.xbox.com?cid=jumplist:marketplace;icon-uri=http://nxeassets.xbox.com/shaxam/0201/30/fc/30fc9af1-e46f-4cee-b034-21a9c0c75461.ICO?v=1#xbl.ICO" /> <meta name="msapplication-task" content="name=Xbox Support;action-uri=http://support.xbox.com;icon-uri=http://support.xbox.com/SiteAssets/XboxSupportV2/images/favicon.ico" /> <meta name="msapplication-task" content="name=PC Setup;action-uri=http://www.xbox.com/PCSetup?cid=jumplist:pcsetup;icon-uri=http://support.xbox.com/SiteAssets/XboxSupportV2/images/favicon.ico" /> <meta name="ms.siteorg" content="Entertainment and Devices" /> <meta name="ms.sitename" content="Xbox" /> <meta name="ms.loc" content="RO" /> <meta name="ms.lang" content="en" /> <meta name="ms.locale" content="" /> <link href="/bundles/xboxsplash2016?v=A7Ka3oyvseaZhlxbMUSKboCzTTrDU-Mc_GkD5Y9TM-41" rel="stylesheet"/> <script> (function () { var html5Elements = ['article', 'section', 'header', 'nav', 'footer', 'aside']; for (var i = 0; i < html5Elements.length; i++) { document.createElement(html5Elements[i]); } })(); </script> <script> var mobileChatCapable = false </script> <script> try { var utcOffsetMinutes = new Date().getTimezoneOffset() * -1; setCookie("UtcOffsetMinutes", utcOffsetMinutes, 30); } catch (e) { } </script> <script> define('capiConfig', [], function () { return { isEnabled: 'False' == 'True' } }); </script> <script src="/bundles/capi?v=1iarK_T2jKBJ-MLyQRAlSeldRJmfEryTSTlz3X58x6Y1"></script> <script> window.xboxComShellData = {"version":"1608.8111.0.0","defaultOptionIndex":0,"searchScopeOptions":[{"value":"http://www.xbox.com/en-GB/Search?q={0}#All","context":"Search All","label":"In All","id":"All","enumValue":0},{"value":"http://www.xbox.com/en-GB/Search?q={0}#General","context":"Search General","label":"In General","id":"General","enumValue":10},{"value":"http://www.xbox.com/en-GB/Search?q={0}#Games","context":"Search Games","label":"In Games","id":"Games","enumValue":20},{"value":"http://www.xbox.com/en-GB/Search?q={0}#Support","context":"Search Support","label":"In Support","id":"Support","enumValue":30},{"value":"http://www.xbox.com/en-GB/Search?q={0}#Forums","context":"Search Forums","label":"In Forums","id":"Forums","enumValue":40}]}; </script> <link href="/en-us/global-resources/Picchu-Grid/CSS/mscom-grid-mixed.css" rel="stylesheet"/> <link href="/en-us/global-resources/Picchu-Grid/CSS/Picchu.css" rel="stylesheet"/> <!--------- css --------------> <link rel="Stylesheet" type="text/css" href="/en-GB/home2015/css/gow-paypal/style.css" /> <link rel="Stylesheet" type="text/css" href="/en-GB/home2015/css/xboxHome.css.v3" /> <link rel="stylesheet" src="http://www.xbox.com/en-GB/home2015/css/slickSlider/slickSlider.css" /> <!-------- js ----------------> <script type="text/javascript" src="http://www.xbox.com/en-GB/home2015/css/slickSlider/slickSlider.js"></script> <!-- Opengraph --> <meta property="og:title" content="Xbox | Games and Entertainment on All Your Devices" /> <meta property="og:type" content="website" /> <meta property="og:description" content="Experience the new generation of games and entertainment with Xbox. Play Xbox games and stream video on all your devices."/> <meta property="og:image" content="http://compass.xbox.com/assets/a9/d0/a9d03015-2760-43df-8056-d23af1969289.gif?n=xbox_facebook_200x200.gif" /> <meta property="og:url" content="http://www.xbox.com/en-GB" /> <meta property="og:site_name" content="Xbox.com" /> <meta name="twitter:card" content="summary"> <meta name="twitter:site" content="@@xbox"> <meta name="twitter:title" content="Xbox | Official Site"> <meta name="twitter:description" content="Experience the new generation of games and entertainment with Xbox. Play Xbox games and stream video on all your devices."> <meta name="ms.sitename" content="Xbox"> <meta name="ms.lang" content="en"> <meta name="ms.loc" content="gb"> <meta name="ms.sitesec" content="xbox"> <meta name="ms.gpn" content="/home"> <meta name=viewport content="initial-scale=1"> <meta name="google-site-verification" content="vP1m7Sdno2pFMNWyDVKozc1D7kICS0oFiFN0uKHTk3Q" /> <meta name="description" content="Experience a new generation of games and entertainment with Xbox. The best games and entertainment on all of your devices." /> <meta name="keywords" content="xbox, xbox one, xbox 360, games, microsoft xbox, apps, live, gold, support, accessories, video games, consoles, halo" /> <title>Xbox UK Home | Consoles, Bundles, Games &amp; Support | Xbox.com</title> <script> var xboxComShellData = {}; xboxComShellData.searchScopeOptions = []; xboxComShellData.version = "0.0.0.0"; xboxComShellData.searchScopeOptions.push({ value: "http://www.xbox.com/en-GB/Search?q={0}#All", context: "Search All", label: "In All", id: "All", enumValue: 0 }); xboxComShellData.searchScopeOptions.push({ value: "http://www.xbox.com/en-GB/Search?q={0}#General", context: "Search General", label: "In General", id: "General", enumValue: 10 }); xboxComShellData.searchScopeOptions.push({ value: "http://www.xbox.com/en-GB/Search?q={0}#Games", context: "Search Games", label: "In Games", id: "Games", enumValue: 20 }); xboxComShellData.searchScopeOptions.push({ value: "http://www.xbox.com/en-GB/Search?q={0}#Support", context: "Search Support", label: "In Support", id: "Support", enumValue: 30 }); xboxComShellData.searchScopeOptions.push({ value: "http://www.xbox.com/en-GB/Search?q={0}#Forums", context: "Search Forums", label: "In Forums", id: "Forums", enumValue: 40 }); xboxComShellData.defaultOptionIndex = 0; require(['window.postXDMessage', 'jquery'], function (postXDMessage, $) { $(function () { postXDMessage({ verb: 'CURRENT_PAGE', uri: window.location.href }, "OTHER"); }); }); </script> <link rel="shortcut icon" href="/shell/images/favicon.ico" /> </head> <body id="DocumentBody" class="marketplaceEnabled pointsDisabled goldEnabled musicPassEnabled" > <div id="bodycolumn"> <link href="https://assets.onestore.ms/cdnfiles/onestorerolling-1608-23000/shell/v3/scss/shell.min.css" rel="stylesheet" type="text/css" /> <!--[if lte IE 8]> <link href="https://assets.onestore.ms/cdnfiles/onestorerolling-1608-23000/shell/common/respond-proxy.html" id="respond-proxy" rel="respond-proxy"/> <![endif]--> <!--[if lte IE 8]> <script src="https://assets.onestore.ms/cdnfiles/onestorerolling-1608-23000/shell/common/js/shell_ie8.js"></script> <![endif]--> <script async src="https://mem.gfx.ms/meversion?partner=xboxcomuhf&market=en-GB"></script> <script src="https://assets.onestore.ms/cdnfiles/onestorerolling-1608-23000/shell/generated/shellservice.v3.min.js"></script> <script src="https://www.microsoft.com/uniblends/scripts/blender.js"></script> <div id="shell-header" class="shell-header shell-responsive " ms.pgarea="header" role="banner"> <div class="shell-header-wrapper"> <div class="shell-header-top" data-bi-area="HeaderL0" data-bi-view="L0V1"> <div class="shell-header-brand" ms.cmpgrp="logo"> <a id="srv_shellHeaderMicrosoftLogo" href="https://www.microsoft.com" ms.cmpnm="MicrosoftBrandLogo" ms.title="Microsoft" title="Microsoft" data-bi-name="BrandLogo" tabindex="10"> <img src="https://assets.onestore.ms/cdnfiles/onestorerolling-1608-23000/shell/v3/images/logo/microsoft.png" alt="Microsoft" /> </a> </div> <div class="shell-header-nav-wrapper" ms.cmpgrp="nav" role="navigation"> <ul class="shell-header-nav" role="menubar" id="srv_shellHeaderNav" data-bi-area="L1" data-bi-view="Hovermenus"> <li class="shell-header-user-mobile-container"> </li> <li class="shell-header-dropdown " data-navcontainer="shellmenu_14_NavContainer"> <div id="shellmenu_14" class="shell-header-dropdown-label"> <a id="Store-navigation" href="javascript:void(0)" role="button" aria-labelledby="shellmenu_14" aria-expanded="false" ms.title="Store" data-bi-name="Store" data-bi-slot="1" tabindex="20"> Store </a> </div> <div class="shell-header-dropdown-content " aria-hidden="true" role="menu"> <dl class="shell-header-dropdown-tab " ms.cmpnm="Store; Store home"> <dt id="shellmenu_15" class="shell-header-dropdown-tab-label shell-header-L2menu-direct-link"> <a href="https://www.microsoftstore.com/store/msuk/en_GB/home" ms.title="Store home" tabindex="20" data-bi-name="StoreHome">Store home</a> </dt> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Store; Devices"> <dt id="shellmenu_16" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Devices" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Devices <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_17"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Surface/categoryID.64664400?icid=All_Surface_surface_nav_22102014" class="shell-l3-list-item" ms.title="Microsoft Surface" tabindex="20" data-bi-name="Devices_Surface"> Microsoft Surface </a> </li> <li id="shellmenu_18"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/categoryID.68236400" class="shell-l3-list-item" ms.title="PCs &amp; tablets" tabindex="20" data-bi-name="Devices_PCsAndTablets"> PCs &amp; tablets </a> </li> <li id="shellmenu_19"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Xbox/categoryID.64542700" class="shell-l3-list-item" ms.title="Xbox" tabindex="20" data-bi-name="Devices_Xbox"> Xbox </a> </li> <li id="shellmenu_20"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/categoryID.69887700" class="shell-l3-list-item" ms.title="Microsoft Band" tabindex="20" data-bi-name="Store_MicrosoftBand"> Microsoft Band </a> </li> <li id="shellmenu_21"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Windows-Phone/categoryID.64542800" class="shell-l3-list-item" ms.title="Windows phone" tabindex="20" data-bi-name="Devices_WindowsPhone"> Windows phone </a> </li> <li id="shellmenu_22"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Accessories/categoryID.64542900" class="shell-l3-list-item" ms.title="Accessories" tabindex="20" data-bi-name="Devices_Accessories"> Accessories </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Store; Software"> <dt id="shellmenu_23" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Software" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Software <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_24"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Office/categoryID.64542500?icid=All_Office_office_nav_22102014" class="shell-l3-list-item" ms.title="Office" tabindex="20" data-bi-name="Store_Software_Office"> Office </a> </li> <li id="shellmenu_25"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Windows/categoryID.70034700" class="shell-l3-list-item" ms.title="Windows" tabindex="20" data-bi-name="Store_Software_Windows"> Windows </a> </li> <li id="shellmenu_26"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Additional-software/categoryID.64543000" class="shell-l3-list-item" ms.title="Additional software" tabindex="20" data-bi-name="Store_Software_AdditionalSoftware"> Additional software </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Store; Apps"> <dt id="shellmenu_27" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Apps" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Apps <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_28"> <a href="https://www.microsoft.com/en-gb/store/top-free/apps/pc" class="shell-l3-list-item" ms.title="All apps" tabindex="20" data-bi-name="Store_AllApps"> All apps </a> </li> <li id="shellmenu_29"> <a href="https://www.microsoft.com/en-gb/store/apps/windows" class="shell-l3-list-item" ms.title="Windows apps" tabindex="20" data-bi-name="Store_Apps_Windowsapps"> Windows apps </a> </li> <li id="shellmenu_30"> <a href="https://www.microsoft.com/en-gb/store/apps/windows-phone" class="shell-l3-list-item" ms.title="Windows Phone apps" tabindex="20" data-bi-name="Store_Apps_WindowsPhoneapps"> Windows Phone apps </a> </li> <li id="shellmenu_31"> <a href="http://www.xbox.com/en-GB/entertainment/xbox-one/live-apps" class="shell-l3-list-item" ms.title="Xbox apps" tabindex="20" data-bi-name="Store_XboxApps"> Xbox apps </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Store; Games"> <dt id="shellmenu_32" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Games" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Games <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_33"> <a href="https://www.microsoft.com/en-gb/store/games" class="shell-l3-list-item" ms.title="All games" tabindex="20" data-bi-name="Store_AllGames"> All games </a> </li> <li id="shellmenu_34"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Xbox-One-all-games-games/categoryID.71132600" class="shell-l3-list-item" ms.title="Xbox One games" tabindex="20" data-bi-name="Store_Xbox One games"> Xbox One games </a> </li> <li id="shellmenu_35"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/list/Xbox-360-games/categoryID.68283700" class="shell-l3-list-item" ms.title="Xbox 360 games" tabindex="20" data-bi-name="Store_Xbox360Games"> Xbox 360 games </a> </li> <li id="shellmenu_36"> <a href="https://www.microsoft.com/en-gb/store/games/windows" class="shell-l3-list-item" ms.title="Windows games " tabindex="20" data-bi-name="Store_Games_Windowsgames"> Windows games </a> </li> <li id="shellmenu_37"> <a href="https://www.microsoft.com/en-gb/store/games/windows-phone" class="shell-l3-list-item" ms.title="Games for Windows Phone" tabindex="20" data-bi-name="Store_Games_WindowsPhonegames"> Games for Windows Phone </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Store; Entertainment"> <dt id="shellmenu_38" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Entertainment" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Entertainment <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_39"> <a href="https://www.microsoft.com/en-gb/store/entertainment" class="shell-l3-list-item" ms.title="All entertainment " tabindex="20" data-bi-name="Store_Entertainment_AllEntertainment"> All entertainment </a> </li> <li id="shellmenu_40"> <a href="https://www.microsoft.com/en-gb/store/movies-and-tv" class="shell-l3-list-item" ms.title="Films &amp; TV" tabindex="20" data-bi-name="Store_Entertainment_MoviesAndTV"> Films &amp; TV </a> </li> <li id="shellmenu_41"> <a href="https://www.microsoft.com/en-gb/store/music" class="shell-l3-list-item" ms.title="Music" tabindex="20" data-bi-name="Store_Entertainment_Music"> Music </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Store; Business &amp; Education"> <dt id="shellmenu_42" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Business &amp; Education" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Business &amp; Education <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_43"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Small-Business/categoryID.68214400" class="shell-l3-list-item" ms.title="Business" tabindex="20" data-bi-name="BusinessandEducation_Business"> Business </a> </li> <li id="shellmenu_44"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Student-store/categoryID.64543200" class="shell-l3-list-item" ms.title="Student store" tabindex="20" data-bi-name="BusinessandEducation_Education"> Student store </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Store; Sales"> <dt id="shellmenu_45" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Sales" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Sales <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_46"> <a href="https://www.microsoftstore.com/store/msuk/en_GB/cat/Student-store/categoryID.64543200" class="shell-l3-list-item" ms.title="Back to school" tabindex="20" data-bi-name="Store_BTS"> Back to school </a> </li> <li id="shellmenu_47"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/categoryID.67806600" class="shell-l3-list-item" ms.title="Sales" tabindex="20" data-bi-name="Store_Sale"> Sales </a> </li> <li id="shellmenu_48"> <a href="https://www.microsoft.com/en-gb/store/gift-cards" class="shell-l3-list-item" ms.title="Gift cards" tabindex="20" data-bi-name="Store_GiftCards"> Gift cards </a> </li> </ul> </dd> </dl> </div> </li> <li class="shell-header-dropdown " data-navcontainer="shellmenu_49_NavContainer"> <div id="shellmenu_49" class="shell-header-dropdown-label"> <a id="Products-navigation" href="javascript:void(0)" role="button" aria-labelledby="shellmenu_49" aria-expanded="false" ms.title="Products" data-bi-name="Products" data-bi-slot="2" tabindex="20"> Products </a> </div> <div class="shell-header-dropdown-content " aria-hidden="true" role="menu"> <dl class="shell-header-dropdown-tab " ms.cmpnm="Products; Software &amp; services"> <dt id="shellmenu_50" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Software &amp; services" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Software &amp; services <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_51"> <a href="//www.microsoft.com/en-gb/windows" class="shell-l3-list-item" ms.title="Windows" tabindex="20" data-bi-name="Products_SoftwareAndServices_Windows"> Windows </a> </li> <li id="shellmenu_52"> <a href="https://products.office.com/en-gb/home?WT.mc_id=oan_winnav_office" class="shell-l3-list-item" ms.title="Office" tabindex="20" data-bi-name="Products_SoftwareAndServices_Office"> Office </a> </li> <li id="shellmenu_53"> <a href="http://www.microsoft.com/en-gb/download/default.aspx" class="shell-l3-list-item" ms.title="Free downloads &amp; security" tabindex="20" data-bi-name="Products_SoftwareAndServices_FreeDownloadsAndSecurity"> Free downloads &amp; security </a> </li> <li id="shellmenu_54"> <a href="http://windows.microsoft.com/en-gb/internet-explorer/download-ie" class="shell-l3-list-item" ms.title="Internet Explorer" tabindex="20" data-bi-name="Products_SoftwareAndServices_InternetExplorer"> Internet Explorer </a> </li> <li id="shellmenu_55"> <a href="http://www.microsoft.com/en-gb/windows/microsoft-edge" class="shell-l3-list-item" ms.title="Microsoft Edge" tabindex="20" data-bi-name="Products_SoftwareAndServices_MicrosoftEdge"> Microsoft Edge </a> </li> <li id="shellmenu_56"> <a href="http://www.skype.com/en/" class="shell-l3-list-item" ms.title="Skype" tabindex="20" data-bi-name="Products_SoftwareAndServices_Skype"> Skype </a> </li> <li id="shellmenu_57"> <a href="http://www.onenote.com/?omkt=en-GB&amp;WT.mc_id=oan_winnav_onenote" class="shell-l3-list-item" ms.title="OneNote" tabindex="20" data-bi-name="Products_SoftwareAndServices_OneNote"> OneNote </a> </li> <li id="shellmenu_58"> <a href="https://onedrive.live.com/about/en-gb/" class="shell-l3-list-item" ms.title="OneDrive" tabindex="20" data-bi-name="Products_SoftwareAndServices_OneDrive"> OneDrive </a> </li> <li id="shellmenu_59"> <a href="http://www.microsoft.com/microsoft-health/en-gb" class="shell-l3-list-item" ms.title="Microsoft Health" tabindex="20" data-bi-name="Products_SoftwareAndServices_MicrosoftHealth"> Microsoft Health </a> </li> <li id="shellmenu_60"> <a href="http://www.msn.com/?ocid=HEA000" class="shell-l3-list-item" ms.title="MSN" tabindex="20" data-bi-name="Products_SoftwareAndServices_MSN"> MSN </a> </li> <li id="shellmenu_61"> <a href="http://www.bing.com" class="shell-l3-list-item" ms.title="Bing" tabindex="20" data-bi-name="Products_SoftwareAndServices_Bing"> Bing </a> </li> <li id="shellmenu_62"> <a href="https://www.microsoft.com/en-gb/groove" class="shell-l3-list-item" ms.title="Microsoft Groove" tabindex="20" data-bi-name="Products_SoftwareAndServices_XboxMusic"> Microsoft Groove </a> </li> <li id="shellmenu_63"> <a href="https://www.microsoft.com/en-gb/movies-and-tv" class="shell-l3-list-item" ms.title="Microsoft Films &amp; TV" tabindex="20" data-bi-name="Products_SoftwareAndServices_XboxVideo"> Microsoft Films &amp; TV </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Products; Devices &amp; Xbox"> <dt id="shellmenu_64" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="Devices &amp; Xbox" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> Devices &amp; Xbox <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_65"> <a href="https://www.microsoft.com/devices/en-gb" class="shell-l3-list-item" ms.title="All Microsoft devices" tabindex="20" data-bi-name="Products_DevicesAndXbox"> All Microsoft devices </a> </li> <li id="shellmenu_66"> <a href="http://www.microsoft.com/surface/en-gb" class="shell-l3-list-item" ms.title="Microsoft Surface" tabindex="20" data-bi-name="Products_DevicesAndXbox_Surface"> Microsoft Surface </a> </li> <li id="shellmenu_67"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/cat/Computers-amp-Tablets/categoryID.68236400" class="shell-l3-list-item" ms.title="All Windows PCs &amp; tablets" tabindex="20" data-bi-name="Products_DevicesAndXbox_AllPCsAndTablets"> All Windows PCs &amp; tablets </a> </li> <li id="shellmenu_68"> <a href="https://www.microsoft.com/hardware/en-gb" class="shell-l3-list-item" ms.title="PC Accessories" tabindex="20" data-bi-name="Products_PCAccessories"> PC Accessories </a> </li> <li id="shellmenu_69"> <a href="http://www.xbox.com/en-gb/" class="shell-l3-list-item" ms.title="Xbox &amp; games" tabindex="20" data-bi-name="Products_DevicesAndXbox_XboxAndGames"> Xbox &amp; games </a> </li> <li id="shellmenu_70"> <a href="http://www.microsoft.com/microsoft-band/en-gb" class="shell-l3-list-item" ms.title="Microsoft Band" tabindex="20" data-bi-name="Products_DevicesAndXbox_MicrosoftBand"> Microsoft Band </a> </li> <li id="shellmenu_71"> <a href="http://www.microsoft.com/en-gb/mobile/" class="shell-l3-list-item" ms.title="Microsoft Lumia" tabindex="20" data-bi-name="Products_MicrosoftLumia"> Microsoft Lumia </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Products; For business"> <dt id="shellmenu_72" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="For business" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> For business <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_73"> <a href="http://www.microsoft.com/en-gb/server-cloud/" class="shell-l3-list-item" ms.title="Cloud platform" tabindex="20" data-bi-name="Products_ForBusiness_CloudPlatform"> Cloud platform </a> </li> <li id="shellmenu_74"> <a href="http://azure.microsoft.com/en-gb/" class="shell-l3-list-item" ms.title="Microsoft Azure" tabindex="20" data-bi-name="Products_ForBusiness_MicrosoftAzure"> Microsoft Azure </a> </li> <li id="shellmenu_75"> <a href="http://www.microsoft.com/en-gb/dynamics/default.aspx" class="shell-l3-list-item" ms.title="Microsoft Dynamics" tabindex="20" data-bi-name="Products_ForBusiness_MicrosoftDynamics"> Microsoft Dynamics </a> </li> <li id="shellmenu_76"> <a href="http://www.microsoft.com/en-gb/windows/business/default.aspx" class="shell-l3-list-item" ms.title="Windows for business" tabindex="20" data-bi-name="Products_ForBusiness_WindowsForBusiness"> Windows for business </a> </li> <li id="shellmenu_77"> <a href="http://office.microsoft.com/en-gb/business?WT.mc_id=oan_winnav_officebusn" class="shell-l3-list-item" ms.title="Office for Business" tabindex="20" data-bi-name="Products_ForBusiness_OfficeForBusiness"> Office for Business </a> </li> <li id="shellmenu_78"> <a href="http://www.skype.com/en/business/" class="shell-l3-list-item" ms.title="Skype for Business" tabindex="20" data-bi-name="Products_ForBusiness_SkypeForBusiness"> Skype for Business </a> </li> <li id="shellmenu_79"> <a href="http://www.microsoft.com/surface/en-gb/business/overview" class="shell-l3-list-item" ms.title="Surface for business" tabindex="20" data-bi-name="Products_ForBusiness_SurfaceForBusiness"> Surface for business </a> </li> <li id="shellmenu_80"> <a href="http://enterprise.microsoft.com/en-gb/" class="shell-l3-list-item" ms.title="Enterprise solutions" tabindex="20" data-bi-name="Products_ForBusiness_EnterpriseSolutions"> Enterprise solutions </a> </li> <li id="shellmenu_81"> <a href="https://business.microsoft.com/en-gb/" class="shell-l3-list-item" ms.title="Small business solutions" tabindex="20" data-bi-name="Products_ForBusiness_SmallBusinessSolutions"> Small business solutions </a> </li> <li id="shellmenu_82"> <a href="https://pinpoint.microsoft.com/en-gb" class="shell-l3-list-item" ms.title="Find a solutions provider" tabindex="20" data-bi-name="Products_ForBusiness_FindASolutionsProvider"> Find a solutions provider </a> </li> <li id="shellmenu_83"> <a href="https://www.microsoft.com/en-gb/licensing/" class="shell-l3-list-item" ms.title="Volume Licensing" tabindex="20" data-bi-name="Products_ForBusiness_VolumeLicensing"> Volume Licensing </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Products; For developers &amp; IT pros"> <dt id="shellmenu_84" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="For developers &amp; IT pros" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> For developers &amp; IT pros <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_85"> <a href="https://dev.windows.com/en-us" class="shell-l3-list-item" ms.title="Develop Windows apps" tabindex="20" data-bi-name="Products_DeveloperAndITPro_DevelopWindowsApps"> Develop Windows apps </a> </li> <li id="shellmenu_86"> <a href="http://azure.microsoft.com/en-gb/" class="shell-l3-list-item" ms.title="Microsoft Azure" tabindex="20" data-bi-name="Products_ForDevelopersAndITPros_Azure"> Microsoft Azure </a> </li> <li id="shellmenu_87"> <a href="https://msdn.microsoft.com/en-gb/" class="shell-l3-list-item" ms.title="MSDN" tabindex="20" data-bi-name="Products_ForDevelopersAndITPros"> MSDN </a> </li> <li id="shellmenu_88"> <a href="http://technet.microsoft.com/en-gb/" class="shell-l3-list-item" ms.title="Technet" tabindex="20" data-bi-name="Products_ForDevelopersAndITPros_TechNet"> Technet </a> </li> <li id="shellmenu_89"> <a href="http://www.visualstudio.com/en-gb" class="shell-l3-list-item" ms.title="Visual Studio" tabindex="20" data-bi-name="Products_ForDevelopersAndITPros_VisualStudio"> Visual Studio </a> </li> </ul> </dd> </dl> <dl class="shell-header-dropdown-tab " ms.cmpnm="Products; For students &amp; educators"> <dt id="shellmenu_90" class="shell-header-dropdown-tab-label"> <a href="javascript:void(0)" role="button" ms.title="For students &amp; educators" ms.interactiontype="14" tabindex="20" data-bi-dnt=""> For students &amp; educators <i class="shell-icon-dropdown facing-right"></i> </a> </dt> <dd class="shell-header-dropdown-tab-content" data-col="0"> <ul class="shell-header-dropdown-tab-list"> <li id="shellmenu_91"> <a href="http://www.microsoftstore.com/store/msuk/en_GB/list/Surface/categoryID.68011900" class="shell-l3-list-item" ms.title="Shop PCs &amp; tablets perfect for students" tabindex="20" data-bi-name="Products_ForStudentsAndEducators_ShopPCsAndTablets"> Shop PCs &amp; tablets perfect for students </a> </li> <li id="shellmenu_92"> <a href="https://www.microsoft.com/en-gb/education/default.aspx" class="shell-l3-list-item" ms.title="Microsoft in Education" tabindex="20" data-bi-name="Products_ForStudentsAndEducators_MicrosoftInEducation"> Microsoft in Education </a> </li> </ul> </dd> </dl> </div> </li> <li id="l1_support" class="shell-header-dropdown-label"> <a class="top-level-link-text ctl_headerNavLink" tabindex="20" href="https://support.microsoft.com/en-gb" ms.title="Support" data-bi-name="Support" data-bi-slot="3"> Support </a> </li> </ul> </div> <div class="shell-header-user-container"> <dl class="shell-header-user"> <dt> <span id="meControl"> <div class="msame_Header" tabindex="60" style="display: inline-block; height: 48px; font-size: 14px; border: 1px solid transparent; border-bottom-style: none; width: 100%;"> <div class="msame_Header_name" style="line-height: 48px; max-width: 160px; display: inline-block; vertical-align: top; font-size: 86%; color: #505050; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; word-break: break-all">Sign in </div> </div> </span> </dt> </dl> </div> <div class="shell-header-nav-toggle " ms.cmpgrp="nav"> <button class="shell-header-toggle-menu" ms.cmpnm="mobile global nav toggle button" ms.title="Toggle menu" title="Toggle Menu" type="button" data-bi-name="Toggle Menu" tabindex="55"> <i class="shell-icon-menu"></i> </button> </div> <ul class="shell-header-toggle" ms.cmpgrp="header actions"> <li> <button class="shell-header-toggle-search" type="button" data-bi-name="Toggle Search Icon" ms.title="search toggle" title="Toggle Search" tabindex="45"> <i class="shell-icon-search"></i> </button> </li> <li> <a id="shell-header-shopping-cart-mobile" href="//www.microsoftstore.com/store/msuk/en_GB/DisplayThreePgCheckoutShoppingCartPage" class="shell-header-toggle-cart" title="Cart" data-bi-name="Toggle Cart" ms.title="cart" tabindex="50"> <i id="toggle-shell-icon-cart" class="shell-icon-cart"></i> <span class="sr-only">Cart</span> <span class="shopping-cart-amount"></span> </a> </li> </ul> <div class="shell-header-actions" ms.cmpgrp="header actions"> <form id="srv_shellHeaderSearchForm" class="shell-search" role="search" action="http://www.xbox.com/en-gb/Search" method="GET" autocomplete="off" onsubmit=" return window.msCommonShell.onSearch(this) " ms.cmpnm="search"> <div class="shell-search-wrapper"> <label for="cli_shellHeaderSearchInput" class="sr-only">Search Microsoft</label> <input id="cli_shellHeaderSearchInput" type="search" title="" name="q" data-bi-dnt="" placeholder="" maxlength="200" tabindex="30" /> <button type="submit" title="Search" data-bi-dnt="" tabindex="40"> <i class="shell-icon-search"></i> <span class="sr-only">Search</span> </button> <div id="cli_searchSuggestionsContainer" class="shell-search-dropdown-container"> <div class="search-dropdown"> <div class="dropdown-item"> <ul id="cli_searchSuggestionsResults" data-bi-name="Search Suggestions" data-bi-source="UnifiedSearch" ms.cmpgrp="search suggestions"></ul> </div> </div> </div> </div> </form> <div class="shell-header-cart"> <a id="shell-header-shopping-cart" href="//www.microsoftstore.com/store/msuk/en_GB/DisplayThreePgCheckoutShoppingCartPage" data-bi-name="Shopping Cart" title="Cart" ms.title="cart" tabindex="50"> <i class="shell-icon-cart"></i> <span class="sr-only">Cart</span> <span class="shopping-cart-amount"></span> </a> </div> <iframe id="shell-cart-count" data-src="//www.microsoftstore.com/store/msuk/en_GB/Content/pbPage.CartSummary" style="display: none"></iframe> </div> </div> </div> </div> <div class="fixed-global-nav-buffer"></div> <!--[if lt IE 9]> <div class="shell-category-header lt-ie9 cat-theme-green" ms.pgarea="categoryheader"> <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--> <div class="shell-category-header cat-theme-green" ms.pgarea="categoryheader"> <!--<![endif]--> <div role="navigation" aria-label="Category level navigation" class="shell-category-nav" ms.cmpgrp="cat nav" data-bi-area="CategoryHeader-" data-bi-view="C0"> <div class="c-nav-pagination c-nav-pagination-prev"> <i class="shell-icon-dropdown facing-left"></i> </div> <ul class="shell-category-top-level shell-category-brand"> <li class="c-logo-item"> <a id="shell-cat-header-logo" class="c-logo c-top-nav-link" href="http://www.xbox.com/en-GB/?xr=mebarnav" title="Xbox" ms.title="" data-bi-name="Category logo" tabindex="70"> <span class="cat-class-logo icon-xbox-logo"></span> <img class="cat-logo-png icon-xbox-logo" alt="Xbox" src="https://assets.onestore.ms/cdnfiles/onestorerolling-1608-23000/shell/v3/images/logo/icon-xbox-logo.png"/> </a> <a id="shell-cat-header-logo-mobile" class="c-logo-mobile c-top-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="" ms.interactiontype="14" data-bi-name="Mobile category logo" tabindex="70"> <span class="cat-class-logo icon-xbox-logo"></span> <img class="cat-logo-png icon-xbox-logo" alt="Xbox" src="https://assets.onestore.ms/cdnfiles/onestorerolling-1608-23000/shell/v3/images/logo/icon-xbox-logo.png"/> <i class="shell-icon-dropdown"></i> </a> <ul class="c-nav-dropdown-menu" role="menu" data-bi-area="CategoryHeader-" data-bi-view="C1"> <li class="c-top-nav-item" id="shellmenu_93-mobilelist"> <a id="shellmenu_93-mobile" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_93-mobilelist" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Xbox One" role="button" ms.interactiontype="14" data-bi-name="XboxOne" data-bi-slot="1" data-show-cta="True"> <span>Xbox One<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="XboxOne-C2" ms.cmpnm="Xbox One" role="menu"> <li class="c-nav-item "> <a id="shellmenu_94-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one-s?xr=shellnav" ms.title="Meet Xbox One S" data-bi-name="Xbox_One_S" data-bi-slot="1" tabindex="70"> <span> Meet Xbox One S </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_95-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one?xr=shellnav" ms.title="Meet Xbox One" data-bi-name="XboxOne_MeetXboxOne" data-bi-slot="2" tabindex="70"> <span> Meet Xbox One </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_96-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/project-scorpio?xr=shellnav" ms.title="Project Scorpio" data-bi-name="Scorpio" data-bi-slot="3" tabindex="70"> <span> Project Scorpio </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_97-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/consoles?xr=shellnav" ms.title="Consoles" data-bi-name="XboxOne_BuyNow" data-bi-slot="4" tabindex="70"> <span> Consoles </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_98-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/experience?xr=shellnav" ms.title="New Xbox Experience" data-bi-name="XboxOne_NewXboxExperience" data-bi-slot="5" tabindex="70"> <span> New Xbox Experience </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_99-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/backward-compatibility" ms.title="Backward Compatibility" data-bi-name="XboxOne_Backward_Compatibility" data-bi-slot="6" tabindex="70"> <span> Backward Compatibility </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_100-mobile" class="c-nav-dropdown-item c-nav-link c-top-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Entertainment on Xbox" role="button" data-bi-name="Entertainment_on_Xbox" data-bi-slot="7" tabindex="70"> <span> Entertainment on Xbox <i class="shell-icon-dropdown"></i> </span> </a> <ul class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Entertainment_on_Xbox-C3" ms.cmpnm="Entertainment on Xbox" role="menu"> <li> <a id="shellmenu_101" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/video?xr=shellnav" ms.title="Movies &amp; TV" data-bi-name="Movies_TV" data-bi-slot="1" tabindex="70"> <span>Movies &amp; TV</span> </a> </li> <li> <a id="shellmenu_102" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/music?xr=shellnav" ms.title="Music" data-bi-name="Entertainment_Music" data-bi-slot="2" tabindex="70"> <span>Music</span> </a> </li> <li> <a id="shellmenu_103" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/xbox-one/games/xbox-fitness?xr=shellnav" ms.title="Xbox Fitness" data-bi-name="Xbox_Fitness" data-bi-slot="3" tabindex="70"> <span>Xbox Fitness</span> </a> </li> <li> <a id="shellmenu_104" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/entertainment/xbox-one/live-apps?xr=shellnav" ms.title="Xbox One Apps" data-bi-name="Xbox_One_Apps" data-bi-slot="4" tabindex="70"> <span>Xbox One Apps</span> </a> </li> <li> <a id="shellmenu_105" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/entertainment/xbox-360/live-apps?xr=shellnav" ms.title="Xbox 360 Apps" data-bi-name="Xbox_360_Apps" data-bi-slot="5" tabindex="70"> <span>Xbox 360 Apps</span> </a> </li> </ul> </li> <li class="c-nav-item "> <a id="shellmenu_106-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/games/xbox-360?xr=shellnav" ms.title="Xbox 360" data-bi-name="Games_Xbox360" data-bi-slot="8" tabindex="70"> <span> Xbox 360 </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_107-mobilelist"> <a id="shellmenu_107-mobile" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_107-mobilelist" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Games" role="button" ms.interactiontype="14" data-bi-name="Games" data-bi-slot="2" data-show-cta="True"> <span>Games<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Games-C2" ms.cmpnm="Games" role="menu"> <li class="c-nav-item "> <a id="shellmenu_108-mobile" class="c-nav-dropdown-item c-nav-link c-top-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Browse all games" role="button" data-bi-name="Browse_all_games" data-bi-slot="1" tabindex="70"> <span> Browse all games <i class="shell-icon-dropdown"></i> </span> </a> <ul class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Browse_all_games-C3" ms.cmpnm="Browse all games" role="menu"> <li> <a id="shellmenu_109" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/xbox-play-anywhere?xr=shellnav" ms.title="Xbox Play Anywhere" data-bi-name="Xbox_Play_Anywhere" data-bi-slot="1" tabindex="70"> <span>Xbox Play Anywhere</span> </a> </li> <li> <a id="shellmenu_110" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/xbox-one?xr=shellnav" ms.title="Xbox One" data-bi-name="Games_Xbox_One" data-bi-slot="2" tabindex="70"> <span>Xbox One</span> </a> </li> <li> <a id="shellmenu_111" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/xbox-one/backward-compatibility?xr=shellnav#bcGames" ms.title="Xbox One Compatible" data-bi-name="Xbox_One_Compatible" data-bi-slot="3" tabindex="70"> <span>Xbox One Compatible</span> </a> </li> <li> <a id="shellmenu_112" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/free-to-play?xr=shellnav" ms.title="Free to Play" data-bi-name="Free_to_Play" data-bi-slot="4" tabindex="70"> <span>Free to Play</span> </a> </li> <li> <a id="shellmenu_113" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/xbox-360?xr=shellnav" ms.title="Xbox 360" data-bi-name="Xbox_360" data-bi-slot="5" tabindex="70"> <span>Xbox 360</span> </a> </li> <li> <a id="shellmenu_114" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/windows?xr=shellnav" ms.title="Windows" data-bi-name="Windows" data-bi-slot="6" tabindex="70"> <span>Windows</span> </a> </li> <li> <a id="shellmenu_115" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/windows-phone?xr=shellnav" ms.title="Windows Phone" data-bi-name="Windows_Phone" data-bi-slot="7" tabindex="70"> <span>Windows Phone</span> </a> </li> </ul> </li> <li class="c-nav-item "> <a id="shellmenu_116-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/entertainment/xbox-one/live-apps/ea-access?xr=shellnav" ms.title="EA Access" data-bi-name="Games_EAAccess" data-bi-slot="2" tabindex="70"> <span> EA Access </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_117-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/games-with-gold?xr=shellnav" ms.title="Games with Gold" data-bi-name="Games_with_Gold" data-bi-slot="3" tabindex="70"> <span> Games with Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_118-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/deals-with-gold?xr=shellnav" ms.title="Deals with Gold" data-bi-name="Deals_with_Gold" data-bi-slot="4" tabindex="70"> <span> Deals with Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_119-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/promotions/sales/sales-and-specials?xr=shellnav" ms.title="Sales &amp; Specials" data-bi-name="Games_SalesAndSpecials" data-bi-slot="5" tabindex="70"> <span> Sales &amp; Specials </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_120-mobile" class="c-nav-dropdown-item c-nav-link " href="https://account.xbox.com/en-GB/PaymentAndBilling/RedeemCode?xr=shellnav" ms.title="Redeem Code" data-bi-name="XboxLiveGold_RedeemCode" data-bi-slot="6" tabindex="70"> <span> Redeem Code </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_121-mobilelist"> <a id="shellmenu_121-mobile" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_121-mobilelist" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Xbox Live" role="button" ms.interactiontype="14" data-bi-name="XboxLiveGold" data-bi-slot="3" data-show-cta="True"> <span>Xbox Live<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="XboxLiveGold-C2" ms.cmpnm="Xbox Live" role="menu"> <li class="c-nav-item "> <a id="shellmenu_122-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live?xr=shellnav" ms.title="Meet Xbox Live" data-bi-name="XboxLiveGold_MeetXboxLiveGold" data-bi-slot="1" tabindex="70"> <span> Meet Xbox Live </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_123-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/gold?xr=shellnav" ms.title="Join Xbox Live Gold" data-bi-name="XboxLiveGold_JoinXboxLiveGold" data-bi-slot="2" tabindex="70"> <span> Join Xbox Live Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_124-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/games-with-gold?xr=shellnav" ms.title="Games with Gold" data-bi-name="XboxLiveGold_GamesWithGold" data-bi-slot="3" tabindex="70"> <span> Games with Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_125-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/deals-with-gold?xr=shellnav" ms.title="Deals with Gold" data-bi-name="XboxLiveGold_DealsWithGold" data-bi-slot="4" tabindex="70"> <span> Deals with Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_126-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/rewards?xr=shellnav" ms.title="Xbox Live Rewards" data-bi-name="XboxLiveGold_XboxLiveRewards" data-bi-slot="5" tabindex="70"> <span> Xbox Live Rewards </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_127-mobile" class="c-nav-dropdown-item c-nav-link " href="https://account.xbox.com/en-GB/PaymentAndBilling/RedeemCode?xr=shellnav" ms.title="Redeem Code" data-bi-name="XboxLiveGold_RedeemCode" data-bi-slot="6" tabindex="70"> <span> Redeem Code </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_128-mobilelist"> <a id="shellmenu_128-mobile" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_128-mobilelist" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Accessories" role="button" ms.interactiontype="14" data-bi-name="Accessories" data-bi-slot="4" data-show-cta="True"> <span>Accessories<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Accessories-C2" ms.cmpnm="Accessories" role="menu"> <li class="c-nav-item "> <a id="shellmenu_129-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?xr=shellnav" ms.title="View all accessories" data-bi-name="View_all_accessories" data-bi-slot="1" tabindex="70"> <span> View all accessories </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_130-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?controllers" ms.title="Controllers &amp; Remotes" data-bi-name="Controllers_Remotes" data-bi-slot="2" tabindex="70"> <span> Controllers &amp; Remotes </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_131-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?headsets" ms.title="Headsets &amp; Communication" data-bi-name="Headsets_Communication" data-bi-slot="3" tabindex="70"> <span> Headsets &amp; Communication </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_132-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?harddrives" ms.title="Hard Drives &amp; Chargers" data-bi-name="Hard_Drives_Chargers" data-bi-slot="4" tabindex="70"> <span> Hard Drives &amp; Chargers </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_133-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?cables" ms.title="Cables &amp; Networking" data-bi-name="Cables_Networking" data-bi-slot="5" tabindex="70"> <span> Cables &amp; Networking </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_134-mobilelist"> <a id="shellmenu_134-mobile" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_134-mobilelist" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Xbox on Windows" role="button" ms.interactiontype="14" data-bi-name="GamingOnWindows" data-bi-slot="5" data-show-cta="True"> <span>Xbox on Windows<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="GamingOnWindows-C2" ms.cmpnm="Xbox on Windows" role="menu"> <li class="c-nav-item "> <a id="shellmenu_135-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/windows-10?xr=shellnav" ms.title="Windows 10 Gaming " data-bi-name="Windows10Gaming " data-bi-slot="1" tabindex="70"> <span> Windows 10 Gaming </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_136-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/windows-10/xbox-app?xr=shellnav" ms.title="Xbox App on Windows 10" data-bi-name="Xbox_App_Windows_10" data-bi-slot="2" tabindex="70"> <span> Xbox App on Windows 10 </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_137-mobile" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/windows-10/accessories?xr=shellnav" ms.title="Windows 10 Accessories" data-bi-name="Windows10_Accessories" data-bi-slot="3" tabindex="70"> <span> Windows 10 Accessories </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_138-mobilelist"> <a id="shellmenu_138-mobile" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_138-mobilelist" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Support" role="button" ms.interactiontype="14" data-bi-name="Support" data-bi-slot="6" data-show-cta="True"> <span>Support<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Support-C2" ms.cmpnm="Support" role="menu"> <li class="c-nav-item "> <a id="shellmenu_139-mobile" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com?xr=shellnav" ms.title="All support" data-bi-name="Support_AllSupport" data-bi-slot="1" tabindex="70"> <span> All support </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_140-mobile" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/xbox-one?xr=shellnav" ms.title="Xbox One" data-bi-name="Support_XboxOne" data-bi-slot="2" tabindex="70"> <span> Xbox One </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_141-mobile" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/xbox-360?xr=shellnav" ms.title="Xbox 360" data-bi-name="Support_Xbox360" data-bi-slot="3" tabindex="70"> <span> Xbox 360 </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_142-mobile" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/xbox-on-windows?xr=shellnav" ms.title="Xbox on Windows 10" data-bi-name="Support_XboxOnWindows" data-bi-slot="4" tabindex="70"> <span> Xbox on Windows 10 </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_143-mobile" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/games?xr=shellnav" ms.title="Games" data-bi-name="Support_XboxWindowsGames" data-bi-slot="5" tabindex="70"> <span> Games </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_144-mobile" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/billing?xr=shellnav" ms.title="Billing" data-bi-name="Support_Billing" data-bi-slot="6" tabindex="70"> <span> Billing </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_145-mobile" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/my-account?xr=shellnav" ms.title="My Account" data-bi-name="Support_MyAccount" data-bi-slot="7" tabindex="70"> <span> My Account </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_146-mobile" class="c-nav-dropdown-item c-nav-link " href="http://forums.xbox.com/?xr=shellnav" ms.title="Xbox Forums" data-bi-name="Support_XboxForums" data-bi-slot="8" tabindex="70"> <span> Xbox Forums </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_147-mobile" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/error-code-lookup?xr=shellnav" ms.title="Error &amp; Status Code Search" data-bi-name="Support_ErrorStatusCodeSearch" data-bi-slot="9" tabindex="70"> <span> Error &amp; Status Code Search </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_148-mobile" class="c-nav-dropdown-item c-nav-link " href="https://support.xbox.com/xbox-live-status?xr=shellnav" ms.title="Xbox Live Status" data-bi-name="Support_XboxLiveStatus" data-bi-slot="10" tabindex="70"> <span> Xbox Live Status </span> </a> </li> <li class="c-nav-item "> <a id="xboxAmbassadorsChat-mobile" class="c-nav-dropdown-item c-nav-link " href="https://community.xbox.com/chat?xr=shellnav" ms.title="Xbox Ambassadors Chat" data-bi-name="Support_XboxAmbassadorsChat" data-bi-slot="11" tabindex="70"> <span> Xbox Ambassadors Chat </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_149-mobilelist"> <a id="shellmenu_149-mobile" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_149-mobilelist" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="My Xbox" role="button" ms.interactiontype="14" data-bi-name="My_Xbox" data-bi-slot="7" data-show-cta="True"> <span>My Xbox<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="My_Xbox-C2" ms.cmpnm="My Xbox" role="menu"> <li class="c-nav-item "> <a id="shellmenu_150-mobile" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/social?xr=shellnav" ms.title="Home" data-bi-name="My_xbox_home" data-bi-slot="1" tabindex="70"> <span> Home </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_151-mobile" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Profile?xr=shellnav" ms.title="Profile" data-bi-name="Profile" data-bi-slot="2" tabindex="70"> <span> Profile </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_152-mobile" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Activity?xr=shellnav" ms.title="Popular" data-bi-name="Popular" data-bi-slot="3" tabindex="70"> <span> Popular </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_153-mobile" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Achievements?xr=shellnav" ms.title="Achievements" data-bi-name="Achievements" data-bi-slot="4" tabindex="70"> <span> Achievements </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_154-mobile" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Friends" ms.title="Friends" data-bi-name="Friends" data-bi-slot="5" tabindex="70"> <span> Friends </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_155-mobile" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Messages?xr=shellnav" ms.title="Messages" data-bi-name="Messages" data-bi-slot="6" tabindex="70"> <span> Messages </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_156-mobile" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/MyGames?xr=shellnav" ms.title="My games" data-bi-name="My_games" data-bi-slot="7" tabindex="70"> <span> My games </span> </a> </li> </ul> </li> </ul> </li> </ul> <ul class="c-menu-container shell-category-top-level shell-category-nav-wrapper" role="menu" data-bi-area="CategoryMenuItems-" data-bi-view="C1"> <li class="c-top-nav-item" id="shellmenu_93list"> <a id="shellmenu_93" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_93list" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Xbox One" role="button" ms.interactiontype="14" data-bi-name="XboxOne" data-bi-slot="1" data-show-cta="True"> <span>Xbox One<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="XboxOne-C2" ms.cmpnm="Xbox One" role="menu"> <li class="c-nav-item "> <a id="shellmenu_94" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one-s?xr=shellnav" ms.title="Meet Xbox One S" data-bi-name="Xbox_One_S" data-bi-slot="1" tabindex="70"> <span> Meet Xbox One S </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_95" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one?xr=shellnav" ms.title="Meet Xbox One" data-bi-name="XboxOne_MeetXboxOne" data-bi-slot="2" tabindex="70"> <span> Meet Xbox One </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_96" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/project-scorpio?xr=shellnav" ms.title="Project Scorpio" data-bi-name="Scorpio" data-bi-slot="3" tabindex="70"> <span> Project Scorpio </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_97" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/consoles?xr=shellnav" ms.title="Consoles" data-bi-name="XboxOne_BuyNow" data-bi-slot="4" tabindex="70"> <span> Consoles </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_98" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/experience?xr=shellnav" ms.title="New Xbox Experience" data-bi-name="XboxOne_NewXboxExperience" data-bi-slot="5" tabindex="70"> <span> New Xbox Experience </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_99" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/backward-compatibility" ms.title="Backward Compatibility" data-bi-name="XboxOne_Backward_Compatibility" data-bi-slot="6" tabindex="70"> <span> Backward Compatibility </span> </a> </li> <li class="c-nav-item-with-dropdown "> <a id="shellmenu_100" class="c-nav-dropdown-item c-nav-link " ms.title="Entertainment on Xbox" role="button" data-bi-name="Entertainment_on_Xbox" data-bi-slot="7" tabindex="70"> <span> Entertainment on Xbox <i class="shell-icon-dropdown"></i> </span> </a> <div class="c-nav-dropdown-tab-content" data-col="1"> <ul class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Entertainment_on_Xbox-C3" ms.cmpnm="Entertainment on Xbox" role="menu"> <li> <a id="shellmenu_101" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/video?xr=shellnav" ms.title="Movies &amp; TV" data-bi-name="Movies_TV" data-bi-slot="1" tabindex="70"> <span>Movies &amp; TV</span> </a> </li> <li> <a id="shellmenu_102" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/music?xr=shellnav" ms.title="Music" data-bi-name="Entertainment_Music" data-bi-slot="2" tabindex="70"> <span>Music</span> </a> </li> <li> <a id="shellmenu_103" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/xbox-one/games/xbox-fitness?xr=shellnav" ms.title="Xbox Fitness" data-bi-name="Xbox_Fitness" data-bi-slot="3" tabindex="70"> <span>Xbox Fitness</span> </a> </li> <li> <a id="shellmenu_104" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/entertainment/xbox-one/live-apps?xr=shellnav" ms.title="Xbox One Apps" data-bi-name="Xbox_One_Apps" data-bi-slot="4" tabindex="70"> <span>Xbox One Apps</span> </a> </li> <li> <a id="shellmenu_105" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/entertainment/xbox-360/live-apps?xr=shellnav" ms.title="Xbox 360 Apps" data-bi-name="Xbox_360_Apps" data-bi-slot="5" tabindex="70"> <span>Xbox 360 Apps</span> </a> </li> </ul> </div> </li> <li class="c-nav-item "> <a id="shellmenu_106" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/games/xbox-360?xr=shellnav" ms.title="Xbox 360" data-bi-name="Games_Xbox360" data-bi-slot="8" tabindex="70"> <span> Xbox 360 </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_107list"> <a id="shellmenu_107" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_107list" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Games" role="button" ms.interactiontype="14" data-bi-name="Games" data-bi-slot="2" data-show-cta="True"> <span>Games<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Games-C2" ms.cmpnm="Games" role="menu"> <li class="c-nav-item-with-dropdown "> <a id="shellmenu_108" class="c-nav-dropdown-item c-nav-link " ms.title="Browse all games" role="button" data-bi-name="Browse_all_games" data-bi-slot="1" tabindex="70"> <span> Browse all games <i class="shell-icon-dropdown"></i> </span> </a> <div class="c-nav-dropdown-tab-content" data-col="1"> <ul class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Browse_all_games-C3" ms.cmpnm="Browse all games" role="menu"> <li> <a id="shellmenu_109" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/xbox-play-anywhere?xr=shellnav" ms.title="Xbox Play Anywhere" data-bi-name="Xbox_Play_Anywhere" data-bi-slot="1" tabindex="70"> <span>Xbox Play Anywhere</span> </a> </li> <li> <a id="shellmenu_110" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/xbox-one?xr=shellnav" ms.title="Xbox One" data-bi-name="Games_Xbox_One" data-bi-slot="2" tabindex="70"> <span>Xbox One</span> </a> </li> <li> <a id="shellmenu_111" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/xbox-one/backward-compatibility?xr=shellnav#bcGames" ms.title="Xbox One Compatible" data-bi-name="Xbox_One_Compatible" data-bi-slot="3" tabindex="70"> <span>Xbox One Compatible</span> </a> </li> <li> <a id="shellmenu_112" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/free-to-play?xr=shellnav" ms.title="Free to Play" data-bi-name="Free_to_Play" data-bi-slot="4" tabindex="70"> <span>Free to Play</span> </a> </li> <li> <a id="shellmenu_113" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/xbox-360?xr=shellnav" ms.title="Xbox 360" data-bi-name="Xbox_360" data-bi-slot="5" tabindex="70"> <span>Xbox 360</span> </a> </li> <li> <a id="shellmenu_114" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/windows?xr=shellnav" ms.title="Windows" data-bi-name="Windows" data-bi-slot="6" tabindex="70"> <span>Windows</span> </a> </li> <li> <a id="shellmenu_115" class="c-nav-dropdown-item c-nav-link" href="http://www.xbox.com/en-GB/games/windows-phone?xr=shellnav" ms.title="Windows Phone" data-bi-name="Windows_Phone" data-bi-slot="7" tabindex="70"> <span>Windows Phone</span> </a> </li> </ul> </div> </li> <li class="c-nav-item "> <a id="shellmenu_116" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/entertainment/xbox-one/live-apps/ea-access?xr=shellnav" ms.title="EA Access" data-bi-name="Games_EAAccess" data-bi-slot="2" tabindex="70"> <span> EA Access </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_117" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/games-with-gold?xr=shellnav" ms.title="Games with Gold" data-bi-name="Games_with_Gold" data-bi-slot="3" tabindex="70"> <span> Games with Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_118" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/deals-with-gold?xr=shellnav" ms.title="Deals with Gold" data-bi-name="Deals_with_Gold" data-bi-slot="4" tabindex="70"> <span> Deals with Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_119" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/promotions/sales/sales-and-specials?xr=shellnav" ms.title="Sales &amp; Specials" data-bi-name="Games_SalesAndSpecials" data-bi-slot="5" tabindex="70"> <span> Sales &amp; Specials </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_120" class="c-nav-dropdown-item c-nav-link " href="https://account.xbox.com/en-GB/PaymentAndBilling/RedeemCode?xr=shellnav" ms.title="Redeem Code" data-bi-name="XboxLiveGold_RedeemCode" data-bi-slot="6" tabindex="70"> <span> Redeem Code </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_121list"> <a id="shellmenu_121" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_121list" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Xbox Live" role="button" ms.interactiontype="14" data-bi-name="XboxLiveGold" data-bi-slot="3" data-show-cta="True"> <span>Xbox Live<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="XboxLiveGold-C2" ms.cmpnm="Xbox Live" role="menu"> <li class="c-nav-item "> <a id="shellmenu_122" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live?xr=shellnav" ms.title="Meet Xbox Live" data-bi-name="XboxLiveGold_MeetXboxLiveGold" data-bi-slot="1" tabindex="70"> <span> Meet Xbox Live </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_123" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/gold?xr=shellnav" ms.title="Join Xbox Live Gold" data-bi-name="XboxLiveGold_JoinXboxLiveGold" data-bi-slot="2" tabindex="70"> <span> Join Xbox Live Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_124" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/games-with-gold?xr=shellnav" ms.title="Games with Gold" data-bi-name="XboxLiveGold_GamesWithGold" data-bi-slot="3" tabindex="70"> <span> Games with Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_125" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/deals-with-gold?xr=shellnav" ms.title="Deals with Gold" data-bi-name="XboxLiveGold_DealsWithGold" data-bi-slot="4" tabindex="70"> <span> Deals with Gold </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_126" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/live/rewards?xr=shellnav" ms.title="Xbox Live Rewards" data-bi-name="XboxLiveGold_XboxLiveRewards" data-bi-slot="5" tabindex="70"> <span> Xbox Live Rewards </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_127" class="c-nav-dropdown-item c-nav-link " href="https://account.xbox.com/en-GB/PaymentAndBilling/RedeemCode?xr=shellnav" ms.title="Redeem Code" data-bi-name="XboxLiveGold_RedeemCode" data-bi-slot="6" tabindex="70"> <span> Redeem Code </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_128list"> <a id="shellmenu_128" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_128list" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Accessories" role="button" ms.interactiontype="14" data-bi-name="Accessories" data-bi-slot="4" data-show-cta="True"> <span>Accessories<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Accessories-C2" ms.cmpnm="Accessories" role="menu"> <li class="c-nav-item "> <a id="shellmenu_129" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?xr=shellnav" ms.title="View all accessories" data-bi-name="View_all_accessories" data-bi-slot="1" tabindex="70"> <span> View all accessories </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_130" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?controllers" ms.title="Controllers &amp; Remotes" data-bi-name="Controllers_Remotes" data-bi-slot="2" tabindex="70"> <span> Controllers &amp; Remotes </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_131" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?headsets" ms.title="Headsets &amp; Communication" data-bi-name="Headsets_Communication" data-bi-slot="3" tabindex="70"> <span> Headsets &amp; Communication </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_132" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?harddrives" ms.title="Hard Drives &amp; Chargers" data-bi-name="Hard_Drives_Chargers" data-bi-slot="4" tabindex="70"> <span> Hard Drives &amp; Chargers </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_133" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/xbox-one/accessories?cables" ms.title="Cables &amp; Networking" data-bi-name="Cables_Networking" data-bi-slot="5" tabindex="70"> <span> Cables &amp; Networking </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_134list"> <a id="shellmenu_134" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_134list" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Xbox on Windows" role="button" ms.interactiontype="14" data-bi-name="GamingOnWindows" data-bi-slot="5" data-show-cta="True"> <span>Xbox on Windows<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="GamingOnWindows-C2" ms.cmpnm="Xbox on Windows" role="menu"> <li class="c-nav-item "> <a id="shellmenu_135" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/windows-10?xr=shellnav" ms.title="Windows 10 Gaming " data-bi-name="Windows10Gaming " data-bi-slot="1" tabindex="70"> <span> Windows 10 Gaming </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_136" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/windows-10/xbox-app?xr=shellnav" ms.title="Xbox App on Windows 10" data-bi-name="Xbox_App_Windows_10" data-bi-slot="2" tabindex="70"> <span> Xbox App on Windows 10 </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_137" class="c-nav-dropdown-item c-nav-link " href="http://www.xbox.com/en-GB/windows-10/accessories?xr=shellnav" ms.title="Windows 10 Accessories" data-bi-name="Windows10_Accessories" data-bi-slot="3" tabindex="70"> <span> Windows 10 Accessories </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_138list"> <a id="shellmenu_138" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_138list" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="Support" role="button" ms.interactiontype="14" data-bi-name="Support" data-bi-slot="6" data-show-cta="True"> <span>Support<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="Support-C2" ms.cmpnm="Support" role="menu"> <li class="c-nav-item "> <a id="shellmenu_139" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com?xr=shellnav" ms.title="All support" data-bi-name="Support_AllSupport" data-bi-slot="1" tabindex="70"> <span> All support </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_140" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/xbox-one?xr=shellnav" ms.title="Xbox One" data-bi-name="Support_XboxOne" data-bi-slot="2" tabindex="70"> <span> Xbox One </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_141" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/xbox-360?xr=shellnav" ms.title="Xbox 360" data-bi-name="Support_Xbox360" data-bi-slot="3" tabindex="70"> <span> Xbox 360 </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_142" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/xbox-on-windows?xr=shellnav" ms.title="Xbox on Windows 10" data-bi-name="Support_XboxOnWindows" data-bi-slot="4" tabindex="70"> <span> Xbox on Windows 10 </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_143" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/games?xr=shellnav" ms.title="Games" data-bi-name="Support_XboxWindowsGames" data-bi-slot="5" tabindex="70"> <span> Games </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_144" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/billing?xr=shellnav" ms.title="Billing" data-bi-name="Support_Billing" data-bi-slot="6" tabindex="70"> <span> Billing </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_145" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/browse/my-account?xr=shellnav" ms.title="My Account" data-bi-name="Support_MyAccount" data-bi-slot="7" tabindex="70"> <span> My Account </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_146" class="c-nav-dropdown-item c-nav-link " href="http://forums.xbox.com/?xr=shellnav" ms.title="Xbox Forums" data-bi-name="Support_XboxForums" data-bi-slot="8" tabindex="70"> <span> Xbox Forums </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_147" class="c-nav-dropdown-item c-nav-link " href="http://support.xbox.com/error-code-lookup?xr=shellnav" ms.title="Error &amp; Status Code Search" data-bi-name="Support_ErrorStatusCodeSearch" data-bi-slot="9" tabindex="70"> <span> Error &amp; Status Code Search </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_148" class="c-nav-dropdown-item c-nav-link " href="https://support.xbox.com/xbox-live-status?xr=shellnav" ms.title="Xbox Live Status" data-bi-name="Support_XboxLiveStatus" data-bi-slot="10" tabindex="70"> <span> Xbox Live Status </span> </a> </li> <li class="c-nav-item "> <a id="xboxAmbassadorsChat" class="c-nav-dropdown-item c-nav-link " href="https://community.xbox.com/chat?xr=shellnav" ms.title="Xbox Ambassadors Chat" data-bi-name="Support_XboxAmbassadorsChat" data-bi-slot="11" tabindex="70"> <span> Xbox Ambassadors Chat </span> </a> </li> </ul> </li> <li class="c-top-nav-item" id="shellmenu_149list"> <a id="shellmenu_149" tabindex="70" aria-expanded="false" aria-labelledby="shellmenu_149list" class="c-top-nav-link c-nav-link c-nav-dropdown" href="javascript:void(0);" ms.title="My Xbox" role="button" ms.interactiontype="14" data-bi-name="My_Xbox" data-bi-slot="7" data-show-cta="True"> <span>My Xbox<i class="shell-icon-dropdown"></i></span> </a> <ul aria-hidden="true" class="c-nav-dropdown-menu" data-bi-area="CategoryHeader-" data-bi-view="My_Xbox-C2" ms.cmpnm="My Xbox" role="menu"> <li class="c-nav-item "> <a id="shellmenu_150" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/social?xr=shellnav" ms.title="Home" data-bi-name="My_xbox_home" data-bi-slot="1" tabindex="70"> <span> Home </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_151" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Profile?xr=shellnav" ms.title="Profile" data-bi-name="Profile" data-bi-slot="2" tabindex="70"> <span> Profile </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_152" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Activity?xr=shellnav" ms.title="Popular" data-bi-name="Popular" data-bi-slot="3" tabindex="70"> <span> Popular </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_153" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Achievements?xr=shellnav" ms.title="Achievements" data-bi-name="Achievements" data-bi-slot="4" tabindex="70"> <span> Achievements </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_154" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Friends" ms.title="Friends" data-bi-name="Friends" data-bi-slot="5" tabindex="70"> <span> Friends </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_155" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/Messages?xr=shellnav" ms.title="Messages" data-bi-name="Messages" data-bi-slot="6" tabindex="70"> <span> Messages </span> </a> </li> <li class="c-nav-item "> <a id="shellmenu_156" class="c-nav-dropdown-item c-nav-link " href="http://account.xbox.com/en-GB/MyGames?xr=shellnav" ms.title="My games" data-bi-name="My_games" data-bi-slot="7" tabindex="70"> <span> My games </span> </a> </li> </ul> </li> </ul> <div class="c-nav-pagination c-nav-pagination-next"> <i class="shell-icon-dropdown facing-right"></i> </div> </div> </div> <div class="fixed-category-nav-buffer"></div> <script type="text/javascript"> var shellInitOptions = { lcaDisclaimerEnabled: false, suggestedProductTitle : 'Suggested products' }; var meControlInitOptions = { containerId: 'meControl', enabled: true, headerHeight: 48, custom: {chevHtml:'<i class="msame_chev_uhf shell-icon-dropdown"></i>'}, mobileBreakpoints: { shortHeader: 1084 }, extensibleLinks : [ { string: 'Profile', url: 'https://account.xbox.com/Profile?xr=mebarnav' , id: '' }, { string: 'Friends', url: 'https://account.xbox.com/Friends?xr=mebarnav' , id: '' }, { string: 'Messages', url: 'https://account.xbox.com/Messages?xr=mebarnav' , id: '' }, { string: 'Xbox settings', url: 'https://account.xbox.com/Settings/Home/?xr=mebarnav#' , id: '' }, { string: 'Subscriptions', url: 'https://account.microsoft.com/services?ref=xboxme' , id: '' }, { string: 'Redeem code', url: 'https://account.xbox.com/PaymentAndBilling/RedeemCode?xr=mebarnav' , id: '' }, ], rpData: { msaInfo: { signInUrl: 'https://account.xbox.com/Account/Signin', signOutUrl: '', accountSettingsUrl: 'https://account.microsoft.com/', switchUrl: '', meUrl: 'https://login.live.com/me.srf?wa=wsignin1.0', isSupported: true }, aadInfo: { }, preferredIdp: 'msa', }, signInStr: 'Sign in', signOutStr: 'Sign out' }; </script> <script type="text/javascript"> require(['jquery', 'common', 'clickstreamTracker', 'vortexEvents'], function ($, common, biTracker, vortexEvents) { var accountAuthority = "https://account.xbox.com"; var signInReturnUrl = "http%3a%2f%2fwww.xbox.com%2fen-GB%2f"; var signInUrl = accountAuthority + "/Account/Signin?returnUrl=" + signInReturnUrl; var signOutUrl = accountAuthority + "/Account/Signout"; var locale = common.locale(); var userDataMeControlPath = common.formatString('{0}/{1}/Profile/UserDataMeControl', accountAuthority, locale); // tags used for telemetry var wedcsTags = { EventCategory: "wcs.cot", ContentName: "wcs.cn", ContentId: "wcs.cid", TargetUri: "wcs.ct", AreaName: "ms.pgarea", ComponentName: "ms.cmpnm" }; var containerControl = "header"; var controlName = "MeControl"; var buttonClickEvent = "4"; var shellOptions = { meControlOptions: { rpData: { msaInfo: { signInUrl: signInUrl, signOutUrl: signOutUrl, accountSettingsUrl: accountAuthority }, preferredIdp: "msa" }, userData: { idp: "msa", firstName: "", lastName: "", memberName: "", cid: "", authenticatedState: "3" } }, // event handlers tracking calls events: { onEventLog: function (eventId, dataPoints) { if (eventId.indexOf('MeControl_') >= 0 && dataPoints.type) { if (dataPoints.type === 'qos' && dataPoints.success === '0') { var eventData = { currentOperationName: eventId, isSuccess: false, latencyMs: dataPoints.duration, errorMessage: dataPoints.errorCode + (dataPoints.IDPError ? ':' + dataPoints.IDPError : ''), requestUri: dataPoints.targetUri, serviceName: controlName, operationName: eventId }; vortexEvents.sendApiComplete(eventData); } if (dataPoints.type == 'bici' && eventId.indexOf('Ready') < 0) { var content = { name: eventId, contentId: eventId, areaName: controlName, targetUri: dataPoints.targetUri }; //To Webi biTracker.captureContentPageAction(content); //To WEDCS window.MscomCustomEvent(wedcsTags.ContentName, eventId, wedcsTags.TargetUri, dataPoints.destUri, wedcsTags.AreaName, containerControl, wedcsTags.ComponentName, controlName); } } }, onSearch: function (searchForm) { var query = searchForm.q ? searchForm.q.value : ""; var scope = searchForm.form ? searchForm.form.value : ""; var destUri = searchForm.action + "?" + $(searchForm).serialize(); var actionName = "Search"; var biContent = { name: actionName, targetUri: destUri }; var customData = { searchTerm: query, searchScope: scope }; //To Webi biTracker.captureContentPageAction(biContent, customData); //To WEDCS window.MscomCustomEvent(wedcsTags.EventCategory, buttonClickEvent, wedcsTags.ContentName, actionName, wedcsTags.TargetUri, destUri, wedcsTags.AreaName, containerControl); } } }; if (window.msCommonShell) { loadShell(); } else { window.onShellReadyToLoad = function () { window.onShellReadyToLoad = null; loadShell(); } } // all browsers except IE before version 9 if (window.addEventListener) { window.addEventListener("message", receiveMessage, false); } else { if (window.attachEvent) { window.attachEvent("onmessage", receiveMessage); } } function loadShellWithUserData(data) { shellOptions.meControlOptions.userData.firstName = data.FirstName; shellOptions.meControlOptions.userData.lastName = data.LastName; shellOptions.meControlOptions.userData.nickName = data.GamerTag; shellOptions.meControlOptions.userData.tileUrl = data.PublicGamerPic; shellOptions.meControlOptions.userData.memberName = data.Email; shellOptions.meControlOptions.userData.cid = data.CID.toString(); shellOptions.meControlOptions.userData.authenticatedState = "1"; shellOptions.meControlOptions.userData.accountTier = data.AccountTier; window.msCommonShell.load(shellOptions); $(document).trigger('meControlLoaded', [shellOptions.meControlOptions.userData]); if (currentUser) { currentUser.tier = shellOptions.meControlOptions.userData.accountTier; currentUser.isSignedIn = true; } } function loadShell() { if (window.msCommonShell) { window.msCommonShell.load(shellOptions); } } function receiveMessage(event) { if (event.origin == accountAuthority && event.data.FirstName) { loadShellWithUserData(event.data); } else { return; } } }); </script> <script type="text/javascript"> //<![CDATA[ $(function () { InitializeMobileLink("#MobileVersionLinkArea", "desktopVersion", "mobileOverride"); }); //]]> </script> <div class="cookieBannerWrapper"> <div class="bar"></div> <div class="cookieBanner"> <div class="alertDescription">By using this site you agree to the use of cookies for analytics, personalized content and ads.</div> <div class="learnMore"> <a href="http://go.microsoft.com:80/fwlink/?LinkId=248681&amp;clcid=0x809" title="Learn More">Learn More</a> <img id="cookieBannerCloseButton" src="/Shell/Images/shell/CloseButtonWhite.png" title="Close" /> </div> </div> </div> <div id="BodyContent" class="container"> <br class="clear" /> <div> <div id= "TopContentBlockList_1" class=""> <style> /*************** Parallax *****************************/ .device-peek-bg#parallaxBG1 { background-image: url(http://compass.xbox.com/assets/ed/ae/edaec881-6b39-4078-9a63-5bdfede9d100.jpg?n=Gears-of-War-4_parallax_1920x1480.jpg); } .device-peek-bg#parallaxBG2 { background-image: url(http://compass.xbox.com/assets/dd/4a/dd4a934a-d067-4c27-9728-9809b3ce53d7.jpg?n=Hogan_parallax_1920x1480_02.jpg); } .device-peek-bg#parallaxBG3 { background-image: url(http://compass.xbox.com/assets/44/00/4400aeb3-89f7-455a-a67f-96cdc30bed42.jpg?n=Forza-Horizon-3_parallax_1920x1480.jpg); } /*************** End Parallax *****************************/ </style> </div> <div id= "TopContentBlockList_2" class=""> <style> .rotate-hero { visibility: hidden; height: 0px; } .rotate-hero.slick-initialized { visibility: visible; height: 100%; } .loadImage img {display: block;} @@media (min-width: 769px) { .loadImage .dskTop {display: block;} .loadImage .heroMobi {display: none;} } @@media (max-width: 768px) { .loadImage .dskTop {display: none;} .loadImage .heroMobi {display: block;} } .loadImage img {height: 100%; width: 100%;} </style> <script type="text/javascript"> $('.rotate-hero').ready(function () { $(".loadImage").hide(); $('.rotate-hero').slick({ // hero methods dots: true, arrows: true, autoplay: true, autoplaySpeed: 5000, nextArrow: '<div class="heroNav slick-next"><img src="http://compass.xbox.com/assets/01/35/0135270d-23cf-489e-8313-4f3ce6f081a9.png?n=ui-global-resources-rotator-forward-button-21x35.png"></div>', prevArrow: '<div class="heroNav slick-prev"><img src="http://compass.xbox.com/assets/cb/1b/cb1b5936-e504-45df-9cde-17d7a2c7d808.png?n=ui-global-resources-rotator-back-button-21x35.png"></div>' }); }); $('.slick-console-scroller').ready(function () { $('.slick-console-scroller').slick({ // Console Rotator methods dots: false, arrows: false, autoplay: false, slidesToShow: 3, lazyLoad: 'ondemand', nextArrow: '<div class="ConsoleNav slick-next"><img src="http://compass.xbox.com/assets/01/35/0135270d-23cf-489e-8313-4f3ce6f081a9.png?n=ui-global-resources-rotator-forward-button-21x35.png"></div>', prevArrow: '<div class="ConsoleNav slick-prev"><img src="http://compass.xbox.com/assets/cb/1b/cb1b5936-e504-45df-9cde-17d7a2c7d808.png?n=ui-global-resources-rotator-back-button-21x35.png"></div>', responsive: [ { breakpoint: 768, settings: { slidesToShow: 1, arrows: true, dots: true, autoplay: true, autoplaySpeed: 5000 } } ] }); }); $(document).ready(function () { $('.news-rotator').slick({ // News Rotator methods infinite: true, lazyLoad: 'ondemand', centerMode: true, slidesToShow: 1, dots: true, arrows: true, asNavFor: '.news-rotator-copy', nextArrow: '<div class="newsRot slick-next"><img src="http://compass.xbox.com/assets/01/35/0135270d-23cf-489e-8313-4f3ce6f081a9.png?n=ui-global-resources-rotator-forward-button-21x35.png"></div>', prevArrow: '<div class="newsRot slick-prev"><img src="http://compass.xbox.com/assets/cb/1b/cb1b5936-e504-45df-9cde-17d7a2c7d808.png?n=ui-global-resources-rotator-back-button-21x35.png"></div>', responsive: [ { breakpoint: 768, settings: { centerMode: false } } ] }); $('.news-rotator-copy').slick({ // News Rotator lower content section methods infinite: true, centerMode: true, slidesToShow: 1, dots: false, arrows: false, fade: true, adaptiveHeight: true, asNavFor: '.news-rotator' }); }); $(window).load(function () { var swap = function (item) { $(item).attr("src", $(item).attr("data-src")); } $(".lazyloadimage").each(function () { if ($(this).attr("src").indexOf("data:") === 0) { setTimeout(swap, 25, this); } }); }); </script> </div> <div id= "TopContentBlockList_3" class=""> <script> requirejs.config({ paths: { Handlebars: '/global-resources/script/js/handlebars-v1.3.0', stx2: '/global-resources/script/js/stx2', local: '/en-GB/home2015/JS/gow-paypal/functions' }, shim: { stx2: ['Handlebars'], local: ['stx2'] }, waitSeconds: 10000 }); require(['local']); </script> </div> </div> <br class="clear" /> <div> <div id= "ContentBlockList_1" class=""> <style> @@media (min-width: 769px) { .rotate-hero .dskTop {display: block;} .rotate-hero .heroMobi {display: none;} .HeroSlide1 { background-image: url('http://compass.xbox.com/assets/de/7b/de7b55ba-db8f-4cf3-8c6a-34eaf565e596.jpg?n=Xbox-One-S-FIFA-17-Bundle_Vigo_superhero-desktop_1920x720_Pre-order.jpg'); background-size: contain; } .HeroSlide2 { background-image: url('http://compass.xbox.com/assets/3f/63/3f637063-5010-4af3-96cd-89aecc0164ff.jpg?n=GOW-4_superhero-desktop_1920x720_Pre-order.jpg'); background-size: contain; } } @@media (max-width: 768px) { .rotate-hero .dskTop {display: none;} .rotate-hero .heroMobi {display: block;} .HeroSlide1 { background-image: url('http://compass.xbox.com/assets/4e/9d/4e9d3287-bb71-4424-997a-68b9c8cc9115.jpg?n=Xbox-One-S-FIFA-17-Bundle_Vigo_superhero-mobile_768x768_pre-order.jpg'); background-size: contain; } .HeroSlide2 { background-image: url('http://compass.xbox.com/assets/f7/9d/f79d6dbf-d89d-48cb-ac52-c8ba07be2bc9.jpg?n=GOW-4_superhero-mobile_768x768_Pre-order.jpg'); background-size: contain; } } </style> <!-- Load image DO NOT EDIT--> <div class="HeroSlide1 loadImage"> <img src="http://compass.xbox.com/assets/8d/52/8d52e1db-777a-4ba5-954e-cbcb56e5dd8e.png?n=Clear-space_8x3.png" class="dskTop" alt="" /> <img src="http://compass.xbox.com/assets/fb/d6/fbd6b190-5ab1-4ca4-8b10-b5ed203069c8.png?n=1pixel-transparent.png" class="heroMobi" alt="" /> </div> <!-- End load image --> <div class="rotate-hero"> <!-- Hero 1--> <div class="HeroSlide1"> <a href="http://www.xbox.com/en-GB/xbox-one/consoles/fifa-17-1tb" data-clickname="www>home>SignedOut>fifa-17-1tb>hero1>click" data-cta="learn-more"> <img src="http://compass.xbox.com/assets/8d/52/8d52e1db-777a-4ba5-954e-cbcb56e5dd8e.png?n=Clear-space_8x3.png" class="dskTop" alt="Xbox One S Fifa 17"> <img src="http://compass.xbox.com/assets/fb/d6/fbd6b190-5ab1-4ca4-8b10-b5ed203069c8.png?n=1pixel-transparent.png" class="heroMobi" alt="Xbox One S Fifa 17"> </a> </div> <!-- Hero 2--> <div class="HeroSlide2"> <a href="http://www.xbox.com/en-GB/games/gears-of-war-4" data-clickname="www>home>SignedOut>gears-of-war-4>hero2>click" data-cta="learn-more"> <img src="http://compass.xbox.com/assets/8d/52/8d52e1db-777a-4ba5-954e-cbcb56e5dd8e.png?n=Clear-space_8x3.png" class="dskTop" alt="gears of war 4"> <img src="http://compass.xbox.com/assets/fb/d6/fbd6b190-5ab1-4ca4-8b10-b5ed203069c8.png?n=1pixel-transparent.png" class="heroMobi" alt="gears of war 4"> </a> </div> </div> </div> <div id= "ContentBlockList_2" class="ribbonBG"> <style> @@media (min-width: 769px) { .ribbonBG { background-image: url('http://compass.xbox.com/assets/ac/d0/acd024e6-abc8-4318-88b6-8772722466f6.png?n=Summer-Spotlight-2016_Ribbon_1920x100_02.png'); height: 100px; background-position: center; overflow: hidden; background-repeat: no-repeat; } .ribbonBG .product-image {display: none;} .ribbonBG .button-container a {color: #fff; } .ribbonBG p {padding-top: 35px;} } @@media (max-width: 768px) { .zeroPad {padding: 0px !important;} .ribbonBG { background-image: url('http://compass.xbox.com/assets/11/6c/116c70e6-d1fe-424d-a82e-ced98c6ebbcb.png?n=Summer-Spotlight-2016_Ribbon_768x175_02.png'); height: 175px; background-position: center; overflow: hidden; background-repeat: no-repeat; } .ribbonBG {background-color: #000;} .ribbonBG p {text-align: center;} .ribbonBG .button-container a {color: #fff; padding-top: 85px;} } </style> <section class=""> <div class="ms-grid zeroPad"> <div class="ms-row vc"> <div class="m-col-1-2"> <p class="subtitle">&nbsp;</p> </div> <div class="m-col-1-2"> <p class="button-container vac"> <a class="isolated-link heroTextLink" href="http://www.xbox.com/promotions/summer-spotlight/" data-cta="learn" data-clickname="www>home>ribbon>summer-spotlight>learnMore>click">Learn more &gt;</a> </p> </div> </div> </div> </section> </div> <div id= "ContentBlockList_3" class=""> <section class="ConsoleRotator multi-product-hero-section"> <div class="ms-grid"> <div class="ms-row vc"> <div class="m-col-3-4"> <div class="slick-console-scroller"> <div class="consoleItem"> <a href="http://www.xbox.com/xbox-one/consoles/gears-of-war-limited-edition" data-clickname="www>home>console-rotator>SignedOut>xbox-one-s-gears-of-war-limited-edition-bundle>click" data-cta="learn"> <img data-lazy="http://compass.xbox.com/assets/3e/6a/3e6a1d8a-4d65-4132-912d-5143d9c52d49.png?n=Homepage_Upgrade-small_480x306_X1S-GOW-4.png" alt="Gears of War 4 Bundle" /> <h3 class="title tac">Gears of War 4 Bundle (2TB)&nbsp;></h3> </a> </div> <div class="consoleItem"> <a href="http://www.xbox.com/xbox-one-s" data-clickname="www>home>console-rotator>SignedOut>xbox-one-s>click" data-cta="learn"> <img data-lazy="http://compass.xbox.com/assets/e9/0f/e90f8f82-443a-4f25-9043-935c08b1a9db.png?n=Homepage_Upgrade-small_480x306_X1S-2TB.png" alt="Xbox One S" /> <h3 class="title tac">Xbox One S&nbsp;></h3> </a> </div> <div class="consoleItem"> <a href="http://www.xbox.com/xbox-one/consoles/elite-bundle" data-clickname="www>home>console-rotator>SignedOut>elite-bundle>click" data-cta="learn"> <img data-lazy="http://compass.xbox.com/assets/a0/6b/a06b14da-228b-4794-b1ba-2aff0b336f0c.png?n=Homepage_Upgrade-small_480x306_Elite.png" alt="Xbox One Elite Bundle" /> <h3 class="title tac">Xbox One Elite Bundle (1 TB)&nbsp;></h3> </a> </div> </div> </div> <div class="m-col-1-4"> <div> <a href="http://www.xbox.com/en-GB/xbox-one/consoles" data-clickname="www>HP>Consoles>Slot4>Default>AllSubs>SeeAll>LearnMore" data-tout="HP:Blade2:Slot4:Default:Learn_More" data-cta="learn"> <h3 class="title static-typography tac">See all bundles for Xbox&nbsp;One&nbsp;></h3> </a> </div> </div> </div> </div> </section> <div class="separatorLine"></div> </div> <div id= "ContentBlockList_4" class=""> </div> <div id= "ContentBlockList_5" class="mosaicBlade"> <div class="sectionHeader BestGamesHeader"> <h2 class="xboxH1"> The best games on Xbox</h2> </div> <section class="ms-grid full mosaic"> <!----Large Tout----> <div class="col-1-2 tout"> <div class="toutCopy largeTout"> <div class="tile-text tac"> <h2 class="subheader no-margin-top white-c LtoutHeadline">Play the Battlefield<sup>TM</sup> 1 Open Beta and Win</h2> <a class="white-tc no-margin-bottom buttonP green-bgc" href="http://www.xbox.com/games/battlefield-1" data-clickname="www>home>SignedOut>Mosaic>LargeTout>battlefield-1-beta>click" data-cta="learn">Play now</a> </div> </div> <img src="http://compass.xbox.com/assets/a7/cd/a7cd70d6-d709-4401-b16f-4d25d6748a93.jpg?n=Battlefield1-Beta-Announce_largetout_960x960.jpg" alt="battlefield 1 beta" /> </div> <!----Small Tout----> <div class="col-1-2 smallTouts"> <div class="col-1-1 tout" > <div class="toutCopy"> <div class="tile-text tac"> <h2 class="subheader no-margin-top white-c"></h2> <a class="isolated-link white-tc no-margin-bottomc" href="https://store.xbox.com/Xbox-One/Games/Livelock/8e639ada-7099-4929-80b7-5ed13dbc06ce" data-clickname="www>home>SignedOut>Mosaic>SmallTout>livelock>click" data-cta="learn">Learn more &gt;</a> </div> </div> <img src="http://compass.xbox.com/assets/80/e1/80e185bc-71b8-40e4-b5e4-e1e1848be828.jpg?n=Livelock_smalltout_960x480.jpg" alt="livelock" /> </div> <!----Small Tout----> <div class="col-1-1 tout" > <div class="toutCopy"> <div class="tile-text tac"> <h2 class="subheader no-margin-top white-c">Browse Xbox One games</h2> <a class="isolated-link white-tc no-margin-bottom" data-productid="xbox_one_games" href="http://www.xbox.com/games/xbox-one" data-clickname="www>HP>BestGames>Slot3>Default>AllSubs>xbox-one-games>LearnMore" data-cta="learn">Learn more &gt;</a> </div> </div> <img src="http://compass.xbox.com/assets/94/e3/94e30d3e-b948-4143-9366-01e916dbb455.jpg?n=CTM2_Small-tout_960x480_02.jpg" alt="xbox one games" /> </div> </div> </section> </div> <div id= "ContentBlockList_6" class="newsRotateBlock"> <div class="sectionHeader"><h2 class="xboxH1">What's new with Xbox One</h2></div> <section class="news-mask"> <div class="news-rotator"> <div class="newsImgDiv"> <img data-lazy="http://compass.xbox.com/assets/e3/f0/e3f009d0-0226-4cbd-97f9-edab16eedd1d.jpg?n=Forza-Horizon-1_Back-Compat_whatsnew-tout_988x556.jpg" alt="forza horizon back compat" /> </div> <div class="newsImgDiv"> <img data-lazy="http://compass.xbox.com/assets/d4/5e/d45eb507-ad00-47fe-8cd0-6b4ac1cc2f4d.jpg?n=Fallout-4_DLC_Nuka-World_whatsnew-tout_988x556.jpg" alt="fallout 4 nuka world" /> </div> <div class="newsImgDiv"> <img data-lazy="http://compass.xbox.com/assets/2d/c4/2dc4f827-2d90-454b-958a-6ac44f45ea02.jpg?n=ROTTR_whatsnew-tout_Endurance_988x556.jpg" alt="rise of the tomb raider" /> </div> </div> </section> <!--------------------------------------------> <section class="news-copy-mask"> <div class="news-rotator-copy"> <div class="newsContentDiv"> <h2 class="headline">New on Back Compat & Games with Gold</h2> <p class="body">With over 300 cars to unlock and an open-world full of challenges, the Forza Horizon festival is a celebration that will keep you coming back again and again. Now, backward compatible racing titles, including Forza Horizon, support Xbox One wheels! Get it free through Games with Gold starting September 1st.</p> <a href="https://www.microsoft.com/en-GB/store/p/forza-horizon/bs9fslk6b1rr" data-clickname="www>homepage>whatsnew>SignedOut>forza-horizon>back-compat>learn-more>click" data-cta="Learn more"> Learn more > </a> </div> <div class="newsContentDiv"> <h2 class="headline">Fallout 4 Nuka World</h2> <p class="body">Take a trip to Nuka-World, a vast amusement park now a lawless city of Raiders. Lead lethal gangs of Raiders and use them to conquer settlements, bending the Commonwealth to your will.</p> <a href="https://www.microsoft.com/en-GB/store/p/fallout-4-nuka-world/bzqb3n46jlg3" data-clickname="www>homepage>whatsnew>SignedOut>fallout-4-nuka-world>learn-more>click" data-cta="Learn more"> Learn more > </a> </div> <div class="newsContentDiv"> <h2 class="headline">Rise of the Tomb Raider</h2> <p class="body">New content coming October 2016. Rise of the Tomb Raider: 20 Year Celebration includes the base game and Season Pass featuring all-new content. Explore Croft Manor in the new “Blood Ties” story, then defend it against a zombie invasion in “Lara’s Nightmare”. </p> <a href="http://www.xbox.com/games/rise-of-the-tomb-raider" data-clickname="www>homepage>whatsnew>SignedOut>rottr-endurance>learn-more>click" data-cta="Learn more"> Learn more > </a> </div> </div> </section> </div> <div id= "ContentBlockList_7" class="livegoldHeader"> <div class="sectionHeader"><h2 class="xboxH1">Xbox One is better with Gold</h2></div> </div> <div id= "ContentBlockList_8" class="GwgBlade"> <section class="FullWidthImage-section GwG"> <div class="FullWidthImage-image" style="background-image: url(http://compass.xbox.com/assets/af/df/afdf9a19-f38f-4655-baf4-f3df28773ce6.jpg?n=Homepage_Live-Gold-Big_1600x640_02.jpg);"></div> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/af/df/afdf9a19-f38f-4655-baf4-f3df28773ce6.jpg?n=Homepage_Live-Gold-Big_1600x640_02.jpg" class="mobile-only lazyloadimage"> <div class="ms-grid"> <div class="ms-row vc"> <div class="col-1-2"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/6d/ca/6dca4e9f-5c85-4d85-9745-e9255c8434fb.png?n=Homepage_Xbox-Live-Logo_136x51.png" alt="" class="btnXbLive lazyloadimage" /><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/bb/b6/bbb6c18e-9b77-450e-a54d-64e1f0e5b964.png?n=Homepage_Live-Gold-logo_136x51.png" alt="" class="btnLiveGoldLogo lazyloadimage"/> <h2 class="white-c no-margin-top xboxH1">Free games and<br />exclusive content</h2> <p>Build imaginative, awe-inspiring worlds with your friends. Compete in heart-pounding matches that require quick thinking and fast reflexes. Whether it’s competitive or cooperative gameplay on your console, Xbox Live Gold takes your game to the next level. Alone you are mighty. With others, you’re Gold.</p> <p class="no-margin-bottom"> <a class="isolated-link white-tc no-margin-bottom" href="http://www.xbox.com/live/gold" data-clickname="www>home>SignedOut>Xbox-Live-Gold>Learn-More>click" data-cta="Learn more">Learn more &gt;</a> </p> </div> </div> </div> </section> <!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> <!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> <!--------------------------------------------------------------------------------------- GWG Touts Below this line!!!!!! --------------------------------------------------------------------------------------------------------------------------> <!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> <!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> <div class="ms-grid full sixteenHundred"> <div class="ms-row fixed fourPXtop"> <div class="col-1-3"> <a href="http://www.xbox.com/live/games-with-gold#xb1" data-clickname="www>home>SignedOut>LiveGold>GwGx1>earthlock>click"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/23/9e/239e98d9-5369-4289-a953-d82c6fbb7287.jpg?n=GwG_Gold-Upsell-Tout_August-30-2016_531x213_Earthlock.jpg" class="gwgGameImage lazyloadimage" alt="Earthlock" /> </a> <div class="ms-row full gwgCopyTouts"> <div class="col-1-3 M-fullColumn"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/e1/8c/e18c7ba9-d542-4b35-babf-d272facc6709.png?n=Homepage_GwG-Logo_115x53.png" class="gwgLogoThumb lazyloadimage" alt="games with gold" /> </div> <div class="col-2-3 M-fullColumn"> <h4 class="xboxH4">Earthlock</h4> <p>This Xbox One game is included with an Xbox Live Gold subscription.</p> <a class="isolated-link white-tc no-margin-bottom learnMoreConstHeight" href="http://www.xbox.com/live/games-with-gold" data-clickname="www>home>SignedOut>Xbox-Live-Gold>GwG#1>Learn-More>click" data-cta="Learn more">Learn more &gt;</a> </div> </div> </div> <!-----------------------------------------------> <div class="col-1-3"> <a href="http://www.xbox.com/live/games-with-gold#360" data-clickname="www>home>SignedOut>LiveGold>GwG360>forza-horizon>click"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/b0/57/b057d9d6-bef5-41b0-a70a-93f02cf318ef.jpg?n=GwG_Gold-Upsell-Tout_August-30-2016_531x213_Forza-Horizon-1.jpg" class="gwgGameImage lazyloadimage" alt="Forza Horizon" /> </a> <div class="ms-row full gwgCopyTouts"> <div class="col-1-3 M-fullColumn"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/e1/8c/e18c7ba9-d542-4b35-babf-d272facc6709.png?n=Homepage_GwG-Logo_115x53.png" class="gwgLogoThumb lazyloadimage" alt="games with gold" /> </div> <div class="col-2-3 M-fullColumn"> <h4 class="xboxH4">Forza Horizon</h4> <p>This Xbox 360 game is included with an Xbox Live Gold subscription.</p> <a class="isolated-link white-tc no-margin-bottom learnMoreConstHeight" href="http://www.xbox.com/live/games-with-gold" data-clickname="www>home>SignedOut>Xbox-Live-Gold>GwG#2>Learn-More>click" data-cta="Learn more">Learn more &gt;</a> </div> </div> </div> <!-----------------------------------------------> <div class="col-1-3"> <a href="http://www.xbox.com/live/deals-with-gold" data-clickname="www>home>SignedOut>LiveGold>DwG>star-wars-battlefront>click"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/c1/c4/c1c4c1d7-31e2-4bc0-8872-529da790c005.jpg?n=star-wars-battlefront_Gold-Tout_531x213.jpg" class="gwgGameImage lazyloadimage" alt="Star Wars Battlefront" /> </a> <div class="ms-row full gwgCopyTouts"> <div class="col-1-3 M-fullColumn"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/10/2e/102eb7a6-6ead-4cef-ae57-62f8fd5a418c.png?n=Homepage_DwG-Logo_115x53.png" class="gwgLogoThumb lazyloadimage" alt="Deals with gold" /> </div> <div class="col-2-3 M-fullColumn"> <h4 class="xboxH4">Star Wars Battlefront and more</h4> <p>This Xbox One game is discounted with an Xbox Live Gold subscription. </p> <a class="isolated-link white-tc no-margin-bottom learnMoreConstHeight" href="http://www.xbox.com/deals-with-gold" data-clickname="www>home>SignedOut>Xbox-Live-Gold>DwG>Learn-More>click" data-cta="Learn more">Learn more &gt;</a> </div> </div> </div> </div> </div> </div> <div id= "ContentBlockList_9" class=""> <section class="FullWidthImage-section GameOnWindows"> <div class="FullWidthImage-image" style="background-image: url(http://compass.xbox.com/assets/91/a1/91a13cc9-a63b-4d53-8b28-2aeec64161a7.png?n=Homepage_Windows_1920x840_04.png);"></div> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/7d/b7/7db723dc-373c-4856-947e-84ac66ee0fc1.png?n=Homepage_Windows-mobile_768x480.png" class="mobile-only lazyloadimage"> <div class="ms-grid"> <div class="ms-row vc"> <div class="col-1-2"> <h2 class="white-c no-margin-top xboxH1">The Best Windows Ever for Gaming</h2> <p>Gaming just got better with Windows 10. Stay connected to your Xbox live community, start party chats, launch into cross-device multiplayer and stream Xbox One games to any Windows 10 PC in your home.*</p> <p class="no-margin-bottom"> <a href="http://www.xbox.com/en-GB/windows-10" class="isolated-link white-c" data-clickname="www>HP>Windows>Default>AllSubs>LearnMore" data-tout="HP:Blade7:Slot1:Default:Windows10" data-cta="Learn more">Learn more &gt;</a> </p> </div> </div> </div> </section> </div> <div id= "ContentBlockList_10" class="getMost360Blade getMostTop"> <div class="ms-grid full sixteenHundred "> <div class="ms-row fixed-large getMostToutRow"> <div class="col-1-3 getMostToutBlock"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/58/d4/58d48c2a-5fd8-4fed-a5d8-bdc5e95d2ebc.png?n=Homepage-X1_cross-sell_400x225_01.png" class="gwgGameImage lazyloadimage" alt="Elite Mapping | Xbox Elite Wireless Controller" /> <h2 class="xboxH2">Xbox One Elite Wireless Controller</h2> <p class="xboxP">Experience game-changing accuracy, faster speed, and a tailored feel unlike anything before.</p> <p class="button-container"> <a href="http://www.xbox.com/en-GB/xbox-one/accessories/controllers/elite-wireless-controller" data-clickname="www>HP>Footer>Slot1>Default>AllSubs>XO_Controllers>LearnMore" data-tout="HP:Blade8:Slot1:Default:XO_Controllers" class="buttonP white-bgc-btn learnMoreGetMore">Learn more</a> </p> </div> <!-----------------------------------------------> <div class="col-1-3 getMostToutBlock"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xbox.com/assets/3a/80/3a807755-1b14-414d-a05c-ebe3f391a577.png?n=Homepage-X1_cross-sell_400x225_Blk-Stereo-Headset.png" class="gwgGameImage lazyloadimage" alt="Xbox One Accessories" /> <h2 class="xboxH2">Xbox One Accessories</h2> <p class="xboxP">With these official Xbox One accessories you can get the most out of your Xbox games. </p> <p class="button-container"> <a href="http://www.xbox.com/en-GB/xbox-one/accessories" data-clickname="www>HP>Footer>Slot2>Default>AllSubs>XO_Accessories>LearnMore" data-tout="HP:Blade8:Slot2:Default:XO_Accessories" data-cta="Learn more" class="buttonP white-bgc-btn learnMoreGetMore">Learn more</a> </p> </div> <!-----------------------------------------------> <div class="col-1-3 getMostToutBlock"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="http://compass.xboxlive.com/assets/e5/f6/e5f68f58-c93e-4687-b897-36bed36e0172.png?n=storebag.png" class="gwgGameImage lazyloadimage" alt="Xbox Sales and Specials" /> <h2 class="xboxH2">Sales and Specials</h2> <p class="xboxP"> We've got new sales and specials every week on Xbox Live. From full game downloads to popular add-ons and Arcade games.</p> <p class="button-container"> <a href="http://www.xbox.com/en-GB/promotions/sales/sales-and-specials" data-clickname="www>HP>Footer>Slot3>Default>AllSubs>Sales>LearnMore" data-tout="HP:Blade8:Slot3:Default:Sales" class="buttonP white-bgc-btn learnMoreGetMore">Learn more</a> </p> </div> </div> </div> </div> <div id= "ContentBlockList_11" class="legalblade"> <style> .legalblade { background-color: black; padding: 14px 0; } .legal { width: 90%; max-width: 960px; margin: 0 auto; } .legal p { font-style: italic; font-size: 14px; color: white; } </style> <section class="legal"> <p>*Games and media content sold separately. Limited number of games available in 2015 support cross-device play; additional games to follow. Stream to one device at a time; streaming with multiplayer from Xbox One requires home network connection and Xbox Live Gold <a href="http://www.windows.com/windows10specs" target="_blank">www.windows.com/windows10specs</a>. Some features including party chats, cross-device multiplayer and sharing game clips and screenshots only available on Windows 10 PC devices.</p> </section> </div> </div> <!-- date: [[2016-09-05T20:32:34.7684057Z]] --> </div> <div id="BodyFooter" class="container"> <div class="shell-footer" role="contentinfo" ms.pgarea="uhffooter" data-bi-area="Footer" data-bi-view="5xLinks"> <div class="shell-footer-wrapper"> <div class="shell-footer-menugroups" ms.cmpgrp="footer nav"> <div class="sfm-group" ms.cmpnm=""> <div class="grp-title"> Xbox <i class="shell-icon-dropdown"></i> </div> <ul> <li> <a href="http://feedback.xbox.com/?xr=footnav" ms.title="Feedback" data-bi-name="FooterMenu_Xbox_Feedback" data-bi-slot="1" data-bi-source="Compass"> Feedback </a> </li> <li> <a href="http://www.xbox.com/support/?xr=footnav" ms.title="Support" data-bi-name="FooterMenu_Xbox_Support" data-bi-slot="2" data-bi-source="Compass"> Support </a> </li> <li> <a href="http://support.xbox.com/xbox-one/games/photosensitive-seizure-warning?xr=footnav" ms.title="Photosensitive Seizure Warning" data-bi-name="FooterMenu_Xbox_PhotoSeizureWarning" data-bi-slot="3" data-bi-source="Compass"> Photosensitive Seizure Warning </a> </li> <li> <a href="http://www.xbox.com/Legal/CodeOfConduct?xr=footnav" ms.title="Code of Conduct" data-bi-name="FooterMenu_Xbox_CodeOfConduct" data-bi-slot="4" data-bi-source="Compass"> Code of Conduct </a> </li> </ul> </div> <div class="sfm-group" ms.cmpnm=""> <div class="grp-title"> Fans <i class="shell-icon-dropdown"></i> </div> <ul> <li> <a href="http://news.xbox.com/?xr=footnav" ms.title="Xbox Wire" data-bi-name="FooterMenu_Fans_XboxWire" data-bi-slot="1" data-bi-source="Compass"> Xbox Wire </a> </li> <li> <a href="http://careers.microsoft.com/gclp.aspx?xr=footnav" ms.title="Jobs" data-bi-name="FooterMenu_Fans_Jobs" data-bi-slot="2" data-bi-source="Compass"> Jobs </a> </li> </ul> </div> <div class="sfm-group" ms.cmpnm=""> <div class="grp-title"> For Developers <i class="shell-icon-dropdown"></i> </div> <ul> <li> <a href="http://www.xbox.com/developers?xr=footnav" ms.title="Games" data-bi-name="FooterMenu_Developers_Games" data-bi-slot="1" data-bi-source="Compass"> Games </a> </li> <li> <a href="http://www.xbox.com/developers/id?xr=footnav" ms.title="ID@@Xbox" data-bi-name="FooterMenu_Developers_ID@@Xbox" data-bi-slot="2" data-bi-source="Compass"> ID@@Xbox </a> </li> <li> <a href="https://dev.windows.com/games?xr=footnav" ms.title="Windows 10" data-bi-name="FooterMenu_Developers_Windows10" data-bi-slot="3" data-bi-source="Compass"> Windows 10 </a> </li> </ul> </div> <div class="sfm-group social"> <ul> <li class="social"><a href="https://www.facebook.com/Microsoft" ms.title="Facebook" data-bi-name="Facebook" data-bi-slot="1" data-bi-source="Compass"><span class="social-Facebook"></span></a></li> <li class="social"><a href="https://twitter.com/microsoft" ms.title="Twitter" data-bi-name="Twitter" data-bi-slot="2" data-bi-source="Compass"><span class="social-Twitter"></span></a></li> </ul> </div> </div> <div class="shell-footer-lang" ms.cmpgrp="loc picker" ms.cmpnm="loc picker" > <ul> <li> <i class="shell-icon-globe"></i> </li><li> <a id="locale-picker-link" ms.title="English (United Kingdom)" href="/Shell/ChangeLocale" data-bi-name="LocalePicker"> English (United Kingdom)&lrm; </a> </li> </ul> </div> <div class="shell-footer-copyright" ms.cmpgrp="corp links" ms.cmpnm="corp"> <ul> <li> <a id="shellmenu_0" href="http://support.microsoft.com/contactus/?ws=support" ms.title="Contact us" class="ctl_footerNavLink" data-bi-name="Footer_ContactUs" data-bi-slot="1"> Contact us </a> </li> <li> <a id="shellmenu_1" href="http://go.microsoft.com/fwlink/?LinkId=248681" ms.title="Privacy &amp; Cookies" class="ctl_footerNavLink" data-bi-name="Footer_PrivacyandCookies" data-bi-slot="2"> Privacy &amp; Cookies </a> </li> <li> <a id="shellmenu_2" href="http://go.microsoft.com/fwlink/?LinkID=530144" ms.title="Terms of use" class="ctl_footerNavLink" data-bi-name="Footer_TermsOfUse" data-bi-slot="3"> Terms of use </a> </li> <li> <a id="shellmenu_3" href="http://www.microsoft.com/trademarks" ms.title="Trademarks" class="ctl_footerNavLink" data-bi-name="Trademarks" data-bi-slot="4"> Trademarks </a> </li> <li> <a id="shellmenu_4" href="http://choice.microsoft.com/" ms.title="About our ads" class="ctl_footerNavLink" data-bi-name="Footer_AboutAds" data-bi-slot="5"> About our ads </a> </li> <li class="ctl_footerCopyright"> &copy; 2016 Microsoft </li> </ul> </div> </div> </div> </div> </div> <!-- SiteCatalyst code version: H.16. Copyright 1996-2010 Adobe, Inc. More info available at http://www.omniture.com --> <script type="text/javascript">//<![CDATA[ try { var s_account="msxboxcomengb,msxboxcomglobal";t_account="msxboxcomv2enGB"; } catch(e) {} //]]></script> <script type="text/javascript" src="/Shell/js/s_code.js"></script> <script type="text/javascript" src="/Shell/js/pageReference.js"></script> <script type="text/javascript">//<![CDATA[ try { s.pageName='www\x2f';s.events='event1';s.prop2='en-gb';s.eVar1='en-gb';s.eVar73='default';s.eVar8='n';s.prop10='n';s.channel='www';s.prop1='home page';s.eVar7='home page'; var extendedReferrer = s.getQueryParam('xr').toLowerCase(); if (extendedReferrer.length > 0) { s.prop9 = extendedReferrer; } if (!s.eVar2) { s.eVar2 = s.pageName; } if ($('#LiveStatusOutage').length > 0) { s.eVar57 = $('#LiveStatusOutage').text(); } require(['xbox.biTracking.pageReference'], function(pageReference){ s.eVar61 = pageReference.getReferrer(); }); s.trackInlineStats=true; $('document').ready(function() { try { if ((typeof BusinessTracking != 'undefined') && (BusinessTracking.extendPageViewData)) { BusinessTracking.extendPageViewData() } var s_code=s.t(); if (s_code) document.write(s_code); }catch(ex){} }); }catch(e){} //]]></script> <noscript><img src="http://o.xbox.com/b/ss/msxboxcomengb,msxboxcomglobal/1/H.16--NS/0?pageName=NoScriptPage" height="1" width="1" border="0" alt="" /></noscript><!--/DO NOT REMOVE/--><!-- End SiteCatalyst code version: H.16. --><!-- Start WEDCS tracking --> <script type="text/javascript"> try { var varAutoFirePV = 0; var varSegmentation = 0; var varClickTracking = 1;var varCustomerTracking = 0; varCustomerCookies = ['MUID'] document.write("<script type='text/javascript' src='http://c.microsoft.com/ms.js'><\/script>"); } catch(e) {} </script> <noscript><img src="http://c.microsoft.com/trans_pixel.aspx" height="1" width="1" border="0" alt="" /></noscript> <!-- End WEDCS tracking --> <script type="text/javascript">//<![CDATA[ window._pageData='xbox-gb-landing'; $(window).load(function () { if (window.BOOMR && window.BOOMR.version) { return; } var dom, doc, where, iframe = document.createElement('iframe'), win = window; function boomerangSaveLoadTime(e) { win.BOOMR_onload = (e && e.timeStamp) || new Date().getTime(); } if (win.addEventListener) { win.addEventListener("load", boomerangSaveLoadTime, false); } else if (win.attachEvent) { win.attachEvent("onload", boomerangSaveLoadTime); } iframe.src = "javascript:false"; iframe.title = ""; iframe.role = "presentation"; (iframe.frameElement || iframe).style.cssText = "width:0;height:0;border:0;display:none;"; where = document.getElementsByTagName('script')[0]; where.parentNode.insertBefore(iframe, where); try { doc = iframe.contentWindow.document; } catch (e) { dom = document.domain; iframe.src = "javascript:var d=document.open();d.domain='" + dom + "';void(0);"; doc = iframe.contentWindow.document; } doc.open()._l = function () { var js = this.createElement("script"); if (dom) this.domain = dom; js.id = "boomr-if-as"; js.src = '//c.go-mpulse.net/boomerang/' + 'Y9YAE-V4HXH-LRFPP-GAGTB-MVYS6'; BOOMR_lstart = new Date().getTime(); this.body.appendChild(js); }; doc.write('<body onload="document._l();">'); doc.close(); }); //]]></script> </body> </html>
the_stack
@model Xms.Web.Customize.Models.WebResourceModel @{ Layout = null; } @{ Xms.Web.Models.DialogModel dialogModel = ViewData["DialogModel"] as Xms.Web.Models.DialogModel; } <!-- (Modal) --> <div class="modal fade" id="webResourceModal" tabindex="-1" role="dialog" aria-labelledby="webResourceModalLabel" aria-hidden="true"> <div class="modal-dialog" style="width:650px;"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button> <h4 class="modal-title" id="webResourceModalLabel"> <span class="glyphicon glyphicon-th"></span> Web资源 </h4> </div> <div class="modal-body"> <div class="row"> @using (Html.BeginRouteForm("Customize", FormMethod.Get, new { @id = "searchForm", @class = "form-horizontal", @role = "form" })) { @Html.AntiForgeryToken() @Html.Hidden("CallBack", dialogModel.CallBack) <div class="form-group col-sm-12" style="height:30px;margin-bottom:0px;"> <label class="col-sm-2 control-label" for="clientip">@app.T["name"]</label> <div class="col-sm-10"> <div class="input-group"> @Html.TextBoxFor(x => x.Name, new { @class = "form-control input-sm" }) <span class="input-group-btn"> <button class="btn btn-default btn-sm datagrid-form-search" type="submit"> <span class="glyphicon glyphicon-search"></span> @app.T["search"] </button> </span> </div> </div> </div> } </div> <div class="datagrid-selecterview mt-2" id="datagridselecterview"></div> <div class="table-responsive" id="gridview"> <table class="table table-striped table-hover table-condensed datatable" id="datatable" data-ajax="true" data-ajaxcontainer="gridview" data-ajaxcallback="ajaxgrid_reset()" data-sortby="@Model.SortBy.ToLower()" data-sortdirection="@Model.SortDirection" data-singlemode="@dialogModel.SingleMode"> </table> <link href="~/content/js/jquery-ui-1.10.3/themes/base/jquery.ui.all.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet"> <link href="~/content/js/grid/pqgrid.dev.css?v=@app.PlatformSettings.VersionNumber" rel="stylesheet"> <link id="themeLink" href="~/content/css/theme/@(app.Theme).css" rel="stylesheet" /> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.button.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.mouse.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.autocomplete.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.draggable.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.resizable.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.tooltip.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="~/content/js/fetch.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="~/content/js/common/filters.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/grid/pqgrid.dev.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/grid/localize/pq-localize-zh.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/cdatagrid.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery.bootpag.min.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/jquery.form.js?v=@app.PlatformSettings.VersionNumber"></script> <script src="/content/js/xms.js?v=@app.PlatformSettings.VersionNumber"></script> <script> var WebResourcesModel = { dialogid: '#webResourceModal', dialog: $('#webResourceModal'), callback : @dialogModel.CallBack, datatable: $("#webResourceModal .datatable"), gridview: $("#webResourceModal #gridview"), searchform: $('#webResourceModal #searchForm'), pagesection: $('#webResourceModal #page-selection'), pageUrl : '@app.Url', callback : @dialogModel.CallBack, inputid : '@dialogModel.InputId', solutionid:'@Model.SolutionId', ajaxgrid_reset : function () { WebResourcesModel.pag_init(); Xms.Web.DataTable(WebResourcesModel.datatable); }, pag_init: function () { WebResourcesModel.pagesection.bootpag({ total: WebResourcesModel.pagesection.attr('data-total') , maxVisible: 5 , page: WebResourcesModel.pagesection.attr('data-page') , leaps: false , prev: '&lsaquo;' , next: '&rsaquo;' , firstLastUse: true , first: '&laquo;' , last: '&raquo;' }).on("page", function (event, /* page number here */ num) { event.preventDefault(); var url = $.setUrlParam(WebResourcesModel.pageUrl, 'page', num); WebResourcesModel.gridview.ajaxLoad(url, WebResourcesModel.gridview.prop('id'), function (response) { WebResourcesModel.ajaxgrid_reset(); }); return false; }); }, dialog_return: function (obj) { if (obj) { var trindex = $(obj).parents('tr:first').index(); var res = Xms.DataGridCtrl.getRowData('datagridselecterview', trindex-1); } else { var res = Xms.DataGridCtrl.getSelectedData('datagridselecterview'); } console.log(res); var result = new Array(); if (!$.isArray(res)) { res = [res]; } if (res && res.length > 0) { $.each(res, function (i, n) { var temp = {} $.extend(temp, n); temp.id = n.webresourceid; result.push(temp); }); } var dialog = $(WebResourcesModel.dialogid); if (dialog.data().OpenDialogCallback) { dialog.data().OpenDialogCallback(result, WebResourcesModel.inputid,WebResourcesModel) } else { WebResourcesModel.callback && WebResourcesModel.callback(result,WebResourcesModel.inputid); } WebResourcesModel.dialog.modal('hide'); } , selectedrow: function (id) { } ,CreateRecord: function(){ Xms.Web.OpenWindow(ORG_SERVERURL +'/customize/webresource/createwebresource?solutionid=' + (WebResourcesModel.solutionid || $.getUrlParam('solutionid'))); } }; $(function () { //WebResourcesModel.ajaxgrid_reset(); // WebResourcesModel.searchform.ajaxSearch('#'+WebResourcesModel.gridview.prop('id'), WebResourcesModel.ajaxgrid_reset); // WebResourcesModel.datatable.ajaxTable(); WebResourcesModel.dialog.modal({ backdrop:'static' }); $("#webResourceModal .datatable").on('hidden.bs.modal', function () { Xms.Web.CloseDialog(WebResourcesModel.dialogid); }); console.log('webResourceModal') $("#webResourceModal").find('button[name=createBtn]').off('click').on('click', null, function (e) { e.preventDefault(); WebResourcesModel.CreateRecord(); }); }); </script> </div> </div> <div class="modal-footer"> <div class="pull-left"> <button type="button" class="btn btn-link" name="createBtn"> <span class="glyphicon glyphicon-plus-sign"></span> 新建 </button> </div> <button type="button" class="btn btn-default" data-dismiss="modal"> <span class="glyphicon glyphicon-remove"></span> 关闭 </button> <button type="button" class="btn btn-primary" onclick="WebResourcesModel.dialog_return()"> <span class="glyphicon glyphicon-ok"></span> 确定 </button> </div> <script> var websourcetypes = [{ label: '脚本', value: 'Script' }, { label: '样式', value: 'Css' }, { label: '网页', value: 'Html' }, { label: '图片', value: 'Picture' }] $(function () { var theaders = { 'typename':'@app.T["typename"]', 'name': '@app.T["name"]', 'description': '@app.T["description"]', 'createdon': '创建时间', 'operation':'@app.T["operation"]' } //列数据配置数据 var columnConfigs = [ //从新配置复选框列的渲染方式, { title: "", dataIndx: "recordid", maxWidth: 48, minWidth: 48, align: "center", resizable: false, type: 'checkBoxSelection', cls: 'ui-state-default', sortable: false, editable: false, render: function (ui) { // console.log(ui) return '<input type="checkbox" value="' + ui.rowData.webresourceid + '" name="recordid" class="">' }, cb: { all: true, header: true } }, { title: "", dataIndx: "name", maxWidth: 30, minWidth: 30, align: "center", resizable: false, cls: 'ui-state-default', sortable: false, editable: false, hidden:true, render: function (ui) { // console.log(ui) return '<input type="hidden" value="' + ui.rowData.webresourceid + '" name="componenttypename" class="">' }, cb: { all: true, header: true } }, { "dataIndx": "name", "title": theaders.name, editable: false, "dataType": "string", "width": 150, "isprimaryfield": false, "attributetypename": "string" }, { "dataIndx": "description", "title": theaders.description, "dataType": "string", editable: false, "width": 150, "isprimaryfield": false, "attributetypename": "string" }, { title: "操作", editable: false, minWidth: 120,width:120, notHeaderFilter: true, editable: false, sortable: false, render: function (ui) { var datas = ui.rowData; var dataIndx = ui.dataIndx; var column = ui.column; var recordid = datas[dataIndx]; var html = '' html= '<a class="btn btn-link btn-xs row-item-dblclick" onclick="WebResourcesModel.dialog_return(this);"><span class="glyphicon glyphicon-ok text-success"></span></a>' return html } } ]; var url = ORG_SERVERURL + '/customize/webresource/index?LoadData=true&'; var $form = $('#searchForm'); var roles_filters = new XmsFilter(); var datagridconfig = { scrollModel: { autoFit: true }, baseUrl: url, columnConfigs: columnConfigs,//字段配置信息 context: $('#gridview'),//底部操作按钮方法触发 filters: roles_filters,//post提交时过滤条件 searchForm: $form//GET提交时查询的数据 , height: 400 , rowDblClick: function (even, ui) { console.log(even, ui); ui.$tr.find('.row-item-dblclick').trigger('click'); } }; setTimeout(function () { $('.datagrid-selecterview').xmsDataTable(datagridconfig); },300) }); </script> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
the_stack
@model Sheng.WeixinConstruction.Client.Shell.Models.PointCommodityOrderDetailViewModel @{ ViewBag.SubTitle = "订单详情"; Layout = "~/Views/Shared/_LayoutBlank.cshtml"; } <style type="text/css"> body { margin-top: 0.6rem; margin-bottom: 0.2rem; } #divTopTitle { height: 0.5rem; color: #FFF; padding-left: 0.2rem; padding-right: 0.2rem; position: fixed; left: 0rem; right: 0rem; top: 0rem; } #divTopTitleBar { position: fixed; left: 0rem; right: 0rem; top: 0.5rem; height: 0.4rem; background-color: white; } .divCommodityItem { box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; padding: 0.1rem 0.05rem; min-height: 0.8rem; width: 100%; color: #535353; margin-top: 0.1rem; } .imgPointCommodity { max-height: 0.8rem; max-width: 100%; vertical-align: middle; } </style> <script> var _orderPrice = @(Model.Order.Price/100f); var _orderId = getQueryString("id"); $(document).ready(function () { //$("#txtCashAccountFee").bind("input propertychange", function () { //}); $("#txtCashAccountFee").change(function () { calculate(); }); }); function showPayView() { var gettpl = document.getElementById('cashPayViewTemplate').innerHTML; var pageii = layer.open({ type: 1, content: gettpl, style: 'position:fixed; left:0.1rem; top:0.1rem;right:0.1rem; border:none;', success: function (elem) { calculate(); } }); } function pay(){ if ($("#formPay").validate({ onfocusout: false, onkeyup: false, showErrors: showValidationErrors, rules: { "txtCashAccountFee": { required: true, number: true, range: [0, 1000000], cash: true, } }, messages: { "txtCashAccountFee": { required: "请输入使用账户余额支付金额", number: "账户余额支付金额请输入有效数字;", range: "账户余额支付金额请介于 0.01 到 1000000 之间;" } } }).form() == false) { return; } calculate(); var args = new Object(); args.OrderId = _orderId; args.CashAccountFee = accMul(parseFloat($("#txtCashAccountFee").val()),100); args.WeixinPayFee = accMul(parseFloat($("#spanWeixinPayFee").html()),100); var loadLayerIndex = layer.open({ type: 2, shadeClose: false, content: '请稍候...' }); $.ajax({ url: "/Api/PointCommodity/OrderPay/@ViewBag.Domain.Id", type: "POST", dataType: "json", data: JSON.stringify(args), success: function (data, status, jqXHR) { if (data.Success) { var reason = data.Data.Reason; var msg = ""; switch (reason) { case 0: msg = "支付成功!"; break; case 1: msg = "您的积分不足。"; break; case 2: msg = "账户余额不足。"; break; case 3: //需要微信支付,微信支付下单成功(返回微支付订单号需转入微信支付画面) break; case 4: msg = "该订单状态不是待支付。"; break; case 5: msg = "订单已过期,请重新下单。"; break; case 6: msg = "订单不存在。"; break; case 7: msg = "微信支付下单失败。<br/>" + data.Data.Message; break; case 8: //已经有待支付的微信支付订单了且微信支付金额同这次一样(返回微支付订单号需转入微信支付画面) break; default: msg = "未知错误"; break; } if (reason == 0) { layerAlertBtn(msg, function () { window.location.reload(); }); } else if (reason == 3 || reason == 8) { var currentUrl = encodeURI(window.location.href); window.location.href = '/Pay/PayOrderDetail/@ViewBag.Domain.Id?id=' + data.Data.Data.PayOrderId + "&action=1&returnUrl=" + currentUrl; } else { layer.close(loadLayerIndex); layerAlert(msg); } } else { layer.close(loadLayerIndex); layerAlert(data.Message); } }, error: function (xmlHttpRequest) { layer.close(loadLayerIndex); //alert("Error: " + xmlHttpRequest.status); } }); } function calculate() { var cashAccountFee = parseFloat($("#txtCashAccountFee").val()); if (isNaN(cashAccountFee)) { cashAccountFee = 0; } if (cashAccountFee >= _orderPrice) { cashAccountFee = _orderPrice; } //var weixinPayFee = _orderPrice - cashAccountFee; var weixinPayFee = accSub(_orderPrice, cashAccountFee); $("#txtCashAccountFee").val(cashAccountFee); $("#spanWeixinPayFee").html(weixinPayFee); } </script> <script type="text/html" id="cashPayViewTemplate"> <div style="padding: 0.2rem;"> <div class="defaultColor" style="font-weight: bold"> 订单金额:@(Model.Order.Price / 100f) 元 </div> <div style="margin-top: 0.1rem; color: #777777"> <span id="spanMessage">当前账户余额:@(ViewBag.Member.CashAccount / 100f) 元</span> </div> <div class="divDotLine" style="margin-top: 0.1rem;"> </div> <form id="formPay"> <div style="margin-top: 0.1rem;"> <span id="spanMessage">使用账户余额:</span> <input id="txtCashAccountFee" name="txtCashAccountFee" class="input_16" style="width:0.5rem;" maxlength="10" value="@if (ViewBag.Member.CashAccount / 100f >= Model.Order.Price/100f) { @Html.Raw(Model.Order.Price/100f); } else { @Html.Raw(ViewBag.Member.CashAccount / 100f); }" /> <span>元</span> </div> </form> <div style="margin-top: 0.1rem;"> 还需微信支付: <span id="spanWeixinPayFee"></span> 元 </div> <div style="text-align: center; margin-top: 0.2rem;"> <input type="button" class="button" style="margin-top: 0.1rem; width: 2rem;" onclick="pay()" value="支 付" /> <input type="button" class="button_gray" style="margin-top: 0.1rem; width: 2rem;" onclick="layer.closeAll()" value="关 闭" /> </div> </div> </script> <div id="divTopTitle" class="gradient"> <div style="padding-top: 0.16rem; font-size: 0.15rem;"> 订单详情 </div> <div style="position: absolute; bottom: 0rem; left: 0.2rem; right: 0.2rem;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width: 0.7rem;" align="left"> <img src="/Content/Images/arrow_up.png" style="width: 0.18rem; display: block; margin-left: 0.15rem;"> </td> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="33%" align="left"></td> <td width="33%" align="left"></td> <td width="33%" align="left"></td> </tr> </table> </td> </tr> </table> </div> </div> <div class="divContent" style="margin-top: 0.1rem;"> <div style="font-size: 0.18rem;"> 订单号:@Model.Order.OrderNumber </div> <div style="margin-top: 0.1rem;"> 状态:@Model.Order.StatusString </div> <div class="divDotLine" style="margin-top: 0.1rem;"> </div> <div style="margin-top: 0.1rem;"> 合计: </div> <div style="margin-top: 0.1rem;"> <span>现金:@(Model.Order.Price / 100f) 元</span><span style="margin-left: 0.4rem;">积分:@Model.Order.Point</span> </div> @if (Model.Order.Status == Sheng.WeixinConstruction.Infrastructure.PointCommodityOrderStatus.NoPayment && Model.Order.ExpireTime > DateTime.Now) { <div style="margin-top: 0.15rem; text-align: center"> <input name="" type="button" class="button" value="支 付" style="width: 1.5rem" onclick="showPayView()"> </div> } @if (Model.Order.ExpireTime <= DateTime.Now) { <div class="defaultColor" style="margin-top: 0.15rem; text-align: center"> 该订单已过期,请重新下单。 </div> } <div class="divDotLine" style="margin-top:0.15rem;"> </div> <div style="margin-top: 0.1rem;"> 下单时间:@Model.Order.OrderTime </div> <div style="margin-top:0.1rem;"> 请在 @Model.Order.ExpireTime 前完成支付,否则订单将被取消。 </div> <div class="divDotLine" style="margin-top: 0.15rem;"> </div> <div style="margin-top: 0.1rem;"> 上门自取 </div> <div style="margin-top: 0.1rem;"> @ViewBag.DomainContext.PointCommodityGetWay </div> <div> @foreach (var item in Model.ItemList) { <div class="divDotLine" style="margin-top: 0.15rem;"> </div> <div class="divCommodityItem" style=""> <div style="float: left; width: 35%; text-align: center"> <img src="@item.ImageUrl" class="imgPointCommodity"> </div> <div style="float: right; width: 60%;"> <div class="defaultColor" style="font-size: 0.14rem;">@item.Name</div> <div style="margin-top: 0.05rem;">数量:@item.Quantity</div> <div style="margin-top: 0.05rem;">@(item.Price * item.Quantity / 100f) 元 + @(item.Point * item.Quantity) 积分</div> </div> <div style="clear: both"></div> </div> } </div> <div class="divDotLine" style="margin-top:0.15rem;"> </div> <div style="margin-top:0.15rem;color:#777777"> <div>处理记录:</div> @foreach (var item in Model.LogList) { <div style="margin-top:0.05rem;">@item.Time:@item.Message</div> } </div> </div>
the_stack
@model NccPage @{ Layout = Constants.AdminLayoutName; //var controllerName = "CmsPage"; Title = "Page Create"; SubTitle = "Create a new page"; if (Model.Id > 0) { Title = "Page Edit"; SubTitle = "Update information of a page"; } } <style> .tabBorderDesign { border-left: 1px solid #ddd; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; } </style> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <div class="panel-heading"> @SubTitle <div class="pull-right"> @if (Model.Id > 0) { if (GlobalContext.WebSite.IsMultiLangual == true || Model.PageDetails.Where(x => x.Language == GlobalContext.WebSite.Language).Count() <= 0) { for (var j = 0; j < Model.PageDetails.Count; j++) { <a href="/@Model.PageDetails[j].Language/@Model.PageDetails[j].Slug" class="btn btn-sm btn-info btn-outline btn-xs" target="_blank"><i class="fa fa-eye"> </i> @Model.PageDetails[j].Language</a> } } else { <a href="/@Model.PageDetails.Where(x => x.Language == GlobalContext.WebSite.Language).FirstOrDefault().Slug" class="btn btn-sm btn-info btn-outline btn-xs" target="_blank"><i class="fa fa-eye"> </i> @GlobalContext.WebSite.Language</a> } <a asp-controller="@ControllerName" asp-action="CreateEdit" asp-route-id="" class="btn btn-outline btn-success btn-xs">New Page</a> } <a asp-controller="@ControllerName" asp-action="Manage" class="btn btn-outline btn-primary btn-xs">Manage Page</a> </div> </div> <div class="panel-body"> <div class="row"> <form id="pageCreateEditForm" class="form-horizontal" asp-controller="@ControllerName" asp-action="CreateEdit" method="post"> <div class="col-sm-8 pull-left"> <span asp-validation-summary="ValidationSummary.All" class="text-danger"></span> <input type="hidden" asp-for="Id" /> <div class=""> @{ var tabBorderDesign = ""; } @if (GlobalContext.WebSite.IsMultiLangual == true) { <ul class="nav nav-tabs" role="tablist"> @foreach (var item in Model.PageDetails) { if (GlobalContext.WebSite.Language == item.Language) { <li role="presentation" class="active"> <a href="#@item.Language" aria-controls="@item.Language" role="tab" data-toggle="tab">(D) @SupportedCultures.Cultures.Where(x => x.TwoLetterISOLanguageName == item.Language).FirstOrDefault().NativeName </a> </li> } else { <li role="presentation" class=""> <a href="#@item.Language" aria-controls="@item.Language" role="tab" data-toggle="tab"> @if (SupportedCultures.Cultures.Where(x => x.TwoLetterISOLanguageName == item.Language).Count() > 0) { <span>@SupportedCultures.Cultures.Where(x => x.TwoLetterISOLanguageName == item.Language).FirstOrDefault().NativeName</span> } else { <span>@item.Language</span> } </a> </li> } } </ul> tabBorderDesign = "tabBorderDesign"; } <!-- Tab panes --> <div class="tab-content @tabBorderDesign" > @{ var activeClass = ""; var i = 0;} @foreach (var item in Model.PageDetails) { if (GlobalContext.WebSite.Language == item.Language) { activeClass = "active"; } else { activeClass = ""; } <div role="tabpanel" class="tab-pane row @activeClass" id="@item.Language"> <div class="" style="padding:10px 25px 25px 25px;"> <div class="col-md-12"> <input type="hidden" asp-for="PageDetails[i].Id" /> <input type="hidden" asp-for="PageDetails[i].Language" /> <div class="form-group input-group"> <span class="input-group-addon">Page Title: </span> <input type="text" class="form-control pageTitle" asp-for="PageDetails[i].Title" placeholder="Enter Page Title in @item.Language"> <span asp-validation-for="PageDetails[i].Title" class="text-danger"></span> </div> <div class="form-group input-group"> <span class="input-group-addon">@ViewBag.DomainName</span> <input type="text" class="form-control pageSlug" asp-for="PageDetails[i].Slug" placeholder="Slug in @item.Language"> <span asp-validation-for="PageDetails[i].Slug" class="text-danger"></span> </div> </div> <div class=""> <label>Page Content</label> @*<textarea id="PageContent" name="PageContent" class="form-control ckeditor" data-val="false">@Model.PageDetails[i].Content</textarea>*@ <textarea class="form-control pageContent" asp-for="PageDetails[i].Content"></textarea> <span asp-validation-for="PageDetails[i].Content" class="text-danger"></span> </div> <div class=""> <label>Meta Description</label> <textarea class="form-control" asp-for="PageDetails[i].MetaDescription" placeholder="Meta description in @item.Language"></textarea> </div> <div class=""> <label>Meta Keyword</label> <textarea class="form-control" asp-for="PageDetails[i].MetaKeyword" placeholder="Meta keyword in @item.Language"></textarea> </div> </div> </div> i++; } </div> </div> </div> <div class="col-sm-4 pull-right"> <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingOne"> <div class="panel-title"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> <i class="more-less glyphicon glyphicon-chevron-down"></i> Publish </a> </div> </div> <div id="collapseOne" class="panel-collapse" role="tabpanel" aria-labelledby="headingOne"> <div class="panel-body"> <div class="from-group"> <label class="control-label col-sm-4">Status</label> <div class="col-sm-8"> <select class="form-control" asp-for="PageStatus" id="PageStatus" asp-items="@ViewBag.PageStatus"></select> </div> </div> <div class="from-group"> <label class="control-label col-sm-4">Visibility</label> <div class="col-sm-8"> <select class="form-control" asp-for="PageType" asp-items="@ViewBag.PageType"></select> </div> </div> <div class="from-group"> <label class="control-label col-sm-4">Schedule Date</label> <div class="col-sm-8"> <div class='input-group date datetimepicker'> <input type="text" class="form-control" asp-for="PublishDate" value="@Model.PublishDate.ToString("MMM dd, yyyy hh:mm tt")" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <div class="from-group"> <label class="control-label col-sm-4">Layout</label> <div class="col-sm-8"> <select class="form-control" asp-for="Layout" asp-items="@ViewBag.Layouts"></select> </div> </div> @*<div> <label>Add to Navigation Menu</label> <input type="checkbox" asp-for="AddToNavigationMenu" /> </div>*@ </div> <div class="panel-footer"> <input type="hidden" name="SubmitType" id="SubmitType" value="Save" /> <div class="pull-left"> <button id="save" class="btn btn-sm btn-primary" type="button"> @if (Model.Id > 0) { <span>Update</span> } else { <span>Save</span> } </button> </div> <div class="pull-right"> @if (Model.Id == 0 || (int)Model.PageStatus != 2) { <button id="publish" class="btn btn-sm btn-success" type="button">Publish</button> } </div> <div style="clear:both;"></div> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingTwo"> <div class="panel-title"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo"> <i class="more-less glyphicon glyphicon-chevron-down"></i> Atributs </a> </div> </div> <div id="collapseTwo" class="panel-collapse " role="tabpanel" aria-labelledby="headingTwo"> <div class="panel-body"> <div class="from-group"> <label class="control-label col-sm-4">Parent Page:</label> <div class="col-sm-8"> <select class="form-control" asp-for="Parent" name="ParentId" asp-items="@ViewBag.AllPages"> <option value="0">Select Parent</option> </select> </div> </div> <div class="from-group"> <label class="control-label col-sm-4">Order</label> <div class="col-sm-8"> <input type="tel" class="form-control" asp-for="PageOrder" value="0" /> </div> </div> </div> </div> </div> </div> </div> </form> </div> <!-- /.row (nested) --> </div> <!-- /.panel-body --> </div> <!-- /.panel --> </div> </div> @section Scripts{ <script> KEDITOR_BASEPATH = "@Url.Content("~/lib/ckeditor/")"; </script> <script src="~/lib/ckeditor/ckeditor.js"></script> <script> $(document).ready(function () { var elements = document.getElementsByClassName('pageContent'); for (var i = 0; i < elements.length; ++i) { console.log(elements[i].name); CKEDITOR.replace(elements[i].name, { enterMode: CKEDITOR.ENTER_DIV, allowedContent: true, filebrowserBrowseUrl: '/MediaHome/?isFile=true&inputId=ckeditor', filebrowserImageBrowseUrl: '/MediaHome/?inputId=ckeditor', //filebrowserUploadUrl: '/media/files', //filebrowserImageUploadUrl: '/MediaHome/Upload', //filebrowserWindowWidth: 800, //filebrowserWindowHeight: 500, toolbar: [ { name: 'document', items: ['Source', '-', /*'Save', 'NewPage', 'DocProps', 'Preview', 'Print', '-', 'Templates'*/] }, { name: 'clipboard', items: ['Cut', 'Copy', 'Paste'] }, { name: 'clipboard1', items: ['PasteText', 'PasteFromWord'] }, { name: 'clipboard2', items: ['Undo', 'Redo'] }, { name: 'editing', items: ['Find', 'Replace', 'SelectAll'] }, { name: 'editing1', items: ['SpellChecker', 'Scayt'] }, { name: 'styles', items: ['Styles'] }, { name: 'styles1', items: ['Format'] }, { name: 'styles2', items: ['Font'] }, { name: 'styles3', items: ['FontSize'] }, { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline'] }, { name: 'basicstyles1', items: ['Strike', 'Subscript', 'Superscript'] }, //{ name: 'basicstyles2', items: ['-', 'RemoveFormat'] }, { name: 'paragraph', items: ['NumberedList', 'BulletedList'] }, { name: 'paragraph1', items: ['Outdent', 'Indent'] }, { name: 'paragraph2', items: ['Blockquote', 'CreateDiv'] }, { name: 'paragraph3', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] }, //{ name: 'paragraph4', items: ['-', 'BidiLtr', 'BidiRtl'] }, { name: 'links', items: ['Link', 'Unlink', 'Anchor'] }, { name: 'insert', items: ['Image', 'Mathjax', /*'Flash',*/ 'Table'] }, //'/', { name: 'colors', items: ['TextColor', 'BGColor'] }, { name: 'insert1', items: ['HorizontalRule', 'Smiley'] }, { name: 'insert2', items: ['SpecialChar', 'PageBreak'] }, { name: 'tools', items: ['Maximize', 'ShowBlocks'] } ], extraPlugins: 'mathjax', mathJaxLib: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML', }); } $(".pageTitle").change(function () { $(this).parent().parent().find(".pageSlug").val(NccUtil.GetSafeSlug($(this).val())); //$(".pageSlug").val(NccUtil.GetSafeSlug($(this).val())); }); $("#publish").click(function () { var element = document.getElementById('PageStatus'); element.value = "2"; //console.log($("#Slug").val()); //if ($("#Slug").val() == "") { // document.getElementById("Slug").value = NccUtil.GetSafeSlug($("#Title").val()); // console.log($("#Slug").val()); //} document.getElementById("SubmitType").value = "publish"; //$("#SubmitType").value = "publish"; //$('#PageContent').html(CKEDITOR.instances["PageContent"].getData()); document.getElementById("pageCreateEditForm").submit(); }); $("#save").click(function () { //if ($("#Slug").val() == "") { // $("#Slug").val(NccUtil.GetSafeSlug($(this).val())); //} $("#SubmitType").val("Save"); //$('#PageContent').html(CKEDITOR.instances["PageContent"].getData()); document.getElementById("pageCreateEditForm").submit(); }); }); </script> }
the_stack