Web.UI - AssignDomain2 dialog (U4-19)
This commit is contained in:
@@ -565,6 +565,7 @@
|
||||
<Content Include="Umbraco\Developer\RelationTypes\RelationTypesWebService.asmx" />
|
||||
<Content Include="Umbraco\Developer\RelationTypes\TreeMenu\ActionDeleteRelationType.js" />
|
||||
<Content Include="Umbraco\Developer\RelationTypes\TreeMenu\ActionNewRelationType.js" />
|
||||
<Content Include="Umbraco\Dialogs\AssignDomain2.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\EditMacro.aspx" />
|
||||
<Content Include="Umbraco\Images\delete.gif" />
|
||||
<Content Include="Umbraco\Images\delete.png" />
|
||||
@@ -604,6 +605,7 @@
|
||||
<Content Include="Umbraco\Webservices\Api\MemberService.asmx" />
|
||||
<Content Include="Umbraco\Webservices\Api\StylesheetService.asmx" />
|
||||
<Content Include="Umbraco\Webservices\Api\TemplateService.asmx" />
|
||||
<Content Include="Umbraco_Client\Application\JQuery\jquery.validate.min.js" />
|
||||
<Content Include="Umbraco_Client\CodeMirror\Js\Lib\codemirror.css" />
|
||||
<Content Include="Umbraco_Client\CodeMirror\Js\Lib\codemirror.js" />
|
||||
<Content Include="Umbraco_Client\CodeMirror\Js\Lib\Util\closetag.js" />
|
||||
@@ -767,6 +769,8 @@
|
||||
<Content Include="Umbraco_Client\ContextMenu\Js\jquery.contextMenu.js" />
|
||||
<Content Include="Umbraco_Client\Dashboards\ExamineManagement.css" />
|
||||
<Content Include="Umbraco_Client\Dashboards\ExamineManagement.js" />
|
||||
<Content Include="Umbraco_Client\Dialogs\AssignDomain2.js" />
|
||||
<Content Include="Umbraco_Client\Dialogs\AssignDomain2.css" />
|
||||
<Content Include="Umbraco_Client\Dialogs\CreateDialog.css" />
|
||||
<Content Include="Umbraco_Client\Dialogs\EditMacro.css" />
|
||||
<Content Include="Umbraco_Client\Dialogs\EditMacro.js" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<link>http://umbraco.org</link>
|
||||
</creator>
|
||||
<area alias="actions">
|
||||
<key alias="assignDomain">Manage hostnames</key>
|
||||
<key alias="assignDomain">Culture and Hostnames</key>
|
||||
<key alias="auditTrail">Audit Trail</key>
|
||||
<key alias="browse">Browse Node</key>
|
||||
<key alias="copy">Copy</key>
|
||||
@@ -36,19 +36,31 @@
|
||||
<key alias="update">Update</key>
|
||||
</area>
|
||||
<area alias="assignDomain">
|
||||
<key alias="permissionDenied">Permission denied.</key>
|
||||
<key alias="addNew">Add new Domain</key>
|
||||
<key alias="invalidDomain">Invalid hostname</key>
|
||||
<key alias="remove">remove</key>
|
||||
<key alias="invalidNode">Invalid node.</key>
|
||||
<key alias="invalidDomain">Invalid domain format.</key>
|
||||
<key alias="duplicateDomain">Domain has already been assigned.</key>
|
||||
<key alias="domain">Domain</key>
|
||||
<key alias="language">Language</key>
|
||||
<key alias="domainCreated">New domain '%0%' has been created</key>
|
||||
<key alias="domainDeleted">Domain '%0%' is deleted</key>
|
||||
<key alias="domainExists">Domain '%0%' has already been assigned</key>
|
||||
<key alias="domainHelp">
|
||||
<![CDATA[eg: example.com, www.example.com, example.com:8080,<br/>
|
||||
https://www.example.com/, example.com/en, etc. Use * to match<br/>
|
||||
any domain and just set the culture.]]>
|
||||
<![CDATA[Valid domain names are: "example.com", "www.example.com", "example.com:8080" or
|
||||
"https://www.example.com/".<br /><br />One-level paths in domains are supported, eg. "example.com/en". However, they
|
||||
they should be avoided. Better use the culture setting above.]]>
|
||||
</key>
|
||||
<key alias="domainUpdated">Domain '%0%' has been updated</key>
|
||||
<key alias="orEdit">Edit Current Domains</key>
|
||||
<key alias="inherit">Inherit</key>
|
||||
<key alias="setLanguage">Culture</key>
|
||||
<key alias="setLanguageHelp">
|
||||
<![CDATA[Set the culture for nodes below the current node,<br /> or inherit culture from parent nodes. Will also apply<br />
|
||||
to the current node, unless a domain below applies too.]]>
|
||||
</key>
|
||||
<key alias="setDomains">Domains</key>
|
||||
</area>
|
||||
<area alias="auditTrails">
|
||||
<key alias="atViewingFor">Viewing for</key>
|
||||
|
||||
77
src/Umbraco.Web.UI/umbraco/dialogs/AssignDomain2.aspx
Normal file
77
src/Umbraco.Web.UI/umbraco/dialogs/AssignDomain2.aspx
Normal file
@@ -0,0 +1,77 @@
|
||||
<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master" Codebehind="AssignDomain2.aspx.cs" AutoEventWireup="True" Inherits="umbraco.dialogs.AssignDomain2" %>
|
||||
<%@ Import Namespace="Umbraco.Web" %>
|
||||
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="head" runat="server">
|
||||
<umb:JsInclude runat="server" FilePath="Dialogs/AssignDomain2.js" PathNameAlias="UmbracoClient" />
|
||||
<umb:JsInclude runat="server" FilePath="Application/JQuery/jquery.validate.min.js" PathNameAlias="UmbracoClient" />
|
||||
<umb:CssInclude runat="server" FilePath="Dialogs/AssignDomain2.css" PathNameAlias="UmbracoClient" />
|
||||
<script type="text/javascript">
|
||||
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
var dialog = new Umbraco.Dialogs.AssignDomain2({
|
||||
nodeId: <%=GetNodeId()%>,
|
||||
restServiceLocation: '<%=GetRestServicePath() %>',
|
||||
invalidDomain: '<%=umbraco.ui.Text("assignDomain", "invalidDomain") %>',
|
||||
duplicateDomain: '<%=umbraco.ui.Text("assignDomain", "duplicateDomain") %>',
|
||||
<asp:Literal runat="server" ID="data" />
|
||||
});
|
||||
dialog.init();
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
|
||||
<cc1:Feedback ID="feedback" runat="server" />
|
||||
|
||||
<div id="komask"></div>
|
||||
<div>
|
||||
<cc1:Pane runat="server" ID="pane_language">
|
||||
<cc1:PropertyPanel runat="server" ID="prop_language">
|
||||
<select class="language" name="language" data-bind="options: languages, optionsText: 'Code', optionsValue: 'Id', value: language, optionsCaption: '<%=umbraco.ui.Text("assignDomain", "inherit") %>'"></select>
|
||||
<br /><small><%=umbraco.ui.Text("assignDomain", "setLanguageHelp") %></small>
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
|
||||
<cc1:Pane runat="server" ID="pane_domains">
|
||||
<cc1:PropertyPanel runat="server">
|
||||
<table class="domains" data-bind="visible: domains().length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%=umbraco.ui.Text("assignDomain", "domain") %></th>
|
||||
<th><%=umbraco.ui.Text("assignDomain", "language") %></th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: domains">
|
||||
<tr>
|
||||
<td valign="top"><input class="domain duplicate" data-bind="value: Name, uniqueName: true" /><input type="hidden" value="0" /></td>
|
||||
<td valign="top"><select class="language" data-bind="options: $parent.languages, optionsText: 'Code', optionsValue: 'Id', value: Lang, uniqueName: true"></select></td>
|
||||
<td valign="top"><a href="#" class="remove" data-bind="click: $parent.removeDomain"><%=umbraco.ui.Text("assignDomain", "remove") %></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="addDomain">
|
||||
<tr>
|
||||
<td valign="top"><button data-bind="click: addDomain"><%=umbraco.ui.Text("assignDomain", "addNew") %></button></td>
|
||||
<td class="help"><small><%=umbraco.ui.Text("assignDomain", "domainHelp") %></small></td>
|
||||
</tr>
|
||||
</table>
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
|
||||
<p>
|
||||
<asp:PlaceHolder runat="server" ID="phSave">
|
||||
<button id="btnSave"><%=umbraco.ui.Text("buttons", "save") %></button>
|
||||
<em><%=umbraco.ui.Text("general", "or")%></em>
|
||||
</asp:PlaceHolder>
|
||||
<a href="#" style="color: #0000ff;" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("general", "cancel")%></a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</asp:Content>
|
||||
4
src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.validate.min.js
vendored
Normal file
4
src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -257,7 +257,7 @@ Umbraco.Application.Actions = function () {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/assignDomain.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId, uiKeys['actions_assignDomain'], true, 500, 420);
|
||||
UmbClientMgr.openModalWindow("dialogs/assignDomain2.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId, uiKeys['actions_assignDomain'], true, 500, 620);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
58
src/Umbraco.Web.UI/umbraco_client/Dialogs/AssignDomain2.css
Normal file
58
src/Umbraco.Web.UI/umbraco_client/Dialogs/AssignDomain2.css
Normal file
@@ -0,0 +1,58 @@
|
||||
/* Custom styles for AssignDomain2.aspx dialog */
|
||||
|
||||
button {
|
||||
font-size: 11px;
|
||||
color: #333333;
|
||||
font-family: Trebuchet MS, Lucida Grande, verdana, arial;
|
||||
}
|
||||
|
||||
table.addDomain {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
table.domains {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.addDomain td.help {
|
||||
padding-left:48px;
|
||||
padding-top:4px;
|
||||
}
|
||||
|
||||
button {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#komask {
|
||||
background: #ffffff;
|
||||
opacity: .6;
|
||||
z-index: 99;
|
||||
display: none;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
input.domain {
|
||||
width: 296px;
|
||||
}
|
||||
|
||||
input.domain.error {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
select.language {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
label.error {
|
||||
padding: 0 0 6px 0;
|
||||
margin: 0;
|
||||
background: none;
|
||||
border:none;
|
||||
}
|
||||
|
||||
a.remove {
|
||||
color: #ff0000;
|
||||
padding-left: 8px;
|
||||
}
|
||||
130
src/Umbraco.Web.UI/umbraco_client/Dialogs/AssignDomain2.js
Normal file
130
src/Umbraco.Web.UI/umbraco_client/Dialogs/AssignDomain2.js
Normal file
@@ -0,0 +1,130 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Dialogs");
|
||||
|
||||
(function ($) {
|
||||
|
||||
// register AssignDomain dialog
|
||||
Umbraco.Dialogs.AssignDomain2 = base2.Base.extend({
|
||||
|
||||
_opts: null,
|
||||
|
||||
_isRepeated: function (element) {
|
||||
var inputs = $('#form1 input.domain');
|
||||
var elementName = element.attr('name');
|
||||
var repeated = false;
|
||||
inputs.each(function() {
|
||||
var input = $(this);
|
||||
if (input.attr('name') != elementName && input.val() == element.val())
|
||||
repeated = true;
|
||||
});
|
||||
return repeated;
|
||||
},
|
||||
|
||||
// constructor
|
||||
constructor: function (opts) {
|
||||
// merge options with default
|
||||
this._opts = $.extend({
|
||||
invalidDomain: 'Invalid domain.',
|
||||
duplicateDomain: 'Domain has already been assigned.'
|
||||
}, opts);
|
||||
},
|
||||
|
||||
// public methods/variables
|
||||
|
||||
languages: null,
|
||||
language: null,
|
||||
domains: null,
|
||||
|
||||
addDomain: function () {
|
||||
this.domains.push({
|
||||
Name: "",
|
||||
Lang: ""
|
||||
});
|
||||
},
|
||||
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
self.domains = ko.observableArray(self._opts.domains);
|
||||
self.languages = self._opts.languages;
|
||||
self.language = self._opts.language;
|
||||
self.removeDomain = function() { self.domains.remove(this); };
|
||||
|
||||
ko.applyBindings(self);
|
||||
|
||||
$.validator.addMethod("domain", function (value, element, param) {
|
||||
var re = /^(http[s]?:\/\/)?([-\w]+(\.[-\w]+)*)(:\d+)?(\/[-\w]*)?$/gi;
|
||||
return this.optional(element) || re.test(value);
|
||||
}, self._opts.invalidDomain);
|
||||
|
||||
$.validator.addMethod("duplicate", function (value, element, param) {
|
||||
return $(element).nextAll('input').val() == 0 && !self._isRepeated($(element));
|
||||
}, self._opts.duplicateDomain);
|
||||
|
||||
$.validator.addClassRules({
|
||||
domain: { domain: true },
|
||||
duplicate: { duplicate: true }
|
||||
});
|
||||
|
||||
$('#form1').validate({
|
||||
debug: true,
|
||||
focusCleanup: true,
|
||||
onkeyup: false
|
||||
});
|
||||
|
||||
$('#form1 input.domain').live('focus', function(event) {
|
||||
if (event.type != 'focusin') return;
|
||||
$(this).nextAll('input').val(0);
|
||||
});
|
||||
|
||||
// force validation *now*
|
||||
$('#form1').valid();
|
||||
|
||||
$('#btnSave').click(function () {
|
||||
if (!$('#form1').valid())
|
||||
return false;
|
||||
|
||||
var mask = $('#komask');
|
||||
var masked = mask.next();
|
||||
mask.height(masked.height());
|
||||
mask.width(masked.width());
|
||||
mask.show();
|
||||
|
||||
var data = { nodeId: self._opts.nodeId, language: self.language ? self.language : 0, domains: self.domains };
|
||||
$.post(self._opts.restServiceLocation + 'SaveLanguageAndDomains', ko.toJSON(data), function (json) {
|
||||
mask.hide();
|
||||
|
||||
if (json.Valid) {
|
||||
UmbClientMgr.closeModalWindow();
|
||||
}
|
||||
else {
|
||||
var inputs = $('#form1 input.domain');
|
||||
inputs.each(function() { $(this).nextAll('input').val(0); });
|
||||
for (var i = 0; i < json.Domains.length; i++) {
|
||||
var d = json.Domains[i];
|
||||
if (d.Duplicate == 1)
|
||||
inputs.each(function() {
|
||||
var input = $(this);
|
||||
if (input.val() == d.Name)
|
||||
input.nextAll('input').val(1);
|
||||
});
|
||||
}
|
||||
$('#form1').valid();
|
||||
}
|
||||
})
|
||||
.fail(function (xhr, textStatus, errorThrown) {
|
||||
mask.css('opacity', 1).css('color', "#ff0000").html(xhr.responseText);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// set defaults for jQuery ajax calls
|
||||
$.ajaxSetup({
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
contentType: 'application/json; charset=utf-8'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user