Add WebCms
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/* Custom styles for AssignDomain2.aspx dialog */
|
||||
|
||||
#komask {
|
||||
background: #ffffff;
|
||||
opacity: .6;
|
||||
z-index: 99;
|
||||
display: none;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
|
||||
select.language {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
input.domain {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
label.error {
|
||||
padding: 0 0 6px 0;
|
||||
margin: 0;
|
||||
background: none;
|
||||
border:none;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Dialogs");
|
||||
|
||||
(function ($) {
|
||||
|
||||
// register AssignDomain dialog
|
||||
Umbraco.Dialogs.AssignDomain2 = base2.Base.extend({
|
||||
|
||||
_opts: null,
|
||||
|
||||
_isRepeated: function (element) {
|
||||
var inputs = $('form 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) {
|
||||
// beware! encode('test') == 'test-'
|
||||
// read eg https://rt.cpan.org/Public/Bug/Display.html?id=94347
|
||||
value = punycode.encode(value);
|
||||
// that regex is best-effort and certainly not exact
|
||||
var re = /^(http[s]?:\/\/)?([-\w]+(\.[-\w]+)*)(:\d+)?(\/[-\w]*|-)?$/gi;
|
||||
var isopt = this.optional(element);
|
||||
var retest = re.test(value);
|
||||
var ret = isopt || retest;
|
||||
return ret;
|
||||
}, self._opts.invalidDomain);
|
||||
|
||||
function getDuplicateMessage(val, el) {
|
||||
var other = $(el).nextAll('input').val();
|
||||
var msg = self._opts.duplicateDomain
|
||||
if (other != "" && other != "!!!")
|
||||
msg = msg + ' (' + other + ')';
|
||||
return msg;
|
||||
}
|
||||
|
||||
$.validator.addMethod("duplicate", function (value, element, param) {
|
||||
return $(element).nextAll('input').val() == "" && !self._isRepeated($(element));
|
||||
}, getDuplicateMessage);
|
||||
|
||||
$.validator.addClassRules({
|
||||
domain: { domain: true },
|
||||
duplicate: { duplicate: true }
|
||||
});
|
||||
|
||||
$('form').validate({
|
||||
debug: true,
|
||||
focusCleanup: true,
|
||||
onkeyup: false
|
||||
});
|
||||
|
||||
$('form input.domain').on('focus', function(event) {
|
||||
if (event.type != 'focusin') return;
|
||||
$(this).nextAll('input').val("");
|
||||
});
|
||||
|
||||
// force validation *now*
|
||||
$('form').valid();
|
||||
|
||||
$('#btnSave').click(function () {
|
||||
if (!$('form').valid())
|
||||
return false;
|
||||
|
||||
var mask = $('#komask');
|
||||
var masked = mask.parent();
|
||||
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 = $('form input.domain');
|
||||
inputs.each(function() { $(this).nextAll('input').val(""); });
|
||||
for (var i = 0; i < json.Domains.length; i++) {
|
||||
var d = json.Domains[i];
|
||||
if (d.Duplicate)
|
||||
inputs.each(function() {
|
||||
var input = $(this);
|
||||
if (input.val() == d.Name)
|
||||
input.nextAll('input').val(d.Other ? d.Other : "!!!");
|
||||
});
|
||||
}
|
||||
$('form').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);
|
||||
@@ -0,0 +1,19 @@
|
||||
.umbracoDialog a {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.umbracoDialog div {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.submit-footer {
|
||||
margin-top: 15px;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* Custom styles for EditMacro.aspx dialog */
|
||||
|
||||
.propertyItemheader
|
||||
{
|
||||
width: 170px !important;
|
||||
}
|
||||
|
||||
.guiInputTextStandard
|
||||
{
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.umbracoPage a {
|
||||
color: blue;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.macro-properties {
|
||||
height: 420px;
|
||||
overflow: auto;
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Dialogs");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Dialogs.EditMacro = base2.Base.extend({
|
||||
/// <summary>Defines the EditMacro class to controll the UI interaction and code insertion for the macro syntax for the code editor</summary>
|
||||
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
_macroAliases: new Array(),
|
||||
|
||||
_pseudoHtmlEncode: function (text) {
|
||||
return text.replace(/\"/gi, "&quot;").replace(/\</gi, "&lt;").replace(/\>/gi, "&gt;");
|
||||
},
|
||||
|
||||
_saveTreepickerValue: function (appAlias, macroAlias) {
|
||||
var treePicker = window.showModalDialog('treePicker.aspx?app=' + appAlias + '&treeType=' + appAlias,
|
||||
'treePicker',
|
||||
'dialogWidth=350px;dialogHeight=300px;scrollbars=no;center=yes;border=thin;help=no;status=no');
|
||||
document.forms[0][macroAlias].value = treePicker;
|
||||
document.getElementById("label" + macroAlias).innerHTML = "</b><i>updated with id: " + treePicker + "</i><b><br/>";
|
||||
},
|
||||
|
||||
_getMacroParameter: function (macroAliasKeyVal) {
|
||||
/// <summary>Returns a string to insert a macro parameter into the code like: MyPropertyName = "MyValue" </summary>
|
||||
var paramString = "";
|
||||
|
||||
var controlId = macroAliasKeyVal[0];
|
||||
var propertyName = macroAliasKeyVal[1];
|
||||
|
||||
var control = jQuery("#" + controlId);
|
||||
if (control == null || (!control.is('input') && !control.is('select') && !control.is('textarea'))) {
|
||||
// hack for tree based macro parameter types
|
||||
var picker = Umbraco.Controls.TreePicker.GetPickerById(controlId);
|
||||
if (picker != undefined) {
|
||||
paramString += propertyName + "=\"" + picker.GetValue() + "\" ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (control.is(':checkbox')) {
|
||||
if (control.is(':checked')) {
|
||||
paramString += propertyName + "=\"1\" ";
|
||||
}
|
||||
else {
|
||||
paramString += propertyName + "=\"0\" ";
|
||||
}
|
||||
}
|
||||
else if (control[0].tagName.toLowerCase() == 'select') {
|
||||
var tempValue = '';
|
||||
control.find(':selected').each(function (i, selected) {
|
||||
tempValue += jQuery(this).attr('value') + ', ';
|
||||
});
|
||||
/*
|
||||
for (var j=0; j<document.forms[0][controlId].length;j++) {
|
||||
if (document.forms[0][controlId][j].selected)
|
||||
tempValue += document.forms[0][controlId][j].value + ', ';
|
||||
}
|
||||
*/
|
||||
if (tempValue.length > 2) {
|
||||
tempValue = tempValue.substring(0, tempValue.length - 2);
|
||||
}
|
||||
|
||||
paramString += propertyName + "=\"" + tempValue + "\" ";
|
||||
|
||||
}
|
||||
else {
|
||||
paramString += propertyName + "=\"" + this._pseudoHtmlEncode(document.forms[0][controlId].value) + "\" ";
|
||||
}
|
||||
}
|
||||
return paramString;
|
||||
},
|
||||
|
||||
_getMacroSyntaxMvc: function() {
|
||||
/// <summary>Return the macro syntax to insert for MVC</summary>
|
||||
|
||||
var macroString = "@Umbraco.RenderMacro(\"" + this._opts.macroAlias + "\"";
|
||||
|
||||
if (this._macroAliases.length > 0) {
|
||||
macroString += ", new {";
|
||||
for (var i = 0; i < this._macroAliases.length; i++) {
|
||||
macroString += this._getMacroParameter(this._macroAliases[i]);
|
||||
if (i < this._macroAliases.length - 1) {
|
||||
macroString += ", ";
|
||||
}
|
||||
}
|
||||
macroString += "}";
|
||||
}
|
||||
|
||||
macroString += ")";
|
||||
return macroString;
|
||||
},
|
||||
|
||||
_getMacroSyntaxWebForms: function () {
|
||||
/// <summary>Return the macro syntax to insert for webforms</summary>
|
||||
|
||||
var macroElement;
|
||||
if (this._opts.useAspNetMasterPages) {
|
||||
macroElement = "umbraco:Macro";
|
||||
}
|
||||
else {
|
||||
macroElement = "?UMBRACO_MACRO";
|
||||
}
|
||||
|
||||
var macroString = '<' + macroElement + ' ';
|
||||
|
||||
for (var i = 0; i < this._macroAliases.length; i++) {
|
||||
macroString += this._getMacroParameter(this._macroAliases[i]);
|
||||
}
|
||||
|
||||
if (macroString.length > 1)
|
||||
macroString = macroString.substr(0, macroString.length - 1);
|
||||
|
||||
if (!this._opts.useAspNetMasterPages) {
|
||||
macroString += " macroAlias=\"" + this._opts.macroAlias + "\"";
|
||||
}
|
||||
|
||||
if (this._opts.useAspNetMasterPages) {
|
||||
macroString += " Alias=\"" + this._opts.macroAlias + "\" runat=\"server\"></" + macroElement + ">";
|
||||
}
|
||||
else {
|
||||
macroString += "></" + macroElement + ">";
|
||||
}
|
||||
return macroString;
|
||||
},
|
||||
|
||||
// Constructor
|
||||
constructor: function () {
|
||||
},
|
||||
|
||||
//public methods
|
||||
|
||||
init: function (opts) {
|
||||
/// <summary>Initializes the class and any UI bindings</summary>
|
||||
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
// Default options go here
|
||||
renderingEngine: "Mvc"
|
||||
}, opts);
|
||||
|
||||
var self = this;
|
||||
|
||||
//The knockout js view model for the selected item
|
||||
var koViewModel = {
|
||||
cancelModal: function () {
|
||||
UmbClientMgr.closeModalWindow();
|
||||
},
|
||||
updateMacro: function () {
|
||||
self.updateMacro();
|
||||
}
|
||||
};
|
||||
|
||||
ko.applyBindings(koViewModel);
|
||||
},
|
||||
|
||||
updateMacro: function () {
|
||||
|
||||
var macroSyntax = null;
|
||||
|
||||
if (this._opts.renderingEngine == "Mvc") {
|
||||
macroSyntax = this._getMacroSyntaxMvc();
|
||||
}
|
||||
else {
|
||||
macroSyntax = this._getMacroSyntaxWebForms();
|
||||
}
|
||||
|
||||
UmbClientMgr.contentFrame().focus();
|
||||
UmbClientMgr.contentFrame().UmbEditor.Insert(macroSyntax, '', this._opts.codeEditorElementId);
|
||||
UmbClientMgr.closeModalWindow();
|
||||
},
|
||||
|
||||
registerAlias: function (alias, pAlias) {
|
||||
var macro = new Array();
|
||||
macro[0] = alias;
|
||||
macro[1] = pAlias;
|
||||
|
||||
this._macroAliases[this._macroAliases.length] = macro;
|
||||
}
|
||||
}, {
|
||||
//Static members
|
||||
|
||||
//private methods/variables
|
||||
_instance: null,
|
||||
|
||||
// Singleton accessor
|
||||
getInstance: function () {
|
||||
if (this._instance == null)
|
||||
this._instance = new Umbraco.Dialogs.EditMacro();
|
||||
return this._instance;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,27 @@
|
||||
#includeUnpublished {
|
||||
margin-left: 16px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#animDiv > div {
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
|
||||
#container label{
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.disabled {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#feedbackMsg > div {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#feedbackMsg ul {
|
||||
margin: 0;
|
||||
padding-left: 15px;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Dialogs");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Dialogs.PublishDialog = base2.Base.extend({
|
||||
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
_koViewModel: null,
|
||||
|
||||
// Constructor
|
||||
constructor: function () {
|
||||
},
|
||||
|
||||
//public methods
|
||||
|
||||
init: function (opts) {
|
||||
/// <summary>Initializes the class and any UI bindings</summary>
|
||||
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
|
||||
}, opts);
|
||||
|
||||
var self = this;
|
||||
|
||||
//The knockout js view model for the selected item
|
||||
self._koViewModel = {
|
||||
publishAll: ko.observable(false),
|
||||
includeUnpublished: ko.observable(false),
|
||||
processStatus: ko.observable("init"),
|
||||
isSuccessful: ko.observable(false),
|
||||
resultMessages: ko.observableArray(),
|
||||
resultMessage: ko.observable(""), //if there's only one result message
|
||||
closeDialog: function () {
|
||||
UmbClientMgr.closeModalWindow();
|
||||
},
|
||||
startPublish: function() {
|
||||
this.processStatus("publishing");
|
||||
|
||||
$.post(self._opts.restServiceLocation + "PublishDocument",
|
||||
JSON.stringify({
|
||||
documentId: self._opts.documentId,
|
||||
publishDescendants: self._koViewModel.publishAll(),
|
||||
includeUnpublished: self._koViewModel.includeUnpublished()
|
||||
}),
|
||||
function (e) {
|
||||
self._koViewModel.processStatus("complete");
|
||||
self._koViewModel.isSuccessful(e.success);
|
||||
var msgs = e.message.trim().split("\r\n");
|
||||
if (msgs.length > 1) {
|
||||
for (var m in msgs) {
|
||||
self._koViewModel.resultMessages.push({ message: msgs[m] });
|
||||
}
|
||||
}
|
||||
else {
|
||||
self._koViewModel.resultMessage(msgs[0]);
|
||||
}
|
||||
|
||||
//sync the tree
|
||||
UmbClientMgr.mainTree().setActiveTreeType('content');
|
||||
UmbClientMgr.mainTree().syncTree(self._opts.documentPath, true);
|
||||
});
|
||||
}
|
||||
};
|
||||
//ensure includeUnpublished is always false if publishAll is ever false
|
||||
self._koViewModel.publishAll.subscribe(function (newValue) {
|
||||
if (newValue === false) {
|
||||
self._koViewModel.includeUnpublished(false);
|
||||
}
|
||||
});
|
||||
|
||||
ko.applyBindings(self._koViewModel);
|
||||
}
|
||||
|
||||
|
||||
}, {
|
||||
//Static members
|
||||
|
||||
//private methods/variables
|
||||
_instance: null,
|
||||
|
||||
// Singleton accessor
|
||||
getInstance: function () {
|
||||
if (this._instance == null)
|
||||
this._instance = new Umbraco.Dialogs.PublishDialog();
|
||||
return this._instance;
|
||||
}
|
||||
});
|
||||
|
||||
//Set defaults for jQuery ajax calls.
|
||||
$.ajaxSetup({
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
contentType: 'application/json; charset=utf-8'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,58 @@
|
||||
#sortableFrame
|
||||
{
|
||||
height: auto;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#sortableNodes
|
||||
{
|
||||
padding: 4px;
|
||||
display: block;
|
||||
border-spacing:0;
|
||||
border-collapse:collapse;
|
||||
}
|
||||
|
||||
#sortableNodes thead tr th
|
||||
{
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding: 4px;
|
||||
padding-right: 25px;
|
||||
background-image: url(../tableSorting/img/bg.gif);
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center right;
|
||||
}
|
||||
|
||||
#sortableNodes thead tr th.headerSortDown
|
||||
{
|
||||
background-image: url(../tableSorting/img/desc.gif);
|
||||
}
|
||||
|
||||
#sortableNodes thead tr th.headerSortUp
|
||||
{
|
||||
background-image: url(../tableSorting/img/asc.gif);
|
||||
}
|
||||
|
||||
#sortableNodes tbody tr td
|
||||
{
|
||||
border-bottom: 1px solid #efefef;
|
||||
}
|
||||
|
||||
#sortableNodes td
|
||||
{
|
||||
padding: 4px;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
tr.tDnD_whileDrag, tr.tDnD_whileDrag td
|
||||
{
|
||||
background: #dcecf3;
|
||||
border-color: #a8d8eb !Important;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#sortableNodes .nowrap
|
||||
{
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Dialogs");
|
||||
|
||||
(function ($) {
|
||||
|
||||
|
||||
Umbraco.Dialogs.SortDialog = base2.Base.extend({
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
_setupTableSorter: function () {
|
||||
//adds a custom sorter to the tablesorter based on the current cultures date/time format
|
||||
$.tablesorter.addParser({
|
||||
// use a unique id
|
||||
id: 'cultureDateParser',
|
||||
is: function(s, table, cell) {
|
||||
//don't auto-detect this parser
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell, cellIndex) {
|
||||
var c = table.config;
|
||||
|
||||
s = s.replace(/\-/g, "/");
|
||||
//all of these basically transform the string into year-month-day since that
|
||||
//is what JS understands when creating a Date object
|
||||
if (c.dateFormat.indexOf("dd/MM/yyyy") == 0 || c.dateFormat.indexOf("dd-MM-yyyy") == 0 || c.dateFormat.indexOf("dd.MM.yyyy") == 0) {
|
||||
s = s.replace(/(\d{1,2})[\/\-\.](\d{1,2})[\/\-\.](\d{4})/, "$3-$2-$1");
|
||||
}
|
||||
else if (c.dateFormat.indexOf("dd/MM/yy") == 0 || c.dateFormat.indexOf("dd-MM-yy") == 0 || c.dateFormat.indexOf("dd.MM.yy") == 0) {
|
||||
s = s.replace(/(\d{1,2})[\/\-\.](\d{1,2})[\/\-\.](\d{2})/, "$3-$2-$1");
|
||||
}
|
||||
else if (c.dateFormat.indexOf("MM/dd/yyyy") == 0 || c.dateFormat.indexOf("MM-dd-yyyy") == 0) {
|
||||
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3-$1-$2");
|
||||
}
|
||||
else if (c.dateFormat.indexOf("MM/dd/yy") == 0 || c.dateFormat.indexOf("MM-dd-yy") == 0) {
|
||||
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$3-$1-$2");
|
||||
}
|
||||
return $.tablesorter.formatFloat(new Date(s).getTime());
|
||||
},
|
||||
// set the type to either numeric or text (text uses a natural sort function
|
||||
// so it will work for everything, but numeric is faster for numbers
|
||||
type: 'numeric'
|
||||
});
|
||||
},
|
||||
|
||||
_saveSort: function() {
|
||||
var rows = $('#sortableNodes tbody tr');
|
||||
var sortOrder = "";
|
||||
|
||||
$.each(rows, function () {
|
||||
sortOrder += $(this).attr("id").replace("node_", "") + ",";
|
||||
});
|
||||
|
||||
$("#sortingDone").hide();
|
||||
$("#sortArea").hide();
|
||||
$("#loading").show();
|
||||
|
||||
var self = this;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: self._opts.serviceUrl,
|
||||
data: '{ "ParentId": "' + self._opts.currentId + '", "SortOrder": "' + sortOrder + '"}',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function(msg) {
|
||||
self._showConfirm();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_showConfirm: function () {
|
||||
$(".umb-dialog-footer").hide();
|
||||
$("#loading").hide();
|
||||
$("#sortingDone").show();
|
||||
UmbClientMgr.mainTree().reloadActionNode();
|
||||
},
|
||||
|
||||
// Constructor
|
||||
constructor: function (opts) {
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
// Default options go here
|
||||
}, opts);
|
||||
|
||||
this._setupTableSorter();
|
||||
},
|
||||
|
||||
//public methods/variables
|
||||
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
//create the sorter
|
||||
$("#sortableNodes").tablesorter({
|
||||
dateFormat: self._opts.dateTimeFormat,
|
||||
headers: {
|
||||
0: { sorter: "text" },
|
||||
1: { sorter: "cultureDateParser" }, //ensure to set our custom parser here
|
||||
2: { sorter: "numeric" }
|
||||
}
|
||||
});
|
||||
|
||||
//setup the drag/drop sorting
|
||||
$("#sortableNodes").tableDnD({ containment: $("#sortableFrame") });
|
||||
|
||||
//wire up the submit button
|
||||
self._opts.submitButton.click(function() {
|
||||
self._saveSort();
|
||||
});
|
||||
|
||||
//wire up the close button
|
||||
self._opts.closeWindowButton.click(function () {
|
||||
UmbClientMgr.closeModalWindow();
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,145 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Dialogs");
|
||||
|
||||
(function($) {
|
||||
|
||||
|
||||
Umbraco.Dialogs.UmbracoField = base2.Base.extend({
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
// Constructor
|
||||
constructor: function (opts) {
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
// Default options go here
|
||||
}, opts);
|
||||
},
|
||||
|
||||
//public methods/variables
|
||||
|
||||
init: function () {
|
||||
var self = this;
|
||||
//bind to the submit handler of the button
|
||||
this._opts.submitButton.click(function () {
|
||||
self.doSubmit();
|
||||
});
|
||||
this._opts.cancelButton.click(function () {
|
||||
UmbClientMgr.closeModalWindow();
|
||||
});
|
||||
},
|
||||
|
||||
doSubmit: function() {
|
||||
//find out if this is an MVC View.
|
||||
var url = window.location.href;
|
||||
var isMvcView = url.indexOf('mvcView=') != -1;
|
||||
var tagString = "";
|
||||
|
||||
//get the form
|
||||
var fieldForm = this._opts.form;
|
||||
|
||||
//formfields
|
||||
var field = fieldForm.field.value;
|
||||
var useIfEmpty = fieldForm.useIfEmpty.value;
|
||||
var alternativeText = fieldForm.alternativeText.value;
|
||||
var insertTextBefore = fieldForm.insertTextBefore.value;
|
||||
var insertTextAfter = fieldForm.insertTextAfter.value;
|
||||
|
||||
if(isMvcView) {
|
||||
tagString = "@Umbraco.Field(\"" + field + "\"";
|
||||
|
||||
if (useIfEmpty != '')
|
||||
tagString += ", altFieldAlias: \"" + useIfEmpty + "\"";
|
||||
|
||||
if (alternativeText != '')
|
||||
tagString += ", altText: \"" + alternativeText + "\"";
|
||||
|
||||
if (fieldForm.recursive.checked)
|
||||
tagString += ", recursive: true";
|
||||
|
||||
if (insertTextBefore != '')
|
||||
tagString += ", insertBefore: \"" + insertTextBefore.replace(/\"/gi, """).replace(/\</gi, "<").replace(/\>/gi, ">") + "\"";
|
||||
|
||||
if (insertTextAfter != "")
|
||||
tagString += ", insertAfter: \"" + insertTextAfter.replace(/\"/gi, """).replace(/\</gi, "<").replace(/\>/gi, ">") + "\"";
|
||||
|
||||
if (fieldForm.formatAsDate[1].checked)
|
||||
tagString += ", formatAsDateWithTime: true, formatAsDateWithTimeSeparator: \"" + fieldForm.formatAsDateWithTimeSeparator.value + "\"";
|
||||
else if (fieldForm.formatAsDate[0].checked)
|
||||
tagString += ", formatAsDate: true";
|
||||
|
||||
if (fieldForm.toCase[1].checked)
|
||||
tagString += ", casing: RenderFieldCaseType.Lower";
|
||||
else if(fieldForm.toCase[2].checked)
|
||||
tagString += ", casing: RenderFieldCaseType.Upper";
|
||||
|
||||
if (fieldForm.urlEncode[1].checked)
|
||||
tagString += ", encoding: RenderFieldEncodingType.Url";
|
||||
else if (fieldForm.urlEncode[2].checked)
|
||||
tagString += ", encoding: RenderFieldEncodingType.Html";
|
||||
|
||||
if (fieldForm.convertLineBreaks.checked)
|
||||
tagString += ", convertLineBreaks: true";
|
||||
|
||||
if (fieldForm.stripParagraph.checked)
|
||||
tagString += ", removeParagraphTags: true";
|
||||
|
||||
tagString += ")";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
tagString = '<' + this._opts.tagName;
|
||||
|
||||
if (field != '')
|
||||
tagString += ' field="' + field + '"';
|
||||
|
||||
if (useIfEmpty != '')
|
||||
tagString += ' useIfEmpty="' + useIfEmpty + '"';
|
||||
|
||||
if (alternativeText != '')
|
||||
tagString += ' textIfEmpty="' + alternativeText + '"';
|
||||
|
||||
if (insertTextBefore != '')
|
||||
tagString += ' insertTextBefore="' + insertTextBefore.replace(/\"/gi, """).replace(/\</gi, "<").replace(/\>/gi, ">") + '"';
|
||||
|
||||
if (insertTextAfter != '')
|
||||
tagString += ' insertTextAfter="' + insertTextAfter.replace(/\"/gi, """).replace(/\</gi, "<").replace(/\>/gi, ">") + '"';
|
||||
|
||||
if (fieldForm.formatAsDate[1].checked)
|
||||
tagString += ' formatAsDateWithTime="true" formatAsDateWithTimeSeparator="' + fieldForm.formatAsDateWithTimeSeparator.value + '"';
|
||||
else if (fieldForm.formatAsDate[0].checked)
|
||||
tagString += ' formatAsDate="true"';
|
||||
|
||||
if (fieldForm.toCase[1].checked)
|
||||
tagString += ' case="' + fieldForm.toCase[1].value + '"';
|
||||
else if (fieldForm.toCase[2].checked)
|
||||
tagString += ' case="' + fieldForm.toCase[2].value + '"';
|
||||
|
||||
if (fieldForm.recursive.checked)
|
||||
tagString += ' recursive="true"';
|
||||
|
||||
if (fieldForm.urlEncode[1].checked)
|
||||
tagString += ' urlEncode="true"';
|
||||
else if (fieldForm.urlEncode[2].checked)
|
||||
tagString += ' htmlEncode="true"';
|
||||
|
||||
if (fieldForm.stripParagraph.checked)
|
||||
tagString += ' stripParagraph="true"';
|
||||
|
||||
if (fieldForm.convertLineBreaks.checked)
|
||||
tagString += ' convertLineBreaks="true"';
|
||||
|
||||
tagString += " runat=\"server\" />";
|
||||
}
|
||||
|
||||
|
||||
UmbClientMgr.contentFrame().focus();
|
||||
UmbClientMgr.contentFrame().UmbEditor.Insert(tagString, '', this._opts.objectId);
|
||||
UmbClientMgr.closeModalWindow();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user