Add WebCms
@@ -0,0 +1,376 @@
|
||||
(function ($) {
|
||||
|
||||
//extensions to base classes such as String and extension methods for jquery.
|
||||
//NOTE: jquery must be loaded before this file.
|
||||
|
||||
//create guid object on the window (which makes it global)
|
||||
if (window.Guid == null) {
|
||||
window.Guid = {
|
||||
generate: function () {
|
||||
///<summary>generates a new Guid</summary>
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (!window.__debug__) {
|
||||
window.__debug__ = function (msg, category, isErr) {
|
||||
///<summary>global method to send debug statements to console that is cross browser (or at least checks if its possible)</summary>
|
||||
|
||||
if (((typeof console) != "undefined") && console.log && console.error) {
|
||||
if (isErr) console.error(category + ": " + msg);
|
||||
else console.log(category + ": " + msg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function (str) {
|
||||
///<summary>startsWith extension method for string</summary>
|
||||
|
||||
return this.substr(0, str.length) === str;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.endsWith) {
|
||||
String.prototype.endsWith = function (str) {
|
||||
///<summary>endsWith extension method for string</summary>
|
||||
|
||||
return this.substr(this.length - str.length) === str;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.utf8Encode) {
|
||||
String.prototype.utf8Encode = function () {
|
||||
///<summary>UTF8 encoder for string</summary>
|
||||
|
||||
var str = this.replace(/\r\n/g, "\n");
|
||||
var utftext = "";
|
||||
for (var n = 0; n < str.length; n++) {
|
||||
var c = str.charCodeAt(n);
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
}
|
||||
else if ((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
}
|
||||
return utftext;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.utf8Decode) {
|
||||
String.prototype.utf8Decode = function () {
|
||||
var utftext = this;
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
|
||||
while (i < utftext.length) {
|
||||
|
||||
c = utftext.charCodeAt(i);
|
||||
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
}
|
||||
else if ((c > 191) && (c < 224)) {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
}
|
||||
else {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
c3 = utftext.charCodeAt(i + 2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return string;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.base64Encode) {
|
||||
String.prototype.base64Encode = function () {
|
||||
///<summary>Base64 encoder for string</summary>
|
||||
|
||||
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
var output = "";
|
||||
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
var input = this.utf8Encode();
|
||||
|
||||
while (i < input.length) {
|
||||
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output +
|
||||
keyStr.charAt(enc1) + keyStr.charAt(enc2) +
|
||||
keyStr.charAt(enc3) + keyStr.charAt(enc4);
|
||||
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.base64Decode) {
|
||||
String.prototype.base64Decode = function () {
|
||||
///<summary>Base64 decoder for string</summary>
|
||||
|
||||
var input = this;
|
||||
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
while (i < input.length) {
|
||||
|
||||
enc1 = keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return output.utf8Decode();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (!Math.randomRange) {
|
||||
Math.randomRange = function (from, to) {
|
||||
///<summary>randomRange extension for math</summary>
|
||||
|
||||
return Math.floor(Math.random() * (to - from + 1) + from);
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.toCamelCase) {
|
||||
String.prototype.toCamelCase = function () {
|
||||
///<summary>toCamelCase extension method for string</summary>
|
||||
|
||||
var s = this.toPascalCase();
|
||||
if ($.trim(s) == "")
|
||||
return "";
|
||||
if (s.length > 1) {
|
||||
var regex = /^([A-Z]*)([A-Z].*)/g;
|
||||
if (s.match(regex)) {
|
||||
var match = regex.exec(s);
|
||||
s = match[1].toLowerCase() + match[2];
|
||||
s = s.substr(0, 1).toLowerCase() + s.substr(1);
|
||||
}
|
||||
} else {
|
||||
s = s.toLowerCase();
|
||||
}
|
||||
return s;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.toPascalCase) {
|
||||
String.prototype.toPascalCase = function () {
|
||||
///<summary>toPascalCase extension method for string</summary>
|
||||
|
||||
var s = "";
|
||||
$.each($.trim(this).split(/[\s\.-]+/g), function (idx, val) {
|
||||
if ($.trim(val) == "")
|
||||
return;
|
||||
if (val.length > 1)
|
||||
s += val.substr(0, 1).toUpperCase() + val.substr(1);
|
||||
else
|
||||
s += val.toUpperCase();
|
||||
});
|
||||
return s;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.toUmbracoAlias) {
|
||||
String.prototype.toUmbracoAlias = function () {
|
||||
///<summary>///<summary>toUmbracoAlias extension method for string</summary></summary>
|
||||
|
||||
var s = this.replace(/[^a-zA-Z0-9\s\.-]+/g, ''); // Strip none alphanumeric chars
|
||||
return s.toCamelCase(); // Convert to camelCase
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.toFunction) {
|
||||
String.prototype.toFunction = function () {
|
||||
var arr = this.split(".");
|
||||
var fn = (window || this);
|
||||
for (var i = 0, len = arr.length; i < len; i++) {
|
||||
fn = fn[arr[i]];
|
||||
}
|
||||
if (typeof fn !== "function") {
|
||||
throw new Error("function not found");
|
||||
}
|
||||
return fn;
|
||||
};
|
||||
}
|
||||
|
||||
//sets defaults for ajax
|
||||
$.ajaxSetup({
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
error: function (x, t, e) {
|
||||
if (x.status.toString().startsWith("500")) {
|
||||
//show ysod overlay if we can
|
||||
if (UmbClientMgr) {
|
||||
var startIndex = x.responseText.indexOf("<body");
|
||||
var endIndex = x.responseText.lastIndexOf("</body>");
|
||||
var body = x.responseText.substring(startIndex, endIndex + 7);
|
||||
var $div = $(body.replace("<body bgcolor=\"white\">", "<div style='display:none;overflow:auto;height:613px;'>").replace("</body>", "</div>"));
|
||||
$div.appendTo($(UmbClientMgr.mainWindow().document.getElementsByTagName("body")[0]));
|
||||
UmbClientMgr.openModalWindowForContent($div, "ysod", true, 640, 640, null, null, null, function() {
|
||||
//remove the $div
|
||||
$div.closest(".umbModalBox").remove();
|
||||
});
|
||||
}
|
||||
else {
|
||||
alert("Unhandled exception occurred.\nStatus: " + x.status + "\nMessage: " + x.statusText + "\n\n" + x.responseText);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.getAllAttributes = function () {
|
||||
///<summary>extension method to get all attributes of a selected element</summary>
|
||||
|
||||
if ($(this).length != 1) {
|
||||
throw "the getAllAttributes method can only be called when matching one jQuery selector";
|
||||
};
|
||||
var el = $(this).get(0);
|
||||
var arr = [];
|
||||
for (var i = 0, attrs = el.attributes; i < attrs.length; i++) {
|
||||
arr.push({ name: attrs.item(i).nodeName, value: attrs.item(i).nodeValue });
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
|
||||
$.fn.outerHtml = function () {
|
||||
///<summary>extension to get the 'outer html' of an element</summary>
|
||||
|
||||
if ($(this).length != 1) {
|
||||
throw "the getAllAttributes method can only be called when matching one jQuery selector";
|
||||
};
|
||||
var nodeName = $(_opts.content).get(0).nodeName.toLowerCase();
|
||||
//start creating raw html
|
||||
var outerHtml = "<" + nodeName;
|
||||
//get all the attributes/values from the original element and add them to the new one
|
||||
var allAttributes = $(_opts.content).getAllAttributes();
|
||||
for (var a in allAttributes) {
|
||||
outerHtml += " " + allAttributes[a].name + "='" + allAttributes[a].value + "'";
|
||||
}
|
||||
outerHtml += ">";
|
||||
outerHtml += $(_opts.content).html();
|
||||
outerHtml += "</" + nodeName + ">";
|
||||
return outerHtml;
|
||||
};
|
||||
|
||||
$.fn.focusFirst = function () {
|
||||
///<summary>extension to focus the first editable field in a form</summary>
|
||||
|
||||
return $(this).each(function () {
|
||||
if ($(this).get(0).nodeName.toLowerCase() != "form") {
|
||||
throw "The focusFirst method can only be applied to a form element";
|
||||
}
|
||||
var first = $(this).find(":input:enabled:visible").not(":submit").not(":button").not(":file").not(":image").not(":radio");
|
||||
if (first.length > 0) {
|
||||
$(first[0]).focus();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.getAttributes = function () {
|
||||
///<summary>Extension method to return all of the attributes for an element</summary>
|
||||
|
||||
var attributes = [];
|
||||
|
||||
if (!this.length)
|
||||
return this;
|
||||
|
||||
$.each(this[0].attributes, function (index, attr) {
|
||||
attributes.push({ name: attr.name, value: attr.value });
|
||||
});
|
||||
|
||||
return attributes;
|
||||
};
|
||||
|
||||
|
||||
//defaults that need to be set on ready
|
||||
$(document).ready(function () {
|
||||
|
||||
//adds a default ignore parameter to jquery validation
|
||||
if ($.validator) {
|
||||
$.validator.setDefaults({ ignore: ".ignore" });
|
||||
}
|
||||
|
||||
//adds a "re-parse" method to the Unobtrusive JS framework since Parse doesn't actually reparse
|
||||
if ($.validator && $.validator.unobtrusive) {
|
||||
$.validator.unobtrusive.reParse = function ($selector) {
|
||||
$selector.removeData("validator");
|
||||
$.validator.unobtrusive.parse($selector);
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//This sets the default jquery ajax headers to include our csrf token, we
|
||||
// need to user the beforeSend method because our token changes per user/login so
|
||||
// it cannot be static
|
||||
$.ajaxSetup({
|
||||
beforeSend: function (xhr) {
|
||||
|
||||
function getCookie(name) {
|
||||
var value = "; " + document.cookie;
|
||||
var parts = value.split("; " + name + "=");
|
||||
if (parts.length === 2) return parts.pop().split(";").shift();
|
||||
}
|
||||
|
||||
xhr.setRequestHeader("X-XSRF-TOKEN", getCookie("XSRF-TOKEN"));
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,60 @@
|
||||
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
|
||||
/// <reference name="MicrosoftAjax.js"/>
|
||||
/// <reference path="/umbraco_client/Application/JQuery/jquery.ba-bbq.min.js" />
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
|
||||
(function($) {
|
||||
|
||||
Umbraco.Controls.HistoryManager = function() {
|
||||
/// <summary>This is a wrapper for the bbq plugin history manager, but we could do alot with history mgmt in the future!</summary>
|
||||
|
||||
var hashFragmentRegex = new RegExp(/^\w+/);
|
||||
function getHashFragment(frag) {
|
||||
//tests for xss and ensures only the first alphanumeric chars are matched
|
||||
var result = hashFragmentRegex.exec(frag);
|
||||
if (result != null && result.length > 0) {
|
||||
return result[0];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
var obj = {
|
||||
|
||||
onNavigate: function(e) {
|
||||
var fragment = getHashFragment($.param.fragment());
|
||||
if (fragment != "") {
|
||||
$(window.top).trigger("navigating", [fragment]); //raise event!
|
||||
}
|
||||
|
||||
},
|
||||
addHistory: function(name, forceRefresh) {
|
||||
var fragment = getHashFragment($.param.fragment());
|
||||
if (fragment == name && forceRefresh) {
|
||||
this.onNavigate();
|
||||
}
|
||||
else {
|
||||
$.bbq.pushState(name, 2);
|
||||
}
|
||||
|
||||
},
|
||||
getCurrent: function () {
|
||||
return getHashFragment($.param.fragment());
|
||||
},
|
||||
|
||||
addEventHandler: function(fnName, fn) {
|
||||
/// <summary>Adds an event listener to the event name event</summary>
|
||||
if (typeof ($) != "undefined") $(window.top).bind(fnName, fn); //if there's no jQuery, there is no events
|
||||
},
|
||||
removeEventHandler: function(fnName, fn) {
|
||||
/// <summary>Removes an event listener to the event name event</summary>
|
||||
if (typeof ($) != "undefined") $(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events
|
||||
}
|
||||
};
|
||||
|
||||
//wire up the navigate events, wrap method to maintain scope
|
||||
$(window).bind('hashchange', function(e) { obj.onNavigate.call(obj); });
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,8 @@
|
||||
(function($) {
|
||||
$.fn.VerticalAlign = function(opts) {
|
||||
return this.each(function() {
|
||||
var top = (($(this).parent().height() - $(this).height()) / 2);
|
||||
$(this).css('margin-top', top);
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// jQuery plugin: fieldSelection - v0.1.0 - last change: 2006-12-16
|
||||
// (c) 2006 Alex Brem <alex@0xab.cd> - http://blog.0xab.cd
|
||||
//
|
||||
|
||||
(function() {
|
||||
|
||||
var fieldSelection = {
|
||||
|
||||
getSelection: function() {
|
||||
|
||||
var e = this.jquery ? this[0] : this;
|
||||
|
||||
return (
|
||||
|
||||
// mozilla or dom 3.0
|
||||
('selectionStart' in e && function() {
|
||||
var l = e.selectionEnd - e.selectionStart;
|
||||
return { start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l) };
|
||||
}) ||
|
||||
|
||||
// exploder
|
||||
(document.selection && function() {
|
||||
|
||||
e.focus();
|
||||
|
||||
var r = document.selection.createRange();
|
||||
if (r == null) {
|
||||
return { start: 0, end: e.value.length, length: 0 }
|
||||
}
|
||||
|
||||
var re = e.createTextRange();
|
||||
var rc = re.duplicate();
|
||||
re.moveToBookmark(r.getBookmark());
|
||||
rc.setEndPoint('EndToStart', re);
|
||||
|
||||
return { start: rc.text.length, end: rc.text.length + r.text.length, length: r.text.length, text: r.text };
|
||||
}) ||
|
||||
|
||||
// browser not supported
|
||||
function() {
|
||||
return { start: 0, end: e.value.length, length: 0 };
|
||||
}
|
||||
|
||||
)();
|
||||
|
||||
},
|
||||
|
||||
replaceSelection: function() {
|
||||
|
||||
var e = this.jquery ? this[0] : this;
|
||||
var text = arguments[0] || '';
|
||||
|
||||
return (
|
||||
|
||||
// mozilla or dom 3.0
|
||||
('selectionStart' in e && function() {
|
||||
e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length);
|
||||
return this;
|
||||
}) ||
|
||||
|
||||
// exploder
|
||||
(document.selection && function() {
|
||||
e.focus();
|
||||
document.selection.createRange().text = text;
|
||||
return this;
|
||||
}) ||
|
||||
|
||||
// browser not supported
|
||||
function() {
|
||||
e.value += text;
|
||||
return this;
|
||||
}
|
||||
|
||||
)();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
jQuery.each(fieldSelection, function(i) { jQuery.fn[i] = this; });
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,813 @@
|
||||
/*
|
||||
* jQuery Autocomplete plugin 1.1
|
||||
*
|
||||
* Copyright (c) 2009 Jörn Zaefferer
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
|
||||
*/
|
||||
|
||||
; (function($) {
|
||||
|
||||
$.fn.extend({
|
||||
autocomplete: function(urlOrData, options) {
|
||||
var isUrl = typeof urlOrData == "string";
|
||||
options = $.extend({}, $.Autocompleter.defaults, {
|
||||
url: isUrl ? urlOrData : null,
|
||||
data: isUrl ? null : urlOrData,
|
||||
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
|
||||
max: options && !options.scroll ? 10 : 150
|
||||
}, options);
|
||||
|
||||
// if highlight is set to false, replace it with a do-nothing function
|
||||
options.highlight = options.highlight || function(value) { return value; };
|
||||
|
||||
// if the formatMatch option is not specified, then use formatItem for backwards compatibility
|
||||
options.formatMatch = options.formatMatch || options.formatItem;
|
||||
|
||||
return this.each(function() {
|
||||
new $.Autocompleter(this, options);
|
||||
});
|
||||
},
|
||||
result: function(handler) {
|
||||
return this.bind("result", handler);
|
||||
},
|
||||
search: function(handler) {
|
||||
return this.trigger("search", [handler]);
|
||||
},
|
||||
flushCache: function() {
|
||||
return this.trigger("flushCache");
|
||||
},
|
||||
setOptions: function(options) {
|
||||
return this.trigger("setOptions", [options]);
|
||||
},
|
||||
unautocomplete: function() {
|
||||
return this.trigger("unautocomplete");
|
||||
}
|
||||
});
|
||||
|
||||
$.Autocompleter = function(input, options) {
|
||||
|
||||
var KEY = {
|
||||
UP: 38,
|
||||
DOWN: 40,
|
||||
DEL: 46,
|
||||
TAB: 9,
|
||||
RETURN: 13,
|
||||
ESC: 27,
|
||||
COMMA: 188,
|
||||
PAGEUP: 33,
|
||||
PAGEDOWN: 34,
|
||||
BACKSPACE: 8
|
||||
};
|
||||
|
||||
// Create $ object for input element
|
||||
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
|
||||
|
||||
var timeout;
|
||||
var previousValue = "";
|
||||
var cache = $.Autocompleter.Cache(options);
|
||||
var hasFocus = 0;
|
||||
var lastKeyPressCode;
|
||||
var config = {
|
||||
mouseDownOnSelect: false
|
||||
};
|
||||
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
|
||||
|
||||
var blockSubmit;
|
||||
|
||||
// prevent form submit in opera when selecting with return key
|
||||
$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
|
||||
if (blockSubmit) {
|
||||
blockSubmit = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
|
||||
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
|
||||
// a keypress means the input has focus
|
||||
// avoids issue where input had focus before the autocomplete was applied
|
||||
hasFocus = 1;
|
||||
// track last key pressed
|
||||
lastKeyPressCode = event.keyCode;
|
||||
switch (event.keyCode) {
|
||||
|
||||
case KEY.UP:
|
||||
event.preventDefault();
|
||||
if (select.visible()) {
|
||||
select.prev();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.DOWN:
|
||||
event.preventDefault();
|
||||
if (select.visible()) {
|
||||
select.next();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.PAGEUP:
|
||||
event.preventDefault();
|
||||
if (select.visible()) {
|
||||
select.pageUp();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.PAGEDOWN:
|
||||
event.preventDefault();
|
||||
if (select.visible()) {
|
||||
select.pageDown();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
// matches also semicolon
|
||||
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
|
||||
case KEY.TAB:
|
||||
case KEY.RETURN:
|
||||
if (selectCurrent()) {
|
||||
// stop default to prevent a form submit, Opera needs special handling
|
||||
event.preventDefault();
|
||||
blockSubmit = true;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.ESC:
|
||||
select.hide();
|
||||
break;
|
||||
|
||||
default:
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(onChange, options.delay);
|
||||
break;
|
||||
}
|
||||
}).focus(function() {
|
||||
// track whether the field has focus, we shouldn't process any
|
||||
// results if the field no longer has focus
|
||||
hasFocus++;
|
||||
}).blur(function() {
|
||||
hasFocus = 0;
|
||||
if (!config.mouseDownOnSelect) {
|
||||
hideResults();
|
||||
}
|
||||
}).click(function() {
|
||||
// show select when clicking in a focused field
|
||||
if (hasFocus++ > 1 && !select.visible()) {
|
||||
onChange(0, true);
|
||||
}
|
||||
}).bind("search", function() {
|
||||
// TODO why not just specifying both arguments?
|
||||
var fn = (arguments.length > 1) ? arguments[1] : null;
|
||||
function findValueCallback(q, data) {
|
||||
var result;
|
||||
if (data && data.length) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i].result.toLowerCase() == q.toLowerCase()) {
|
||||
result = data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof fn == "function") fn(result);
|
||||
else $input.trigger("result", result && [result.data, result.value]);
|
||||
}
|
||||
$.each(trimWords($input.val()), function(i, value) {
|
||||
request(value, findValueCallback, findValueCallback);
|
||||
});
|
||||
}).bind("flushCache", function() {
|
||||
cache.flush();
|
||||
}).bind("setOptions", function() {
|
||||
$.extend(options, arguments[1]);
|
||||
// if we've updated the data, repopulate
|
||||
if ("data" in arguments[1])
|
||||
cache.populate();
|
||||
}).bind("unautocomplete", function() {
|
||||
select.unbind();
|
||||
$input.unbind();
|
||||
$(input.form).unbind(".autocomplete");
|
||||
});
|
||||
|
||||
|
||||
function selectCurrent() {
|
||||
var selected = select.selected();
|
||||
if (!selected)
|
||||
return false;
|
||||
|
||||
var v = selected.result;
|
||||
previousValue = v;
|
||||
|
||||
if (options.multiple) {
|
||||
var words = trimWords($input.val());
|
||||
if (words.length > 1) {
|
||||
var seperator = options.multipleSeparator.length;
|
||||
var cursorAt = $(input).selection().start;
|
||||
var wordAt, progress = 0;
|
||||
$.each(words, function(i, word) {
|
||||
progress += word.length;
|
||||
if (cursorAt <= progress) {
|
||||
wordAt = i;
|
||||
return false;
|
||||
}
|
||||
progress += seperator;
|
||||
});
|
||||
words[wordAt] = v;
|
||||
// TODO this should set the cursor to the right position, but it gets overriden somewhere
|
||||
//$.Autocompleter.Selection(input, progress + seperator, progress + seperator);
|
||||
v = words.join(options.multipleSeparator);
|
||||
}
|
||||
v += options.multipleSeparator;
|
||||
}
|
||||
|
||||
$input.val(v);
|
||||
hideResultsNow();
|
||||
$input.trigger("result", [selected.data, selected.value]);
|
||||
return true;
|
||||
}
|
||||
|
||||
function onChange(crap, skipPrevCheck) {
|
||||
if (lastKeyPressCode == KEY.DEL) {
|
||||
select.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
var currentValue = $input.val();
|
||||
|
||||
if (!skipPrevCheck && currentValue == previousValue)
|
||||
return;
|
||||
|
||||
previousValue = currentValue;
|
||||
|
||||
currentValue = lastWord(currentValue);
|
||||
if (currentValue.length >= options.minChars) {
|
||||
$input.addClass(options.loadingClass);
|
||||
if (!options.matchCase)
|
||||
currentValue = currentValue.toLowerCase();
|
||||
request(currentValue, receiveData, hideResultsNow);
|
||||
} else {
|
||||
stopLoading();
|
||||
select.hide();
|
||||
}
|
||||
};
|
||||
|
||||
function trimWords(value) {
|
||||
if (!value)
|
||||
return [""];
|
||||
if (!options.multiple)
|
||||
return [$.trim(value)];
|
||||
return $.map(value.split(options.multipleSeparator), function(word) {
|
||||
return $.trim(value).length ? $.trim(word) : null;
|
||||
});
|
||||
}
|
||||
|
||||
function lastWord(value) {
|
||||
if (!options.multiple)
|
||||
return value;
|
||||
var words = trimWords(value);
|
||||
if (words.length == 1)
|
||||
return words[0];
|
||||
var cursorAt = $(input).selection().start;
|
||||
if (cursorAt == value.length) {
|
||||
words = trimWords(value)
|
||||
} else {
|
||||
words = trimWords(value.replace(value.substring(cursorAt), ""));
|
||||
}
|
||||
return words[words.length - 1];
|
||||
}
|
||||
|
||||
// fills in the input box w/the first match (assumed to be the best match)
|
||||
// q: the term entered
|
||||
// sValue: the first matching result
|
||||
function autoFill(q, sValue) {
|
||||
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
|
||||
// if the last user key pressed was backspace, don't autofill
|
||||
if (options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE) {
|
||||
// fill in the value (keep the case the user has typed)
|
||||
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
|
||||
// select the portion of the value not typed by the user (so the next character will erase)
|
||||
$(input).selection(previousValue.length, previousValue.length + sValue.length);
|
||||
}
|
||||
};
|
||||
|
||||
function hideResults() {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(hideResultsNow, 200);
|
||||
};
|
||||
|
||||
function hideResultsNow() {
|
||||
var wasVisible = select.visible();
|
||||
select.hide();
|
||||
clearTimeout(timeout);
|
||||
stopLoading();
|
||||
if (options.mustMatch) {
|
||||
// call search and run callback
|
||||
$input.search(
|
||||
function(result) {
|
||||
// if no value found, clear the input box
|
||||
if (!result) {
|
||||
if (options.multiple) {
|
||||
var words = trimWords($input.val()).slice(0, -1);
|
||||
$input.val(words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : ""));
|
||||
}
|
||||
else {
|
||||
$input.val("");
|
||||
$input.trigger("result", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function receiveData(q, data) {
|
||||
if (data && data.length && hasFocus) {
|
||||
stopLoading();
|
||||
select.display(data, q);
|
||||
autoFill(q, data[0].value);
|
||||
select.show();
|
||||
} else {
|
||||
hideResultsNow();
|
||||
}
|
||||
};
|
||||
|
||||
function request(term, success, failure) {
|
||||
if (!options.matchCase)
|
||||
term = term.toLowerCase();
|
||||
var data = cache.load(term);
|
||||
// recieve the cached data
|
||||
if (data && data.length) {
|
||||
success(term, data);
|
||||
// if an AJAX url has been supplied, try loading the data now
|
||||
} else if ((typeof options.url == "string") && (options.url.length > 0)) {
|
||||
|
||||
var extraParams = {
|
||||
timestamp: +new Date()
|
||||
};
|
||||
$.each(options.extraParams, function(key, param) {
|
||||
extraParams[key] = typeof param == "function" ? param() : param;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
// try to leverage ajaxQueue plugin to abort previous requests
|
||||
mode: "abort",
|
||||
// limit abortion to this input
|
||||
port: "autocomplete" + input.name,
|
||||
dataType: options.dataType,
|
||||
url: options.url,
|
||||
data: $.extend({
|
||||
q: lastWord(term),
|
||||
limit: options.max
|
||||
}, extraParams),
|
||||
success: function(data) {
|
||||
var parsed = options.parse && options.parse(data) || parse(data);
|
||||
cache.add(term, parsed);
|
||||
success(term, parsed);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
|
||||
select.emptyList();
|
||||
failure(term);
|
||||
}
|
||||
};
|
||||
|
||||
function parse(data) {
|
||||
var parsed = [];
|
||||
var rows = data.split("\n");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = $.trim(rows[i]);
|
||||
if (row) {
|
||||
row = row.split("|");
|
||||
parsed[parsed.length] = {
|
||||
data: row,
|
||||
value: row[0],
|
||||
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
return parsed;
|
||||
};
|
||||
|
||||
function stopLoading() {
|
||||
$input.removeClass(options.loadingClass);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
$.Autocompleter.defaults = {
|
||||
inputClass: "ac_input",
|
||||
resultsClass: "ac_results",
|
||||
loadingClass: "ac_loading",
|
||||
minChars: 1,
|
||||
delay: 400,
|
||||
matchCase: false,
|
||||
matchSubset: true,
|
||||
matchContains: false,
|
||||
cacheLength: 10,
|
||||
max: 100,
|
||||
mustMatch: false,
|
||||
extraParams: {},
|
||||
selectFirst: true,
|
||||
formatItem: function(row) { return row[0]; },
|
||||
formatMatch: null,
|
||||
autoFill: false,
|
||||
width: 0,
|
||||
multiple: false,
|
||||
multipleSeparator: ", ",
|
||||
highlight: function(value, term) {
|
||||
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
|
||||
},
|
||||
scroll: true,
|
||||
scrollHeight: 180,
|
||||
focus: function (event, ui) { }
|
||||
};
|
||||
|
||||
$.Autocompleter.Cache = function(options) {
|
||||
|
||||
var data = {};
|
||||
var length = 0;
|
||||
|
||||
function matchSubset(s, sub) {
|
||||
s = s.toString(); // FR: This forces the value to be a string, otherwise the indexOf() method fails on anything other but a string
|
||||
if (!options.matchCase)
|
||||
s = s.toLowerCase();
|
||||
var i = s.indexOf(sub);
|
||||
if (options.matchContains == "word") {
|
||||
i = s.toLowerCase().search("\\b" + sub.toLowerCase());
|
||||
}
|
||||
if (i == -1) return false;
|
||||
return i == 0 || options.matchContains;
|
||||
};
|
||||
|
||||
function add(q, value) {
|
||||
if (length > options.cacheLength) {
|
||||
flush();
|
||||
}
|
||||
if (!data[q]) {
|
||||
length++;
|
||||
}
|
||||
data[q] = value;
|
||||
}
|
||||
|
||||
function populate() {
|
||||
if (!options.data) return false;
|
||||
// track the matches
|
||||
var stMatchSets = {},
|
||||
nullData = 0;
|
||||
|
||||
// no url was specified, we need to adjust the cache length to make sure it fits the local data store
|
||||
if (!options.url) options.cacheLength = 1;
|
||||
|
||||
// track all options for minChars = 0
|
||||
stMatchSets[""] = [];
|
||||
|
||||
// loop through the array and create a lookup structure
|
||||
for (var i = 0, ol = options.data.length; i < ol; i++) {
|
||||
var rawValue = options.data[i];
|
||||
// if rawValue is a string, make an array otherwise just reference the array
|
||||
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
|
||||
|
||||
var value = options.formatMatch(rawValue, i + 1, options.data.length);
|
||||
if (value === false)
|
||||
continue;
|
||||
|
||||
var firstChar = value.charAt(0).toLowerCase();
|
||||
// if no lookup array for this character exists, look it up now
|
||||
if (!stMatchSets[firstChar])
|
||||
stMatchSets[firstChar] = [];
|
||||
|
||||
// if the match is a string
|
||||
var row = {
|
||||
value: value,
|
||||
data: rawValue,
|
||||
result: options.formatResult && options.formatResult(rawValue) || value
|
||||
};
|
||||
|
||||
// push the current match into the set list
|
||||
stMatchSets[firstChar].push(row);
|
||||
|
||||
// keep track of minChars zero items
|
||||
if (nullData++ < options.max) {
|
||||
stMatchSets[""].push(row);
|
||||
}
|
||||
};
|
||||
|
||||
// add the data items to the cache
|
||||
$.each(stMatchSets, function(i, value) {
|
||||
// increase the cache size
|
||||
options.cacheLength++;
|
||||
// add to the cache
|
||||
add(i, value);
|
||||
});
|
||||
}
|
||||
|
||||
// populate any existing data
|
||||
setTimeout(populate, 25);
|
||||
|
||||
function flush() {
|
||||
data = {};
|
||||
length = 0;
|
||||
}
|
||||
|
||||
return {
|
||||
flush: flush,
|
||||
add: add,
|
||||
populate: populate,
|
||||
load: function(q) {
|
||||
if (!options.cacheLength || !length)
|
||||
return null;
|
||||
/*
|
||||
* if dealing w/local data and matchContains than we must make sure
|
||||
* to loop through all the data collections looking for matches
|
||||
*/
|
||||
if (!options.url && options.matchContains) {
|
||||
// track all matches
|
||||
var csub = [];
|
||||
// loop through all the data grids for matches
|
||||
for (var k in data) {
|
||||
// don't search through the stMatchSets[""] (minChars: 0) cache
|
||||
// this prevents duplicates
|
||||
if (k.length > 0) {
|
||||
var c = data[k];
|
||||
$.each(c, function(i, x) {
|
||||
// if we've got a match, add it to the array
|
||||
if (matchSubset(x.value, q)) {
|
||||
csub.push(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return csub;
|
||||
} else
|
||||
// if the exact item exists, use it
|
||||
if (data[q]) {
|
||||
return data[q];
|
||||
} else
|
||||
if (options.matchSubset) {
|
||||
for (var i = q.length - 1; i >= options.minChars; i--) {
|
||||
var c = data[q.substr(0, i)];
|
||||
if (c) {
|
||||
var csub = [];
|
||||
$.each(c, function(i, x) {
|
||||
if (matchSubset(x.value, q)) {
|
||||
csub[csub.length] = x;
|
||||
}
|
||||
});
|
||||
return csub;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.Autocompleter.Select = function(options, input, select, config) {
|
||||
var CLASSES = {
|
||||
ACTIVE: "ac_over"
|
||||
};
|
||||
|
||||
var listItems,
|
||||
active = -1,
|
||||
data,
|
||||
term = "",
|
||||
needsInit = true,
|
||||
element,
|
||||
list;
|
||||
|
||||
// Create results
|
||||
function init() {
|
||||
if (!needsInit)
|
||||
return;
|
||||
element = $("<div/>")
|
||||
.hide()
|
||||
.addClass(options.resultsClass)
|
||||
.css("position", "absolute")
|
||||
.appendTo(document.body);
|
||||
|
||||
list = $("<ul/>").appendTo(element).mouseover(function(event) {
|
||||
if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
|
||||
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
options.focus(event, target(event));
|
||||
}
|
||||
}).click(function(event) {
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
select();
|
||||
// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
|
||||
input.focus();
|
||||
return false;
|
||||
}).mousedown(function() {
|
||||
config.mouseDownOnSelect = true;
|
||||
}).mouseup(function() {
|
||||
config.mouseDownOnSelect = false;
|
||||
});
|
||||
|
||||
if (options.width > 0)
|
||||
element.css("width", options.width);
|
||||
|
||||
needsInit = false;
|
||||
}
|
||||
|
||||
function target(event) {
|
||||
var element = event.target;
|
||||
while (element && element.tagName != "LI")
|
||||
element = element.parentNode;
|
||||
// more fun with IE, sometimes event.target is empty, just ignore it then
|
||||
if (!element)
|
||||
return [];
|
||||
return element;
|
||||
}
|
||||
|
||||
function moveSelect(step) {
|
||||
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
|
||||
movePosition(step);
|
||||
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
|
||||
options.focus(null, activeItem);
|
||||
|
||||
if (options.scroll) {
|
||||
var offset = 0;
|
||||
listItems.slice(0, active).each(function() {
|
||||
offset += this.offsetHeight;
|
||||
});
|
||||
if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
|
||||
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
|
||||
} else if (offset < list.scrollTop()) {
|
||||
list.scrollTop(offset);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function movePosition(step) {
|
||||
active += step;
|
||||
if (active < 0) {
|
||||
active = listItems.size() - 1;
|
||||
} else if (active >= listItems.size()) {
|
||||
active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function limitNumberOfItems(available) {
|
||||
return options.max && options.max < available
|
||||
? options.max
|
||||
: available;
|
||||
}
|
||||
|
||||
function fillList() {
|
||||
list.empty();
|
||||
var max = limitNumberOfItems(data.length);
|
||||
for (var i = 0; i < max; i++) {
|
||||
if (!data[i])
|
||||
continue;
|
||||
var formatted = options.formatItem(data[i].data, i + 1, max, data[i].value, term);
|
||||
if (formatted === false)
|
||||
continue;
|
||||
var li = $("<li/>").html(options.highlight(formatted, term)).addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
|
||||
$.data(li, "ac_data", data[i]);
|
||||
}
|
||||
listItems = list.find("li");
|
||||
if (options.selectFirst) {
|
||||
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
|
||||
active = 0;
|
||||
}
|
||||
// apply bgiframe if available
|
||||
if ($.fn.bgiframe)
|
||||
list.bgiframe();
|
||||
}
|
||||
|
||||
return {
|
||||
display: function(d, q) {
|
||||
init();
|
||||
data = d;
|
||||
term = q;
|
||||
fillList();
|
||||
},
|
||||
next: function() {
|
||||
moveSelect(1);
|
||||
},
|
||||
prev: function() {
|
||||
moveSelect(-1);
|
||||
},
|
||||
pageUp: function() {
|
||||
if (active != 0 && active - 8 < 0) {
|
||||
moveSelect(-active);
|
||||
} else {
|
||||
moveSelect(-8);
|
||||
}
|
||||
},
|
||||
pageDown: function() {
|
||||
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
|
||||
moveSelect(listItems.size() - 1 - active);
|
||||
} else {
|
||||
moveSelect(8);
|
||||
}
|
||||
},
|
||||
hide: function() {
|
||||
element && element.hide();
|
||||
listItems && listItems.removeClass(CLASSES.ACTIVE);
|
||||
active = -1;
|
||||
},
|
||||
visible: function() {
|
||||
return element && element.is(":visible");
|
||||
},
|
||||
current: function() {
|
||||
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
|
||||
},
|
||||
show: function() {
|
||||
var offset = $(input).offset();
|
||||
element.css({
|
||||
width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
|
||||
top: offset.top + input.offsetHeight,
|
||||
left: offset.left
|
||||
}).show();
|
||||
if (options.scroll) {
|
||||
list.scrollTop(0);
|
||||
list.css({
|
||||
maxHeight: options.scrollHeight,
|
||||
overflow: 'auto'
|
||||
});
|
||||
|
||||
if ($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
|
||||
var listHeight = 0;
|
||||
listItems.each(function() {
|
||||
listHeight += this.offsetHeight;
|
||||
});
|
||||
var scrollbarsVisible = listHeight > options.scrollHeight;
|
||||
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight);
|
||||
if (!scrollbarsVisible) {
|
||||
// IE doesn't recalculate width when scrollbar disappears
|
||||
listItems.width(list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
selected: function() {
|
||||
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
|
||||
return selected && selected.length && $.data(selected[0], "ac_data");
|
||||
},
|
||||
emptyList: function() {
|
||||
list && list.empty();
|
||||
},
|
||||
unbind: function() {
|
||||
element && element.remove();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.fn.selection = function(start, end) {
|
||||
if (start !== undefined) {
|
||||
return this.each(function() {
|
||||
if (this.createTextRange) {
|
||||
var selRange = this.createTextRange();
|
||||
if (end === undefined || start == end) {
|
||||
selRange.move("character", start);
|
||||
selRange.select();
|
||||
} else {
|
||||
selRange.collapse(true);
|
||||
selRange.moveStart("character", start);
|
||||
selRange.moveEnd("character", end);
|
||||
selRange.select();
|
||||
}
|
||||
} else if (this.setSelectionRange) {
|
||||
this.setSelectionRange(start, end);
|
||||
} else if (this.selectionStart) {
|
||||
this.selectionStart = start;
|
||||
this.selectionEnd = end;
|
||||
}
|
||||
});
|
||||
}
|
||||
var field = this[0];
|
||||
if (field.createTextRange) {
|
||||
var range = document.selection.createRange(),
|
||||
orig = field.value,
|
||||
teststring = "<->",
|
||||
textLength = range.text.length;
|
||||
range.text = teststring;
|
||||
var caretAt = field.value.indexOf(teststring);
|
||||
field.value = orig;
|
||||
this.selection(caretAt, caretAt + textLength);
|
||||
return {
|
||||
start: caretAt,
|
||||
end: caretAt + textLength
|
||||
}
|
||||
} else if (field.selectionStart !== undefined) {
|
||||
return {
|
||||
start: field.selectionStart,
|
||||
end: field.selectionEnd
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* jQuery BBQ: Back Button & Query Library - v1.3pre - 8/26/2010
|
||||
* http://benalman.com/projects/jquery-bbq-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
(function ($, r) { var h, n = Array.prototype.slice, t = decodeURIComponent, a = $.param, j, c, m, y, b = $.bbq = $.bbq || {}, s, x, k, e = $.event.special, d = "hashchange", B = "querystring", F = "fragment", z = "elemUrlAttr", l = "href", w = "src", p = /^.*\?|#.*$/g, u, H, g, i, C, E = {}; function G(I) { return typeof I === "string" } function D(J) { var I = n.call(arguments, 1); return function () { return J.apply(this, I.concat(n.call(arguments))) } } function o(I) { return I.replace(H, "$2") } function q(I) { return I.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/, "$1") } function f(K, P, I, L, J) { var R, O, N, Q, M; if (L !== h) { N = I.match(K ? H : /^([^#?]*)\??([^#]*)(#?.*)/); M = N[3] || ""; if (J === 2 && G(L)) { O = L.replace(K ? u : p, "") } else { Q = m(N[2]); L = G(L) ? m[K ? F : B](L) : L; O = J === 2 ? L : J === 1 ? $.extend({}, L, Q) : $.extend({}, Q, L); O = j(O); if (K) { O = O.replace(g, t) } } R = N[1] + (K ? C : O || !N[1] ? "?" : "") + O + M } else { R = P(I !== h ? I : location.href) } return R } a[B] = D(f, 0, q); a[F] = c = D(f, 1, o); a.sorted = j = function (J, K) { var I = [], L = {}; $.each(a(J, K).split("&"), function (P, M) { var O = M.replace(/(?:%5B|=).*$/, ""), N = L[O]; if (!N) { N = L[O] = []; I.push(O) } N.push(M) }); return $.map(I.sort(), function (M) { return L[M] }).join("&") }; c.noEscape = function (J) { J = J || ""; var I = $.map(J.split(""), encodeURIComponent); g = new RegExp(I.join("|"), "g") }; c.noEscape(",/"); c.ajaxCrawlable = function (I) { if (I !== h) { if (I) { u = /^.*(?:#!|#)/; H = /^([^#]*)(?:#!|#)?(.*)$/; C = "#!" } else { u = /^.*#/; H = /^([^#]*)#?(.*)$/; C = "#" } i = !!I } return i }; c.ajaxCrawlable(0); $.deparam = m = function (L, I) { var K = {}, J = { "true": !0, "false": !1, "null": null }; $.each(L.replace(/\+/g, " ").split("&"), function (O, T) { var N = T.split("="), S = t(N[0]), M, R = K, P = 0, U = S.split("]["), Q = U.length - 1; if (/\[/.test(U[0]) && /\]$/.test(U[Q])) { U[Q] = U[Q].replace(/\]$/, ""); U = U.shift().split("[").concat(U); Q = U.length - 1 } else { Q = 0 } if (N.length === 2) { M = t(N[1]); if (I) { M = M && !isNaN(M) ? +M : M === "undefined" ? h : J[M] !== h ? J[M] : M } if (Q) { for (; P <= Q; P++) { S = U[P] === "" ? R.length : U[P]; R = R[S] = P < Q ? R[S] || (U[P + 1] && isNaN(U[P + 1]) ? {} : []) : M } } else { if ($.isArray(K[S])) { K[S].push(M) } else { if (K[S] !== h) { K[S] = [K[S], M] } else { K[S] = M } } } } else { if (S) { K[S] = I ? h : "" } } }); return K }; function A(K, I, J) { if (I === h || typeof I === "boolean") { J = I; I = a[K ? F : B]() } else { I = G(I) ? I.replace(K ? u : p, "") : I } return m(I, J) } m[B] = D(A, 0); m[F] = y = D(A, 1); $[z] || ($[z] = function (I) { return $.extend(E, I) })({ a: l, base: l, iframe: w, img: w, input: w, form: "action", link: l, script: w }); k = $[z]; function v(L, J, K, I) { if (!G(K) && typeof K !== "object") { I = K; K = J; J = h } return this.each(function () { var O = $(this), M = J || k()[(this.nodeName || "").toLowerCase()] || "", N = M && O.attr(M) || ""; O.attr(M, a[L](N, K, I)) }) } $.fn[B] = D(v, B); $.fn[F] = D(v, F); b.pushState = s = function (L, I) { if (G(L) && /^#/.test(L) && I === h) { I = 2 } var K = L !== h, J = c(location.href, K ? L : {}, K ? I : 2); location.href = J }; b.getState = x = function (I, J) { return I === h || typeof I === "boolean" ? y(I) : y(J)[I] }; b.removeState = function (I) { var J = {}; if (I !== h) { J = x(); $.each($.isArray(I) ? I : arguments, function (L, K) { delete J[K] }) } s(J, 2) }; e[d] = $.extend(e[d], { add: function (I) { var K; function J(M) { var L = M[F] = c(); M.getState = function (N, O) { return N === h || typeof N === "boolean" ? m(L, N) : m(L, O)[N] }; K.apply(this, arguments) } if ($.isFunction(I)) { K = I; return J } else { K = I.handler; I.handler = J } } }) })(jQuery, this);
|
||||
/*
|
||||
* jQuery hashchange event - v1.3 - 7/21/2010
|
||||
* http://benalman.com/projects/jquery-hashchange-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
(function ($, e, b) { var c = "hashchange", h = document, f, g = $.event.special, i = h.documentMode, d = "on" + c in e && (i === b || i > 7); function a(j) { j = j || location.href; return "#" + j.replace(/^[^#]*#?(.*)$/, "$1") } $.fn[c] = function (j) { return j ? this.bind(c, j) : this.trigger(c) }; $.fn[c].delay = 50; g[c] = $.extend(g[c], { setup: function () { if (d) { return false } $(f.start) }, teardown: function () { if (d) { return false } $(f.stop) } }); f = (function () { var j = {}, p, m = a(), k = function (q) { return q }, l = k, o = k; j.start = function () { p || n() }; j.stop = function () { p && clearTimeout(p); p = b }; function n() { var r = a(), q = o(m); if (r !== m) { l(m = r, q); $(e).trigger(c) } else { if (q !== m) { location.href = location.href.replace(/#.*/, "") + q } } p = setTimeout(n, $.fn[c].delay) } $.browser && $.browser.msie && !d && (function () { var q, r; j.start = function () { if (!q) { r = $.fn[c].src; r = r && r + a(); q = $('<iframe tabindex="-1" title="empty"/>').hide().one("load", function () { r || l(a()); n() }).attr("src", r || "javascript:0").insertAfter("body")[0].contentWindow; h.onpropertychange = function () { try { if (event.propertyName === "title") { q.document.title = h.title } } catch (s) { } } } }; j.stop = k; o = function () { return a(q.location.href) }; l = function (v, s) { var u = q.document, t = $.fn[c].domain; if (v !== s) { u.title = h.title; u.open(); t && u.write('<script>document.domain="' + t + '"<\/script>'); u.close(); q.location.hash = v } } })(); return j })() })(jQuery, this);
|
||||
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Cookie plugin
|
||||
*
|
||||
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a cookie with the given name and value and other optional parameters.
|
||||
*
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Set the value of a cookie.
|
||||
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
||||
* @desc Create a cookie with all available options.
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Create a session cookie.
|
||||
* @example $.cookie('the_cookie', null);
|
||||
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
||||
* used when the cookie was set.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @param String value The value of the cookie.
|
||||
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
||||
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
||||
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
||||
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
||||
* when the the browser exits.
|
||||
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
||||
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
||||
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
||||
* require a secure protocol (like HTTPS).
|
||||
* @type undefined
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the value of a cookie with the given name.
|
||||
*
|
||||
* @example $.cookie('the_cookie');
|
||||
* @desc Get the value of a cookie.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @return The value of the cookie.
|
||||
* @type String
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
jQuery.cookie = function(name, value, options) {
|
||||
if (typeof value != 'undefined') { // name and value given, set cookie
|
||||
options = options || {};
|
||||
if (value === null) {
|
||||
value = '';
|
||||
options.expires = -1;
|
||||
}
|
||||
var expires = '';
|
||||
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||||
var date;
|
||||
if (typeof options.expires == 'number') {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
||||
} else {
|
||||
date = options.expires;
|
||||
}
|
||||
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
|
||||
}
|
||||
// CAUTION: Needed to parenthesize options.path and options.domain
|
||||
// in the following expressions, otherwise they evaluate to undefined
|
||||
// in the packed version for some reason...
|
||||
var path = options.path ? '; path=' + (options.path) : '';
|
||||
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
||||
var secure = options.secure ? '; secure' : '';
|
||||
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
||||
} else { // only name given, get cookie
|
||||
var cookieValue = null;
|
||||
if (document.cookie && document.cookie != '') {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim(cookies[i]);
|
||||
// Does this cookie string begin with the name we want?
|
||||
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cookieValue;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* jQuery Hotkeys Plugin
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Based upon the plugin by Tzury Bar Yochay:
|
||||
* http://github.com/tzuryby/hotkeys
|
||||
*
|
||||
* Original idea by:
|
||||
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
||||
*/
|
||||
|
||||
(function(jQuery){
|
||||
|
||||
jQuery.hotkeys = {
|
||||
version: "0.8",
|
||||
|
||||
specialKeys: {
|
||||
8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
|
||||
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
|
||||
37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
|
||||
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
|
||||
104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
|
||||
112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
|
||||
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
|
||||
},
|
||||
|
||||
shiftNums: {
|
||||
"`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
|
||||
"8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
|
||||
".": ">", "/": "?", "\\": "|"
|
||||
}
|
||||
};
|
||||
|
||||
function keyHandler( handleObj ) {
|
||||
// Only care when a possible input has been specified
|
||||
if ( typeof handleObj.data !== "string" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var origHandler = handleObj.handler,
|
||||
keys = handleObj.data.toLowerCase().split(" ");
|
||||
|
||||
handleObj.handler = function( event ) {
|
||||
// Don't fire in text-accepting inputs that we didn't directly bind to
|
||||
if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
|
||||
event.target.type === "text") ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Keypress represents characters, not special keys
|
||||
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
|
||||
character = String.fromCharCode( event.which ).toLowerCase(),
|
||||
key, modif = "", possible = {};
|
||||
|
||||
// check combinations (alt|ctrl|shift+anything)
|
||||
if ( event.altKey && special !== "alt" ) {
|
||||
modif += "alt+";
|
||||
}
|
||||
|
||||
if ( event.ctrlKey && special !== "ctrl" ) {
|
||||
modif += "ctrl+";
|
||||
}
|
||||
|
||||
// TODO: Need to make sure this works consistently across platforms
|
||||
if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
|
||||
modif += "meta+";
|
||||
}
|
||||
|
||||
if ( event.shiftKey && special !== "shift" ) {
|
||||
modif += "shift+";
|
||||
}
|
||||
|
||||
if ( special ) {
|
||||
possible[ modif + special ] = true;
|
||||
|
||||
} else {
|
||||
possible[ modif + character ] = true;
|
||||
possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
|
||||
|
||||
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
|
||||
if ( modif === "shift+" ) {
|
||||
possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for ( var i = 0, l = keys.length; i < l; i++ ) {
|
||||
if ( possible[ keys[i] ] ) {
|
||||
return origHandler.apply( this, arguments );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
jQuery.each([ "keydown", "keyup", "keypress" ], function() {
|
||||
jQuery.event.special[ this ] = { add: keyHandler };
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
@@ -0,0 +1,232 @@
|
||||
/*!
|
||||
* jQuery idleTimer plugin
|
||||
* version 0.9.100511
|
||||
* by Paul Irish.
|
||||
* http://github.com/paulirish/yui-misc/tree/
|
||||
* MIT license
|
||||
|
||||
* adapted from YUI idle timer by nzakas:
|
||||
* http://github.com/nzakas/yui-misc/
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas C. Zakas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
// API available in <= v0.8
|
||||
/*******************************
|
||||
|
||||
// idleTimer() takes an optional argument that defines the idle timeout
|
||||
// timeout is in milliseconds; defaults to 30000
|
||||
$.idleTimer(10000);
|
||||
|
||||
|
||||
$(document).bind("idle.idleTimer", function(){
|
||||
// function you want to fire when the user goes idle
|
||||
});
|
||||
|
||||
|
||||
$(document).bind("active.idleTimer", function(){
|
||||
// function you want to fire when the user becomes active again
|
||||
});
|
||||
|
||||
// pass the string 'destroy' to stop the timer
|
||||
$.idleTimer('destroy');
|
||||
|
||||
// you can query if the user is idle or not with data()
|
||||
$.data(document,'idleTimer'); // 'idle' or 'active'
|
||||
|
||||
// you can get time elapsed since user when idle/active
|
||||
$.idleTimer('getElapsedTime'); // time since state change in ms
|
||||
|
||||
********/
|
||||
|
||||
|
||||
|
||||
// API available in >= v0.9
|
||||
/*************************
|
||||
|
||||
// bind to specific elements, allows for multiple timer instances
|
||||
$(elem).idleTimer(timeout|'destroy'|'getElapsedTime');
|
||||
$.data(elem,'idleTimer'); // 'idle' or 'active'
|
||||
|
||||
// if you're using the old $.idleTimer api, you should not do $(document).idleTimer(...)
|
||||
|
||||
// element bound timers will only watch for events inside of them.
|
||||
// you may just want page-level activity, in which case you may set up
|
||||
// your timers on document, document.documentElement, and document.body
|
||||
|
||||
|
||||
********/
|
||||
|
||||
(function ($) {
|
||||
|
||||
$.idleTimer = function (newTimeout, elem) {
|
||||
|
||||
// defaults that are to be stored as instance props on the elem
|
||||
|
||||
var idle = false, //indicates if the user is idle
|
||||
enabled = true, //indicates if the idle timer is enabled
|
||||
timeout = 30000, //the amount of time (ms) before the user is considered idle
|
||||
events = 'mousemove keydown DOMMouseScroll mousewheel mousedown'; // activity is one of these events
|
||||
|
||||
|
||||
elem = elem || document;
|
||||
|
||||
|
||||
|
||||
/* (intentionally not documented)
|
||||
* Toggles the idle state and fires an appropriate event.
|
||||
* @return {void}
|
||||
*/
|
||||
var toggleIdleState = function (myelem) {
|
||||
|
||||
// curse you, mozilla setTimeout lateness bug!
|
||||
if (typeof myelem == 'number') myelem = undefined;
|
||||
|
||||
var obj = $.data(myelem || elem, 'idleTimerObj');
|
||||
|
||||
//toggle the state
|
||||
obj.idle = !obj.idle;
|
||||
|
||||
// reset timeout counter
|
||||
obj.olddate = +new Date;
|
||||
|
||||
//fire appropriate event
|
||||
|
||||
// create a custom event, but first, store the new state on the element
|
||||
// and then append that string to a namespace
|
||||
var event = jQuery.Event($.data(elem, 'idleTimer', obj.idle ? "idle" : "active") + '.idleTimer');
|
||||
|
||||
// we dont want this to bubble
|
||||
event.stopPropagation();
|
||||
$(elem).trigger(event);
|
||||
},
|
||||
|
||||
/**
|
||||
* Stops the idle timer. This removes appropriate event handlers
|
||||
* and cancels any pending timeouts.
|
||||
* @return {void}
|
||||
* @method stop
|
||||
* @static
|
||||
*/
|
||||
stop = function (elem) {
|
||||
|
||||
var obj = $.data(elem, 'idleTimerObj');
|
||||
|
||||
//set to disabled
|
||||
obj.enabled = false;
|
||||
|
||||
//clear any pending timeouts
|
||||
clearTimeout(obj.tId);
|
||||
|
||||
//detach the event handlers
|
||||
$(elem).unbind('.idleTimer');
|
||||
},
|
||||
|
||||
|
||||
/* (intentionally not documented)
|
||||
* Handles a user event indicating that the user isn't idle.
|
||||
* @param {Event} event A DOM2-normalized event object.
|
||||
* @return {void}
|
||||
*/
|
||||
handleUserEvent = function () {
|
||||
|
||||
var obj = $.data(this, 'idleTimerObj');
|
||||
|
||||
//clear any existing timeout
|
||||
clearTimeout(obj.tId);
|
||||
|
||||
|
||||
|
||||
//if the idle timer is enabled
|
||||
if (obj.enabled) {
|
||||
|
||||
|
||||
//if it's idle, that means the user is no longer idle
|
||||
if (obj.idle) {
|
||||
toggleIdleState(this);
|
||||
}
|
||||
|
||||
//set a new timeout
|
||||
obj.tId = setTimeout(toggleIdleState, obj.timeout);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Starts the idle timer. This adds appropriate event handlers
|
||||
* and starts the first timeout.
|
||||
* @param {int} newTimeout (Optional) A new value for the timeout period in ms.
|
||||
* @return {void}
|
||||
* @method $.idleTimer
|
||||
* @static
|
||||
*/
|
||||
|
||||
|
||||
var obj = $.data(elem, 'idleTimerObj') || new function () { };
|
||||
|
||||
obj.olddate = obj.olddate || +new Date;
|
||||
|
||||
//assign a new timeout if necessary
|
||||
if (typeof newTimeout == "number") {
|
||||
timeout = newTimeout;
|
||||
} else if (newTimeout === 'destroy') {
|
||||
stop(elem);
|
||||
return this;
|
||||
} else if (newTimeout === 'getElapsedTime') {
|
||||
return (+new Date) - obj.olddate;
|
||||
}
|
||||
|
||||
//assign appropriate event handlers
|
||||
$(elem).bind($.trim((events + ' ').split(' ').join('.idleTimer ')), handleUserEvent);
|
||||
|
||||
|
||||
obj.idle = idle;
|
||||
obj.enabled = enabled;
|
||||
obj.timeout = timeout;
|
||||
|
||||
|
||||
//set a timeout to toggle state
|
||||
obj.tId = setTimeout(toggleIdleState, obj.timeout);
|
||||
|
||||
// assume the user is active for the first x seconds.
|
||||
$.data(elem, 'idleTimer', "active");
|
||||
|
||||
// store our instance on the object
|
||||
$.data(elem, 'idleTimerObj', obj);
|
||||
|
||||
|
||||
|
||||
}; // end of $.idleTimer()
|
||||
|
||||
|
||||
// v0.9 API for defining multiple timers.
|
||||
$.fn.idleTimer = function (newTimeout) {
|
||||
|
||||
this[0] && $.idleTimer(newTimeout, this[0]);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Metadata - jQuery plugin for parsing metadata from elements
|
||||
*
|
||||
* Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.metadata.js 3620 2007-10-10 20:55:38Z pmclanahan $
|
||||
*
|
||||
*/
|
||||
(function($){$.extend({metadata:{defaults:{type:'class',name:'metadata',cre:/({.*})/,single:'metadata'},setType:function(type,name){this.defaults.type=type;this.defaults.name=name;},get:function(elem,opts){var settings=$.extend({},this.defaults,opts);if(!settings.single.length)settings.single='metadata';var data=$.data(elem,settings.single);if(data)return data;data="{}";if(settings.type=="class"){var m=settings.cre.exec(elem.className);if(m)data=m[1];}else if(settings.type=="elem"){if(!elem.getElementsByTagName)return;var e=elem.getElementsByTagName(settings.name);if(e.length)data=$.trim(e[0].innerHTML);}else if(elem.getAttribute!=undefined){var attr=elem.getAttribute(settings.name);if(attr)data=attr;}if(data.indexOf('{')<0)data="{"+data+"}";data=eval("("+data+")");$.data(elem,settings.single,data);return data;}}});$.fn.metadata=function(opts){return $.metadata.get(this[0],opts);};})(jQuery);
|
||||
@@ -0,0 +1,3 @@
|
||||
//used for live editing to invoke no conflict after jquery has loaded with lazy loading
|
||||
//alert("jquery.noConflict: " + jQuery.noConflict);
|
||||
jQuery.noConflict();
|
||||
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
** Unobtrusive Ajax support library for jQuery
|
||||
** Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
(function(a){var b="unobtrusiveAjaxClick",g="unobtrusiveValidation";function c(d,b){var a=window,c=(d||"").split(".");while(a&&c.length)a=a[c.shift()];if(typeof a==="function")return a;b.push(d);return Function.constructor.apply(null,b)}function d(a){return a==="GET"||a==="POST"}function f(b,a){!d(a)&&b.setRequestHeader("X-HTTP-Method-Override",a)}function h(c,b,e){var d;if(e.indexOf("application/x-javascript")!==-1)return;d=(c.getAttribute("data-ajax-mode")||"").toUpperCase();a(c.getAttribute("data-ajax-update")).each(function(f,c){var e;switch(d){case"BEFORE":e=c.firstChild;a("<div />").html(b).contents().each(function(){c.insertBefore(this,e)});break;case"AFTER":a("<div />").html(b).contents().each(function(){c.appendChild(this)});break;default:a(c).html(b)}})}function e(b,e){var j,k,g,i;j=b.getAttribute("data-ajax-confirm");if(j&&!window.confirm(j))return;k=a(b.getAttribute("data-ajax-loading"));i=b.getAttribute("data-ajax-loading-duration")||0;a.extend(e,{type:b.getAttribute("data-ajax-method")||undefined,url:b.getAttribute("data-ajax-url")||undefined,beforeSend:function(d){var a;f(d,g);a=c(b.getAttribute("data-ajax-begin"),["xhr"]).apply(this,arguments);a!==false&&k.show(i);return a},complete:function(){k.hide(i);c(b.getAttribute("data-ajax-complete"),["xhr","status"]).apply(this,arguments)},success:function(a,e,d){h(b,a,d.getResponseHeader("Content-Type")||"text/html");c(b.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(this,arguments)},error:c(b.getAttribute("data-ajax-failure"),["xhr","status","error"])});e.data.push({name:"X-Requested-With",value:"XMLHttpRequest"});g=e.type.toUpperCase();if(!d(g)){e.type="POST";e.data.push({name:"X-HTTP-Method-Override",value:g})}a.ajax(e)}function i(c){var b=a(c).data(g);return!b||!b.validate||b.validate()}a("a[data-ajax=true]").live("click",function(a){a.preventDefault();e(this,{url:this.href,type:"GET",data:[]})});a("form[data-ajax=true] input[type=image]").live("click",function(c){var g=c.target.name,d=a(c.target),f=d.parents("form")[0],e=d.offset();a(f).data(b,[{name:g+".x",value:Math.round(c.pageX-e.left)},{name:g+".y",value:Math.round(c.pageY-e.top)}]);setTimeout(function(){a(f).removeData(b)},0)});a("form[data-ajax=true] :submit").live("click",function(c){var e=c.target.name,d=a(c.target).parents("form")[0];a(d).data(b,e?[{name:e,value:c.target.value}]:[]);setTimeout(function(){a(d).removeData(b)},0)});a("form[data-ajax=true]").live("submit",function(d){var c=a(this).data(b)||[];d.preventDefault();if(!i(this))return;e(this,{url:this.action,type:this.method||"GET",data:c.concat(a(this).serializeArray())})})})(jQuery);
|
||||
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
** Unobtrusive validation support library for jQuery and jQuery Validate
|
||||
** Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
(function(a){var d=a.validator,b,f="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function i(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function g(a){return a.substr(0,a.lastIndexOf(".")+1)}function e(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function l(c,d){var b=a(this).find("[data-valmsg-for='"+d[0].name+"']"),e=a.parseJSON(b.attr("data-valmsg-replace"))!==false;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(e){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function k(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("<li />").html(this.message).appendTo(b)})}}function j(c){var b=c.data("unobtrusiveContainer"),d=a.parseJSON(b.attr("data-valmsg-replace"));if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");c.removeData("unobtrusiveContainer");d&&b.empty()}}function h(d){var b=a(d),c=b.data(f);if(!c){c={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:a.proxy(l,d),invalidHandler:a.proxy(k,d),messages:{},rules:{},success:a.proxy(j,d)},attachValidation:function(){b.validate(this.options)},validate:function(){b.validate();return b.valid()}};b.data(f,c)}return c}d.unobtrusive={adapters:[],parseElement:function(b,i){var d=a(b),e=d.parents("form")[0],c,g,f;if(!e)return;c=h(e);c.options.rules[b.name]=g={};c.options.messages[b.name]=f={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:e,message:i,params:h,rules:g,messages:f})}});!i&&c.attachValidation()},parse:function(b){a(b).find(":input[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});a("form").each(function(){var a=h(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});b.addSingleVal("accept","exts").addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.add("equalto",["other"],function(b){var h=g(b.element.name),i=b.params.other,d=e(i,h),f=a(b.form).find(":input[name="+d+"]")[0];c(b,"equalTo",f)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","fields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},f=g(b.element.name);a.each(i(b.params.fields||b.element.name),function(h,g){var c=e(g,f);d.data[c]=function(){return a(b.form).find(":input[name='"+c+"']").val()}});c(b,"remote",d)});a(function(){d.unobtrusive.parse(document)})})(jQuery);
|
||||
@@ -0,0 +1,17 @@
|
||||
if (typeof Umbraco == 'undefined') var Umbraco = {};
|
||||
if (!Umbraco.Sys) Umbraco.Sys = {};
|
||||
|
||||
Umbraco.Sys.registerNamespace = function(namespace) {
|
||||
/// <summary>
|
||||
/// Used to easily register namespaces for classes without doing the syntax listed on line 1/2 for each class.
|
||||
/// Pretty much the same as ASP.NET's Type.registerNamespace, except in order to use it, you must register
|
||||
/// all of your scripts with ScriptManager, this class doesn't require this.
|
||||
/// </summary>
|
||||
namespace = namespace.split('.');
|
||||
if (!window[namespace[0]]) window[namespace[0]] = {};
|
||||
var strFullNamespace = namespace[0];
|
||||
for (var i = 1; i < namespace.length; i++) {
|
||||
strFullNamespace += "." + namespace[i];
|
||||
eval("if(!window." + strFullNamespace + ")window." + strFullNamespace + "={};");
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,451 @@
|
||||
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
|
||||
/// <reference path="UmbracoUtils.js" />
|
||||
/// <reference path="/umbraco_client/modal/modal.js" />
|
||||
/// <reference path="language.aspx" />
|
||||
/// <reference name="MicrosoftAjax.js"/>
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Application");
|
||||
|
||||
Umbraco.Application.Actions = function() {
|
||||
/// <summary>
|
||||
/// Application actions actions for the context menu, help dialogs, logout, etc...
|
||||
/// This class supports an event listener model. Currently the available events are:
|
||||
/// "nodeDeleting","nodeDeleted","nodeRefresh"
|
||||
/// </summary>
|
||||
|
||||
return {
|
||||
_utils: Umbraco.Utils, //alias to Umbraco Utils
|
||||
_dialogWindow: null,
|
||||
/// <field name="_dialogWindow">A reference to a dialog window to open, any action that doesn't open in an overlay, opens in a dialog</field>
|
||||
_isDebug: false, //set to true to enable alert debugging
|
||||
_windowTitle: " - Umbraco CMS - ",
|
||||
_currApp: "",
|
||||
_isSaving: "",
|
||||
|
||||
addEventHandler: function(fnName, fn) {
|
||||
/// <summary>Adds an event listener to the event name event</summary>
|
||||
if (typeof(jQuery) != "undefined") jQuery(window.top).bind(fnName, fn); //if there's no jQuery, there is no events
|
||||
},
|
||||
|
||||
removeEventHandler: function(fnName, fn) {
|
||||
/// <summary>Removes an event listener to the event name event</summary>
|
||||
if (typeof(jQuery) != "undefined") jQuery(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events
|
||||
},
|
||||
|
||||
showSpeachBubble: function(ico, hdr, msg) {
|
||||
if (typeof(UmbClientMgr.mainWindow().UmbSpeechBubble) != "undefined") {
|
||||
UmbClientMgr.mainWindow().UmbSpeechBubble.ShowMessage(ico, hdr, msg);
|
||||
}
|
||||
else alert(msg);
|
||||
},
|
||||
|
||||
launchHelp: function(lang, userType) {
|
||||
/// <summary>Launches the contextual help window</summary>
|
||||
var rightUrl = UmbClientMgr.contentFrame().document.location.href.split("\/");
|
||||
if (rightUrl.length > 0) {
|
||||
rightUrl = rightUrl[rightUrl.length - 1];
|
||||
}
|
||||
if (rightUrl.indexOf("?") > 0) {
|
||||
rightUrl = rightUrl.substring(0, rightUrl.indexOf("?"));
|
||||
}
|
||||
var url = "/umbraco/helpRedirect.aspx?Application=" + this._currApp + '&ApplicationURL=' + rightUrl + '&Language=' + lang + "&UserType=" + userType;
|
||||
window.open(url);
|
||||
return false;
|
||||
},
|
||||
|
||||
launchAbout: function() {
|
||||
/// <summary>Launches the about Umbraco window</summary>
|
||||
UmbClientMgr.openModalWindow("dialogs/about.aspx", UmbClientMgr.uiKeys()['general_about'], true, 450, 390);
|
||||
return false;
|
||||
},
|
||||
|
||||
launchCreateWizard: function() {
|
||||
/// <summary>Launches the create content wizard</summary>
|
||||
|
||||
if (this._currApp == 'media' || this._currApp == 'content' || this._currApp == '') {
|
||||
if (this._currApp == '') {
|
||||
this._currApp = 'content';
|
||||
}
|
||||
|
||||
UmbClientMgr.openModalWindow("dialogs/create.aspx?nodeType=" + this._currApp + "&app=" + this._currApp + "&rnd=" + this._utils.generateRandom(), UmbClientMgr.uiKeys()['actions_create'] + " " + this._currApp, true, 620, 470);
|
||||
return false;
|
||||
|
||||
}
|
||||
else
|
||||
alert('Not supported - please create by right clicking the parentnode and choose new...');
|
||||
},
|
||||
|
||||
logout: function(t) {
|
||||
|
||||
if (!t) {
|
||||
throw "The security token must be set in order to log a user out using this method";
|
||||
}
|
||||
|
||||
if (confirm(UmbClientMgr.uiKeys()["defaultdialogs_confirmlogout"])) {
|
||||
//raise beforeLogout event
|
||||
jQuery(window.top).trigger("beforeLogout", []);
|
||||
|
||||
document.location.href = 'logout.aspx?t=' + t;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
submitDefaultWindow: function() {
|
||||
|
||||
if (!this._isSaving) {
|
||||
this._isSaving = true;
|
||||
|
||||
//v6 way
|
||||
var link = jQuery(".btn[id*=save]:first, .editorIcon[id*=save]:first, .editorIcon:input:image[id*=Save]:first");
|
||||
|
||||
//this is made of bad, to work around webforms horrible wiring
|
||||
if(!link.hasClass("client-side") && link.attr("href").indexOf("javascript:") == 0){
|
||||
eval(link.attr('href').replace('javascript:',''));
|
||||
}else{
|
||||
link.click();
|
||||
}
|
||||
}
|
||||
this._isSaving = false;
|
||||
return false;
|
||||
},
|
||||
|
||||
bindSaveShortCut: function () {
|
||||
|
||||
var keys = "ctrl+s";
|
||||
if (navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
|
||||
keys = "meta+s";
|
||||
}
|
||||
|
||||
jQuery(document).bind('keydown', keys, function (evt) { UmbClientMgr.appActions().submitDefaultWindow(); return false; });
|
||||
jQuery(":input").bind('keydown', keys, function (evt) { UmbClientMgr.appActions().submitDefaultWindow(); return false; });
|
||||
},
|
||||
|
||||
shiftApp: function (whichApp, appName) {
|
||||
/// <summary>Changes the application</summary>
|
||||
|
||||
this._debug("shiftApp: " + whichApp + ", " + appName);
|
||||
|
||||
UmbClientMgr.mainTree().saveTreeState(this._currApp == "" ? "content" : this._currApp);
|
||||
|
||||
this._currApp = whichApp.toLowerCase();
|
||||
|
||||
if (this._currApp != 'media' && this._currApp != 'content' && this._currApp != 'member') {
|
||||
jQuery("#buttonCreate").attr("disabled", "true").fadeOut(400);
|
||||
jQuery("#FindDocuments .umbracoSearchHolder").fadeOut(400);
|
||||
}
|
||||
else {
|
||||
// create button should still remain disabled for the memebers section
|
||||
if (this._currApp == 'member') {
|
||||
jQuery("#buttonCreate").attr("disabled", "true").css("display", "inline-block").css("visibility", "hidden");
|
||||
}
|
||||
else {
|
||||
jQuery("#buttonCreate").removeAttr("disabled").fadeIn(500).css("visibility", "visible");
|
||||
}
|
||||
jQuery("#FindDocuments .umbracoSearchHolder").fadeIn(500);
|
||||
//need to set the recycle bin node id based on app
|
||||
switch (this._currApp) {
|
||||
case ("media"):
|
||||
UmbClientMgr.mainTree().setRecycleBinNodeId(-21);
|
||||
break;
|
||||
case ("content"):
|
||||
UmbClientMgr.mainTree().setRecycleBinNodeId(-20);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UmbClientMgr.mainTree().rebuildTree(whichApp, function(args) {
|
||||
//the callback will fire when the tree rebuilding is done, we
|
||||
//need to check the args to see if the tree was rebuild from cache
|
||||
//and if it had a previously selected node, if it didn't then load the dashboard.
|
||||
if (!args) {
|
||||
UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp);
|
||||
}
|
||||
});
|
||||
|
||||
jQuery("#treeWindowLabel").html(appName);
|
||||
|
||||
UmbClientMgr.mainWindow().document.title = appName + this._windowTitle + window.location.hostname.toLowerCase().replace('www', '');
|
||||
},
|
||||
|
||||
getCurrApp: function() {
|
||||
return this._currApp;
|
||||
},
|
||||
|
||||
|
||||
//TODO: Move this into a window manager class
|
||||
openDialog: function(diaTitle, diaDoc, dwidth, dheight, optionalParams) {
|
||||
/// <summary>Opens the dialog window</summary>
|
||||
|
||||
if (this._dialogWindow != null && !this._dialogWindow.closed) {
|
||||
this._dialogWindow.close();
|
||||
}
|
||||
this._dialogWindow = UmbClientMgr.mainWindow().open(diaDoc, 'dialogpage', "width=" + dwidth + "px,height=" + dheight + "px" + optionalParams);
|
||||
},
|
||||
|
||||
openDashboard: function(whichApp) {
|
||||
UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp);
|
||||
},
|
||||
|
||||
actionTreeEditMode: function() {
|
||||
/// <summary></summary>
|
||||
UmbClientMgr.mainTree().toggleEditMode(true);
|
||||
},
|
||||
|
||||
actionSort: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/sort.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&app=' + this._currApp + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_sort'], true, 600, 450);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
actionChangeDocType: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/changeDocType.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&app=' + this._currApp + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_changeDocType'], true, 600, 600);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
actionRights: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/cruds.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_rights'], true, 800, 300);
|
||||
}
|
||||
},
|
||||
|
||||
actionProtect: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/protectPage.aspx?mode=cut&nodeId=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_protect'], true, 535, 480);
|
||||
}
|
||||
},
|
||||
|
||||
actionRollback: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
UmbClientMgr.openModalWindow('dialogs/rollback.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_rollback'], true, 600, 550);
|
||||
},
|
||||
|
||||
actionRefresh: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
//raise nodeRefresh event
|
||||
jQuery(window.top).trigger("nodeRefresh", []);
|
||||
},
|
||||
|
||||
actionNotify: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/notifications.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_notify'], true, 300, 480);
|
||||
}
|
||||
},
|
||||
|
||||
actionUpdate: function() {
|
||||
/// <summary></summary>
|
||||
},
|
||||
|
||||
actionPublish: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '' != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/publish.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId, uiKeys['actions_publish'], true, 540, 280);
|
||||
}
|
||||
},
|
||||
|
||||
actionToPublish: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
if (confirm(uiKeys['defaultdialogs_confirmSure'] + '\n\n')) {
|
||||
UmbClientMgr.openModalWindow('dialogs/SendPublish.aspx?id=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_sendtopublish'], true, 300, 200);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
actionQuit: function(t) {
|
||||
|
||||
if (!t) {
|
||||
throw "The security token must be set in order to log a user out using this method";
|
||||
}
|
||||
|
||||
if (confirm(uiKeys['defaultdialogs_confirmlogout'] + '\n\n'))
|
||||
document.location.href = 'logout.aspx?t=' + t;
|
||||
},
|
||||
|
||||
actionRePublish: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
UmbClientMgr.openModalWindow('dialogs/republish.aspx?rnd=' + this._utils.generateRandom(), 'Republishing entire site', true, 450, 210);
|
||||
},
|
||||
|
||||
actionAssignDomain: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/assignDomain2.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId, uiKeys['actions_assignDomain'], true, 500, 620);
|
||||
}
|
||||
},
|
||||
|
||||
actionNew: function() {
|
||||
/// <summary>Show the create new modal overlay</summary>
|
||||
var actionNode = UmbClientMgr.mainTree().getActionNode();
|
||||
if (actionNode.nodeType != '') {
|
||||
if (actionNode.nodeType == "content") {
|
||||
UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 600, 425);
|
||||
}
|
||||
else if (actionNode.nodeType == "initmember") {
|
||||
UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 480, 380);
|
||||
}
|
||||
else if (actionNode.nodeType == "users") {
|
||||
UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 480, 380);
|
||||
}
|
||||
else if (actionNode.nodeType == "initpython" || actionNode.nodeType == "initdlrscripting") {
|
||||
UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 420, 380);
|
||||
}
|
||||
else {
|
||||
UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 420, 270);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
actionNewFolder: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
this.openDialog("Opret", "createFolder.aspx?nodeId=" + UmbClientMgr.mainTree().getActionNode().nodeId + "&nodeType=" + UmbClientMgr.mainTree().getActionNode().nodeType + "&nodeName=" + nodeName + '&rnd=' + this._utils.generateRandom(), 320, 225);
|
||||
}
|
||||
},
|
||||
|
||||
actionSendToTranslate: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/sendToTranslation.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_sendToTranslate'], true, 500, 470);
|
||||
}
|
||||
},
|
||||
|
||||
actionEmptyTranscan: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/emptyTrashcan.aspx?type=" + this._currApp, uiKeys['actions_emptyTrashcan'], true, 500, 220);
|
||||
}
|
||||
},
|
||||
|
||||
actionImport: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/importDocumentType.aspx?rnd=" + this._utils.generateRandom(), uiKeys['actions_importDocumentType'], true, 460, 400);
|
||||
}
|
||||
},
|
||||
|
||||
actionExport: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
this.openDialog("Export", "dialogs/exportDocumentType.aspx?nodeId=" + UmbClientMgr.mainTree().getActionNode().nodeId + "&rnd=" + this._utils.generateRandom(), 320, 205);
|
||||
}
|
||||
},
|
||||
|
||||
actionAudit: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
UmbClientMgr.openModalWindow('dialogs/viewAuditTrail.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_auditTrail'], true, 550, 500);
|
||||
},
|
||||
|
||||
actionPackage: function() {
|
||||
/// <summary></summary>
|
||||
},
|
||||
|
||||
actionDelete: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
var actionNode = UmbClientMgr.mainTree().getActionNode();
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeType == "content" && UmbClientMgr.mainTree().getActionNode().nodeId == '-1')
|
||||
return;
|
||||
|
||||
this._debug("actionDelete");
|
||||
|
||||
// tg: quick workaround for the are you sure you want to delete 'null' confirm message happening when deleting xslt files
|
||||
currrentNodeName = UmbClientMgr.mainTree().getActionNode().nodeName;
|
||||
if (currrentNodeName == null || currrentNodeName == "null") {
|
||||
currrentNodeName = UmbClientMgr.mainTree().getActionNode().nodeId;
|
||||
}
|
||||
|
||||
if (confirm(uiKeys['defaultdialogs_confirmdelete'] + ' "' + currrentNodeName + '"?\n\n')) {
|
||||
//raise nodeDeleting event
|
||||
jQuery(window.top).trigger("nodeDeleting", []);
|
||||
var _this = this;
|
||||
|
||||
//check if it's in the recycle bin
|
||||
if (actionNode.jsNode.closest("li[id='-20']").length == 1 || actionNode.jsNode.closest("li[id='-21']").length == 1) {
|
||||
umbraco.presentation.webservices.legacyAjaxCalls.DeleteContentPermanently(
|
||||
UmbClientMgr.mainTree().getActionNode().nodeId,
|
||||
UmbClientMgr.mainTree().getActionNode().nodeType,
|
||||
function() {
|
||||
_this._debug("actionDelete: Raising event");
|
||||
//raise nodeDeleted event
|
||||
jQuery(window.top).trigger("nodeDeleted", []);
|
||||
});
|
||||
}
|
||||
else {
|
||||
umbraco.presentation.webservices.legacyAjaxCalls.Delete(
|
||||
UmbClientMgr.mainTree().getActionNode().nodeId,
|
||||
UmbClientMgr.mainTree().getActionNode().nodeName,
|
||||
UmbClientMgr.mainTree().getActionNode().nodeType,
|
||||
function() {
|
||||
_this._debug("actionDelete: Raising event");
|
||||
//raise nodeDeleted event
|
||||
jQuery(window.top).trigger("nodeDeleted", []);
|
||||
},
|
||||
function(error) {
|
||||
_this._debug("actionDelete: Raising public error event");
|
||||
//raise public error event
|
||||
jQuery(window.top).trigger("publicError", [error]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
actionDisable: function() {
|
||||
/// <summary>
|
||||
/// Used for users when disable is selected.
|
||||
/// </summary>
|
||||
|
||||
if (confirm(uiKeys['defaultdialogs_confirmdisable'] + ' "' + UmbClientMgr.mainTree().getActionNode().nodeName + '"?\n\n')) {
|
||||
umbraco.presentation.webservices.legacyAjaxCalls.DisableUser(UmbClientMgr.mainTree().getActionNode().nodeId, function() {
|
||||
UmbClientMgr.mainTree().reloadActionNode();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
actionMove: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/moveOrCopy.aspx?app=" + this._currApp + "&mode=cut&id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_move'], true, 500, 460);
|
||||
}
|
||||
},
|
||||
|
||||
actionCopy: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
UmbClientMgr.openModalWindow("dialogs/moveOrCopy.aspx?app=" + this._currApp + "&mode=copy&id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_copy'], true, 500, 470);
|
||||
}
|
||||
},
|
||||
_debug: function(strMsg) {
|
||||
if (this._isDebug) {
|
||||
Sys.Debug.trace("AppActions: " + strMsg);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,263 @@
|
||||
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
|
||||
/// <reference path="/umbraco_client/Application/HistoryManager.js" />
|
||||
/// <reference path="/umbraco_client/ui/jquery.js" />
|
||||
/// <reference path="/umbraco_client/Tree/UmbracoTree.js" />
|
||||
/// <reference name="MicrosoftAjax.js"/>
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Application");
|
||||
|
||||
(function($) {
|
||||
Umbraco.Application.ClientManager = function() {
|
||||
/// <summary>
|
||||
/// A class which ensures that all calls made to the objects that it owns are done in the context
|
||||
/// of the main Umbraco application window.
|
||||
/// </summary>
|
||||
|
||||
return {
|
||||
_isDirty: false,
|
||||
_isDebug: false,
|
||||
_mainTree: null,
|
||||
_appActions: null,
|
||||
_historyMgr: null,
|
||||
_rootPath: "/umbraco", //this is the default
|
||||
_modal: new Array(), //track all modal window objects (they get stacked)
|
||||
|
||||
historyManager: function() {
|
||||
if (!this._historyMgr) {
|
||||
this._historyMgr = new Umbraco.Controls.HistoryManager();
|
||||
}
|
||||
return this._historyMgr;
|
||||
},
|
||||
|
||||
setUmbracoPath: function(strPath) {
|
||||
/// <summary>
|
||||
/// sets the Umbraco root path folder
|
||||
/// </summary>
|
||||
this._debug("setUmbracoPath: " + strPath);
|
||||
this._rootPath = strPath;
|
||||
},
|
||||
|
||||
mainWindow: function() {
|
||||
/// <summary>
|
||||
/// Returns a reference to the main frame of the application
|
||||
/// </summary>
|
||||
return top;
|
||||
},
|
||||
mainTree: function() {
|
||||
/// <summary>
|
||||
/// Returns a reference to the main UmbracoTree API object.
|
||||
/// Sometimes an Umbraco page will need to be opened without being contained in the iFrame from the main window
|
||||
/// so this method is will construct a false tree to be returned if this is the case as to avoid errors.
|
||||
/// </summary>
|
||||
/// <returns type="Umbraco.Controls.UmbracoTree" />
|
||||
|
||||
|
||||
if (this._mainTree == null) {
|
||||
this._mainTree = top.UmbClientMgr.mainTree();
|
||||
}
|
||||
return this._mainTree;
|
||||
},
|
||||
appActions: function() {
|
||||
/// <summary>
|
||||
/// Returns a reference to the application actions object
|
||||
/// </summary>
|
||||
|
||||
//if the main window has no actions, we'll create some
|
||||
if (this._appActions == null) {
|
||||
if (typeof this.mainWindow().appActions == 'undefined') {
|
||||
this._appActions = new Umbraco.Application.Actions();
|
||||
}
|
||||
else this._appActions = this.mainWindow().appActions;
|
||||
}
|
||||
return this._appActions;
|
||||
},
|
||||
uiKeys: function() {
|
||||
/// <summary>
|
||||
/// Returns a reference to the main windows uiKeys object for globalization
|
||||
/// </summary>
|
||||
|
||||
//TODO: If there is no main window, we need to go retrieve the appActions from the server!
|
||||
return this.mainWindow().uiKeys;
|
||||
},
|
||||
// windowMgr: function()
|
||||
// return null;
|
||||
// },
|
||||
contentFrameAndSection: function(app, rightFrameUrl) {
|
||||
//this.appActions().shiftApp(app, this.uiKeys()['sections_' + app]);
|
||||
var self = this;
|
||||
self.mainWindow().UmbClientMgr.historyManager().addHistory(app, true);
|
||||
window.setTimeout(function() {
|
||||
self.mainWindow().UmbClientMgr.contentFrame(rightFrameUrl);
|
||||
}, 200);
|
||||
},
|
||||
contentFrame: function (strLocation) {
|
||||
/// <summary>
|
||||
/// This will return the reference to the right content frame if strLocation is null or empty,
|
||||
/// or set the right content frames location to the one specified by strLocation.
|
||||
/// </summary>
|
||||
|
||||
this._debug("contentFrame: " + strLocation);
|
||||
|
||||
if (strLocation == null || strLocation == "") {
|
||||
if (typeof this.mainWindow().right != "undefined") {
|
||||
return this.mainWindow().right;
|
||||
}
|
||||
else {
|
||||
return this.mainWindow(); //return the current window if the content frame doesn't exist in the current context
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
//its a hash change so process that like angular
|
||||
if (strLocation.substr(0, 1) !== "#") {
|
||||
if (strLocation.substr(0, 1) != "/") {
|
||||
//if the path doesn't start with "/" or with the root path then
|
||||
//prepend the root path
|
||||
strLocation = this._rootPath + "/" + strLocation;
|
||||
}
|
||||
else if (strLocation.length >= this._rootPath.length
|
||||
&& strLocation.substr(0, this._rootPath.length) != this._rootPath) {
|
||||
strLocation = this._rootPath + "/" + strLocation;
|
||||
}
|
||||
}
|
||||
|
||||
this._debug("contentFrame: parsed location: " + strLocation);
|
||||
|
||||
if (!this.mainWindow().UmbClientMgr) {
|
||||
window.setTimeout(function() {
|
||||
var self = this;
|
||||
self.mainWindow().location.href = strLocation;
|
||||
}, 200);
|
||||
}
|
||||
else {
|
||||
this.mainWindow().UmbClientMgr.contentFrame(strLocation);
|
||||
}
|
||||
}
|
||||
},
|
||||
reloadContentFrameUrlIfPathLoaded: function (url) {
|
||||
var contentFrame;
|
||||
if (typeof this.mainWindow().right != "undefined") {
|
||||
contentFrame = this.mainWindow().right;
|
||||
}
|
||||
else {
|
||||
contentFrame = this.mainWindow();
|
||||
}
|
||||
|
||||
var currentPath = contentFrame.location.pathname + (contentFrame.location.search ? contentFrame.location.search : "");
|
||||
if (currentPath == url) {
|
||||
contentFrame.location.reload();
|
||||
}
|
||||
},
|
||||
|
||||
/** This is used to launch an angular based modal window instead of the legacy window */
|
||||
openAngularModalWindow: function (options) {
|
||||
if (!this.mainWindow().UmbClientMgr) {
|
||||
throw "An angular modal window can only be launched when the modal is running within the main Umbraco application";
|
||||
}
|
||||
else {
|
||||
this.mainWindow().UmbClientMgr.openAngularModalWindow.apply(this.mainWindow().UmbClientMgr, [options]);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/** This is used to launch an angular based modal window instead of the legacy window */
|
||||
rootScope: function () {
|
||||
|
||||
if (!this.mainWindow().UmbClientMgr) {
|
||||
throw "An angular modal window can only be launched when the modal is running within the main Umbraco application";
|
||||
}
|
||||
else {
|
||||
return this.mainWindow().UmbClientMgr.rootScope();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
reloadLocation: function () {
|
||||
if (this.mainWindow().UmbClientMgr) {
|
||||
this.mainWindow().UmbClientMgr.reloadLocation();
|
||||
}
|
||||
},
|
||||
|
||||
openModalWindow: function(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) {
|
||||
//need to create the modal on the top window if the top window has a client manager, if not, create it on the current window
|
||||
|
||||
//if this is the top window, or if the top window doesn't have a client manager, create the modal in this manager
|
||||
if (window == this.mainWindow() || !this.mainWindow().UmbClientMgr) {
|
||||
var m = new Umbraco.Controls.ModalWindow();
|
||||
this._modal.push(m);
|
||||
m.open(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback);
|
||||
}
|
||||
else {
|
||||
//if the main window has a client manager, then call the main window's open modal method whilst keeping the context of it's manager.
|
||||
if (this.mainWindow().UmbClientMgr) {
|
||||
this.mainWindow().UmbClientMgr.openModalWindow.apply(this.mainWindow().UmbClientMgr,
|
||||
[url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback]);
|
||||
}
|
||||
else {
|
||||
return; //exit recurse.
|
||||
}
|
||||
}
|
||||
},
|
||||
openModalWindowForContent: function (jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) {
|
||||
//need to create the modal on the top window if the top window has a client manager, if not, create it on the current window
|
||||
|
||||
//if this is the top window, or if the top window doesn't have a client manager, create the modal in this manager
|
||||
if (window == this.mainWindow() || !this.mainWindow().UmbClientMgr) {
|
||||
var m = new Umbraco.Controls.ModalWindow();
|
||||
this._modal.push(m);
|
||||
m.show(jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback);
|
||||
}
|
||||
else {
|
||||
//if the main window has a client manager, then call the main window's open modal method whilst keeping the context of it's manager.
|
||||
if (this.mainWindow().UmbClientMgr) {
|
||||
this.mainWindow().UmbClientMgr.openModalWindowForContent.apply(this.mainWindow().UmbClientMgr,
|
||||
[jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback]);
|
||||
}
|
||||
else {
|
||||
return; //exit recurse.
|
||||
}
|
||||
}
|
||||
},
|
||||
closeModalWindow: function(rVal) {
|
||||
/// <summary>
|
||||
/// will close the latest open modal window.
|
||||
/// if an rVal is passed in, then this will be sent to the onCloseCallback method if it was specified.
|
||||
/// </summary>
|
||||
if (this._modal != null && this._modal.length > 0) {
|
||||
this._modal.pop().close(rVal);
|
||||
}
|
||||
else {
|
||||
//this will recursively try to close a modal window until the parent window has a modal object or the window is the top and has the modal object
|
||||
var mgr = null;
|
||||
if (window.parent == null || window.parent == window) {
|
||||
//we are at the root window, check if we can close the modal window from here
|
||||
if (window.UmbClientMgr != null && window.UmbClientMgr._modal != null && window.UmbClientMgr._modal.length > 0) {
|
||||
mgr = window.UmbClientMgr;
|
||||
}
|
||||
else {
|
||||
return; //exit recursion.
|
||||
}
|
||||
}
|
||||
else if (typeof window.parent.UmbClientMgr != "undefined") {
|
||||
mgr = window.parent.UmbClientMgr;
|
||||
}
|
||||
mgr.closeModalWindow.call(mgr, rVal);
|
||||
}
|
||||
},
|
||||
_debug: function(strMsg) {
|
||||
if (this._isDebug) {
|
||||
Sys.Debug.trace("UmbClientMgr: " + strMsg);
|
||||
}
|
||||
},
|
||||
get_isDirty: function() {
|
||||
return this._isDirty;
|
||||
},
|
||||
set_isDirty: function(value) {
|
||||
this._isDirty = value;
|
||||
}
|
||||
};
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
//define alias for use throughout application
|
||||
var UmbClientMgr = new Umbraco.Application.ClientManager();
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Utils");
|
||||
|
||||
Umbraco.Utils.generateRandom = function() {
|
||||
/// <summary>Returns a random integer for use with URLs</summary>
|
||||
var day = new Date();
|
||||
var z = day.getTime();
|
||||
var y = (z - (parseInt(z / 1000, 10) * 1000)) / 10;
|
||||
return y;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Utils");
|
||||
|
||||
Umbraco.Utils.UrlEncoder = {
|
||||
|
||||
// public method for url encoding
|
||||
encode: function(string) {
|
||||
return escape(this._utf8_encode(string));
|
||||
},
|
||||
|
||||
// public method for url decoding
|
||||
decode: function(string) {
|
||||
return this._utf8_decode(unescape(string));
|
||||
},
|
||||
|
||||
// private method for UTF-8 encoding
|
||||
_utf8_encode: function(string) {
|
||||
string = string.replace(/\r\n/g, "\n");
|
||||
var utftext = "";
|
||||
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
|
||||
var c = string.charCodeAt(n);
|
||||
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
}
|
||||
else if ((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return utftext;
|
||||
},
|
||||
|
||||
// private method for UTF-8 decoding
|
||||
_utf8_decode: function(utftext) {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
|
||||
while (i < utftext.length) {
|
||||
|
||||
c = utftext.charCodeAt(i);
|
||||
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
}
|
||||
else if ((c > 191) && (c < 224)) {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
}
|
||||
else {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
c3 = utftext.charCodeAt(i + 2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor");
|
||||
|
||||
(function($) {
|
||||
Umbraco.Controls.CodeEditor.UmbracoEditor = function(isSimpleEditor, controlId) {
|
||||
|
||||
//initialize
|
||||
var _isSimpleEditor = isSimpleEditor;
|
||||
var _controlId = controlId;
|
||||
|
||||
if (!_isSimpleEditor && typeof(codeEditor) == "undefined") {
|
||||
throw "CodeMirror editor not found!";
|
||||
}
|
||||
|
||||
//create the inner object
|
||||
var obj = {
|
||||
_editor: (typeof(codeEditor) == "undefined" ? null : codeEditor), //the codemirror object
|
||||
_control: $("#" + _controlId), //the original textbox as a jquery object
|
||||
_cmSave: null,//the saved selection of the code mirror editor (used for IE)
|
||||
|
||||
IsSimpleEditor: typeof(CodeMirror) == "undefined" ? true : typeof(codeEditor) == "undefined" ? true : _isSimpleEditor,
|
||||
|
||||
GetCode: function() {
|
||||
if (this.IsSimpleEditor) {
|
||||
return this._control.val();
|
||||
}
|
||||
else {
|
||||
//this is a wrapper for CodeMirror
|
||||
return this._editor.getValue();
|
||||
}
|
||||
},
|
||||
SetCode: function(code) {
|
||||
if (this.IsSimpleEditor) {
|
||||
this._control.val(code);
|
||||
}
|
||||
else {
|
||||
//this is a wrapper for CodeMirror
|
||||
this._editor.focus();
|
||||
|
||||
var codeChanged = this._editor.getValue() != code;
|
||||
var cursor = this._editor.doc.getCursor();
|
||||
|
||||
this._editor.setValue(code);
|
||||
|
||||
// Restore cursor position if the server saved code matches.
|
||||
if (!codeChanged)
|
||||
this._editor.setCursor(cursor);
|
||||
|
||||
this._editor.focus();
|
||||
}
|
||||
},
|
||||
GetSelection: function(code) {
|
||||
if (this.IsSimpleEditor) {
|
||||
this._control.getSelection().text
|
||||
}
|
||||
else {
|
||||
//this is a wrapper for CodeMirror
|
||||
this._editor.getSelection();
|
||||
}
|
||||
},
|
||||
Insert: function(open, end, txtEl, arg3) {
|
||||
//arg3 gets appended to open, not actually sure why it's needed but we'll keep it for legacy, it's optional
|
||||
if (_isSimpleEditor) {
|
||||
if (navigator.userAgent.match('MSIE')) {
|
||||
this._IEInsertSelection(open, end, txtEl, arg3);
|
||||
}
|
||||
else {
|
||||
//if not ie, use jquery field select, it's easier
|
||||
var selection = jQuery("#" + txtEl).getSelection().text;
|
||||
var replace = (arg3) ? open + arg3 : open; //concat open and arg3, if arg3 specified
|
||||
if (end != "") {
|
||||
replace = replace + selection + end;
|
||||
}
|
||||
jQuery("#" + txtEl).replaceSelection(replace);
|
||||
jQuery("#" + txtEl).focus();
|
||||
this._insertSimple(open, end, txtEl, arg3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._editor.focus(); //need to restore the focus to the editor body
|
||||
|
||||
//if the saved selection (IE only) is not null, then
|
||||
if (this._cmSave != null) {
|
||||
this._editor.selectLines(this._cmSave.start.line, this._cmSave.start.character, this._cmSave.end.line, this._cmSave.end.character);
|
||||
}
|
||||
|
||||
var selection = this._editor.getSelection();
|
||||
|
||||
var replace = (arg3) ? open + arg3 : open; //concat open and arg3, if arg3 specified
|
||||
if (end != "") {
|
||||
replace = replace + selection + end;
|
||||
}
|
||||
this._editor.replaceSelection(replace);
|
||||
this._editor.focus();
|
||||
}
|
||||
},
|
||||
_IEInsertSelection: function(open, end, txtEl) {
|
||||
var tArea = document.getElementById(txtEl);
|
||||
tArea.focus();
|
||||
open = (open) ? open : "";
|
||||
end = (end) ? end : "";
|
||||
var curSelect = tArea.currRange;
|
||||
if (arguments[3]) {
|
||||
if (end == "") {
|
||||
curSelect.text = open + arguments[3];
|
||||
}
|
||||
else {
|
||||
curSelect.text = open + arguments[3] + curSelect.text + end;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (end == "") {
|
||||
curSelect.text = open;
|
||||
}
|
||||
else {
|
||||
curSelect.text = open + curSelect.text + end;
|
||||
}
|
||||
}
|
||||
curSelect.select();
|
||||
},
|
||||
_IESelectionHelper: function() {
|
||||
/// <summary>
|
||||
/// Because IE is lame, we have to continuously save the selections created by the user
|
||||
/// in the editors so that when the selections are lost (i.e. the user types in a different text box
|
||||
/// we'll need to restore the selection when they return focus
|
||||
/// </summary>
|
||||
if (document.all) {
|
||||
var _this = this;
|
||||
if (this._editor == null) {
|
||||
|
||||
function storeCaret(editEl) {
|
||||
editEl.currRange = document.selection.createRange().duplicate();
|
||||
}
|
||||
|
||||
//need to store the selection details on each event while editing content
|
||||
this._control.select(function() { storeCaret(this) });
|
||||
this._control.click(function() { storeCaret(this) });
|
||||
this._control.keyup(function() { storeCaret(this) });
|
||||
}
|
||||
else {
|
||||
|
||||
/*
|
||||
//Removed as its not needed in codemirror2 apparently
|
||||
this._editor.options.cursorActivity = function() {
|
||||
_this._cmSave = {
|
||||
start: _this._editor.cursorPosition(true), //save start position
|
||||
end: _this._editor.cursorPosition(false) //save end position
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// obj._IESelectionHelper();
|
||||
|
||||
// alert(obj);
|
||||
|
||||
return obj;
|
||||
};
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,191 @@
|
||||
function resizeTextArea(textEditor, offsetX, offsetY) {
|
||||
var clientHeight = getViewportHeight();
|
||||
var clientWidth = getViewportWidth();
|
||||
|
||||
if (textEditor != null) {
|
||||
// textEditor.style.width = (clientWidth - offsetX) + "px";
|
||||
textEditor.style.height = (clientHeight - getY(textEditor) - offsetY) + "px";
|
||||
}
|
||||
}
|
||||
|
||||
function UmbracoCodeSnippet() {
|
||||
this.BeginTag = "";
|
||||
this.EndTag = "";
|
||||
this.TargetId = "";
|
||||
this.CursorPos = 0;
|
||||
}
|
||||
|
||||
|
||||
// Ctrl + S support
|
||||
var ctrlDown = false;
|
||||
var shiftDown = false;
|
||||
var keycode = 0;
|
||||
|
||||
function shortcutCheckKeysDown(e) {
|
||||
|
||||
ctrlDown = e.ctrlKey;
|
||||
shiftDown = e.shiftKey;
|
||||
keycode = e.keyCode;
|
||||
|
||||
//save
|
||||
// uncommented by NH 07-05-11 as it's been replaced by a native bindShortcutkey() method in the ClientManager
|
||||
/*
|
||||
if (ctrlDown && keycode == 83) {
|
||||
doSubmit();
|
||||
if (window.addEventListener) {
|
||||
e.preventDefault();
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
//snippet
|
||||
if (ctrlDown && keycode == 77) {
|
||||
if (window.umbracoInsertSnippet) {
|
||||
var snippetCode = umbracoInsertSnippet();
|
||||
if (window.UmbEditor) {
|
||||
UmbEditor.Insert(snippetCode.BeginTag, snippetCode.EndTag, snippetCode.TargetId);
|
||||
if (window.addEventListener) {
|
||||
e.preventDefault();
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//load the insert value dialog: ctrl + g
|
||||
if (ctrlDown && keycode == 71) {
|
||||
umbracoInsertField('', 'xsltInsertValueOf', '', 'felt', 750, 230, '');
|
||||
if (window.addEventListener) {
|
||||
e.preventDefault();
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function shortcutCheckKeysUp(e) {
|
||||
ctrlDown = e.ctrlKey;
|
||||
shiftDown = e.shiftKey;
|
||||
}
|
||||
|
||||
function shortcutCheckKeysPressFirefox(e) {
|
||||
if (ctrlDown && keycode == 83)
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
if (window.addEventListener) {
|
||||
document.addEventListener('keyup', shortcutCheckKeysUp, false);
|
||||
document.addEventListener('keydown', shortcutCheckKeysDown, false);
|
||||
document.addEventListener('keypress', shortcutCheckKeysPressFirefox, false);
|
||||
} else {
|
||||
document.attachEvent("onkeyup", shortcutCheckKeysUp);
|
||||
document.attachEvent("onkeydown", shortcutCheckKeysDown);
|
||||
}
|
||||
|
||||
|
||||
var tab = {
|
||||
key: 9,
|
||||
string: "\t",
|
||||
nl2br: true,
|
||||
tosp: true,
|
||||
watching: {},
|
||||
results: {},
|
||||
$: function (id) {
|
||||
return document.getElementById(id);
|
||||
},
|
||||
|
||||
watch: function (obj) {
|
||||
if (obj && this.$(obj)) {
|
||||
this.watching["_" + obj] = this.$(obj);
|
||||
this.addEvent(this.$(obj), "keydown", function (evt) {
|
||||
var sct = tab.$(obj).scrollTop;
|
||||
var l = tab.$(obj).value.length;
|
||||
var evt = (evt) ? evt : ((window.event) ? event : null);
|
||||
|
||||
if (evt) {
|
||||
var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
|
||||
|
||||
if (elem) {
|
||||
var char_code = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
|
||||
|
||||
if (char_code == tab.key) {
|
||||
if (tab.$(obj).attachEvent) {
|
||||
var range = document.selection.createRange();
|
||||
|
||||
range.text = tab.string;
|
||||
range.moveStart("character", -1);
|
||||
//range.select();
|
||||
} else if (typeof tab.$(obj).selectionStart != "undefined") {
|
||||
var start = tab.$(obj).value.substr(0, tab.$(obj).selectionStart);
|
||||
var end = tab.$(obj).value.substr(tab.$(obj).selectionStart, l);
|
||||
var selection = tab.$(obj).value.replace(start, "").replace(end, "")
|
||||
tab.$(obj).value = start + tab.string + selection + end;
|
||||
tab.$(obj).setSelectionRange(start.length + 1, start.length + 1);
|
||||
tab.$(obj).scrollTop = sct;
|
||||
} else {
|
||||
tab.$(obj).value += tab.string;
|
||||
}
|
||||
|
||||
if (evt.preventDefault) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
} else {
|
||||
evt.returnValue = false;
|
||||
evt.cancelBubble = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
click: function (obj, fn) {
|
||||
if (obj && this.$(obj)) {
|
||||
this.addEvent(this.$(obj), "click", function () {
|
||||
tab.results["_" + this.id.split("_")[1]] = tab.parse(tab.watching["_" + this.id.split("_")[1]].value);
|
||||
|
||||
if (fn && fn.constructor == Function) {
|
||||
fn();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
get: function (obj) {
|
||||
if (obj && this.$(obj)) {
|
||||
return this.results["_" + obj];
|
||||
}
|
||||
},
|
||||
|
||||
parse: function (str) {
|
||||
var str = (str) ? str : "";
|
||||
|
||||
if (str.length) {
|
||||
if (this.tosp) {
|
||||
str = str.replace(/\t/g, " ");
|
||||
}
|
||||
|
||||
if (this.nl2br) {
|
||||
str = str.replace(/\r?\n/g, "<br />");
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
},
|
||||
|
||||
addEvent: function (obj, type, fn) {
|
||||
if (obj.attachEvent) {
|
||||
obj["e" + type + fn] = fn;
|
||||
obj[type + fn] = function () {
|
||||
obj["e" + type + fn](window.event);
|
||||
}
|
||||
|
||||
obj.attachEvent("on" + type, obj[type + fn]);
|
||||
} else {
|
||||
obj.addEventListener(type, fn, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
.CodeMirror {
|
||||
border: none !Important;
|
||||
font-size: 15px !Important;
|
||||
}
|
||||
.CodeMirror-gutter{background: none !Important; border: none; padding-right: 5px;}
|
||||
|
||||
span.cm-at{background: yellow !Important;}
|
||||
textarea.codepress{display: block; width: 100% !Important; font-size: 14px;}
|
||||
@@ -0,0 +1,174 @@
|
||||
.colorpicker {
|
||||
width: 356px;
|
||||
height: 176px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
background: url(../images/colorpicker_background.png);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
display: none;
|
||||
z-index:10020;
|
||||
}
|
||||
.colorpicker_color {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
left: 14px;
|
||||
top: 13px;
|
||||
position: absolute;
|
||||
background: #f00;
|
||||
overflow: hidden;
|
||||
cursor: crosshair;
|
||||
}
|
||||
.colorpicker_color div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
background: url(../images/colorpicker_overlay.png);
|
||||
}
|
||||
.colorpicker_color div div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
overflow: hidden;
|
||||
background: url(../images/colorpicker_select.gif);
|
||||
margin: -5px 0 0 -5px;
|
||||
}
|
||||
.colorpicker_hue {
|
||||
position: absolute;
|
||||
top: 13px;
|
||||
left: 171px;
|
||||
width: 35px;
|
||||
height: 150px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.colorpicker_hue div {
|
||||
position: absolute;
|
||||
width: 35px;
|
||||
height: 9px;
|
||||
overflow: hidden;
|
||||
background: url(../images/colorpicker_indic.gif) left top;
|
||||
margin: -4px 0 0 0;
|
||||
left: 0px;
|
||||
}
|
||||
.colorpicker_new_color {
|
||||
position: absolute;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
left: 213px;
|
||||
top: 13px;
|
||||
background: #f00;
|
||||
}
|
||||
.colorpicker_current_color {
|
||||
position: absolute;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
left: 283px;
|
||||
top: 13px;
|
||||
background: #f00;
|
||||
}
|
||||
.colorpicker input {
|
||||
background-color: transparent;
|
||||
border: 1px solid transparent;
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #898989;
|
||||
top: 4px;
|
||||
right: 11px;
|
||||
text-align: right;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 11px;
|
||||
}
|
||||
.colorpicker_hex {
|
||||
position: absolute;
|
||||
width: 72px;
|
||||
height: 22px;
|
||||
background: url(../images/colorpicker_hex.png) top;
|
||||
left: 212px;
|
||||
top: 142px;
|
||||
}
|
||||
.colorpicker_hex input {
|
||||
right: 6px;
|
||||
}
|
||||
.colorpicker_field {
|
||||
height: 22px;
|
||||
width: 62px;
|
||||
background-position: top;
|
||||
position: absolute;
|
||||
}
|
||||
.colorpicker_field span {
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 22px;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
right: 0;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.colorpicker_rgb_r {
|
||||
background-image: url(../images/colorpicker_rgb_r.png);
|
||||
top: 52px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_rgb_g {
|
||||
background-image: url(../images/colorpicker_rgb_g.png);
|
||||
top: 82px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_rgb_b {
|
||||
background-image: url(../images/colorpicker_rgb_b.png);
|
||||
top: 112px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_hsb_h {
|
||||
background-image: url(../images/colorpicker_hsb_h.png);
|
||||
top: 52px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_hsb_s {
|
||||
background-image: url(../images/colorpicker_hsb_s.png);
|
||||
top: 82px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_hsb_b {
|
||||
background-image: url(../images/colorpicker_hsb_b.png);
|
||||
top: 112px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_submit {
|
||||
position: absolute;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
background: url(../images/colorpicker_submit.png) top;
|
||||
left: 322px;
|
||||
top: 142px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.colorpicker_focus {
|
||||
background-position: center;
|
||||
}
|
||||
.colorpicker_hex.colorpicker_focus {
|
||||
background-position: bottom;
|
||||
}
|
||||
.colorpicker_submit.colorpicker_focus {
|
||||
background-position: bottom;
|
||||
}
|
||||
.colorpicker_slider {
|
||||
background-position: bottom;
|
||||
}
|
||||
|
||||
|
||||
/*custom adjustments*/
|
||||
|
||||
.colorpicker_hsb_h, colorpicker_hsb_s, colorpicker_hsb_b, colorpicker_submit
|
||||
{
|
||||
display:none;
|
||||
}
|
||||
.colorpicker
|
||||
{
|
||||
width:282px;
|
||||
}
|
||||
|
After Width: | Height: | Size: 49 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 532 B |
|
After Width: | Height: | Size: 970 B |
|
After Width: | Height: | Size: 1012 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 86 B |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 970 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 984 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 562 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 970 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 86 B |
|
After Width: | Height: | Size: 1008 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1018 B |
|
After Width: | Height: | Size: 997 B |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 518 B |
|
After Width: | Height: | Size: 315 B |
@@ -0,0 +1,484 @@
|
||||
/**
|
||||
*
|
||||
* Color picker
|
||||
* Author: Stefan Petre www.eyecon.ro
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses
|
||||
*
|
||||
*/
|
||||
(function ($) {
|
||||
var ColorPicker = function () {
|
||||
var
|
||||
ids = {},
|
||||
inAction,
|
||||
charMin = 65,
|
||||
visible,
|
||||
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
|
||||
defaults = {
|
||||
eventName: 'click',
|
||||
onShow: function () {},
|
||||
onBeforeShow: function(){},
|
||||
onHide: function () {},
|
||||
onChange: function () {},
|
||||
onSubmit: function () {},
|
||||
color: 'ff0000',
|
||||
livePreview: true,
|
||||
flat: false
|
||||
},
|
||||
fillRGBFields = function (hsb, cal) {
|
||||
var rgb = HSBToRGB(hsb);
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(1).val(rgb.r).end()
|
||||
.eq(2).val(rgb.g).end()
|
||||
.eq(3).val(rgb.b).end();
|
||||
},
|
||||
fillHSBFields = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(4).val(hsb.h).end()
|
||||
.eq(5).val(hsb.s).end()
|
||||
.eq(6).val(hsb.b).end();
|
||||
},
|
||||
fillHexFields = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(0).val(HSBToHex(hsb)).end();
|
||||
},
|
||||
setSelector = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
|
||||
$(cal).data('colorpicker').selectorIndic.css({
|
||||
left: parseInt(150 * hsb.s/100, 10),
|
||||
top: parseInt(150 * (100-hsb.b)/100, 10)
|
||||
});
|
||||
},
|
||||
setHue = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
|
||||
},
|
||||
setCurrentColor = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
||||
},
|
||||
setNewColor = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
||||
},
|
||||
keyDown = function (ev) {
|
||||
var pressedKey = ev.charCode || ev.keyCode || -1;
|
||||
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
|
||||
return false;
|
||||
}
|
||||
var cal = $(this).parent().parent();
|
||||
if (cal.data('colorpicker').livePreview === true) {
|
||||
change.apply(this);
|
||||
}
|
||||
},
|
||||
change = function (ev) {
|
||||
var cal = $(this).parent().parent(), col;
|
||||
if (this.parentNode.className.indexOf('_hex') > 0) {
|
||||
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
|
||||
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
|
||||
cal.data('colorpicker').color = col = fixHSB({
|
||||
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
|
||||
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
|
||||
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
|
||||
});
|
||||
} else {
|
||||
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
|
||||
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
|
||||
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
|
||||
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
|
||||
}));
|
||||
}
|
||||
if (ev) {
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
}
|
||||
setSelector(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
|
||||
},
|
||||
blur = function (ev) {
|
||||
var cal = $(this).parent().parent();
|
||||
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
||||
},
|
||||
focus = function () {
|
||||
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
|
||||
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
||||
$(this).parent().addClass('colorpicker_focus');
|
||||
},
|
||||
downIncrement = function (ev) {
|
||||
var field = $(this).parent().find('input').focus();
|
||||
var current = {
|
||||
el: $(this).parent().addClass('colorpicker_slider'),
|
||||
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
|
||||
y: ev.pageY,
|
||||
field: field,
|
||||
val: parseInt(field.val(), 10),
|
||||
preview: $(this).parent().parent().data('colorpicker').livePreview
|
||||
};
|
||||
$(document).bind('mouseup', current, upIncrement);
|
||||
$(document).bind('mousemove', current, moveIncrement);
|
||||
},
|
||||
moveIncrement = function (ev) {
|
||||
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
|
||||
if (ev.data.preview) {
|
||||
change.apply(ev.data.field.get(0), [true]);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
upIncrement = function (ev) {
|
||||
change.apply(ev.data.field.get(0), [true]);
|
||||
ev.data.el.removeClass('colorpicker_slider').find('input').focus();
|
||||
$(document).unbind('mouseup', upIncrement);
|
||||
$(document).unbind('mousemove', moveIncrement);
|
||||
return false;
|
||||
},
|
||||
downHue = function (ev) {
|
||||
var current = {
|
||||
cal: $(this).parent(),
|
||||
y: $(this).offset().top
|
||||
};
|
||||
current.preview = current.cal.data('colorpicker').livePreview;
|
||||
$(document).bind('mouseup', current, upHue);
|
||||
$(document).bind('mousemove', current, moveHue);
|
||||
},
|
||||
moveHue = function (ev) {
|
||||
change.apply(
|
||||
ev.data.cal.data('colorpicker')
|
||||
.fields
|
||||
.eq(4)
|
||||
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
|
||||
.get(0),
|
||||
[ev.data.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upHue = function (ev) {
|
||||
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
$(document).unbind('mouseup', upHue);
|
||||
$(document).unbind('mousemove', moveHue);
|
||||
return false;
|
||||
},
|
||||
downSelector = function (ev) {
|
||||
var current = {
|
||||
cal: $(this).parent(),
|
||||
pos: $(this).offset()
|
||||
};
|
||||
current.preview = current.cal.data('colorpicker').livePreview;
|
||||
$(document).bind('mouseup', current, upSelector);
|
||||
$(document).bind('mousemove', current, moveSelector);
|
||||
},
|
||||
moveSelector = function (ev) {
|
||||
change.apply(
|
||||
ev.data.cal.data('colorpicker')
|
||||
.fields
|
||||
.eq(6)
|
||||
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
|
||||
.end()
|
||||
.eq(5)
|
||||
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
|
||||
.get(0),
|
||||
[ev.data.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upSelector = function (ev) {
|
||||
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
$(document).unbind('mouseup', upSelector);
|
||||
$(document).unbind('mousemove', moveSelector);
|
||||
return false;
|
||||
},
|
||||
enterSubmit = function (ev) {
|
||||
$(this).addClass('colorpicker_focus');
|
||||
},
|
||||
leaveSubmit = function (ev) {
|
||||
$(this).removeClass('colorpicker_focus');
|
||||
},
|
||||
clickSubmit = function (ev) {
|
||||
var cal = $(this).parent();
|
||||
var col = cal.data('colorpicker').color;
|
||||
cal.data('colorpicker').origColor = col;
|
||||
setCurrentColor(col, cal.get(0));
|
||||
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
|
||||
},
|
||||
show = function (ev) {
|
||||
var cal = $('#' + $(this).data('colorpickerId'));
|
||||
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
|
||||
var pos = $(this).offset();
|
||||
var viewPort = getViewport();
|
||||
var top = pos.top + this.offsetHeight;
|
||||
var left = pos.left;
|
||||
if (top + 176 > viewPort.t + viewPort.h) {
|
||||
top -= this.offsetHeight + 176;
|
||||
}
|
||||
if (left + 356 > viewPort.l + viewPort.w) {
|
||||
left -= 356;
|
||||
}
|
||||
cal.css({left: left + 'px', top: top + 'px'});
|
||||
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
|
||||
cal.show();
|
||||
}
|
||||
$(document).bind('mousedown', {cal: cal}, hide);
|
||||
return false;
|
||||
},
|
||||
hide = function (ev) {
|
||||
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
|
||||
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
||||
ev.data.cal.hide();
|
||||
}
|
||||
$(document).unbind('mousedown', hide);
|
||||
}
|
||||
},
|
||||
isChildOf = function(parentEl, el, container) {
|
||||
if (parentEl == el) {
|
||||
return true;
|
||||
}
|
||||
if (parentEl.contains) {
|
||||
return parentEl.contains(el);
|
||||
}
|
||||
if ( parentEl.compareDocumentPosition ) {
|
||||
return !!(parentEl.compareDocumentPosition(el) & 16);
|
||||
}
|
||||
var prEl = el.parentNode;
|
||||
while(prEl && prEl != container) {
|
||||
if (prEl == parentEl)
|
||||
return true;
|
||||
prEl = prEl.parentNode;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getViewport = function () {
|
||||
var m = document.compatMode == 'CSS1Compat';
|
||||
return {
|
||||
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
||||
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
|
||||
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
|
||||
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
|
||||
};
|
||||
},
|
||||
fixHSB = function (hsb) {
|
||||
return {
|
||||
h: Math.min(360, Math.max(0, hsb.h)),
|
||||
s: Math.min(100, Math.max(0, hsb.s)),
|
||||
b: Math.min(100, Math.max(0, hsb.b))
|
||||
};
|
||||
},
|
||||
fixRGB = function (rgb) {
|
||||
return {
|
||||
r: Math.min(255, Math.max(0, rgb.r)),
|
||||
g: Math.min(255, Math.max(0, rgb.g)),
|
||||
b: Math.min(255, Math.max(0, rgb.b))
|
||||
};
|
||||
},
|
||||
fixHex = function (hex) {
|
||||
var len = 6 - hex.length;
|
||||
if (len > 0) {
|
||||
var o = [];
|
||||
for (var i=0; i<len; i++) {
|
||||
o.push('0');
|
||||
}
|
||||
o.push(hex);
|
||||
hex = o.join('');
|
||||
}
|
||||
return hex;
|
||||
},
|
||||
HexToRGB = function (hex) {
|
||||
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
||||
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
|
||||
},
|
||||
HexToHSB = function (hex) {
|
||||
return RGBToHSB(HexToRGB(hex));
|
||||
},
|
||||
RGBToHSB = function (rgb) {
|
||||
var hsb = {
|
||||
h: 0,
|
||||
s: 0,
|
||||
b: 0
|
||||
};
|
||||
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
||||
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
||||
var delta = max - min;
|
||||
hsb.b = max;
|
||||
if (max != 0) {
|
||||
|
||||
}
|
||||
hsb.s = max != 0 ? 255 * delta / max : 0;
|
||||
if (hsb.s != 0) {
|
||||
if (rgb.r == max) {
|
||||
hsb.h = (rgb.g - rgb.b) / delta;
|
||||
} else if (rgb.g == max) {
|
||||
hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
||||
} else {
|
||||
hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
||||
}
|
||||
} else {
|
||||
hsb.h = -1;
|
||||
}
|
||||
hsb.h *= 60;
|
||||
if (hsb.h < 0) {
|
||||
hsb.h += 360;
|
||||
}
|
||||
hsb.s *= 100/255;
|
||||
hsb.b *= 100/255;
|
||||
return hsb;
|
||||
},
|
||||
HSBToRGB = function (hsb) {
|
||||
var rgb = {};
|
||||
var h = Math.round(hsb.h);
|
||||
var s = Math.round(hsb.s*255/100);
|
||||
var v = Math.round(hsb.b*255/100);
|
||||
if(s == 0) {
|
||||
rgb.r = rgb.g = rgb.b = v;
|
||||
} else {
|
||||
var t1 = v;
|
||||
var t2 = (255-s)*v/255;
|
||||
var t3 = (t1-t2)*(h%60)/60;
|
||||
if(h==360) h = 0;
|
||||
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
|
||||
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
|
||||
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
|
||||
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
|
||||
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
|
||||
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
|
||||
else {rgb.r=0; rgb.g=0; rgb.b=0}
|
||||
}
|
||||
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
|
||||
},
|
||||
RGBToHex = function (rgb) {
|
||||
var hex = [
|
||||
rgb.r.toString(16),
|
||||
rgb.g.toString(16),
|
||||
rgb.b.toString(16)
|
||||
];
|
||||
$.each(hex, function (nr, val) {
|
||||
if (val.length == 1) {
|
||||
hex[nr] = '0' + val;
|
||||
}
|
||||
});
|
||||
return hex.join('');
|
||||
},
|
||||
HSBToHex = function (hsb) {
|
||||
return RGBToHex(HSBToRGB(hsb));
|
||||
},
|
||||
restoreOriginal = function () {
|
||||
var cal = $(this).parent();
|
||||
var col = cal.data('colorpicker').origColor;
|
||||
cal.data('colorpicker').color = col;
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
setSelector(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
};
|
||||
return {
|
||||
init: function (opt) {
|
||||
opt = $.extend({}, defaults, opt||{});
|
||||
if (typeof opt.color == 'string') {
|
||||
opt.color = HexToHSB(opt.color);
|
||||
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
|
||||
opt.color = RGBToHSB(opt.color);
|
||||
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
|
||||
opt.color = fixHSB(opt.color);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function () {
|
||||
if (!$(this).data('colorpickerId')) {
|
||||
var options = $.extend({}, opt);
|
||||
options.origColor = opt.color;
|
||||
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
|
||||
$(this).data('colorpickerId', id);
|
||||
var cal = $(tpl).attr('id', id);
|
||||
if (options.flat) {
|
||||
cal.appendTo(this).show();
|
||||
} else {
|
||||
cal.appendTo(document.body);
|
||||
}
|
||||
options.fields = cal
|
||||
.find('input')
|
||||
.bind('keyup', keyDown)
|
||||
.bind('change', change)
|
||||
.bind('blur', blur)
|
||||
.bind('focus', focus);
|
||||
cal
|
||||
.find('span').bind('mousedown', downIncrement).end()
|
||||
.find('>div.colorpicker_current_color').bind('click', restoreOriginal);
|
||||
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
|
||||
options.selectorIndic = options.selector.find('div div');
|
||||
options.el = this;
|
||||
options.hue = cal.find('div.colorpicker_hue div');
|
||||
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
|
||||
options.newColor = cal.find('div.colorpicker_new_color');
|
||||
options.currentColor = cal.find('div.colorpicker_current_color');
|
||||
cal.data('colorpicker', options);
|
||||
cal.find('div.colorpicker_submit')
|
||||
.bind('mouseenter', enterSubmit)
|
||||
.bind('mouseleave', leaveSubmit)
|
||||
.bind('click', clickSubmit);
|
||||
fillRGBFields(options.color, cal.get(0));
|
||||
fillHSBFields(options.color, cal.get(0));
|
||||
fillHexFields(options.color, cal.get(0));
|
||||
setHue(options.color, cal.get(0));
|
||||
setSelector(options.color, cal.get(0));
|
||||
setCurrentColor(options.color, cal.get(0));
|
||||
setNewColor(options.color, cal.get(0));
|
||||
if (options.flat) {
|
||||
cal.css({
|
||||
position: 'relative',
|
||||
display: 'block'
|
||||
});
|
||||
} else {
|
||||
$(this).bind(options.eventName, show);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
showPicker: function() {
|
||||
return this.each( function () {
|
||||
if ($(this).data('colorpickerId')) {
|
||||
show.apply(this);
|
||||
}
|
||||
});
|
||||
},
|
||||
hidePicker: function() {
|
||||
return this.each( function () {
|
||||
if ($(this).data('colorpickerId')) {
|
||||
$('#' + $(this).data('colorpickerId')).hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
setColor: function(col) {
|
||||
if (typeof col == 'string') {
|
||||
col = HexToHSB(col);
|
||||
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
||||
col = RGBToHSB(col);
|
||||
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
||||
col = fixHSB(col);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function(){
|
||||
if ($(this).data('colorpickerId')) {
|
||||
var cal = $('#' + $(this).data('colorpickerId'));
|
||||
cal.data('colorpicker').color = col;
|
||||
cal.data('colorpicker').origColor = col;
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setSelector(col, cal.get(0));
|
||||
setCurrentColor(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
$.fn.extend({
|
||||
ColorPicker: ColorPicker.init,
|
||||
ColorPickerHide: ColorPicker.hidePicker,
|
||||
ColorPickerShow: ColorPicker.showPicker,
|
||||
ColorPickerSetColor: ColorPicker.setColor
|
||||
});
|
||||
})(jQuery)
|
||||
@@ -0,0 +1,155 @@
|
||||
/*!
|
||||
* jQuery contextMenu - Plugin for simple contextMenu handling
|
||||
*
|
||||
* Version: 1.5.22
|
||||
*
|
||||
* Authors: Rodney Rehm, Addy Osmani (patches for FF)
|
||||
* Web: http://medialize.github.com/jQuery-contextMenu/
|
||||
*
|
||||
* Licensed under
|
||||
* MIT License http://www.opensource.org/licenses/mit-license
|
||||
* GPL v3 http://opensource.org/licenses/GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
.context-menu-list
|
||||
{
|
||||
/*margin:0;
|
||||
padding:0;
|
||||
|
||||
min-width: 120px;
|
||||
max-width: 250px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
list-style-type: none;
|
||||
|
||||
border: 1px solid #DDD;
|
||||
background: #EEE;
|
||||
|
||||
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
-ms-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
-o-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 11px;*/
|
||||
|
||||
background: #f0f0f0 url(../../Tree/Themes/umbraco/contextMenuBg.gif) repeat-y left;
|
||||
border: 1px solid #979797;
|
||||
padding: 2px 3px;
|
||||
min-width: 130px;
|
||||
max-width: 250px;
|
||||
font-family: Arial,Lucida Grande;
|
||||
font-size: 11px;
|
||||
margin: 0px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.context-menu-item
|
||||
{
|
||||
border-left: none;
|
||||
background: transparent;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
padding: 0 0 0 35px;
|
||||
margin: 0;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.context-menu-separator {
|
||||
padding-bottom:0;
|
||||
height: 1px;
|
||||
margin: 3px 0 3px 30px;
|
||||
border-bottom: 1px solid #DDD;
|
||||
}
|
||||
|
||||
.context-menu-item > label > input,
|
||||
.context-menu-item > label > textarea {
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.context-menu-item.hover {
|
||||
cursor: pointer;
|
||||
background: #D5EFFC;
|
||||
border:1px solid #99DEFD;
|
||||
}
|
||||
|
||||
.context-menu-item.disabled {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.context-menu-input.hover,
|
||||
.context-menu-item.disabled.hover {
|
||||
cursor: default;
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
.context-menu-submenu:after {
|
||||
content: ">";
|
||||
color: #666;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 3px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* icons
|
||||
#protip:
|
||||
In case you want to use sprites for icons (which I would suggest you do) have a look at
|
||||
http://css-tricks.com/13224-pseudo-spriting/ to get an idea of how to implement
|
||||
.context-menu-item.icon:before {}
|
||||
*/
|
||||
.context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; background-position: 4px 4px; }
|
||||
.context-menu-item.icon-edit { background-image: url(../../../umbraco/images/pencil.png); }
|
||||
.context-menu-item.icon-delete { background-image: url(../../../umbraco/images/delete.small.png); }
|
||||
.context-menu-item.icon-download { background-image: url(../../../umbraco/images/download.png); }
|
||||
|
||||
/* vertically align inside labels */
|
||||
.context-menu-input > label > * { vertical-align: top; }
|
||||
|
||||
/* position checkboxes and radios as icons */
|
||||
.context-menu-input > label > input[type="checkbox"],
|
||||
.context-menu-input > label > input[type="radio"] {
|
||||
margin-left: -17px;
|
||||
}
|
||||
.context-menu-input > label > span {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.context-menu-input > label,
|
||||
.context-menu-input > label > input[type="text"],
|
||||
.context-menu-input > label > textarea,
|
||||
.context-menu-input > label > select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
-o-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.context-menu-input > label > textarea {
|
||||
height: 100px;
|
||||
}
|
||||
.context-menu-item > .context-menu-list {
|
||||
display: none;
|
||||
/* re-positioned by js */
|
||||
right: -5px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.context-menu-item.hover > .context-menu-list {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.context-menu-accesskey {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1,423 @@
|
||||
/*!
|
||||
* jQuery UI Timepicker 0.2.1
|
||||
*
|
||||
* Copyright (c) 2009 Martin Milesich (http://milesich.com/)
|
||||
*
|
||||
* Some parts are
|
||||
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
||||
*
|
||||
* $Id: timepicker.js 28 2009-08-11 20:31:23Z majlo $
|
||||
*
|
||||
* Depends:
|
||||
* ui.core.js
|
||||
* ui.datepicker.js
|
||||
* ui.slider.js
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
* Extending default values
|
||||
*/
|
||||
$.extend($.datepicker._defaults, {
|
||||
'stepMinutes': 1, // Number of minutes to step up/down
|
||||
'stepHours': 1, // Number of hours to step up/down
|
||||
'time24h': false, // True if 24h time
|
||||
'showTime': false, // Show timepicker with datepicker
|
||||
'altTimeField': '' // Selector for an alternate field to store time into
|
||||
});
|
||||
|
||||
/**
|
||||
* _hideDatepicker must be called with null
|
||||
*/
|
||||
$.datepicker._connectDatepickerOverride = $.datepicker._connectDatepicker;
|
||||
$.datepicker._connectDatepicker = function(target, inst) {
|
||||
$.datepicker._connectDatepickerOverride(target, inst);
|
||||
|
||||
// showButtonPanel is required with timepicker
|
||||
if (this._get(inst, 'showTime')) {
|
||||
inst.settings['showButtonPanel'] = true;
|
||||
}
|
||||
|
||||
var showOn = this._get(inst, 'showOn');
|
||||
|
||||
if (showOn == 'button' || showOn == 'both') {
|
||||
// Unbind all click events
|
||||
inst.trigger.unbind('click');
|
||||
|
||||
// Bind new click event
|
||||
inst.trigger.click(function() {
|
||||
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
|
||||
$.datepicker._hideDatepicker(null); // This override is all about the "null"
|
||||
else
|
||||
$.datepicker._showDatepicker(target);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Datepicker does not have an onShow event so I need to create it.
|
||||
* What I actually doing here is copying original _showDatepicker
|
||||
* method to _showDatepickerOverload method.
|
||||
*/
|
||||
$.datepicker._showDatepickerOverride = $.datepicker._showDatepicker;
|
||||
$.datepicker._showDatepicker = function (input) {
|
||||
// keep the current value
|
||||
var originalval = input.value;
|
||||
|
||||
// Keep the first 10 chars for now yyyy-mm-dd - this removes the time part which was breaking the standardDatePicker parsing code
|
||||
input.value = originalval.length>10 ? originalval.substring(0, 10) : originalval;
|
||||
|
||||
|
||||
// Call the original method which will show the datepicker
|
||||
$.datepicker._showDatepickerOverride(input);
|
||||
|
||||
// Put it back
|
||||
input.value = originalval;
|
||||
|
||||
input = input.target || input;
|
||||
|
||||
// find from button/image trigger
|
||||
if (input.nodeName.toLowerCase() != 'input') input = $('input', input.parentNode)[0];
|
||||
|
||||
// Do not show timepicker if datepicker is disabled
|
||||
if ($.datepicker._isDisabledDatepicker(input)) return;
|
||||
|
||||
// Get instance to datepicker
|
||||
var inst = $.datepicker._getInst(input);
|
||||
|
||||
var showTime = $.datepicker._get(inst, 'showTime');
|
||||
|
||||
// If showTime = True show the timepicker
|
||||
if (showTime) $.timepicker.show(input);
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as above. Here I need to extend the _checkExternalClick method
|
||||
* because I don't want to close the datepicker when the sliders get focus.
|
||||
*/
|
||||
$.datepicker._checkExternalClickOverride = $.datepicker._checkExternalClick;
|
||||
$.datepicker._checkExternalClick = function (event) {
|
||||
if (!$.datepicker._curInst) return;
|
||||
var $target = $(event.target);
|
||||
|
||||
if (($target.parents('#' + $.timepicker._mainDivId).length == 0)) {
|
||||
$.datepicker._checkExternalClickOverride(event);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Datepicker has onHide event but I just want to make it simple for you
|
||||
* so I hide the timepicker when datepicker hides.
|
||||
*/
|
||||
$.datepicker._hideDatepickerOverride = $.datepicker._hideDatepicker;
|
||||
$.datepicker._hideDatepicker = function(input, duration) {
|
||||
// Some lines from the original method
|
||||
var inst = this._curInst;
|
||||
|
||||
if (!inst || (input && inst != $.data(input, PROP_NAME))) return;
|
||||
|
||||
// Get the value of showTime property
|
||||
var showTime = this._get(inst, 'showTime');
|
||||
|
||||
if (input === undefined && showTime) {
|
||||
if (inst.input) {
|
||||
inst.input.val(this._formatDate(inst));
|
||||
inst.input.trigger('change'); // fire the change event
|
||||
}
|
||||
|
||||
this._updateAlternate(inst);
|
||||
|
||||
if (showTime) $.timepicker.update(this._formatDate(inst));
|
||||
}
|
||||
|
||||
// Hide datepicker
|
||||
$.datepicker._hideDatepickerOverride(input, duration);
|
||||
|
||||
// Hide the timepicker if enabled
|
||||
if (showTime) {
|
||||
$.timepicker.hide();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a complete replacement of the _selectDate method.
|
||||
* If showed with timepicker do not close when date is selected.
|
||||
*/
|
||||
$.datepicker._selectDate = function(id, dateStr) {
|
||||
var target = $(id);
|
||||
var inst = this._getInst(target[0]);
|
||||
var showTime = this._get(inst, 'showTime');
|
||||
dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
|
||||
if (!showTime) {
|
||||
if (inst.input)
|
||||
inst.input.val(dateStr);
|
||||
this._updateAlternate(inst);
|
||||
}
|
||||
var onSelect = this._get(inst, 'onSelect');
|
||||
if (onSelect)
|
||||
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
|
||||
else if (inst.input && !showTime)
|
||||
inst.input.trigger('change'); // fire the change event
|
||||
if (inst.inline)
|
||||
this._updateDatepicker(inst);
|
||||
else if (!inst.stayOpen) {
|
||||
if (showTime) {
|
||||
this._updateDatepicker(inst);
|
||||
} else {
|
||||
this._hideDatepicker(null, this._get(inst, 'duration'));
|
||||
this._lastInput = inst.input[0];
|
||||
if (typeof(inst.input[0]) != 'object')
|
||||
inst.input[0].focus(); // restore focus
|
||||
this._lastInput = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* We need to resize the timepicker when the datepicker has been changed.
|
||||
*/
|
||||
$.datepicker._updateDatepickerOverride = $.datepicker._updateDatepicker;
|
||||
$.datepicker._updateDatepicker = function(inst) {
|
||||
$.datepicker._updateDatepickerOverride(inst);
|
||||
$.timepicker.resize();
|
||||
};
|
||||
|
||||
function Timepicker() {}
|
||||
|
||||
Timepicker.prototype = {
|
||||
init: function()
|
||||
{
|
||||
this._mainDivId = 'ui-timepicker-div';
|
||||
this._inputId = null;
|
||||
this._orgValue = null;
|
||||
this._orgHour = null;
|
||||
this._orgMinute = null;
|
||||
this._colonPos = -1;
|
||||
this._visible = false;
|
||||
this.tpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible" style="width: 100px; display: none; position: absolute;"></div>');
|
||||
this._generateHtml();
|
||||
},
|
||||
|
||||
show: function (input)
|
||||
{
|
||||
// Get instance to datepicker
|
||||
var inst = $.datepicker._getInst(input);
|
||||
|
||||
this._time24h = $.datepicker._get(inst, 'time24h');
|
||||
this._altTimeField = $.datepicker._get(inst, 'altTimeField');
|
||||
|
||||
var stepMinutes = parseInt($.datepicker._get(inst, 'stepMinutes'), 10) || 1;
|
||||
var stepHours = parseInt($.datepicker._get(inst, 'stepHours'), 10) || 1;
|
||||
|
||||
if (60 % stepMinutes != 0) { stepMinutes = 1; }
|
||||
if (24 % stepHours != 0) { stepHours = 1; }
|
||||
|
||||
$('#hourSlider').slider('option', 'max', 24 - stepHours);
|
||||
$('#hourSlider').slider('option', 'step', stepHours);
|
||||
|
||||
$('#minuteSlider').slider('option', 'max', 60 - stepMinutes);
|
||||
$('#minuteSlider').slider('option', 'step', stepMinutes);
|
||||
|
||||
this._inputId = input.id;
|
||||
|
||||
if (!this._visible) {
|
||||
this._parseTime();
|
||||
this._orgValue = $('#' + this._inputId).val();
|
||||
}
|
||||
|
||||
this.resize();
|
||||
|
||||
$('#' + this._mainDivId).show();
|
||||
|
||||
this._visible = true;
|
||||
|
||||
var dpDiv = $('#' + $.datepicker._mainDivId);
|
||||
var dpDivPos = dpDiv.position();
|
||||
|
||||
var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
|
||||
var tpRight = this.tpDiv.offset().left + this.tpDiv.outerWidth();
|
||||
|
||||
if (tpRight > viewWidth) {
|
||||
dpDiv.css('left', dpDivPos.left - (tpRight - viewWidth) - 5);
|
||||
this.tpDiv.css('left', dpDiv.offset().left + dpDiv.outerWidth() + 'px');
|
||||
}
|
||||
},
|
||||
|
||||
update: function (fd)
|
||||
{
|
||||
var curTime = $('#' + this._mainDivId + ' span.fragHours').text()
|
||||
+ ':'
|
||||
+ $('#' + this._mainDivId + ' span.fragMinutes').text();
|
||||
|
||||
if (!this._time24h) {
|
||||
curTime += ' ' + $('#' + this._mainDivId + ' span.fragAmpm').text();
|
||||
}
|
||||
|
||||
var curDate = $('#' + this._inputId).val();
|
||||
|
||||
$('#' + this._inputId).val(fd + ' ' + curTime);
|
||||
|
||||
if (this._altTimeField) {
|
||||
$(this._altTimeField).each(function() { $(this).val(curTime); });
|
||||
}
|
||||
},
|
||||
|
||||
hide: function ()
|
||||
{
|
||||
this._visible = false;
|
||||
$('#' + this._mainDivId).hide();
|
||||
},
|
||||
|
||||
resize: function ()
|
||||
{
|
||||
var dpDiv = $('#' + $.datepicker._mainDivId);
|
||||
var dpDivPos = dpDiv.position();
|
||||
|
||||
var hdrHeight = $('#' + $.datepicker._mainDivId + ' > div.ui-datepicker-header:first-child').height();
|
||||
|
||||
$('#' + this._mainDivId + ' > div.ui-datepicker-header:first-child').css('height', hdrHeight);
|
||||
|
||||
this.tpDiv.css({
|
||||
'height': dpDiv.height(),
|
||||
'top' : dpDivPos.top,
|
||||
'left' : dpDivPos.left + dpDiv.outerWidth() + 'px'
|
||||
});
|
||||
|
||||
$('#hourSlider').css('height', this.tpDiv.height() - (3.5 * hdrHeight));
|
||||
$('#minuteSlider').css('height', this.tpDiv.height() - (3.5 * hdrHeight));
|
||||
},
|
||||
|
||||
_generateHtml: function ()
|
||||
{
|
||||
var html = '';
|
||||
|
||||
html += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">';
|
||||
html += '<div class="ui-datepicker-title" style="margin:0">';
|
||||
html += '<span class="fragHours">08</span><span class="delim">:</span><span class="fragMinutes">45</span> <span class="fragAmpm"></span></div></div><table>';
|
||||
html += '<tr><th>Hour</th><th>Minute</th></tr>';
|
||||
html += '<tr><td align="center"><div id="hourSlider" class="slider"></div></td><td align="center"><div id="minuteSlider" class="slider"></div></td></tr>';
|
||||
html += '</table>';
|
||||
|
||||
this.tpDiv.empty().append(html);
|
||||
$('body').append(this.tpDiv);
|
||||
|
||||
var self = this;
|
||||
|
||||
$('#hourSlider').slider({
|
||||
orientation: "vertical",
|
||||
range: 'min',
|
||||
min: 0,
|
||||
max: 23,
|
||||
step: 1,
|
||||
slide: function(event, ui) {
|
||||
self._writeTime('hour', ui.value);
|
||||
},
|
||||
stop: function(event, ui) {
|
||||
$('#' + self._inputId).focus();
|
||||
}
|
||||
});
|
||||
|
||||
$('#minuteSlider').slider({
|
||||
orientation: "vertical",
|
||||
range: 'min',
|
||||
min: 0,
|
||||
max: 59,
|
||||
step: 1,
|
||||
slide: function(event, ui) {
|
||||
self._writeTime('minute', ui.value);
|
||||
},
|
||||
stop: function(event, ui) {
|
||||
$('#' + self._inputId).focus();
|
||||
}
|
||||
});
|
||||
|
||||
$('#hourSlider > a').css('padding', 0);
|
||||
$('#minuteSlider > a').css('padding', 0);
|
||||
},
|
||||
|
||||
_writeTime: function (type, value)
|
||||
{
|
||||
if (type == 'hour') {
|
||||
if (!this._time24h) {
|
||||
if (value < 12) {
|
||||
$('#' + this._mainDivId + ' span.fragAmpm').text('am');
|
||||
} else {
|
||||
$('#' + this._mainDivId + ' span.fragAmpm').text('pm');
|
||||
value -= 12;
|
||||
}
|
||||
|
||||
if (value == 0) value = 12;
|
||||
} else {
|
||||
$('#' + this._mainDivId + ' span.fragAmpm').text('');
|
||||
}
|
||||
|
||||
if (value < 10) value = '0' + value;
|
||||
$('#' + this._mainDivId + ' span.fragHours').text(value);
|
||||
}
|
||||
|
||||
if (type == 'minute') {
|
||||
if (value < 10) value = '0' + value;
|
||||
$('#' + this._mainDivId + ' span.fragMinutes').text(value);
|
||||
}
|
||||
},
|
||||
|
||||
_parseTime: function ()
|
||||
{
|
||||
var dt = $('#' + this._inputId).val();
|
||||
|
||||
this._colonPos = dt.search(':');
|
||||
|
||||
var m = 0, h = 0, a = '';
|
||||
|
||||
if (this._colonPos != -1) {
|
||||
h = parseInt(dt.substr(this._colonPos - 2, 2), 10);
|
||||
m = parseInt(dt.substr(this._colonPos + 1, 2), 10);
|
||||
a = jQuery.trim(dt.substr(this._colonPos + 3, 3));
|
||||
}
|
||||
|
||||
a = a.toLowerCase();
|
||||
|
||||
if (a != 'am' && a != 'pm') {
|
||||
a = '';
|
||||
}
|
||||
|
||||
if (h < 0) h = 0;
|
||||
if (m < 0) m = 0;
|
||||
|
||||
if (h > 23) h = 23;
|
||||
if (m > 59) m = 59;
|
||||
|
||||
if (a == 'pm' && h < 12) h += 12;
|
||||
if (a == 'am' && h == 12) h = 0;
|
||||
|
||||
this._setTime('hour', h);
|
||||
this._setTime('minute', m);
|
||||
|
||||
this._orgHour = h;
|
||||
this._orgMinute = m;
|
||||
},
|
||||
|
||||
_setTime: function (type, value)
|
||||
{
|
||||
if (isNaN(value)) value = 0;
|
||||
if (value < 0) value = 0;
|
||||
if (value > 23 && type == 'hour') value = 23;
|
||||
if (value > 59 && type == 'minute') value = 59;
|
||||
|
||||
if (type == 'hour') {
|
||||
$('#hourSlider').slider('value', value);
|
||||
}
|
||||
|
||||
if (type == 'minute') {
|
||||
$('#minuteSlider').slider('value', value);
|
||||
}
|
||||
|
||||
this._writeTime(type, value);
|
||||
}
|
||||
};
|
||||
|
||||
$.timepicker = new Timepicker();
|
||||
$('document').ready(function () {$.timepicker.init();});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,47 @@
|
||||
(function($) {
|
||||
|
||||
$.fn.umbDateTimePicker = function(showTime, chooseDateTxt, noDateTxt, removeDateTxt) {
|
||||
return $(this).each(function() {
|
||||
//create the date/time picker
|
||||
$(this).datepicker({
|
||||
duration: "",
|
||||
showTime: showTime,
|
||||
constrainInput: true,
|
||||
buttonText: "<span>" + chooseDateTxt + "</span>",
|
||||
showOn: 'button',
|
||||
changeYear: true,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
time24h: true,
|
||||
onClose: function(dateText, inst) { if (dateText == '') return; $(this).nextAll('div').remove(); }
|
||||
});
|
||||
//simple method to create the no date selected text block
|
||||
var addNoDate = function(obj) {
|
||||
if (obj.siblings('div').length == 0) {
|
||||
obj.siblings('button').after('<div>' + noDateTxt + '</div>');
|
||||
}
|
||||
obj.nextAll('a').remove();
|
||||
}
|
||||
//simple method to handle the clear date button click
|
||||
var clearDate = function() {
|
||||
$(this).siblings('input').val('');
|
||||
addNoDate($(this));
|
||||
$(this).remove();
|
||||
}
|
||||
//wire up the textbox event, we'll create/remove items when it has values or not.
|
||||
$(this).change(function() {
|
||||
if ($(this).val() == '') {
|
||||
addNoDate($(this));
|
||||
}
|
||||
else {
|
||||
if ($(this).nextAll('a').length == 0) {
|
||||
$('<a>' + removeDateTxt + '</a>').insertAfter($(this).nextAll('button')).click(clearDate);
|
||||
}
|
||||
$(this).nextAll('div').remove();
|
||||
}
|
||||
});
|
||||
//wire up anchor click
|
||||
$(this).nextAll('a').click(clearDate);
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
After Width: | Height: | Size: 89 B |
|
After Width: | Height: | Size: 85 B |
|
After Width: | Height: | Size: 89 B |
|
After Width: | Height: | Size: 49 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 116 B |
@@ -0,0 +1,221 @@
|
||||
/* Distributed as part of The Coolest DHTML Calendar
|
||||
Author: Mihai Bazon, www.bazon.net/mishoo
|
||||
Copyright Dynarch.com 2005, www.dynarch.com
|
||||
*/
|
||||
|
||||
/* The main calendar widget. DIV containing a table. */
|
||||
|
||||
div.calendar { position: relative; border: 2px solid #CAC9C9;}
|
||||
|
||||
.calendar, .calendar table {
|
||||
|
||||
font-size: 11px;
|
||||
color: #000;
|
||||
cursor: default;
|
||||
font-family: "trebuchet ms",verdana,tahoma,sans-serif;
|
||||
background: #fff url(../../propertyPane/images/propertyBackground.gif);
|
||||
}
|
||||
|
||||
.calendar table {
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Header part -- contains navigation buttons and day names. */
|
||||
|
||||
.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
|
||||
text-align: center; /* They are the navigation buttons */
|
||||
padding: 2px; /* Make the buttons seem like they're pressing */
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.calendar .nav {
|
||||
font-family: verdana,tahoma,sans-serif;
|
||||
}
|
||||
|
||||
.calendar .nav div {
|
||||
}
|
||||
|
||||
.calendar thead tr { color: #000; }
|
||||
|
||||
.calendar thead .title { /* This holds the current "month, year" */
|
||||
font-weight: bold; /* Pressing it will take you to the current date */
|
||||
text-align: center;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.calendar thead .headrow { /* Row <TR> containing navigation buttons */
|
||||
|
||||
}
|
||||
|
||||
.calendar thead .name { /* Cells <TD> containing the day names */
|
||||
border-bottom: 1px solid #797979;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.calendar thead .weekend { /* How a weekend day name shows in header */
|
||||
color: #c44;
|
||||
}
|
||||
|
||||
.calendar thead .hilite { /* How do the buttons in header appear when hover */
|
||||
border-bottom: 1px solid #797979;
|
||||
padding: 2px 2px 1px 2px;
|
||||
}
|
||||
|
||||
.calendar thead .active { /* Active (pressed) buttons in header */
|
||||
padding: 3px 1px 0px 3px;
|
||||
border-bottom: 1px solid #797979;
|
||||
}
|
||||
|
||||
.calendar thead .daynames { /* Row <TR> containing the day names */
|
||||
}
|
||||
|
||||
/* The body part -- contains all the days in month. */
|
||||
|
||||
.calendar tbody .day { /* Cells <TD> containing month days dates */
|
||||
font-family: verdana,tahoma,sans-serif;
|
||||
width: 2em;
|
||||
color: #000;
|
||||
text-align: right;
|
||||
padding: 2px 4px 2px 2px;
|
||||
}
|
||||
.calendar tbody .day.othermonth {
|
||||
font-size: 80%;
|
||||
color: #999;
|
||||
}
|
||||
.calendar tbody .day.othermonth.oweekend {
|
||||
color: #f99;
|
||||
}
|
||||
|
||||
.calendar table .wn {
|
||||
padding: 2px 3px 2px 2px;
|
||||
border-right: 1px solid #797979;
|
||||
}
|
||||
|
||||
.calendar tbody .rowhilite td,
|
||||
.calendar tbody .rowhilite td.wn {
|
||||
}
|
||||
|
||||
.calendar tbody td.today { font-weight: bold; /* background: url("today-bg.gif") no-repeat 70% 50%; */ }
|
||||
|
||||
.calendar tbody td.hilite { /* Hovered cells <TD> */
|
||||
padding: 1px 3px 1px 1px;
|
||||
border: 1px solid #bbb;
|
||||
}
|
||||
|
||||
.calendar tbody td.active { /* Active (pressed) cells <TD> */
|
||||
padding: 2px 2px 0px 2px;
|
||||
}
|
||||
|
||||
.calendar tbody td.weekend { /* Cells showing weekend days */
|
||||
color: #c44;
|
||||
}
|
||||
|
||||
.calendar tbody td.selected { /* Cell showing selected date */
|
||||
font-weight: bold;
|
||||
border: 1px solid #797979;
|
||||
padding: 1px 3px 1px 1px;
|
||||
}
|
||||
|
||||
.calendar tbody .disabled { color: #999; }
|
||||
|
||||
.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* The footer part -- status bar and "Close" button */
|
||||
|
||||
.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
|
||||
padding: 2px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.calendar tfoot .hilite { /* Hover style for buttons in footer */
|
||||
background: #afa;
|
||||
border: 1px solid #084;
|
||||
color: #000;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
|
||||
background: #7c7;
|
||||
padding: 2px 0px 0px 2px;
|
||||
}
|
||||
|
||||
/* Combo boxes (menus that display months/years for direct selection) */
|
||||
|
||||
.calendar .combo {
|
||||
position: absolute;
|
||||
display: none;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 4em;
|
||||
cursor: default;
|
||||
border-width: 0 1px 1px 1px;
|
||||
border-style: solid;
|
||||
border-color: #797979;
|
||||
color: #000;
|
||||
z-index: 100;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.calendar .combo .label,
|
||||
.calendar .combo .label-IEfix {
|
||||
text-align: center;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.calendar .combo .label-IEfix {
|
||||
width: 4em;
|
||||
}
|
||||
|
||||
.calendar .combo .hilite {
|
||||
}
|
||||
|
||||
.calendar .combo .active {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.calendar td.time {
|
||||
border-top: 1px solid #797979;
|
||||
padding: 1px 0px;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
.calendar td.time .hour,
|
||||
.calendar td.time .minute,
|
||||
.calendar td.time .ampm {
|
||||
padding: 0px 5px 0px 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.calendar td.time .hour,
|
||||
.calendar td.time .minute {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.calendar td.time .ampm {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.calendar td.time .colon {
|
||||
padding: 0px 2px 0px 3px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.calendar td.time span.hilite {
|
||||
}
|
||||
|
||||
.calendar td.time span.active {
|
||||
}
|
||||
|
After Width: | Height: | Size: 116 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 674 B |
|
After Width: | Height: | Size: 633 B |
@@ -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);
|
||||
@@ -0,0 +1,28 @@
|
||||
a
|
||||
{
|
||||
color: #3C6B96;
|
||||
}
|
||||
|
||||
.tdDir a
|
||||
{
|
||||
color: #3C6B96;
|
||||
padding: 3px;
|
||||
padding-left: 25px;
|
||||
background: url(../../umbraco/images/foldericon.png) no-repeat 2px 2px;
|
||||
}
|
||||
|
||||
.tdFile a
|
||||
{
|
||||
color: #3C6B96;
|
||||
padding: 3px;
|
||||
padding-left: 25px;
|
||||
background: url(../../umbraco/images/file.png) no-repeat 2px 2px;
|
||||
}
|
||||
|
||||
small a
|
||||
{
|
||||
color: #999;
|
||||
padding-left: 3px !Important;
|
||||
background-image: none !Important;
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
table.macro-props {
|
||||
width: 98%;
|
||||
border: 0;
|
||||
}
|
||||
table.macro-props td {
|
||||
padding: 4px;
|
||||
}
|
||||
table.macro-props td.propertyHeader {
|
||||
width: 200px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
table.macro-props td.propertyContent {
|
||||
vertical-align: middle;
|
||||
}
|
||||
table.macro-props td.propertyContent .guiInputText {
|
||||
width: 300px;
|
||||
}
|
||||
table.macro-props td.propertyContent .guiInputText.small
|
||||
{
|
||||
width: 60px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
table.macro-props.params td.propertyHeader
|
||||
{
|
||||
width: 25%;
|
||||
}
|
||||
table.macro-props.params td.propertyContent input,
|
||||
table.macro-props.params td.propertyContent select
|
||||
{
|
||||
width: 90%;
|
||||
}
|
||||
table.macro-props.params td.propertyContent input[type=submit] {
|
||||
width: 100px;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Editors");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Editors.EditMacroScripts = base2.Base.extend({
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
// Constructor
|
||||
constructor: function(opts) {
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
|
||||
|
||||
// Default options go here
|
||||
}, opts);
|
||||
},
|
||||
|
||||
init: function () {
|
||||
//setup UI elements
|
||||
var self = this;
|
||||
|
||||
//bind to the save event
|
||||
this._opts.saveButton.click(function (event) {
|
||||
event.preventDefault();
|
||||
self.doSubmit();
|
||||
});
|
||||
},
|
||||
|
||||
doSubmit: function () {
|
||||
var self = this;
|
||||
|
||||
jQuery('#errorDiv').hide();
|
||||
|
||||
var fileName = this._opts.nameTxtBox.val();
|
||||
var codeVal = this._opts.editorSourceElement.val();
|
||||
//if CodeMirror is not defined, then the code editor is disabled.
|
||||
if (typeof (CodeMirror) != "undefined") {
|
||||
codeVal = UmbEditor.GetCode();
|
||||
}
|
||||
umbraco.presentation.webservices.codeEditorSave.SaveDLRScript(
|
||||
fileName, self._opts.originalFileName, codeVal, self._opts.skipTestingCheckBox.is(':checked'),
|
||||
function (t) { self.submitSucces(t); },
|
||||
function (t) { self.submitFailure(t); });
|
||||
|
||||
},
|
||||
|
||||
submitSucces: function(t) {
|
||||
if (t != 'true') {
|
||||
top.UmbSpeechBubble.ShowMessage('error', 'Saving scripting file failed', t);
|
||||
}
|
||||
|
||||
var newFilePath = this._opts.nameTxtBox.val();
|
||||
|
||||
//if the filename changes, we need to redirect since the file name is used in the url
|
||||
if (this._opts.originalFileName != newFilePath) {
|
||||
var newLocation = window.location.pathname + "?" + "&file=" + newFilePath;
|
||||
|
||||
UmbClientMgr.contentFrame(newLocation);
|
||||
|
||||
//we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done!
|
||||
top.UmbSpeechBubble.ShowMessage('save', 'Scripting file saved', '');
|
||||
}
|
||||
else {
|
||||
|
||||
top.UmbSpeechBubble.ShowMessage('save', 'Scripting file saved', '');
|
||||
UmbClientMgr.mainTree().setActiveTreeType('python');
|
||||
//we need to pass in the newId parameter so it knows which node to resync after retreival from the server
|
||||
UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath);
|
||||
//set the original file path to the new one
|
||||
this._opts.originalFileName = newFilePath;
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
submitFailure: function(t) {
|
||||
top.UmbSpeechBubble.ShowMessage('warning', 'Scripting file could not be saved', '');
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,116 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Editors");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Editors.EditScript = base2.Base.extend({
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
// Constructor
|
||||
constructor: function(opts) {
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
|
||||
|
||||
// Default options go here
|
||||
}, opts);
|
||||
},
|
||||
|
||||
init: function () {
|
||||
//setup UI elements
|
||||
var self = this;
|
||||
|
||||
//bind to the save event
|
||||
this._opts.saveButton.click(function (event) {
|
||||
event.preventDefault();
|
||||
self.doSubmit();
|
||||
});
|
||||
},
|
||||
|
||||
doSubmit: function () {
|
||||
var self = this;
|
||||
|
||||
var filename = this._opts.nameTxtBox.val();
|
||||
var codeval = this._opts.editorSourceElement.val();
|
||||
//if CodeMirror is not defined, then the code editor is disabled.
|
||||
if (typeof (CodeMirror) != "undefined") {
|
||||
codeval = UmbEditor.GetCode();
|
||||
}
|
||||
|
||||
this.save(
|
||||
filename,
|
||||
self._opts.originalFileName,
|
||||
codeval);
|
||||
},
|
||||
|
||||
save: function (filename, oldName, contents) {
|
||||
var self = this;
|
||||
|
||||
$.post(self._opts.restServiceLocation + "SaveScript",
|
||||
JSON.stringify({
|
||||
filename: filename,
|
||||
oldName: oldName,
|
||||
contents: contents
|
||||
}),
|
||||
function (e) {
|
||||
if (e.success) {
|
||||
self.submitSuccess(e);
|
||||
} else {
|
||||
self.submitFailure(e.message, e.header);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
submitSuccess: function (args) {
|
||||
var msg = args.message;
|
||||
var header = args.header;
|
||||
var path = this._opts.treeSyncPath;
|
||||
var pathChanged = false;
|
||||
if (args.path) {
|
||||
if (path != args.path) {
|
||||
pathChanged = true;
|
||||
}
|
||||
path = args.path;
|
||||
}
|
||||
if (args.contents) {
|
||||
UmbEditor.SetCode(args.contents);
|
||||
}
|
||||
|
||||
UmbClientMgr.mainTree().setActiveTreeType("scripts");
|
||||
if (pathChanged) {
|
||||
// no! file is used in url so we need to redirect
|
||||
//UmbClientMgr.mainTree().moveNode(this._opts.originalFileName, path);
|
||||
//this._opts.treeSyncPath = args.path;
|
||||
//this._opts.lttPathElement.prop("href", args.url).html(args.url);
|
||||
|
||||
var qs = window.location.search;
|
||||
if (qs.startsWith("?")) qs = qs.substring("?".length);
|
||||
var qp1 = qs.split("&");
|
||||
var qp2 = [];
|
||||
for (var i = 0; i < qp1.length; i++)
|
||||
if (!qp1[i].startsWith("file="))
|
||||
qp2.push(qp1[i]);
|
||||
|
||||
var location = window.location.pathname + "?" + qp2.join("&") + "&file=" + args.name;
|
||||
UmbClientMgr.contentFrame(location);
|
||||
|
||||
// need to do it after we navigate otherwise the navigation waits until the message timeout is done
|
||||
top.UmbSpeechBubble.ShowMessage("save", header, msg);
|
||||
}
|
||||
else {
|
||||
top.UmbSpeechBubble.ShowMessage("save", header, msg);
|
||||
this._opts.lttPathElement.prop("href", args.url).html(args.url);
|
||||
this._opts.originalFileName = args.name;
|
||||
this._opts.treeSyncPath = args.path;
|
||||
UmbClientMgr.mainTree().syncTree(path, true);
|
||||
}
|
||||
|
||||
//this._opts.lttPathElement.prop("href", args.url).html(args.url);
|
||||
//this._opts.originalFileName = args.name;
|
||||
},
|
||||
|
||||
submitFailure: function(err, header) {
|
||||
top.UmbSpeechBubble.ShowMessage('error', header, err);
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,109 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Editors");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Editors.EditStyleSheet = base2.Base.extend({
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
// Constructor
|
||||
constructor: function(opts) {
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
|
||||
|
||||
// Default options go here
|
||||
}, opts);
|
||||
},
|
||||
|
||||
init: function() {
|
||||
//setup UI elements
|
||||
var self = this;
|
||||
|
||||
//bind to the save event
|
||||
this._opts.saveButton.click(function (event) {
|
||||
event.preventDefault();
|
||||
self.doSubmit();
|
||||
});
|
||||
},
|
||||
|
||||
doSubmit: function() {
|
||||
var self = this;
|
||||
|
||||
var filename = this._opts.nameTxtBox.val();
|
||||
var codeval = this._opts.editorSourceElement.val();
|
||||
//if CodeMirror is not defined, then the code editor is disabled.
|
||||
if (typeof(CodeMirror) != "undefined") {
|
||||
codeval = UmbEditor.GetCode();
|
||||
}
|
||||
|
||||
this.save(
|
||||
filename,
|
||||
self._opts.originalFileName,
|
||||
codeval);
|
||||
},
|
||||
|
||||
save: function (filename, oldName, contents) {
|
||||
var self = this;
|
||||
|
||||
$.post(self._opts.restServiceLocation + "SaveStylesheet",
|
||||
JSON.stringify({
|
||||
filename: filename,
|
||||
oldName: oldName,
|
||||
contents: contents
|
||||
}),
|
||||
function (e) {
|
||||
if (e.success) {
|
||||
self.submitSuccess(e);
|
||||
} else {
|
||||
self.submitFailure(e.message, e.header);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
submitSuccess: function (args) {
|
||||
var msg = args.message;
|
||||
var header = args.header;
|
||||
var path = this._opts.treeSyncPath;
|
||||
var pathChanged = false;
|
||||
if (args.path) {
|
||||
if (path != args.path) {
|
||||
pathChanged = true;
|
||||
}
|
||||
path = args.path;
|
||||
}
|
||||
if (args.contents) {
|
||||
UmbEditor.SetCode(args.contents);
|
||||
}
|
||||
|
||||
UmbClientMgr.mainTree().setActiveTreeType("stylesheets");
|
||||
if (pathChanged) {
|
||||
// file is used in url so we need to redirect
|
||||
var qs = window.location.search;
|
||||
if (qs.startsWith("?")) qs = qs.substring("?".length);
|
||||
var qp1 = qs.split("&");
|
||||
var qp2 = [];
|
||||
for (var i = 0; i < qp1.length; i++)
|
||||
if (!qp1[i].startsWith("id="))
|
||||
qp2.push(qp1[i]);
|
||||
|
||||
var location = window.location.pathname + "?" + qp2.join("&") + "&id=" + args.name;
|
||||
UmbClientMgr.contentFrame(location);
|
||||
|
||||
// need to do it after we navigate otherwise the navigation waits until the message timeout is done
|
||||
top.UmbSpeechBubble.ShowMessage("save", header, msg);
|
||||
}
|
||||
else {
|
||||
top.UmbSpeechBubble.ShowMessage("save", header, msg);
|
||||
this._opts.lttPathElement.prop("href", args.url).html(args.url);
|
||||
this._opts.originalFileName = args.name;
|
||||
this._opts.treeSyncPath = args.path;
|
||||
UmbClientMgr.mainTree().syncTree(path, true);
|
||||
}
|
||||
},
|
||||
|
||||
submitFailure: function(err, header) {
|
||||
top.UmbSpeechBubble.ShowMessage('error', header, err);
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,181 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Editors");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Editors.EditTemplate = base2.Base.extend({
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
_openMacroModal: function(alias) {
|
||||
|
||||
var self = this;
|
||||
|
||||
UmbClientMgr.openAngularModalWindow({
|
||||
template: "views/common/dialogs/insertmacro.html",
|
||||
dialogData: {
|
||||
renderingEngine: "WebForms",
|
||||
macroData: { macroAlias: alias }
|
||||
},
|
||||
callback: function(data) {
|
||||
UmbEditor.Insert(data.syntax, '', self._opts.editorClientId);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_insertMacro: function(alias) {
|
||||
var macroElement = "umbraco:Macro";
|
||||
if (!this._opts.useMasterPages) {
|
||||
macroElement = "?UMBRACO_MACRO";
|
||||
}
|
||||
var cp = macroElement + ' Alias="' + alias + '" runat="server"';
|
||||
UmbEditor.Insert('<' + cp + ' />', '', this._opts.editorClientId);
|
||||
},
|
||||
|
||||
_insertCodeBlockFromTemplate: function(templateId) {
|
||||
var self = this;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: this._opts.umbracoPath + "/webservices/templates.asmx/GetCodeSnippet",
|
||||
data: "{templateId: '" + templateId + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function(msg) {
|
||||
|
||||
var cp = 'umbraco:Macro runat="server" language="cshtml"';
|
||||
UmbEditor.Insert('\n<' + cp + '>\n' + msg.d, '\n</umbraco:Macro' + '>\n', self._opts.editorClientId);
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_insertCodeBlock: function() {
|
||||
var snip = this._umbracoInsertSnippet();
|
||||
UmbEditor.Insert(snip.BeginTag, snip.EndTag, this._opts.editorClientId);
|
||||
},
|
||||
|
||||
_umbracoInsertSnippet: function() {
|
||||
var snip = new UmbracoCodeSnippet();
|
||||
var cp = 'umbraco:Macro runat="server" language="cshtml"';
|
||||
snip.BeginTag = '\n<' + cp + '>\n';
|
||||
snip.EndTag = '\n<' + '/umbraco:Macro' + '>\n';
|
||||
snip.TargetId = this._opts.editorClientId;
|
||||
return snip;
|
||||
},
|
||||
|
||||
// Constructor
|
||||
constructor: function(opts) {
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
|
||||
|
||||
// Default options go here
|
||||
}, opts);
|
||||
},
|
||||
|
||||
init: function() {
|
||||
//<summary>Sets up the UI and binds events</summary>
|
||||
|
||||
var self = this;
|
||||
|
||||
//bind to the save event
|
||||
this._opts.saveButton.click(function (event) {
|
||||
event.preventDefault();
|
||||
self.doSubmit();
|
||||
});
|
||||
|
||||
$("#sb").click(function() {
|
||||
self._insertCodeBlock();
|
||||
});
|
||||
$("#sbMacro").click(function() {
|
||||
self._openMacroModal();
|
||||
});
|
||||
//macro split button
|
||||
$('#sbMacro').splitbutton({ menu: '#macroMenu' });
|
||||
$("#splitButtonMacro").appendTo("#splitButtonMacroPlaceHolder");
|
||||
|
||||
////razor macro split button
|
||||
$('#sb').splitbutton({ menu: '#codeTemplateMenu' });
|
||||
$("#splitButton").appendTo("#splitButtonPlaceHolder");
|
||||
|
||||
$(".macro").click(function() {
|
||||
var alias = $(this).attr("rel");
|
||||
if ($(this).attr("params") == "1") {
|
||||
self._openMacroModal(alias);
|
||||
}
|
||||
else {
|
||||
self._insertMacro(alias);
|
||||
}
|
||||
});
|
||||
|
||||
$(".codeTemplate").click(function() {
|
||||
self._insertCodeBlockFromTemplate($(this).attr("rel"));
|
||||
});
|
||||
},
|
||||
|
||||
doSubmit: function() {
|
||||
this.save(jQuery('#' + this._opts.templateNameClientId).val(), jQuery('#' + this._opts.templateAliasClientId).val(), UmbEditor.GetCode());
|
||||
},
|
||||
|
||||
save: function(templateName, templateAlias, codeVal) {
|
||||
var self = this;
|
||||
|
||||
$.post(self._opts.restServiceLocation + "SaveTemplate",
|
||||
JSON.stringify({
|
||||
templateName: templateName,
|
||||
templateAlias: templateAlias,
|
||||
templateContents: codeVal,
|
||||
templateId: self._opts.templateId,
|
||||
masterTemplateId: this._opts.masterPageDropDown.val()
|
||||
}),
|
||||
function (e) {
|
||||
if (e.success) {
|
||||
self.submitSuccess(e);
|
||||
} else {
|
||||
self.submitFailure(e.message, e.header);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
submitSuccess: function (args) {
|
||||
var msg = args.message;
|
||||
var header = args.header;
|
||||
var path = this._opts.treeSyncPath;
|
||||
var pathChanged = false;
|
||||
if (args.path) {
|
||||
if (path != args.path) {
|
||||
pathChanged = true;
|
||||
}
|
||||
path = args.path;
|
||||
}
|
||||
if (args.contents) {
|
||||
UmbEditor.SetCode(args.contents);
|
||||
}
|
||||
|
||||
var alias = args.alias;
|
||||
this._opts.aliasTxtBox.val(alias);
|
||||
|
||||
top.UmbSpeechBubble.ShowMessage('save', header, msg);
|
||||
UmbClientMgr.mainTree().setActiveTreeType('templates');
|
||||
if (pathChanged) {
|
||||
UmbClientMgr.mainTree().moveNode(this._opts.templateId, path);
|
||||
}
|
||||
else {
|
||||
UmbClientMgr.mainTree().syncTree(path, true);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
submitFailure: function (err, header) {
|
||||
top.UmbSpeechBubble.ShowMessage('error', header, err);
|
||||
}
|
||||
});
|
||||
|
||||
//Set defaults for jQuery ajax calls.
|
||||
$.ajaxSetup({
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
contentType: 'application/json; charset=utf-8'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,288 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Editors");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Editors.EditView = base2.Base.extend({
|
||||
/// <summary>Defines the EditView class to controll the persisting of the view file and UI interaction</summary>
|
||||
|
||||
//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 change of the master template drop down
|
||||
this._opts.masterPageDropDown.change(function () {
|
||||
self.changeMasterPageFile();
|
||||
});
|
||||
//bind to the save event
|
||||
this._opts.saveButton.click(function (event) {
|
||||
event.preventDefault();
|
||||
self.doSubmit();
|
||||
});
|
||||
},
|
||||
|
||||
insertMacroMarkup: function(alias) {
|
||||
/// <summary>callback used to insert the markup for a macro with no parameters</summary>
|
||||
|
||||
UmbEditor.Insert("@Umbraco.RenderMacro(\"" + alias + "\")", "", this._opts.codeEditorElementId);
|
||||
},
|
||||
|
||||
insertRenderBody: function() {
|
||||
UmbEditor.Insert("@RenderBody()", "", this._opts.codeEditorElementId);
|
||||
},
|
||||
|
||||
openMacroModal: function (alias) {
|
||||
/// <summary>callback used to display the modal dialog to insert a macro with parameters</summary>
|
||||
|
||||
var self = this;
|
||||
|
||||
UmbClientMgr.openAngularModalWindow({
|
||||
template: "views/common/dialogs/insertmacro.html",
|
||||
dialogData: {
|
||||
renderingEngine: "Mvc",
|
||||
macroData: {macroAlias: alias}
|
||||
},
|
||||
callback: function (data) {
|
||||
UmbEditor.Insert(data.syntax, '', self._opts.codeEditorElementId);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
openSnippetModal: function (type) {
|
||||
/// <summary>callback used to display the modal dialog to insert a macro with parameters</summary>
|
||||
|
||||
var self = this;
|
||||
|
||||
UmbClientMgr.openAngularModalWindow({
|
||||
template: "views/common/dialogs/template/snippet.html",
|
||||
callback: function (data) {
|
||||
|
||||
var code = "";
|
||||
|
||||
if (type === 'section') {
|
||||
code = "\n@section " + data.name + "{\n";
|
||||
code += "<!-- Content here -->\n" +
|
||||
"}\n";
|
||||
}
|
||||
|
||||
if (type === 'rendersection') {
|
||||
if (data.required) {
|
||||
code = "\n@RenderSection(\"" + data.name + "\", true)\n";
|
||||
} else {
|
||||
code = "\n@RenderSection(\"" + data.name + "\", false)\n";
|
||||
}
|
||||
}
|
||||
|
||||
UmbEditor.Insert(code, '', self._opts.codeEditorElementId);
|
||||
},
|
||||
type: type
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
openQueryModal: function () {
|
||||
/// <summary>callback used to display the modal dialog to insert a macro with parameters</summary>
|
||||
|
||||
var self = this;
|
||||
|
||||
UmbClientMgr.openAngularModalWindow({
|
||||
template: "views/common/dialogs/template/queryBuilder.html",
|
||||
callback: function (data) {
|
||||
|
||||
//var dataFormatted = data.replace(new RegExp('[' + "." + ']', 'g'), "\n\t\t\t\t\t.");
|
||||
|
||||
var code = "\n@{\n" + "\tvar selection = " + data + ";\n}\n";
|
||||
code += "<ul>\n" +
|
||||
"\t@foreach(var item in selection){\n" +
|
||||
"\t\t<li>\n" +
|
||||
"\t\t\t<a href=\"@item.Url\">@item.Name</a>\n" +
|
||||
"\t\t</li>\n" +
|
||||
"\t}\n" +
|
||||
"</ul>\n\n";
|
||||
|
||||
UmbEditor.Insert(code, '', self._opts.codeEditorElementId);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
doSubmit: function () {
|
||||
/// <summary>Submits the data to the server for saving</summary>
|
||||
var codeVal = UmbClientMgr.contentFrame().UmbEditor.GetCode();
|
||||
var self = this;
|
||||
|
||||
if (this._opts.editorType == "Template") {
|
||||
//saving a template view
|
||||
|
||||
$.post(self._opts.restServiceLocation + "SaveTemplate",
|
||||
JSON.stringify({
|
||||
templateName: this._opts.nameTxtBox.val(),
|
||||
templateAlias: this._opts.aliasTxtBox.val(),
|
||||
templateContents: codeVal,
|
||||
templateId: this._opts.templateId,
|
||||
masterTemplateId: this._opts.masterPageDropDown.val()
|
||||
}),
|
||||
function(e) {
|
||||
if (e.success) {
|
||||
self.submitSuccess(e);
|
||||
} else {
|
||||
self.submitFailure(e.message, e.header);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
//saving a partial view
|
||||
var actionName = this._opts.editorType === "PartialViewMacro" ? "SavePartialViewMacro" : "SavePartialView";
|
||||
|
||||
$.post(self._opts.restServiceLocation + actionName,
|
||||
JSON.stringify({
|
||||
filename: this._opts.nameTxtBox.val(),
|
||||
oldName: this._opts.originalFileName,
|
||||
contents: codeVal
|
||||
}),
|
||||
function(e) {
|
||||
if (e.success) {
|
||||
self.submitSuccess(e);
|
||||
} else {
|
||||
self.submitFailure(e.message, e.header);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
submitSuccess: function (args) {
|
||||
|
||||
var msg = args.message;
|
||||
var header = args.header;
|
||||
var path = this._opts.treeSyncPath;
|
||||
var pathChanged = false;
|
||||
if (args.path) {
|
||||
if (path != args.path) {
|
||||
pathChanged = true;
|
||||
}
|
||||
path = args.path;
|
||||
}
|
||||
if (args.contents) {
|
||||
UmbEditor.SetCode(args.contents);
|
||||
} else if (!this.IsSimpleEditor) {
|
||||
// Restore focuse to text region. SetCode also does this.
|
||||
UmbEditor._editor.focus();
|
||||
}
|
||||
|
||||
UmbClientMgr.mainTree().setActiveTreeType(this._opts.currentTreeType);
|
||||
|
||||
if (this._opts.editorType == "Template") {
|
||||
|
||||
var alias = args.alias;
|
||||
this._opts.aliasTxtBox.val(alias);
|
||||
|
||||
top.UmbSpeechBubble.ShowMessage('save', header, msg);
|
||||
|
||||
//templates are different because they are ID based, whereas view files are file based without a static id
|
||||
|
||||
if (pathChanged) {
|
||||
UmbClientMgr.mainTree().moveNode(this._opts.templateId, path);
|
||||
this._opts.treeSyncPath = path;
|
||||
}
|
||||
else {
|
||||
UmbClientMgr.mainTree().syncTree(path, true);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
var newFilePath = this._opts.nameTxtBox.val();
|
||||
|
||||
|
||||
function trimStart(str, trim) {
|
||||
if (str.startsWith(trim)) {
|
||||
return str.substring(trim.length);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
//if the filename changes, we need to redirect since the file name is used in the url
|
||||
if (this._opts.originalFileName != newFilePath) {
|
||||
var queryParts = trimStart(window.location.search, "?").split('&');
|
||||
var notFileParts = [];
|
||||
for (var i = 0; i < queryParts.length; i++) {
|
||||
if (queryParts[i].substr(0, "file=".length) != "file=") {
|
||||
notFileParts.push(queryParts[i]);
|
||||
}
|
||||
}
|
||||
var newLocation = window.location.pathname + "?" + notFileParts.join("&") + "&file=" + newFilePath;
|
||||
|
||||
UmbClientMgr.contentFrame(newLocation);
|
||||
|
||||
//we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done!
|
||||
top.UmbSpeechBubble.ShowMessage('save', header, msg);
|
||||
}
|
||||
else {
|
||||
|
||||
top.UmbSpeechBubble.ShowMessage('save', header, msg);
|
||||
|
||||
if (args && args.name) {
|
||||
this._opts.originalFileName = args.name;
|
||||
}
|
||||
if (args && args.path) {
|
||||
this._opts.treeSyncPath = args.path;
|
||||
}
|
||||
|
||||
UmbClientMgr.mainTree().syncTree(path, true, null, newFilePath.split("/")[1]);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
submitFailure: function (err, header) {
|
||||
top.UmbSpeechBubble.ShowMessage('error', header, err);
|
||||
},
|
||||
|
||||
changeMasterPageFile: function ( ) {
|
||||
//var editor = document.getElementById(this._opts.sourceEditorId);
|
||||
var templateDropDown = this._opts.masterPageDropDown.get(0);
|
||||
var templateCode = UmbClientMgr.contentFrame().UmbEditor.GetCode();
|
||||
var newValue = templateDropDown.options[templateDropDown.selectedIndex].id;
|
||||
|
||||
var layoutDefRegex = new RegExp("(@{[\\s\\S]*?Layout\\s*?=\\s*?)(\"[^\"]*?\"|null)(;[\\s\\S]*?})", "gi");
|
||||
|
||||
if (newValue != undefined && newValue != "") {
|
||||
if (layoutDefRegex.test(templateCode)) {
|
||||
// Declaration exists, so just update it
|
||||
templateCode = templateCode.replace(layoutDefRegex, "$1\"" + newValue + "\"$3");
|
||||
} else {
|
||||
// Declaration doesn't exist, so prepend to start of doc
|
||||
//TODO: Maybe insert at the cursor position, rather than just at the top of the doc?
|
||||
templateCode = "@{\n\tLayout = \"" + newValue + "\";\n}\n" + templateCode;
|
||||
}
|
||||
} else {
|
||||
if (layoutDefRegex.test(templateCode)) {
|
||||
// Declaration exists, so just update it
|
||||
templateCode = templateCode.replace(layoutDefRegex, "$1null$3");
|
||||
}
|
||||
}
|
||||
|
||||
UmbClientMgr.contentFrame().UmbEditor.SetCode(templateCode);
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Set defaults for jQuery ajax calls.
|
||||
$.ajaxSetup({
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
contentType: 'application/json; charset=utf-8'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,14 @@
|
||||
#errorDiv
|
||||
{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#errorDiv a
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
|
||||
.propertyItemheader
|
||||
{
|
||||
width: 200px !important;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Editors");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Editors.EditXslt = base2.Base.extend({
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
// Constructor
|
||||
constructor: function(opts) {
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
|
||||
|
||||
// Default options go here
|
||||
}, opts);
|
||||
},
|
||||
|
||||
init: function () {
|
||||
//setup UI elements
|
||||
var self = this;
|
||||
|
||||
//bind to the save event
|
||||
this._opts.saveButton.click(function (event) {
|
||||
event.preventDefault();
|
||||
self.doSubmit();
|
||||
});
|
||||
},
|
||||
|
||||
doSubmit: function () {
|
||||
var self = this;
|
||||
|
||||
var fileName = this._opts.nameTxtBox.val();
|
||||
var codeVal = this._opts.editorSourceElement.val();
|
||||
//if CodeMirror is not defined, then the code editor is disabled.
|
||||
if (typeof (CodeMirror) != "undefined") {
|
||||
codeVal = UmbEditor.GetCode();
|
||||
}
|
||||
umbraco.presentation.webservices.codeEditorSave.SaveXslt(
|
||||
fileName, self._opts.originalFileName, codeVal, self._opts.skipTestingCheckBox.is(':checked'),
|
||||
function (t) { self.submitSucces(t); },
|
||||
function (t) { self.submitFailure(t); });
|
||||
|
||||
},
|
||||
|
||||
submitSucces: function (t) {
|
||||
if (t != 'true') {
|
||||
top.UmbSpeechBubble.ShowMessage('error', 'Saving XSLT file failed',"<pre>" + t + "</pre>");
|
||||
}
|
||||
|
||||
var newFilePath = this._opts.nameTxtBox.val();
|
||||
|
||||
//if the filename changes, we need to redirect since the file name is used in the url
|
||||
if (this._opts.originalFileName != newFilePath) {
|
||||
var newLocation = window.location.pathname + "?" + "&file=" + newFilePath;
|
||||
|
||||
UmbClientMgr.contentFrame(newLocation);
|
||||
|
||||
//we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done!
|
||||
top.UmbSpeechBubble.ShowMessage('save', 'XSLT file saved', '');
|
||||
}
|
||||
else {
|
||||
|
||||
top.UmbSpeechBubble.ShowMessage('save', 'XSLT file saved', '');
|
||||
UmbClientMgr.mainTree().setActiveTreeType('xslt');
|
||||
//we need to pass in the newId parameter so it knows which node to resync after retreival from the server
|
||||
UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath);
|
||||
//set the original file path to the new one
|
||||
this._opts.originalFileName = newFilePath;
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
submitFailure: function (t) {
|
||||
alert(t);
|
||||
top.UmbSpeechBubble.ShowMessage('warning', 'XSLT file could not be saved', '');
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,498 @@
|
||||
/*
|
||||
* Class: fileUploader
|
||||
* Use: Upload multiple files using jquery
|
||||
* Author: Matt Brailsford
|
||||
* Version: 1.0
|
||||
*/
|
||||
|
||||
(function ($, window, document, undefined) {
|
||||
|
||||
$.event.props.push('dataTransfer');
|
||||
|
||||
var defaultOptions = {
|
||||
autoUpload: false,
|
||||
limit: false,
|
||||
allowedExtension: 'jpg|jpeg|gif|png|pdf',
|
||||
dropTarget: null,
|
||||
|
||||
//Callbacks
|
||||
onValidationError: null,
|
||||
onAdd: function () { },
|
||||
onRemove: function () { },
|
||||
onUpload: function () { },
|
||||
onUploadAll: function () { },
|
||||
onProgress: function () { },
|
||||
onDone: function () { },
|
||||
onDoneAll: function () { }
|
||||
};
|
||||
|
||||
var isHtml5 = (window.FormData) ? true : false;
|
||||
|
||||
function FileUploader(el, options) {
|
||||
var self = this;
|
||||
var $el = $(el);
|
||||
|
||||
// Setup instance
|
||||
self.input = el;
|
||||
self.form = $el.parents("form");
|
||||
self.uploaderId = ++$.fileUploader.count;
|
||||
|
||||
self.opts = $.extend({}, defaultOptions, options);
|
||||
|
||||
// Initialize
|
||||
self._init();
|
||||
|
||||
// Return configures component
|
||||
return self;
|
||||
}
|
||||
|
||||
FileUploader.prototype = {
|
||||
|
||||
// Private methods
|
||||
_init: function () {
|
||||
var self = this;
|
||||
|
||||
// Init vars
|
||||
self.wrapperId = 'fu-fileUploader-' + self.uploaderId;
|
||||
self.wrapper = '<div id="' + self.wrapperId + '" class="fu-fileUploader"><div class="fu-formContainer"></div><div class="fu-itemContainer"></div></div>';
|
||||
|
||||
self.wrapperSelector = '#' + self.wrapperId;
|
||||
self.formContainerSelector = self.wrapperSelector + " .fu-formContainer";
|
||||
self.itemContainerSelector = self.wrapperSelector + " .fu-itemContainer";
|
||||
|
||||
self.itemCount = 0;
|
||||
|
||||
self.progressTimeout = null;
|
||||
self.inProgressJqXhr = null;
|
||||
self.inProgressItemId = 0;
|
||||
|
||||
//prepend wrapper markup
|
||||
self.form.before(self.wrapper);
|
||||
|
||||
//clear all form data
|
||||
$(":file", self.form).each(function () {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
// Hide the form (we'll just use it as a template)
|
||||
self.form.hide();
|
||||
|
||||
// Create the actual form users will interact with
|
||||
self._createNewForm();
|
||||
|
||||
// Hookup drag and drop support
|
||||
$(self.opts.dropTarget !== null ? self.opts.dropTarget : self.wrapperSelector).bind('dragenter dragover', false).bind('drop', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
self._addFileHtml5(e.dataTransfer);
|
||||
});
|
||||
},
|
||||
|
||||
_getFileName: function (filePath) {
|
||||
var fileName = filePath;
|
||||
if (fileName.indexOf('/') > -1) {
|
||||
fileName = fileName.substring(fileName.lastIndexOf('/') + 1);
|
||||
} else if (fileName.indexOf('\\') > -1) {
|
||||
fileName = fileName.substring(fileName.lastIndexOf('\\') + 1);
|
||||
}
|
||||
return fileName;
|
||||
},
|
||||
|
||||
_validateFileName: function (fileName) {
|
||||
var self = this;
|
||||
var extensions = new RegExp(self.opts.allowedExtension + '$', 'i');
|
||||
if (extensions.test(fileName)) {
|
||||
return fileName;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
},
|
||||
|
||||
_getFileSize: function (file) {
|
||||
var fileSize = 0;
|
||||
if (file.size > 1024 * 1024) {
|
||||
fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100).toString() + 'MB';
|
||||
} else {
|
||||
fileSize = (Math.round(file.size * 100 / 1024) / 100).toString() + 'KB';
|
||||
}
|
||||
return fileSize;
|
||||
},
|
||||
|
||||
_createNewForm: function () {
|
||||
var self = this;
|
||||
var id = ++self.itemCount;
|
||||
|
||||
var itemId = 'fu-item-' + self.uploaderId + '-' + id;
|
||||
var iframeId = 'fu-frame-' + self.uploaderId + '-' + id;
|
||||
var formId = 'fu-form-' + self.uploaderId + '-' + id;
|
||||
|
||||
// Create item container
|
||||
var item = $('<div id="' + itemId + '" class="fu-item"></div>');
|
||||
|
||||
// Create iFrame for iFrame based uploads
|
||||
$('<iframe name="' + iframeId + '"></iframe>').attr({
|
||||
id: iframeId,
|
||||
src: 'about:blank',
|
||||
style: 'display:none'
|
||||
}).prependTo(item);
|
||||
|
||||
// Clone the form
|
||||
var newForm = self.form.clone().attr({
|
||||
id: formId,
|
||||
target: iframeId
|
||||
}).prependTo(item).show();
|
||||
|
||||
// Remove any id's / css classes from file inputs
|
||||
$(":file", newForm).each(function (idx, itm) {
|
||||
$(itm).removeAttr("id").removeAttr("class");
|
||||
});
|
||||
|
||||
// Hide everything in the form, other than file inputs
|
||||
newForm.children().each(function () {
|
||||
var isFile = $(this).is(':file');
|
||||
if (!isFile && $(this).find(':file').length === 0) {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Append everything to the form container
|
||||
item.prependTo(self.formContainerSelector);
|
||||
|
||||
// Attatch event listener to file input
|
||||
$(":file", newForm).change(function () {
|
||||
if (isHtml5) {
|
||||
self._addFileHtml5(this);
|
||||
} else {
|
||||
self._addFile($(this));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_addFileHtml5: function (input) {
|
||||
var self = this;
|
||||
$.each(input.files, function (index, file) {
|
||||
self._addFile(file);
|
||||
});
|
||||
self._afterAddFile();
|
||||
},
|
||||
|
||||
_addFile: function (input) {
|
||||
var self = this;
|
||||
var id = self.itemCount;
|
||||
var $item = $('#fu-item-' + self.uploaderId + '-' + id);
|
||||
|
||||
// Validate file
|
||||
var filename = (isHtml5) ? input.name : self._getFileName($(input).val());
|
||||
if (self._validateFileName(filename) == -1) {
|
||||
if ($.isFunction(self.opts.onValidationError)) {
|
||||
self.opts.onValidationError({ input: input, type: 'format' });
|
||||
} else {
|
||||
alert('Invalid file!');
|
||||
}
|
||||
$item.find("form :file").val('');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check to see if we have reached the limit
|
||||
if (self.opts.limit !== false &&
|
||||
self.opts.limit >= $(self.itemContainerSelector + " .fu-item").length) {
|
||||
if ($.isFunction(self.opts.onValidationError)) {
|
||||
self.opts.onValidationError({ input: input, type: 'limit' });
|
||||
} else {
|
||||
alert('Maximum limit reached!');
|
||||
}
|
||||
$item.find("form :file").val('');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create context object
|
||||
var data = {
|
||||
uploaderId: self.uploaderId,
|
||||
itemId: id,
|
||||
name: filename,
|
||||
size: (isHtml5) ? self._getFileSize(input) : "Unkown",
|
||||
status: 'queued',
|
||||
progress: 0,
|
||||
input: input,
|
||||
context: null // Somewhere for users to store cutom data
|
||||
};
|
||||
|
||||
//Store data in item
|
||||
$item.data('data', data);
|
||||
|
||||
// Move item to queue, and hide it
|
||||
$item.appendTo(self.itemContainerSelector).hide();
|
||||
|
||||
//Create a new form
|
||||
self._createNewForm();
|
||||
|
||||
//Callback on file queued
|
||||
self.opts.onAdd(data);
|
||||
|
||||
if (!isHtml5) {
|
||||
self._afterAddFile();
|
||||
}
|
||||
},
|
||||
|
||||
_afterAddFile: function () {
|
||||
var self = this;
|
||||
if (self.opts.autoUpload) {
|
||||
self._processNextItemInQueue(true);
|
||||
}
|
||||
},
|
||||
|
||||
_processNextItemInQueue: function (autoProceed) {
|
||||
var self = this;
|
||||
var totalItems = $(self.itemContainerSelector + " .fu-item");
|
||||
if (totalItems.length > 0) {
|
||||
var $pendingUpload = $(totalItems.get(0));
|
||||
var data = $pendingUpload.data('data');
|
||||
|
||||
//before upload
|
||||
var response = self.opts.onUpload(data);
|
||||
if (response === false) {
|
||||
return false; //TODO: Raise onDone event?
|
||||
}
|
||||
|
||||
self.inProgressItemId = data.itemId;
|
||||
|
||||
data.status = "inprogress";
|
||||
data.progress = 0;
|
||||
|
||||
if (isHtml5) {
|
||||
//Upload Using Html5 api
|
||||
self._uploadHtml5($pendingUpload, autoProceed);
|
||||
} else {
|
||||
//upload using iframe
|
||||
self._uploadIFrame($pendingUpload, autoProceed);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_uploadHtml5: function ($item, autoProceed) {
|
||||
var self = this;
|
||||
var $form = $item.find("form");
|
||||
var data = $item.data('data');
|
||||
var file = data.input;
|
||||
if (file) {
|
||||
var fd = new FormData();
|
||||
fd.append($(":file", $form).first().attr('name'), file);
|
||||
|
||||
//get other form input and append to formData
|
||||
$form.find(':input').each(function () {
|
||||
if (!$(this).is(':file')) {
|
||||
fd.append($(this).attr('name'), $(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
//Upload using jQuery AJAX
|
||||
self.inProgressJqXhr = $.ajax({
|
||||
url: $form.attr('action'),
|
||||
data: fd,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
type: 'POST',
|
||||
xhr: function () {
|
||||
var req = $.ajaxSettings.xhr();
|
||||
if (req) {
|
||||
req.upload.addEventListener('progress', function (ev) {
|
||||
data.progress = Math.round(ev.loaded * 100 / ev.total);
|
||||
self.opts.onProgress(data);
|
||||
}, false);
|
||||
}
|
||||
return req;
|
||||
}
|
||||
}).success(function (d) {
|
||||
data.status = 'success';
|
||||
self.opts.onDone(data);
|
||||
}).error(function (jqXhr, textStatus, errorThrown) {
|
||||
data.status = 'error';
|
||||
data.message = errorThrown;
|
||||
self.opts.onDone(data);
|
||||
}).complete(function (jqXhr, textStatus) {
|
||||
self._afterUpload($item, autoProceed);
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
_uploadIFrame: function ($item, autoProceed) {
|
||||
var self = this;
|
||||
var $form = $item.find("form");
|
||||
var $iframe = $item.find("iframe");
|
||||
var data = $item.data('data');
|
||||
|
||||
self._startDummyProgress(data);
|
||||
|
||||
$form.submit();
|
||||
|
||||
$iframe.load(function () {
|
||||
self._stopDummyProgress(data, true);
|
||||
|
||||
// Read content returned
|
||||
var rawResponse;
|
||||
|
||||
if (this.contentDocument) {
|
||||
rawResponse = this.contentDocument.body.innerHTML;
|
||||
} else {
|
||||
rawResponse = this.contentWindow.document.body.innerHTML;
|
||||
}
|
||||
|
||||
var response = $.parseJSON(rawResponse);
|
||||
|
||||
if (response.success) {
|
||||
data.status = 'success';
|
||||
} else {
|
||||
data.status = 'error';
|
||||
data.message = 'An error occured whilst uploading.';
|
||||
}
|
||||
|
||||
self.opts.onDone(data);
|
||||
|
||||
self._afterUpload($item, autoProceed);
|
||||
});
|
||||
},
|
||||
|
||||
_startDummyProgress: function (data, count) {
|
||||
var self = this;
|
||||
|
||||
if (count === undefined) {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
if ($.fileUploader.percentageInterval[count]) {
|
||||
data.progress = $.fileUploader.percentageInterval[count] + Math.floor(Math.random() * 5 + 1);
|
||||
self.opts.onProgress(data);
|
||||
}
|
||||
|
||||
if ($.fileUploader.timeInterval[count]) {
|
||||
self.progressTimeout = setTimeout(function () {
|
||||
self._startDummyProgress(data, ++count);
|
||||
}, $.fileUploader.timeInterval[count] * 1000);
|
||||
}
|
||||
},
|
||||
|
||||
_stopDummyProgress: function (data, success) {
|
||||
var self = this;
|
||||
|
||||
clearTimeout(self.progressTimeout);
|
||||
|
||||
if (success) {
|
||||
// Force a 100% onProgress event
|
||||
data.progress = 100;
|
||||
self.opts.onProgress(data);
|
||||
}
|
||||
},
|
||||
|
||||
_afterUpload: function ($item, autoProceed) {
|
||||
var self = this;
|
||||
var data = $item.data('data');
|
||||
|
||||
if (data.itemId == self.inProgressItemId) {
|
||||
self.inProgressItemId = 0;
|
||||
self.inProgressJqXhr = null;
|
||||
}
|
||||
|
||||
$item.remove();
|
||||
|
||||
if ($(self.itemContainerSelector + " .fu-item").length > 0) {
|
||||
if (autoProceed) {
|
||||
self._processNextItemInQueue(autoProceed);
|
||||
}
|
||||
}
|
||||
else {
|
||||
self.opts.onDoneAll();
|
||||
}
|
||||
},
|
||||
|
||||
// Public methods
|
||||
uploadAll: function () {
|
||||
var self = this;
|
||||
var result = self.opts.onUploadAll(self);
|
||||
if (result === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self._processNextItemInQueue(true);
|
||||
},
|
||||
|
||||
cancelAll: function () {
|
||||
var self = this;
|
||||
|
||||
// Remove current form
|
||||
$(self.formContainerSelector).empty();
|
||||
|
||||
var queuedItems = $(self.itemContainerSelector + " .fu-item");
|
||||
for (var i = 0; i < queuedItems.length; i++) {
|
||||
var data = $(queuedItems.get(i)).data('data');
|
||||
self.cancelItem(data.itemId);
|
||||
}
|
||||
|
||||
self.itemCount = 0;
|
||||
|
||||
// Recreate the form
|
||||
self._createNewForm();
|
||||
},
|
||||
|
||||
cancelItem: function (itemId) {
|
||||
var self = this;
|
||||
var $item = $("#fu-item-" + self.uploaderId + "-" + itemId);
|
||||
var data = $item.data('data');
|
||||
|
||||
// If the item to cancel is in progress, abort the upload
|
||||
if (self.inProgressItemId == itemId && self.inProgressJqXhr) {
|
||||
//NB: The abort event handler will cleanup the aborted item from the queue
|
||||
self.inProgressJqXhr.abort();
|
||||
}
|
||||
else {
|
||||
// Update the status
|
||||
data.status = 'canceled';
|
||||
|
||||
self.opts.onDone(data);
|
||||
|
||||
self._afterUpload($item, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fileUploader = {
|
||||
version: '1.0',
|
||||
count: 0,
|
||||
timeInterval: [1, 2, 4, 2, 1, 5, 5, 5, 5],
|
||||
percentageInterval: [10, 20, 30, 40, 60, 80, 85, 90, 95]
|
||||
};
|
||||
|
||||
$.fn.fileUploader = function (o) {
|
||||
var args = arguments;
|
||||
if (typeof o === 'string') {
|
||||
var api = this.fileUploaderApi();
|
||||
if (api[o]) {
|
||||
return api[o].apply(api, Array.prototype.slice.call(args, 1));
|
||||
} else {
|
||||
$.error('Method ' + o + ' does not exist on jQuery.fileUploader');
|
||||
}
|
||||
}
|
||||
else if (typeof o === 'object' || !o) {
|
||||
return this.each(function () {
|
||||
var fileUploader = new FileUploader(this, o);
|
||||
$(this).data("fileuploader_api", fileUploader);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.fileUploaderApi = function () {
|
||||
//ensure there's only 1
|
||||
if (this.length != 1) {
|
||||
throw "Requesting the API can only match one element";
|
||||
}
|
||||
|
||||
//ensure thsi is a collapse panel
|
||||
if (this.data("fileuploader_api") === null) {
|
||||
throw "The matching element had not been bound to a fileUploader";
|
||||
}
|
||||
|
||||
return this.data("fileuploader_api");
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
||||
@@ -0,0 +1,274 @@
|
||||
.umbFolderBrowser {
|
||||
|
||||
}
|
||||
|
||||
.upload-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: transparent url(../../modal/modalBackground.gif);
|
||||
z-index: 9999;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.upload-panel {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
text-align: center;
|
||||
margin: -200px 0 0 -200px;
|
||||
border: solid 5px #ccc;
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.upload-panel h1 {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.upload-panel p {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.upload-panel .queued,
|
||||
.upload-panel .queued li {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.upload-panel .queued {
|
||||
display: block;
|
||||
margin: 20px 0;
|
||||
height: 220px;
|
||||
overflow: auto;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.upload-panel .queued li {
|
||||
display: block;
|
||||
background: transparent url(../../../umbraco/images/umbraco/mediaFile.gif) left center no-repeat;
|
||||
padding: 2px 0 2px 20px;
|
||||
}
|
||||
|
||||
.upload-panel .queued li .label {
|
||||
display: inline-block;
|
||||
width: 145px;
|
||||
margin: 0 5px 0 0;
|
||||
border: solid 1px #e0e0e0;
|
||||
height: 1.5em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.upload-panel .queued li span.progress {
|
||||
display: inline-block;
|
||||
width: 180px;
|
||||
border: solid 1px #e0e0e0;
|
||||
overflow: hidden;
|
||||
height: 1.5em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.upload-panel .queued li span.progress span {
|
||||
display: inline-block;
|
||||
background: #6c3;
|
||||
overflow: hidden;
|
||||
height: 1.5em;
|
||||
}
|
||||
|
||||
.upload-panel .queued li span.progress span.canceled,
|
||||
.upload-panel .queued li span.progress span.error {
|
||||
background: #f33;
|
||||
}
|
||||
|
||||
.upload-panel .queued li img {
|
||||
margin-left: 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.upload-panel .buttons {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.upload-panel .buttons span {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .breadcrumb {
|
||||
margin: 20px 20px 15px;
|
||||
padding: 0 0 10px;
|
||||
background: none !Important;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .breadcrumb li {
|
||||
display: inline;
|
||||
padding: 0 5px 0 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .breadcrumb li:after {
|
||||
content: '>';
|
||||
}
|
||||
|
||||
.umbFolderBrowser .breadcrumb li:last-child:after,
|
||||
.umbFolderBrowser .breadcrumb li:first-child:after {
|
||||
content: '';
|
||||
}
|
||||
|
||||
.umbFolderBrowser .breadcrumb li a {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .thumb-sizer {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
right: 270px;
|
||||
border-right: solid 1px #ccc;
|
||||
padding-right: 15px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .thumb-sizer input,
|
||||
.umbFolderBrowser .thumb-sizer img {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .filter {
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
right: 80px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .filter input {
|
||||
border: solid 1px #ccc;
|
||||
padding: 0 3px;
|
||||
width: 194px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .throbber {
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items {
|
||||
margin: 5px 15px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items li {
|
||||
display: inline-block;
|
||||
list-style: none;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items li div {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
list-style: none;
|
||||
margin: 5px;
|
||||
padding: 0;
|
||||
background: #f5f5f5;
|
||||
text-align: center;
|
||||
border: solid 1px #ccc;
|
||||
width: 120px;
|
||||
height: 150px;
|
||||
float: left;
|
||||
-moz-box-shadow: 2px 2px 2px #e0e0e0;
|
||||
-webkit-box-shadow: 2px 2px 2px #e0e0e0;
|
||||
box-shadow: 2px 2px 2px #e0e0e0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items.medium li div {
|
||||
width: 95px;
|
||||
height: 125px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items.small li div {
|
||||
width: 70px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .img {
|
||||
display: block;
|
||||
background: #e0e0e0;
|
||||
text-align: center;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items.medium .img {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items.small .img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .img:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .img img {
|
||||
display:inline;
|
||||
display:inline-table;
|
||||
display:inline-block;
|
||||
vertical-align: middle;
|
||||
max-width: 100px;
|
||||
max-height: 100px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items.medium .img img {
|
||||
max-width: 75px;
|
||||
max-height: 75px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items.small .img img {
|
||||
max-width: 50px;
|
||||
max-height: 50px;
|
||||
}
|
||||
|
||||
.umbFolderBrowser li span {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
margin: 0 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items li.selected div {
|
||||
background: #D5EFFC;
|
||||
border-color: #99DEFD;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items li.selected .img {
|
||||
background: #99DEFD;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items.ui-sortable-dragging li.selected {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items.ui-sortable-dragging li.ui-sortable-helper,
|
||||
.umbFolderBrowser .items.ui-sortable-dragging li.ui-sortable-placeholder {
|
||||
display: inline-block !important;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items li.ui-sortable-helper div {
|
||||
border: dotted 5px #99DEFD;
|
||||
}
|
||||
|
||||
.umbFolderBrowser .items li.ui-sortable-helper span {
|
||||
display: none !important;
|
||||
}
|
||||
@@ -0,0 +1,468 @@
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
|
||||
(function ($, Base, window, document, undefined) {
|
||||
|
||||
var itemMappingOptions = {
|
||||
'create': function (o) {
|
||||
var item = ko.mapping.fromJS(o.data);
|
||||
item.selected = ko.observable(false);
|
||||
item.toggleSelected = function (itm, e) {
|
||||
|
||||
if (this.selected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!e.ctrlKey) {
|
||||
for (var i = 0; i < o.parent().length; i++) {
|
||||
o.parent()[i].selected(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.selected(true);
|
||||
};
|
||||
item.edit = function () {
|
||||
//TODO: Could do with a better way of getting to the parent control
|
||||
$(".umbFolderBrowser").folderBrowserApi()._editItem(this.Id());
|
||||
};
|
||||
return item;
|
||||
}
|
||||
};
|
||||
|
||||
Umbraco.Controls.FolderBrowser = Base.extend({
|
||||
// Private
|
||||
_el: null,
|
||||
_elId: null,
|
||||
_parentId: null,
|
||||
_nodePath: null,
|
||||
_opts: null,
|
||||
_viewModel: null,
|
||||
|
||||
_getChildNodes: function () {
|
||||
var self = this;
|
||||
|
||||
$.ajaxSetup({ cache: false });
|
||||
$.getJSON(self._opts.basePath + "/FolderBrowserService/GetChildren/" + self._parentId, function (data) {
|
||||
if (data != undefined && data.length > 0) {
|
||||
ko.mapping.fromJS(data, itemMappingOptions, self._viewModel.items);
|
||||
} else {
|
||||
self._viewModel.items([]);
|
||||
$("img.throbber").hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_getItemById: function (id) {
|
||||
var self = this;
|
||||
|
||||
var results = ko.utils.arrayFilter(self._viewModel.items(), function (item) {
|
||||
return item.Id() === id;
|
||||
});
|
||||
|
||||
return results.length == 1 ? results[0] : undefined;
|
||||
},
|
||||
|
||||
_editItem: function (id) {
|
||||
var self = this;
|
||||
|
||||
var item = self._getItemById(id);
|
||||
if (item === undefined) {
|
||||
throw Error("No item found with the id: " + id);
|
||||
}
|
||||
|
||||
window.location.href = "editMedia.aspx?id=" + item.Id();
|
||||
},
|
||||
|
||||
_downloadItem: function (id) {
|
||||
var self = this;
|
||||
|
||||
var item = self._getItemById(id);
|
||||
if (item === undefined) {
|
||||
throw Error("No item found with the id: " + id);
|
||||
}
|
||||
|
||||
window.open(item.FileUrl(), "Download");
|
||||
},
|
||||
|
||||
_deleteItems: function (ids) {
|
||||
var self = this;
|
||||
|
||||
var msg = ids.length + " item" + ((ids.length > 1) ? "s" : "");
|
||||
|
||||
if (confirm(window.top.uiKeys['defaultdialogs_confirmdelete'] + ' the selected ' + msg + '?\n\n')) {
|
||||
$(window.top).trigger("nodeDeleting", []);
|
||||
|
||||
$.getJSON(self._opts.basePath + "/FolderBrowserService/Delete/" + ids.join(), function (data) {
|
||||
if (data != undefined && data.success) {
|
||||
//raise nodeDeleted event
|
||||
$(window.top).trigger("nodeDeleted", []);
|
||||
|
||||
//TODO: Reload current open node in tree
|
||||
|
||||
// Reload nodes
|
||||
self._getChildNodes();
|
||||
|
||||
} else {
|
||||
throw Error("There was an error deleting the selected nodes: " + ids.join());
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_initViewModel: function () {
|
||||
var self = this;
|
||||
|
||||
// Setup the viewmode;
|
||||
self._viewModel = $.extend({}, {
|
||||
parent: self,
|
||||
thumbSize: ko.observable('large'),
|
||||
filterTerm: ko.observable(''),
|
||||
items: ko.observableArray([]),
|
||||
queued: ko.observableArray([])
|
||||
});
|
||||
|
||||
self._viewModel.thumbSize.subscribe(function (newValue) {
|
||||
$(".umbFolderBrowser .items").removeClass("large").removeClass("medium").removeClass("small").addClass(newValue);
|
||||
});
|
||||
|
||||
self._viewModel.filtered = ko.computed(function () {
|
||||
return ko.utils.arrayFilter(this.items(), function (item) {
|
||||
return item.Name().toLowerCase().indexOf(self._viewModel.filterTerm().toLowerCase()) > -1 ||
|
||||
item.Tags().toLowerCase().indexOf(self._viewModel.filterTerm().toLowerCase()) > -1;
|
||||
});
|
||||
}, self._viewModel);
|
||||
|
||||
self._viewModel.selected = ko.computed(function () {
|
||||
return ko.utils.arrayFilter(this.items(), function (item) {
|
||||
return item.selected();
|
||||
});
|
||||
}, self._viewModel);
|
||||
|
||||
self._viewModel.selectedIds = ko.computed(function () {
|
||||
var ids = [];
|
||||
ko.utils.arrayForEach(this.selected(), function (item) {
|
||||
ids.push(item.Id());
|
||||
});
|
||||
return ids;
|
||||
}, self._viewModel);
|
||||
|
||||
self._viewModel.itemIds = ko.computed(function () {
|
||||
var ids = [];
|
||||
ko.utils.arrayForEach(this.items(), function (item) {
|
||||
ids.push(item.Id());
|
||||
});
|
||||
return ids;
|
||||
}, self._viewModel);
|
||||
|
||||
},
|
||||
|
||||
_initToolbar: function () {
|
||||
var self = this;
|
||||
|
||||
// Inject the upload button into the toolbar
|
||||
var button = $("<a href='#' class='btn' title='upload'><i class='icon-upload'></i></a>");
|
||||
button.click(function (e) {
|
||||
e.preventDefault();
|
||||
$(".upload-overlay").show();
|
||||
});
|
||||
$(".umb-panel-header .umb-btn-toolbar").append(button);
|
||||
},
|
||||
|
||||
_initOverlay: function () {
|
||||
var self = this;
|
||||
|
||||
// Inject the upload overlay
|
||||
var instructions = 'draggable' in document.createElement('span') ? "<h1>Drag files here to upload</h1> \<p>Or, click the button below to choose the items to upload</p>" : "<h1>Click the browse button below to choose the items to upload</h1>";
|
||||
|
||||
var overlay = $("<div class='upload-overlay'>" +
|
||||
"<div class='upload-panel'>" +
|
||||
instructions +
|
||||
"<form action=\"" + self._opts.umbracoPath + "/webservices/MediaUploader.ashx?format=json&action=upload&parentNodeId=" + this._parentId + "\" method=\"post\" enctype=\"multipart/form-data\">" +
|
||||
"<input id='fileupload' type='file' name='file' multiple>" +
|
||||
"<input type='hidden' name='__reqver' value='" + self._opts.reqver + "' />" +
|
||||
"<input type='hidden' name='name' />" +
|
||||
"<input type='hidden' name='replaceExisting' />" +
|
||||
"</form>" +
|
||||
"<ul class='queued' data-bind='foreach: queued'><li>" +
|
||||
"<input type='text' class='label' data-bind=\"value: name, valueUpdate: 'afterkeydown', enable: progress() == 0\" />" +
|
||||
"<span class='progress' data-bind='attr: { title : message }'><span data-bind=\"style: { width: progress() + '%' }, attr: { class: status() }\"></span></span>" +
|
||||
"<a href='' data-bind='click: cancel'><img src='images/delete.png' /></a>" +
|
||||
"</li></ul>" +
|
||||
"<div class='buttons'>" +
|
||||
"<span>" +
|
||||
"<button class='button upload' data-bind='enable: queued().length > 0'>Upload</button>" +
|
||||
"<input type='checkbox' id='replaceExisting' data-bind='enable: queued().length > 0' />" +
|
||||
"<label for='replaceExisting'>Overwrite existing?</label> " +
|
||||
"</span>" +
|
||||
"<a href='#' class='cancel'>Cancel All</a> " +
|
||||
"<a href='#' class='close'>Close</a>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
|
||||
$("body").prepend(overlay);
|
||||
|
||||
// Create uploader
|
||||
jQuery("#fileupload").fileUploader({
|
||||
allowedExtension: '',
|
||||
dropTarget: ".upload-overlay",
|
||||
onAdd: function (data) {
|
||||
|
||||
// Create a bindable version of the data object
|
||||
var file = {
|
||||
uploaderId: data.uploaderId,
|
||||
itemId: data.itemId,
|
||||
name: ko.observable(data.name),
|
||||
size: data.size,
|
||||
progress: ko.observable(data.progress),
|
||||
status: ko.observable(''),
|
||||
message: ko.observable(''),
|
||||
cancel: function () {
|
||||
if (this.progress() < 100) {
|
||||
jQuery("#fileupload").fileUploader("cancelItem", this.itemId);
|
||||
} else {
|
||||
self._viewModel.queued.remove(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
file.name.subscribe(function (newValue) {
|
||||
$("#fu-item-" + file.uploaderId + "-" + file.itemId + " input[name=name]").val(newValue);
|
||||
});
|
||||
|
||||
// Store item back in context for easy access later
|
||||
data.context = file;
|
||||
|
||||
// Push bindable item into queue
|
||||
self._viewModel.queued.push(file);
|
||||
},
|
||||
onDone: function (data) {
|
||||
switch (data.status) {
|
||||
case 'success':
|
||||
self._viewModel.queued.remove(data.context);
|
||||
break;
|
||||
case 'error':
|
||||
data.context.message(data.message);
|
||||
data.context.status(data.status);
|
||||
//self._viewModel.queued.remove(data.context);
|
||||
break;
|
||||
case 'canceled':
|
||||
data.context.message("Canceled by user");
|
||||
data.context.progress(100);
|
||||
data.context.status(data.status);
|
||||
//self._viewModel.queued.remove(data.context);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
onProgress: function (data) {
|
||||
data.context.progress(data.progress);
|
||||
},
|
||||
onDoneAll: function () {
|
||||
self._getChildNodes();
|
||||
$(".upload-overlay").hide();
|
||||
UmbClientMgr.mainTree().syncTree(self._nodePath.toString(), true, false);
|
||||
}
|
||||
});
|
||||
|
||||
// Hook up uploader buttons
|
||||
$(".upload-overlay .upload").click(function (e) {
|
||||
e.preventDefault();
|
||||
jQuery("#fileupload").fileUploader("uploadAll");
|
||||
});
|
||||
|
||||
$(".upload-overlay #replaceExisting").click(function () {
|
||||
$("input[name=replaceExisting]").val($(this).is(":checked"));
|
||||
});
|
||||
|
||||
$(".upload-overlay .cancel").click(function (e) {
|
||||
e.preventDefault();
|
||||
$("#fileupload").fileUploader("cancelAll");
|
||||
});
|
||||
|
||||
$(".upload-overlay .close").click(function (e) {
|
||||
e.preventDefault();
|
||||
$(".upload-overlay").hide();
|
||||
});
|
||||
|
||||
// Listen for drag events
|
||||
$(".umbFolderBrowser").on('dragenter dragover', function (e) {
|
||||
$(".upload-overlay").show();
|
||||
});
|
||||
|
||||
$(".upload-overlay").on('dragleave dragexit', function (e) {
|
||||
$(this).hide();
|
||||
}).click(function () {
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
$(".upload-panel").click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
},
|
||||
|
||||
_initContextMenu: function () {
|
||||
var self = this;
|
||||
|
||||
// Setup context menus
|
||||
$.contextMenu({
|
||||
selector: '.umbFolderBrowser .items li',
|
||||
callback: function (key, options) {
|
||||
var id = options.$trigger.data("id");
|
||||
switch (key) {
|
||||
case "edit":
|
||||
self._editItem(id);
|
||||
break;
|
||||
case "download":
|
||||
self._downloadItem(id);
|
||||
break;
|
||||
case "delete":
|
||||
self._deleteItems(self._viewModel.selectedIds());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
items: {
|
||||
"edit": { name: "Edit", icon: "edit" },
|
||||
"download": { name: "Download", icon: "download" },
|
||||
"separator1": "-----",
|
||||
"delete": { name: "Delete", icon: "delete" }
|
||||
},
|
||||
animation: { show: "fadeIn", hide: "fadeOut" }
|
||||
});
|
||||
},
|
||||
|
||||
_initItems: function () {
|
||||
var self = this;
|
||||
|
||||
$(".umbFolderBrowser .items").sortable({
|
||||
helper: "clone",
|
||||
opacity: 0.6,
|
||||
start: function (e, ui) {
|
||||
// Add dragging class to container
|
||||
$(".umbFolderBrowser .items").addClass("ui-sortable-dragging");
|
||||
},
|
||||
update: function (e, ui) {
|
||||
// Can't sort when filtered so just return
|
||||
if (self._viewModel.filterTerm().length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//var oldIndex = self._viewModel.items.indexOf(self._viewModel.tempItem());
|
||||
var newIndex = ui.item.index();
|
||||
|
||||
$(".umbFolderBrowser .items .selected").sort(function (a, b) {
|
||||
return parseInt($(a).data("order"), 10) > parseInt($(b).data("order"), 10) ? 1 : -1;
|
||||
}).each(function (idx, itm) {
|
||||
var id = $(itm).data("id");
|
||||
var item = self._getItemById(id);
|
||||
if (item !== undefined) {
|
||||
var oldIndex = self._viewModel.items.indexOf(item);
|
||||
|
||||
// Update the index of the current item in the array
|
||||
self._viewModel.items.splice((newIndex + idx), 0, self._viewModel.items.splice(oldIndex, 1)[0]);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
stop: function (e, ui) {
|
||||
// Remove dragging class from container
|
||||
$(".umbFolderBrowser .items").removeClass("ui-sortable-dragging");
|
||||
|
||||
if (self._viewModel.filterTerm().length > 0) {
|
||||
$(this).sortable("cancel");
|
||||
alert("Can't sort items which have been filtered");
|
||||
}
|
||||
else {
|
||||
|
||||
$.ajax({
|
||||
url: self._opts.umbracoPath + "/umbracoapi/media/postsort",
|
||||
type: 'POST',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: 'json',
|
||||
data: JSON.stringify({
|
||||
parentId: self._parentId,
|
||||
idSortOrder: self._viewModel.itemIds()
|
||||
}),
|
||||
processData: false,
|
||||
success: function (data, textStatus) {
|
||||
if (textStatus == "error") {
|
||||
alert("Could not update sort order");
|
||||
self._getChildNodes();
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
alert("Could not update sort order. Err: " + data.statusText);
|
||||
self._getChildNodes();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Constructor
|
||||
constructor: function (el, opts) {
|
||||
var self = this;
|
||||
|
||||
// Store el info
|
||||
self._el = el;
|
||||
self._elId = el.id;
|
||||
|
||||
// Grab parent id from element
|
||||
self._parentId = $(el).data("parentid");
|
||||
|
||||
// Grab node path from element
|
||||
self._nodePath = $(el).data("nodepath");
|
||||
|
||||
// Merge options with default
|
||||
self._opts = $.extend({
|
||||
|
||||
// Default options go here
|
||||
}, opts);
|
||||
|
||||
self._initViewModel();
|
||||
self._initToolbar();
|
||||
self._initOverlay();
|
||||
self._initContextMenu();
|
||||
self._initItems();
|
||||
|
||||
// Bind the viewmodel
|
||||
ko.applyBindings(self._viewModel, el);
|
||||
ko.applyBindings(self._viewModel, $(".upload-overlay").get(0));
|
||||
|
||||
// Grab children media items
|
||||
self._getChildNodes();
|
||||
}
|
||||
|
||||
// Public
|
||||
});
|
||||
|
||||
$.fn.folderBrowser = function (o) {
|
||||
if ($(this).length != 1) {
|
||||
throw "Only one folder browser can exist on the page at any one time";
|
||||
}
|
||||
|
||||
return $(this).each(function () {
|
||||
var folderBrowser = new Umbraco.Controls.FolderBrowser(this, o);
|
||||
$(this).data("api", folderBrowser);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.folderBrowserApi = function () {
|
||||
//ensure there's only 1
|
||||
if ($(this).length != 1) {
|
||||
throw "Requesting the API can only match one element";
|
||||
}
|
||||
|
||||
//ensure thsi is a collapse panel
|
||||
if ($(this).data("api") === null) {
|
||||
throw "The matching element had not been bound to a folderBrowser";
|
||||
}
|
||||
|
||||
return $(this).data("api");
|
||||
};
|
||||
|
||||
})(jQuery, base2.Base, window, document);
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
//todo
|
||||
function openIconPicker(element) {
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,77 @@
|
||||
.outtaHere {
|
||||
position:absolute;
|
||||
left:-3000px;
|
||||
}
|
||||
/* Selects */
|
||||
.selectArea {
|
||||
position: relative;
|
||||
height: 29px;
|
||||
float:left;
|
||||
color:#000;
|
||||
font-size:13px;
|
||||
line-height:29px;
|
||||
}
|
||||
.selectArea .left {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width:15px;
|
||||
height:29px;
|
||||
background: url(../images/select-left.png) no-repeat;
|
||||
display: block;
|
||||
}
|
||||
.selectArea a.selectButton {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width:310px;
|
||||
height:29px;
|
||||
background: url(../images/select-button.png) no-repeat;
|
||||
}
|
||||
.selectArea .center{
|
||||
height: 29px;
|
||||
line-height:28px;
|
||||
display:block;
|
||||
margin:0 24px 0 15px;
|
||||
background: url(../images/select-center.png) repeat-x;
|
||||
}
|
||||
.selectArea .center img {
|
||||
float:left;
|
||||
}
|
||||
/*Selects drop-down*/
|
||||
.optionsDivInvisible,
|
||||
.optionsDivVisible {
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
border: 1px solid #896e68;
|
||||
display: block;
|
||||
z-index: 30;
|
||||
font-size: 11px;
|
||||
}
|
||||
.optionsDivInvisible {display: none;}
|
||||
.optionsDivVisible ul {
|
||||
margin:0;
|
||||
padding:0;
|
||||
overflow:hidden;
|
||||
width:100%;
|
||||
list-style: none;
|
||||
}
|
||||
.optionsDivVisible ul li {
|
||||
float:left;
|
||||
width:100%;
|
||||
}
|
||||
.optionsDivVisible a {
|
||||
color: #000;
|
||||
overflow:hidden;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
height:1%;
|
||||
padding: 3px 5px;
|
||||
}
|
||||
.optionsDivVisible a img {
|
||||
border:none;
|
||||
float:left;
|
||||
}
|
||||
.optionsDivVisible a:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
* jQuery UI CSS Framework 1.8.6
|
||||
*
|
||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Theming/API
|
||||
*/
|
||||
|
||||
/* Layout helpers
|
||||
----------------------------------*/
|
||||
.ui-helper-hidden { display: none; }
|
||||
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
|
||||
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
||||
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
||||
.ui-helper-clearfix { display: inline-block; }
|
||||
/* required comment for clearfix to work in Opera \*/
|
||||
* html .ui-helper-clearfix { height:1%; }
|
||||
.ui-helper-clearfix { display:block; }
|
||||
/* end clearfix */
|
||||
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
||||
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-disabled { cursor: default !important; }
|
||||
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
||||
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||
|
||||
|
||||
/*
|
||||
* jQuery UI CSS Framework 1.8.6
|
||||
*
|
||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Theming/API
|
||||
*
|
||||
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
|
||||
*/
|
||||
|
||||
|
||||
/* Component containers
|
||||
----------------------------------*/
|
||||
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
|
||||
.ui-widget .ui-widget { font-size: 1em; }
|
||||
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
|
||||
.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(../images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
|
||||
.ui-widget-content a { color: #333333; }
|
||||
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(../images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
|
||||
.ui-widget-header a { color: #ffffff; }
|
||||
|
||||
/* Interaction states
|
||||
----------------------------------*/
|
||||
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(../images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
|
||||
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
|
||||
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(../images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
|
||||
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
|
||||
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(../images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
|
||||
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
|
||||
.ui-widget :active { outline: none; }
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(../images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
|
||||
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
|
||||
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(../images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
|
||||
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
|
||||
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
|
||||
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
||||
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
||||
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon { width: 16px; height: 16px; background-image: url(../images/ui-icons_222222_256x240.png); }
|
||||
.ui-widget-content .ui-icon {background-image: url(../images/ui-icons_222222_256x240.png); }
|
||||
.ui-widget-header .ui-icon {background-image: url(../images/ui-icons_ffffff_256x240.png); }
|
||||
.ui-state-default .ui-icon { background-image: url(../images/ui-icons_ef8c08_256x240.png); }
|
||||
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(../images/ui-icons_ef8c08_256x240.png); }
|
||||
.ui-state-active .ui-icon {background-image: url(../images/ui-icons_ef8c08_256x240.png); }
|
||||
.ui-state-highlight .ui-icon {background-image: url(../images/ui-icons_228ef1_256x240.png); }
|
||||
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(../images/ui-icons_ffd27a_256x240.png); }
|
||||
|
||||
/* positioning */
|
||||
.ui-icon-carat-1-n { background-position: 0 0; }
|
||||
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
||||
.ui-icon-carat-1-e { background-position: -32px 0; }
|
||||
.ui-icon-carat-1-se { background-position: -48px 0; }
|
||||
.ui-icon-carat-1-s { background-position: -64px 0; }
|
||||
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
||||
.ui-icon-carat-1-w { background-position: -96px 0; }
|
||||
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
||||
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
||||
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
||||
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
||||
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
||||
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
||||
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
||||
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
||||
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
||||
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
||||
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
||||
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
||||
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
||||
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
||||
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
||||
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
||||
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
||||
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
||||
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
||||
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
||||
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
||||
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
||||
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
||||
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
||||
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
||||
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
||||
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
||||
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
||||
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
||||
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
||||
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
||||
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
||||
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
||||
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
||||
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
||||
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
||||
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
||||
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
||||
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
||||
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
||||
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
||||
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
||||
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
||||
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
||||
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
||||
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
||||
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
||||
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
||||
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
||||
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
||||
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
||||
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
||||
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
||||
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
||||
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
||||
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
||||
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
||||
.ui-icon-extlink { background-position: -32px -80px; }
|
||||
.ui-icon-newwin { background-position: -48px -80px; }
|
||||
.ui-icon-refresh { background-position: -64px -80px; }
|
||||
.ui-icon-shuffle { background-position: -80px -80px; }
|
||||
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
||||
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
||||
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
||||
.ui-icon-folder-open { background-position: -16px -96px; }
|
||||
.ui-icon-document { background-position: -32px -96px; }
|
||||
.ui-icon-document-b { background-position: -48px -96px; }
|
||||
.ui-icon-note { background-position: -64px -96px; }
|
||||
.ui-icon-mail-closed { background-position: -80px -96px; }
|
||||
.ui-icon-mail-open { background-position: -96px -96px; }
|
||||
.ui-icon-suitcase { background-position: -112px -96px; }
|
||||
.ui-icon-comment { background-position: -128px -96px; }
|
||||
.ui-icon-person { background-position: -144px -96px; }
|
||||
.ui-icon-print { background-position: -160px -96px; }
|
||||
.ui-icon-trash { background-position: -176px -96px; }
|
||||
.ui-icon-locked { background-position: -192px -96px; }
|
||||
.ui-icon-unlocked { background-position: -208px -96px; }
|
||||
.ui-icon-bookmark { background-position: -224px -96px; }
|
||||
.ui-icon-tag { background-position: -240px -96px; }
|
||||
.ui-icon-home { background-position: 0 -112px; }
|
||||
.ui-icon-flag { background-position: -16px -112px; }
|
||||
.ui-icon-calendar { background-position: -32px -112px; }
|
||||
.ui-icon-cart { background-position: -48px -112px; }
|
||||
.ui-icon-pencil { background-position: -64px -112px; }
|
||||
.ui-icon-clock { background-position: -80px -112px; }
|
||||
.ui-icon-disk { background-position: -96px -112px; }
|
||||
.ui-icon-calculator { background-position: -112px -112px; }
|
||||
.ui-icon-zoomin { background-position: -128px -112px; }
|
||||
.ui-icon-zoomout { background-position: -144px -112px; }
|
||||
.ui-icon-search { background-position: -160px -112px; }
|
||||
.ui-icon-wrench { background-position: -176px -112px; }
|
||||
.ui-icon-gear { background-position: -192px -112px; }
|
||||
.ui-icon-heart { background-position: -208px -112px; }
|
||||
.ui-icon-star { background-position: -224px -112px; }
|
||||
.ui-icon-link { background-position: -240px -112px; }
|
||||
.ui-icon-cancel { background-position: 0 -128px; }
|
||||
.ui-icon-plus { background-position: -16px -128px; }
|
||||
.ui-icon-plusthick { background-position: -32px -128px; }
|
||||
.ui-icon-minus { background-position: -48px -128px; }
|
||||
.ui-icon-minusthick { background-position: -64px -128px; }
|
||||
.ui-icon-close { background-position: -80px -128px; }
|
||||
.ui-icon-closethick { background-position: -96px -128px; }
|
||||
.ui-icon-key { background-position: -112px -128px; }
|
||||
.ui-icon-lightbulb { background-position: -128px -128px; }
|
||||
.ui-icon-scissors { background-position: -144px -128px; }
|
||||
.ui-icon-clipboard { background-position: -160px -128px; }
|
||||
.ui-icon-copy { background-position: -176px -128px; }
|
||||
.ui-icon-contact { background-position: -192px -128px; }
|
||||
.ui-icon-image { background-position: -208px -128px; }
|
||||
.ui-icon-video { background-position: -224px -128px; }
|
||||
.ui-icon-script { background-position: -240px -128px; }
|
||||
.ui-icon-alert { background-position: 0 -144px; }
|
||||
.ui-icon-info { background-position: -16px -144px; }
|
||||
.ui-icon-notice { background-position: -32px -144px; }
|
||||
.ui-icon-help { background-position: -48px -144px; }
|
||||
.ui-icon-check { background-position: -64px -144px; }
|
||||
.ui-icon-bullet { background-position: -80px -144px; }
|
||||
.ui-icon-radio-off { background-position: -96px -144px; }
|
||||
.ui-icon-radio-on { background-position: -112px -144px; }
|
||||
.ui-icon-pin-w { background-position: -128px -144px; }
|
||||
.ui-icon-pin-s { background-position: -144px -144px; }
|
||||
.ui-icon-play { background-position: 0 -160px; }
|
||||
.ui-icon-pause { background-position: -16px -160px; }
|
||||
.ui-icon-seek-next { background-position: -32px -160px; }
|
||||
.ui-icon-seek-prev { background-position: -48px -160px; }
|
||||
.ui-icon-seek-end { background-position: -64px -160px; }
|
||||
.ui-icon-seek-start { background-position: -80px -160px; }
|
||||
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
||||
.ui-icon-seek-first { background-position: -80px -160px; }
|
||||
.ui-icon-stop { background-position: -96px -160px; }
|
||||
.ui-icon-eject { background-position: -112px -160px; }
|
||||
.ui-icon-volume-off { background-position: -128px -160px; }
|
||||
.ui-icon-volume-on { background-position: -144px -160px; }
|
||||
.ui-icon-power { background-position: 0 -176px; }
|
||||
.ui-icon-signal-diag { background-position: -16px -176px; }
|
||||
.ui-icon-signal { background-position: -32px -176px; }
|
||||
.ui-icon-battery-0 { background-position: -48px -176px; }
|
||||
.ui-icon-battery-1 { background-position: -64px -176px; }
|
||||
.ui-icon-battery-2 { background-position: -80px -176px; }
|
||||
.ui-icon-battery-3 { background-position: -96px -176px; }
|
||||
.ui-icon-circle-plus { background-position: 0 -192px; }
|
||||
.ui-icon-circle-minus { background-position: -16px -192px; }
|
||||
.ui-icon-circle-close { background-position: -32px -192px; }
|
||||
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
||||
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
||||
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
||||
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
||||
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
||||
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
||||
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
||||
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
||||
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
||||
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
||||
.ui-icon-circle-check { background-position: -208px -192px; }
|
||||
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
||||
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
||||
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
||||
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
||||
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
||||
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
||||
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
||||
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
||||
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
||||
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
||||
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
||||
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
||||
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Corner radius */
|
||||
.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
|
||||
.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
||||
.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
||||
.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
||||
.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
||||
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
||||
.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
||||
.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
||||
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { background: #666666 url(../images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
|
||||
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(../images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
|
||||
* jQuery UI Progressbar 1.8.6
|
||||
*
|
||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Progressbar#theming
|
||||
*/
|
||||
.ui-progressbar { height:2em; text-align: left; }
|
||||
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
|
||||
@@ -0,0 +1,174 @@
|
||||
* html body{width: expression(document.documentElement.clientWidth < 1000 ? "1000px" : "auto");}
|
||||
#header{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-header.png', sizingmethod='scale');
|
||||
}
|
||||
.tabset .b{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/sep1.png', sizingmethod='scale');
|
||||
}
|
||||
.tabset ul li.active em{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bul1.png', sizingmethod='crop');
|
||||
}
|
||||
.btn-box .t{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/sep1.png', sizingmethod='scale');
|
||||
}
|
||||
.btn-get span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-get.png', sizingmethod='crop');
|
||||
}
|
||||
.btn-accept span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-accept.png', sizingmethod='crop');
|
||||
}
|
||||
.mini-tabset li.btn-yes a span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-yes.png', sizingmethod='crop');
|
||||
}
|
||||
.mini-tabset li.btn-no a span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-no.png', sizingmethod='crop');
|
||||
}
|
||||
.selectArea a.selectButton{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/select-button.png', sizingmethod='crop');
|
||||
}
|
||||
.selectArea .left{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/select-left.png', sizingmethod='crop');
|
||||
}
|
||||
.selectArea .center{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/select-center.png', sizingmethod='scale');
|
||||
}
|
||||
.instruction-hold .row span{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-inp.png', sizingmethod='crop');
|
||||
}
|
||||
.btn-continue span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-continue.png', sizingmethod='crop');
|
||||
}
|
||||
.instruction-hold .error span{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-inp-error.png', sizingmethod='crop');
|
||||
}
|
||||
.validaing{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/ico-validaing.png', sizingmethod='crop') !important;
|
||||
}
|
||||
.invalidaing{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/ico-invalidaing.png', sizingmethod='crop') !important;
|
||||
}
|
||||
.drop-hold .t{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-drop-t.png', sizingmethod='crop');
|
||||
}
|
||||
.drop-hold .b{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-drop-b.png', sizingmethod='crop');
|
||||
}
|
||||
.add-nav ul li.hover em{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bul3.png', sizingmethod='crop');
|
||||
}
|
||||
.gallery .btn-prev span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-prev.png', sizingmethod='crop');
|
||||
}
|
||||
.gallery .btn-next span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-next.png', sizingmethod='crop');
|
||||
}
|
||||
.gal-drop .btn-preview span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-preview.png', sizingmethod='crop');
|
||||
}
|
||||
.gal-drop .btn-install-gal span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-install-gal.png', sizingmethod='crop');
|
||||
}
|
||||
.paging ul li a{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-paging.png', sizingmethod='crop');
|
||||
}
|
||||
.paging ul li a:hover,
|
||||
.paging ul li.active a{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-paging-h.png', sizingmethod='crop');
|
||||
}
|
||||
.lightbox .t{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-lightbox-t.png', sizingmethod='crop');
|
||||
}
|
||||
.lightbox .b{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/bg-lightbox-b.png', sizingmethod='crop');
|
||||
}
|
||||
.lightbox .btn-install{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-install.png', sizingmethod='crop');
|
||||
}
|
||||
.lightbox .btn-install:hover{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-install-hover.png', sizingmethod='crop');
|
||||
}
|
||||
.lightbox .btn-close{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-close.png', sizingmethod='crop');
|
||||
}
|
||||
.btn-web li.btn-set a span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-set.png', sizingmethod='crop');
|
||||
}
|
||||
.btn-web li.btn-preview-web a span{
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-preview-web.png', sizingmethod='crop');
|
||||
}
|
||||
.threcol .t{
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/sep1.png', sizingmethod='scale');
|
||||
}
|
||||
.gallery .box {
|
||||
filter: none !important;
|
||||
}
|
||||
.btn-box .btn-install span {
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-install.png', sizingmethod='crop');
|
||||
}
|
||||
.ui-selectmenu-status {
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/select-left-2.png', sizingmethod='crop');
|
||||
}
|
||||
.ui-state-default .ui-icon {
|
||||
cursor: pointer;
|
||||
background:url(../images/none.gif);
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/select-button.png', sizingmethod='crop');
|
||||
}
|
||||
.btn-box .btn-create span {
|
||||
background:url(../images/none.gif);
|
||||
cursor:pointer;
|
||||
filter: progid:dximagetransform.microsoft.alphaimageloader(src='../umbraco_client/installer/images/btn-create.png', sizingmethod='crop');
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/* v1.0 | 20080212 */
|
||||
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
font-size: 100%;
|
||||
vertical-align: baseline;
|
||||
background: transparent;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
|
||||
/* remember to define focus styles! */
|
||||
:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
/* remember to highlight inserts somehow! */
|
||||
ins {
|
||||
text-decoration: none;
|
||||
}
|
||||
del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
/* tables still need 'cellspacing="0"' in the markup */
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||