Merge branch '1.x' into feature/audittrail

This commit is contained in:
Sipke Schoorstra
2014-07-23 19:03:28 -07:00
44 changed files with 366 additions and 231 deletions

View File

@@ -95,7 +95,11 @@ namespace Orchard.Core.Shapes {
.OnDisplaying(displaying => {
var menuItem = displaying.Shape;
var menu = menuItem.Menu;
int level = menuItem.Level;
menuItem.Metadata.Alternates.Add("MenuItem__level__" + level);
menuItem.Metadata.Alternates.Add("MenuItem__" + EncodeAlternateElement(menu.MenuName));
menuItem.Metadata.Alternates.Add("MenuItem__" + EncodeAlternateElement(menu.MenuName) + "__level__" + level);
});
builder.Describe("MenuItemLink")
@@ -103,23 +107,31 @@ namespace Orchard.Core.Shapes {
var menuItem = displaying.Shape;
string menuName = menuItem.Menu.MenuName;
string contentType = null;
int level = menuItem.Level;
if (menuItem.Content != null) {
contentType = ((IContent) menuItem.Content).ContentItem.ContentType;
}
menuItem.Metadata.Alternates.Add("MenuItemLink__level__" + level);
// MenuItemLink__[ContentType] e.g. MenuItemLink-HtmlMenuItem
// MenuItemLink__[ContentType]__level__[level] e.g. MenuItemLink-HtmlMenuItem-level-2
if (contentType != null) {
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(contentType));
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(contentType) + "__level__" + level);
}
// MenuItemLink__[MenuName] e.g. MenuItemLink-Main-Menu
// MenuItemLink__[MenuName]__level__[level] e.g. MenuItemLink-Main-Menu-level-2
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(menuName));
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(menuName) + "__level__" + level);
// MenuItemLink__[MenuName]__[ContentType] e.g. MenuItemLink-Main-Menu-HtmlMenuItem
// MenuItemLink__[MenuName]__[ContentType] e.g. MenuItemLink-Main-Menu-HtmlMenuItem-level-2
if (contentType != null) {
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(menuName) + "__" + EncodeAlternateElement(contentType));
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(menuName) + "__" + EncodeAlternateElement(contentType) + "__level__" + level);
}
});
builder.Describe("LocalMenu")

View File

@@ -1,10 +1,11 @@
"use strict";
var Markdown;
if (typeof exports === "object" && typeof require === "function") // we're in a CommonJS (e.g. Node.js) module
Markdown = exports;
else
Markdown = {};
// The following text is included for historical reasons, but should
// be taken with a pinch of salt; it's not all true anymore.
@@ -92,7 +93,7 @@ else
// caused an exception (and hence stopped the rendering) when the user entered
// e.g. [push] or [__proto__]. Adding a prefix to the actual key prevents this
// (since no builtin property starts with "s_"). See
// http://meta.stackoverflow.com/questions/64655/strange-wmd-bug
// http://meta.stackexchange.com/questions/64655/strange-wmd-bug
// (granted, switching from Array() to Object() alone would have left only __proto__
// to be a problem)
function SaveHash() { }
@@ -105,7 +106,7 @@ else
}
};
Markdown.Converter = function () {
Markdown.Converter = function (OPTIONS) {
var pluginHooks = this.hooks = new HookCollection();
// given a URL that was encountered by itself (without markup), should return the link text that's to be given to this link
@@ -142,6 +143,91 @@ else
// Used to track when we're inside an ordered or unordered list
// (see _ProcessListItems() for details):
var g_list_level;
OPTIONS = OPTIONS || {};
var asciify = identity, deasciify = identity;
if (OPTIONS.nonAsciiLetters) {
/* In JavaScript regular expressions, \w only denotes [a-zA-Z0-9_].
* That's why there's inconsistent handling e.g. with intra-word bolding
* of Japanese words. That's why we do the following if OPTIONS.nonAsciiLetters
* is true:
*
* Before doing bold and italics, we find every instance
* of a unicode word character in the Markdown source that is not
* matched by \w, and the letter "Q". We take the character's code point
* and encode it in base 51, using the "digits"
*
* A, B, ..., P, R, ..., Y, Z, a, b, ..., y, z
*
* delimiting it with "Q" on both sides. For example, the source
*
* > In Chinese, the smurfs are called 藍精靈, meaning "blue spirits".
*
* turns into
*
* > In Chinese, the smurfs are called QNIhQQMOIQQOuUQ, meaning "blue spirits".
*
* Since everything that is a letter in Unicode is now a letter (or
* several letters) in ASCII, \w and \b should always do the right thing.
*
* After the bold/italic conversion, we decode again; since "Q" was encoded
* alongside all non-ascii characters (as "QBfQ"), and the conversion
* will not generate "Q", the only instances of that letter should be our
* encoded characters. And since the conversion will not break words, the
* "Q...Q" should all still be in one piece.
*
* We're using "Q" as the delimiter because it's probably one of the
* rarest characters, and also because I can't think of any special behavior
* that would ever be triggered by this letter (to use a silly example, if we
* delimited with "H" on the left and "P" on the right, then "Ψ" would be
* encoded as "HTTP", which may cause special behavior). The latter would not
* actually be a huge issue for bold/italic, but may be if we later use it
* in other places as well.
* */
(function () {
var lettersThatJavaScriptDoesNotKnowAndQ = /[Q\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376-\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0523\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0621-\u064a\u0660-\u0669\u066e-\u066f\u0671-\u06d3\u06d5\u06e5-\u06e6\u06ee-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07c0-\u07ea\u07f4-\u07f5\u07fa\u0904-\u0939\u093d\u0950\u0958-\u0961\u0966-\u096f\u0971-\u0972\u097b-\u097f\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc-\u09dd\u09df-\u09e1\u09e6-\u09f1\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a66-\u0a6f\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0-\u0ae1\u0ae6-\u0aef\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b66-\u0b6f\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0be6-\u0bef\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58-\u0c59\u0c60-\u0c61\u0c66-\u0c6f\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0-\u0ce1\u0ce6-\u0cef\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d28\u0d2a-\u0d39\u0d3d\u0d60-\u0d61\u0d66-\u0d6f\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32-\u0e33\u0e40-\u0e46\u0e50-\u0e59\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0ed0-\u0ed9\u0edc-\u0edd\u0f00\u0f20-\u0f29\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f-\u1049\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070\u1075-\u1081\u108e\u1090-\u1099\u10a0-\u10c5\u10d0-\u10fa\u10fc\u1100-\u1159\u115f-\u11a2\u11a8-\u11f9\u1200-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u17e0-\u17e9\u1810-\u1819\u1820-\u1877\u1880-\u18a8\u18aa\u1900-\u191c\u1946-\u196d\u1970-\u1974\u1980-\u19a9\u19c1-\u19c7\u19d0-\u19d9\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b50-\u1b59\u1b83-\u1ba0\u1bae-\u1bb9\u1c00-\u1c23\u1c40-\u1c49\u1c4d-\u1c7d\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u203f-\u2040\u2054\u2071\u207f\u2090-\u2094\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2183-\u2184\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2c6f\u2c71-\u2c7d\u2c80-\u2ce4\u2d00-\u2d25\u2d30-\u2d65\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3006\u3031-\u3035\u303b-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fc3\ua000-\ua48c\ua500-\ua60c\ua610-\ua62b\ua640-\ua65f\ua662-\ua66e\ua67f-\ua697\ua717-\ua71f\ua722-\ua788\ua78b-\ua78c\ua7fb-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8d0-\ua8d9\ua900-\ua925\ua930-\ua946\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa50-\uaa59\uac00-\ud7a3\uf900-\ufa2d\ufa30-\ufa6a\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe33-\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]/g;
var cp_Q = "Q".charCodeAt(0);
var cp_A = "A".charCodeAt(0);
var cp_Z = "Z".charCodeAt(0);
var dist_Za = "a".charCodeAt(0) - cp_Z - 1;
asciify = function(text) {
return text.replace(lettersThatJavaScriptDoesNotKnowAndQ, function (m) {
var c = m.charCodeAt(0);
var s = "";
var v;
while (c > 0) {
v = (c % 51) + cp_A;
if (v >= cp_Q)
v++;
if (v > cp_Z)
v += dist_Za;
s = String.fromCharCode(v) + s;
c = c / 51 | 0;
}
return "Q" + s + "Q";
})
};
deasciify = function(text) {
return text.replace(/Q([A-PR-Za-z]{1,3})Q/g, function (m, s) {
var c = 0;
var v;
for (var i = 0; i < s.length; i++) {
v = s.charCodeAt(i);
if (v > cp_Z)
v -= dist_Za;
if (v > cp_Q)
v--;
v -= cp_A;
c = (c * 51) + v;
}
return String.fromCharCode(c);
})
}
})();
}
this.makeHtml = function (text) {
@@ -227,7 +313,7 @@ else
/*
text = text.replace(/
^[ ]{0,3}\[(.+)\]: // id = $1 attacklab: g_tab_width - 1
^[ ]{0,3}\[([^\[\]]+)\]: // id = $1 attacklab: g_tab_width - 1
[ \t]*
\n? // maybe *one* newline
[ \t]*
@@ -248,7 +334,7 @@ else
/gm, function(){...});
*/
text = text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,
text = text.replace(/^[ ]{0,3}\[([^\[\]]+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,
function (wholeMatch, m1, m2, m3, m4, m5) {
m1 = m1.toLowerCase();
g_urls.set(m1, _EncodeAmpsAndAngles(m2)); // Link IDs are case-insensitive
@@ -307,7 +393,7 @@ else
) // attacklab: there are sentinel newlines at end of document
/gm,function(){...}};
*/
text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm, hashElement);
text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm, hashMatch);
//
// Now match more liberally, simply from `\n<tag>` to `</tag>\n`
@@ -327,7 +413,7 @@ else
) // attacklab: there are sentinel newlines at end of document
/gm,function(){...}};
*/
text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm, hashElement);
text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm, hashMatch);
// Special case just for <hr />. It was easier to make a special case than
// to make the other regex more complicated.
@@ -344,9 +430,9 @@ else
[ \t]*
(?=\n{2,}) // followed by a blank line
)
/g,hashElement);
/g,hashMatch);
*/
text = text.replace(/\n[ ]{0,3}((<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, hashElement);
text = text.replace(/\n[ ]{0,3}((<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, hashMatch);
// Special case for standalone HTML comments:
@@ -356,14 +442,14 @@ else
[ ]{0,3} // attacklab: g_tab_width - 1
( // save in $1
<!
(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--) // see http://www.w3.org/TR/html-markup/syntax.html#comments and http://meta.stackoverflow.com/q/95256
(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--) // see http://www.w3.org/TR/html-markup/syntax.html#comments and http://meta.stackexchange.com/q/95256
>
[ \t]*
(?=\n{2,}) // followed by a blank line
)
/g,hashElement);
/g,hashMatch);
*/
text = text.replace(/\n\n[ ]{0,3}(<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>[ \t]*(?=\n{2,}))/g, hashElement);
text = text.replace(/\n\n[ ]{0,3}(<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>[ \t]*(?=\n{2,}))/g, hashMatch);
// PHP and ASP-style processor instructions (<?...?> and <%...%>)
@@ -382,26 +468,21 @@ else
[ \t]*
(?=\n{2,}) // followed by a blank line
)
/g,hashElement);
/g,hashMatch);
*/
text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, hashElement);
text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, hashMatch);
return text;
}
function hashElement(wholeMatch, m1) {
var blockText = m1;
// Undo double lines
blockText = blockText.replace(/^\n+/, "");
// strip trailing blank lines
blockText = blockText.replace(/\n+$/g, "");
function hashBlock(text) {
text = text.replace(/(^\n+|\n+$)/g, "");
// Replace the element text with a marker ("~KxK" where x is its key)
blockText = "\n\n~K" + (g_html_blocks.push(blockText) - 1) + "K\n\n";
return "\n\n~K" + (g_html_blocks.push(text) - 1) + "K\n\n";
}
return blockText;
function hashMatch(wholeMatch, m1) {
return hashBlock(m1);
}
var blockGamutHookCallback = function (t) { return _RunBlockGamut(t); }
@@ -488,7 +569,7 @@ else
text = text.replace(regex, function (wholeMatch) {
var tag = wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`");
tag = escapeCharacters(tag, wholeMatch.charAt(1) == "!" ? "\\`*_/" : "\\`*_"); // also escape slashes in comments to prevent autolinking there -- http://meta.stackoverflow.com/questions/95987
tag = escapeCharacters(tag, wholeMatch.charAt(1) == "!" ? "\\`*_/" : "\\`*_"); // also escape slashes in comments to prevent autolinking there -- http://meta.stackexchange.com/questions/95987
return tag;
});
@@ -997,11 +1078,6 @@ else
return text;
}
function hashBlock(text) {
text = text.replace(/(^\n+|\n+$)/g, "");
return "\n\n~K" + (g_html_blocks.push(text) - 1) + "K\n\n";
}
function _DoCodeSpans(text) {
//
// * Backtick quotes are used for <code></code> spans.
@@ -1030,8 +1106,9 @@ else
/*
text = text.replace(/
(^|[^\\]) // Character before opening ` can't be a backslash
(^|[^\\`]) // Character before opening ` can't be a backslash or backtick
(`+) // $2 = Opening run of `
(?!`) // and no more backticks -- match the full run
( // $3 = The code block
[^\r]*?
[^`] // attacklab: work around lack of lookbehind
@@ -1041,7 +1118,7 @@ else
/gm, function(){...});
*/
text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
text = text.replace(/(^|[^\\`])(`+)(?!`)([^\r]*?[^`])\2(?!`)/gm,
function (wholeMatch, m1, m2, m3, m4) {
var c = m3;
c = c.replace(/^([ \t]*)/g, ""); // leading whitespace
@@ -1087,14 +1164,38 @@ else
function _DoItalicsAndBold(text) {
text = asciify(text);
// <strong> must go first:
text = text.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g,
"$1<strong>$3</strong>$4");
// (^|[\W_]) Start with a non-letter or beginning of string. Store in \1.
// (?:(?!\1)|(?=^)) Either the next character is *not* the same as the previous,
// or we started at the end of the string (in which case the previous
// group had zero width, so we're still there). Because the next
// character is the marker, this means that if there are e.g. multiple
// underscores in a row, we can only match the left-most ones (which
// prevents foo___bar__ from getting bolded)
// (\*|_) The marker character itself, asterisk or underscore. Store in \2.
// \2 The marker again, since bold needs two.
// (?=\S) The first bolded character cannot be a space.
// ([^\r]*?\S) The actual bolded string. At least one character, and it cannot *end*
// with a space either. Note that like in many other places, [^\r] is
// just a workaround for JS' lack of single-line regexes; it's equivalent
// to a . in an /s regex, because the string cannot contain any \r (they
// are removed in the normalizing step).
// \2\2 The marker character, twice -- end of bold.
// (?!\2) Not followed by another marker character (ensuring that we match the
// rightmost two in a longer row)...
// (?=[\W_]|$) ...but by any other non-word character or the end of string.
text = text.replace(/(^|[\W_])(?:(?!\1)|(?=^))(\*|_)\2(?=\S)([^\r]*?\S)\2\2(?!\2)(?=[\W_]|$)/g,
"$1<strong>$3</strong>");
text = text.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g,
"$1<em>$3</em>$4");
// This is almost identical to the <strong> regex, except 1) there's obviously just one marker
// character, and 2) the italicized string cannot contain the marker character.
text = text.replace(/(^|[\W_])(?:(?!\1)|(?=^))(\*|_)(?=\S)((?:(?!\2)[^\r])*?\S)\2(?!\2)(?=[\W_]|$)/g,
"$1<em>$3</em>");
return text;
return deasciify(text);
}
function _DoBlockQuotes(text) {
@@ -1286,7 +1387,13 @@ else
// autolink anything like <http://example.com>
var replacer = function (wholematch, m1) { return "<a href=\"" + m1 + "\">" + pluginHooks.plainLinkText(m1) + "</a>"; }
var replacer = function (wholematch, m1) {
var url = encodeProblemUrlChars(m1);
url = escapeCharacters(url, "*_");
return "<a href=\"" + url + "\">" + pluginHooks.plainLinkText(m1) + "</a>";
};
text = text.replace(/<((https?|ftp):[^'">\s]+)>/gi, replacer);
// Email addresses: <address@domain.foo>
@@ -1409,4 +1516,4 @@ else
}; // end of the Markdown.Converter constructor
})();
})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -232,7 +232,7 @@
var regexText;
var replacementText;
// chrome bug ... documented at: http://meta.stackoverflow.com/questions/63307/blockquote-glitch-in-editor-in-chrome-6-and-7/65985#65985
// chrome bug ... documented at: http://meta.stackexchange.com/questions/63307/blockquote-glitch-in-editor-in-chrome-6-and-7/65985#65985
if (navigator.userAgent.match(/Chrome/)) {
"X".match(/()./);
}
@@ -1079,7 +1079,9 @@
var checkEscape = function (key) {
var code = (key.charCode || key.keyCode);
if (code === 27) {
if (key.stopPropagation) key.stopPropagation();
close(true);
return false;
}
};
@@ -1087,7 +1089,7 @@
// isCancel is true if we don't care about the input text.
// isCancel is false if we are going to keep the text.
var close = function (isCancel) {
util.removeEvent(doc.body, "keydown", checkEscape);
util.removeEvent(doc.body, "keyup", checkEscape);
var text = input.value;
if (isCancel) {
@@ -1171,7 +1173,7 @@
form.appendChild(okButton);
form.appendChild(cancelButton);
util.addEvent(doc.body, "keydown", checkEscape);
util.addEvent(doc.body, "keyup", checkEscape);
dialog.style.top = "50%";
dialog.style.left = "50%";
dialog.style.display = "block";
@@ -1686,14 +1688,39 @@
// sure the URL and the optinal title are "nice".
function properlyEncoded(linkdef) {
return linkdef.replace(/^\s*(.*?)(?:\s+"(.+)")?\s*$/, function (wholematch, link, title) {
link = link.replace(/\?.*$/, function (querypart) {
return querypart.replace(/\+/g, " "); // in the query string, a plus and a space are identical
});
link = decodeURIComponent(link); // unencode first, to prevent double encoding
link = encodeURI(link).replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29');
link = link.replace(/\?.*$/, function (querypart) {
return querypart.replace(/\+/g, "%2b"); // since we replaced plus with spaces in the query part, all pluses that now appear where originally encoded
});
var inQueryString = false;
// The last alternative, `[^\w\d-./]`, is just a shortcut that lets us skip
// the most common characters in URLs. Replacing it with `.` would not change
// the result, because encodeURI returns those characters unchanged, but it
// would mean lots of unnecessary replacement calls
link = link.replace(/%(?:[\da-fA-F]{2})|\?|\+|[^\w\d-./]/g, function (match) {
// Valid percent encoding. Could just return it as is, but we follow RFC3986
// Section 2.1 which says "For consistency, URI producers and normalizers
// should use uppercase hexadecimal digits for all percent-encodings."
// Note that we also handle (illegal) stand-alone percent characters by
// replacing them with "%25"
if (match.length === 3 && match.charAt(0) == "%") {
return match.toUpperCase();
}
switch (match) {
case "?":
inQueryString = true;
return "?";
break;
// In the query string, a plus and a space are identical -- normalize.
// Not strictly necessary, but identical behavior to the previous version
// of this function.
case "+":
if (inQueryString)
return "%20";
break;
}
return encodeURI(match);
})
if (title) {
title = title.trim ? title.trim() : title.replace(/^\s*/, "").replace(/\s*$/, "");
title = title.replace(/"/g, "quot;").replace(/\(/g, "&#40;").replace(/\)/g, "&#41;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -1874,7 +1901,7 @@
//
// Since this is essentially a backwards-moving regex, it's susceptible to
// catstrophic backtracking and can cause the browser to hang;
// see e.g. http://meta.stackoverflow.com/questions/9807.
// see e.g. http://meta.stackexchange.com/questions/9807.
//
// Hence we replaced this by a simple state machine that just goes through the
// lines and checks for a), b), and c).

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,4 @@
(function(){function i(n){return n.replace(/<[^>]*>?/gi,e)}function e(n){return n.match(r)||n.match(u)||n.match(f)?n:""}function o(n){var i,t;if(n=="")return"";var s=/<\/?\w+[^>]*(\s|$|>)/g,r=n.toLowerCase().match(s),f=(r||[]).length;if(f==0)return n;var e,h,u,o=[],c=[],l=!1;for(t=0;t<f;t++)if(e=r[t].replace(/<\/?(\w+).*/,"$1"),!o[t]&&!("<p><img><br><li><hr>".search("<"+e+">")>-1)){if(h=r[t],u=-1,!/^<\//.test(h))for(i=t+1;i<f;i++)if(!o[i]&&r[i]=="<\/"+e+">"){u=i;break}u==-1?l=c[t]=!0:o[u]=!0}return l?(t=0,n.replace(s,function(n){var i=c[t]?"":n;return t++,i})):n}var n,t;typeof exports=="object"&&typeof require=="function"?(n=exports,t=require("./Markdown.Converter").Converter):(n=window.Markdown,t=n.Converter),n.getSanitizingConverter=function(){var n=new t;return n.hooks.chain("postConversion",i),n.hooks.chain("postConversion",o),n};var r=/^(<\/?(b|blockquote|code|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|pre|s|sup|sub|strong|strike|ul)>|<(br|hr)\s?\/?>)$/i,u=/^(<a\shref="((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\stitle="[^"<>]+")?\s?>|<\/a>)$/i,f=/^(<img\ssrc="(https?:\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\swidth="\d{1,3}")?(\sheight="\d{1,3}")?(\salt="[^"<>]*")?(\stitle="[^"<>]*")?\s?\/?>)$/i})();
//@ sourceMappingURL=Markdown.Sanitizer.min.js.map
(function(){function i(n){return n.replace(/<[^>]*>?/gi,e)}function e(n){return n.match(r)||n.match(u)||n.match(f)?n:""}function o(n){var i,t;if(n=="")return"";var s=/<\/?\w+[^>]*(\s|$|>)/g,r=n.toLowerCase().match(s),f=(r||[]).length;if(f==0)return n;var e,h,u,o=[],c=[],l=!1;for(t=0;t<f;t++)if(e=r[t].replace(/<\/?(\w+).*/,"$1"),!o[t]&&!("<p><img><br><li><hr>".search("<"+e+">")>-1)){if(h=r[t],u=-1,!/^<\//.test(h))for(i=t+1;i<f;i++)if(!o[i]&&r[i]=="<\/"+e+">"){u=i;break}u==-1?l=c[t]=!0:o[u]=!0}return l?(t=0,n.replace(s,function(n){var i=c[t]?"":n;return t++,i})):n}var n,t;typeof exports=="object"&&typeof require=="function"?(n=exports,t=require("./Markdown.Converter").Converter):(n=window.Markdown,t=n.Converter);n.getSanitizingConverter=function(){var n=new t;return n.hooks.chain("postConversion",i),n.hooks.chain("postConversion",o),n};var r=/^(<\/?(b|blockquote|code|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|pre|s|sup|sub|strong|strike|ul)>|<(br|hr)\s?\/?>)$/i,u=/^(<a\shref="((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\stitle="[^"<>]+")?\s?>|<\/a>)$/i,f=/^(<img\ssrc="(https?:\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\swidth="\d{1,3}")?(\sheight="\d{1,3}")?(\salt="[^"<>]*")?(\stitle="[^"<>]*")?\s?\/?>)$/i})();
/*
//# sourceMappingURL=Markdown.Sanitizer.min.js.map
*/

View File

@@ -2,7 +2,7 @@
"version":3,
"file":"Markdown.Sanitizer.min.js",
"lineCount":1,
"mappings":"CAAC,QAAS,CAAA,CAAG,CAiBTA,SAASA,CAAY,CAACC,CAAD,CAAO,CACxB,OAAOA,CAAIC,QAAQ,CAAC,YAAY,CAAEC,CAAf,CADK,CAY5BA,SAASA,CAAW,CAACC,CAAD,CAAM,CACtB,OAAIA,CAAGC,MAAM,CAACC,CAAD,CAAsB,EAAGF,CAAGC,MAAM,CAACE,CAAD,CAAU,EAAGH,CAAGC,MAAM,CAACG,CAAD,C,CAC1DJ,C,CAEA,EAJW,CAe1BK,SAASA,CAAW,CAACR,CAAD,CAAO,CAuBlB,IAaYS,EAmBbC,C,CArDJ,GAAIV,CAAK,EAAG,GACR,MAAO,EAAE,CAEb,IAAIW,EAAK,wBAGLC,EAAOZ,CAAIa,YAAY,CAAA,CAAET,MAAM,CAACO,CAAD,EAG/BG,EAAW,CAACF,CAAK,EAAG,CAAA,CAAT,CAAYG,OANK,CAOhC,GAAID,CAAS,EAAG,EACZ,OAAOd,CAAI,CAEf,IAAIgB,EAASb,EAETC,EACAa,EAAY,CAAA,EACZC,EAAY,CAAA,EACZC,EAAe,CAAA,CALH,CAQhB,IAAST,CAAK,CAAE,CAAC,CAAEA,CAAK,CAAEI,CAAQ,CAAEJ,CAAI,EAAxC,CAII,GAHAM,CAAQ,CAAEJ,CAAK,CAAAF,CAAA,CAAKT,QAAQ,CAAC,aAAa,CAAE,IAAhB,CAAqB,CAG7C,CAAAgB,CAAU,CAAAP,CAAA,CAAM,EAAG,EAXT,sBAWoBU,OAAO,CAAC,GAAI,CAAEJ,CAAQ,CAAE,GAAjB,CAAsB,CAAE,IAC7D,CAKJ,GAHAb,CAAI,CAAES,CAAK,CAAAF,CAAA,CAAK,CAChBN,CAAM,CAAE,EAAE,CAEN,CAAC,MAAMiB,KAAK,CAAClB,CAAD,EAGZ,IAASM,CAAK,CAAEC,CAAK,CAAE,CAAC,CAAED,CAAK,CAAEK,CAAQ,CAAEL,CAAI,EAA/C,CACI,GAAI,CAACQ,CAAU,CAAAR,CAAA,CAAM,EAAGG,CAAK,CAAAH,CAAA,CAAM,EAAG,KAAK,CAAEO,CAAQ,CAAE,IAAK,CACxDZ,CAAM,CAAEK,CAAI,CACZ,KAFwD,CAOhEL,CAAM,EAAG,EAAb,CACIe,CAAa,CAAED,CAAU,CAAAR,CAAA,CAAM,CAAE,CAAA,CADrC,CAGIO,CAAU,CAAAb,CAAA,CAAO,CAAE,CAAA,CAnBnB,CAiCR,OAXKe,C,EA3BIT,CAgCA,CAAE,C,CACJV,CAAIC,QAAQ,CAACU,CAAE,CAAE,QAAS,CAACP,CAAD,CAAQ,CACrC,IAAIkB,EAAMJ,CAAU,CAAAR,CAAA,CAAM,CAAE,EAAG,CAAEN,CAAK,CAEtC,OADAM,CAAI,EAAE,CACCY,CAH8B,CAAtB,E,CALRtB,CAnDY,CA3C3B,IAAIuB,EAAQC,CAAS,CACjB,OAAOC,OAAQ,EAAI,QAAS,EAAG,OAAOC,OAAQ,EAAI,UAAtD,EACIH,CAAO,CAAEE,OAAO,CAChBD,CAAU,CAAEE,OAAO,CAAC,sBAAD,CAAwBF,WAF/C,EAIID,CAAO,CAAEI,MAAMC,SAAS,CACxBJ,CAAU,CAAED,CAAMC,W,CAGtBD,CAAMM,uBAAwB,CAAEC,QAAS,CAAA,CAAG,CACxC,IAAIC,EAAY,IAAIP,CAAW,CAG/B,OAFAO,CAASC,MAAMC,MAAM,CAAC,gBAAgB,CAAElC,CAAnB,CAAgC,CACrDgC,CAASC,MAAMC,MAAM,CAAC,gBAAgB,CAAEzB,CAAnB,CAA+B,CAC7CuB,CAJiC,C,CAY5C,IAAI1B,EAAsB,sHAEtBC,EAAU,yGAGVC,EAAY,2JA3BP,EA2GX,CAAA,CAAE",
"mappings":"CAAC,QAAS,CAAA,CAAG,CAiBTA,SAASA,CAAY,CAACC,CAAD,CAAO,CACxB,OAAOA,CAAIC,QAAQ,CAAa,YAAA,CAAEC,CAAf,CADK,CAY5BA,SAASA,CAAW,CAACC,CAAD,CAAM,CACtB,OAAIA,CAAGC,MAAM,CAACC,CAAD,CAAsB,EAAGF,CAAGC,MAAM,CAACE,CAAD,CAAU,EAAGH,CAAGC,MAAM,CAACG,CAAD,CAAjE,CACOJ,CADP,CAGO,EAJW,CAe1BK,SAASA,CAAW,CAACR,CAAD,CAAO,CAuBlB,IAaYS,EAmBbC,C,CArDJ,GAAIV,CAAK,EAAG,GACR,MAAO,EAAE,CAEb,IAAIW,EAA4B,wBAG5BC,EAAOZ,CAAIa,YAAY,CAAA,CAAET,MAAM,CAACO,CAAD,EAG/BG,EAAW,CAACF,CAAK,EAAG,CAAA,CAAT,CAAYG,OANK,CAOhC,GAAID,CAAS,EAAG,EACZ,OAAOd,CAAI,CAEf,IAAIgB,EAASb,EAETC,EACAa,EAAY,CAAA,EACZC,EAAY,CAAA,EACZC,EAAe,CAAA,CALH,CAQhB,IAAST,CAAK,CAAE,CAAC,CAAEA,CAAK,CAAEI,CAAQ,CAAEJ,CAAI,EAAxC,CAII,GAHAM,CAAQ,CAAEJ,CAAK,CAAAF,CAAA,CAAKT,QAAQ,CAAc,aAAA,CAAE,IAAhB,CAAqB,CAG7C,CAAAgB,CAAU,CAAAP,CAAA,CAAM,EAAG,EAXT,sBAWoBU,OAAO,CAAC,GAAI,CAAEJ,CAAQ,CAAE,GAAjB,CAAsB,CAAE,IAC7D,CAKJ,GAHAb,CAAI,CAAES,CAAK,CAAAF,CAAA,CAAK,CAChBN,CAAM,CAAE,EAAE,CAEN,CAAO,MAAAiB,KAAK,CAAClB,CAAD,EAGZ,IAASM,CAAK,CAAEC,CAAK,CAAE,CAAC,CAAED,CAAK,CAAEK,CAAQ,CAAEL,CAAI,EAA/C,CACI,GAAI,CAACQ,CAAU,CAAAR,CAAA,CAAM,EAAGG,CAAK,CAAAH,CAAA,CAAM,EAAG,KAAK,CAAEO,CAAQ,CAAE,IAAK,CACxDZ,CAAM,CAAEK,CAAI,CACZ,KAFwD,CAOhEL,CAAM,EAAG,EAAb,CACIe,CAAa,CAAED,CAAU,CAAAR,CAAA,CAAM,CAAE,CAAA,CADrC,CAGIO,CAAU,CAAAb,CAAA,CAAO,CAAE,CAAA,CAnBnB,CAiCR,OAXKe,CAAD,EAKAT,CAAK,CAAE,C,CACJV,CAAIC,QAAQ,CAACU,CAAE,CAAE,QAAS,CAACP,CAAD,CAAQ,CACrC,IAAIkB,EAAMJ,CAAU,CAAAR,CAAA,CAAM,CAAE,EAAG,CAAEN,CAAK,CAEtC,OADAM,CAAI,EAAE,CACCY,CAH8B,CAAtB,EANf,CACOtB,CAnDY,CA3C3B,IAAIuB,EAAQC,CAAS,CACjB,OAAOC,OAAQ,EAAI,QAAS,EAAG,OAAOC,OAAQ,EAAI,UAAtD,EACIH,CAAO,CAAEE,OAAO,CAChBD,CAAU,CAAEE,OAAO,CAAC,sBAAD,CAAwBF,WAF/C,EAIID,CAAO,CAAEI,MAAMC,SAAS,CACxBJ,CAAU,CAAED,CAAMC,W,CAGtBD,CAAMM,uBAAwB,CAAEC,QAAS,CAAA,CAAG,CACxC,IAAIC,EAAY,IAAIP,CAAW,CAG/B,OAFAO,CAASC,MAAMC,MAAM,CAAC,gBAAgB,CAAElC,CAAnB,CAAgC,CACrDgC,CAASC,MAAMC,MAAM,CAAC,gBAAgB,CAAEzB,CAAnB,CAA+B,CAC7CuB,CAJiC,C,CAY5C,IAAI1B,EAA2I,sHAE3IC,EAAkH,yGAGlHC,EAAuK,2JA3BlK,EA2GX,CAAA,CAAE",
"sources":["Markdown.Sanitizer.js"],
"names":["sanitizeHtml","html","replace","sanitizeTag","tag","match","basic_tag_whitelist","a_white","img_white","balanceTags","ntag","ctag","re","tags","toLowerCase","tagcount","length","tagname","tagpaired","tagremove","needsRemoval","search","test","res","output","Converter","exports","require","window","Markdown","getSanitizingConverter","output.getSanitizingConverter","converter","hooks","chain"]
}

View File

@@ -23,6 +23,10 @@ namespace Orchard.Azure.Services.FileSystems.Media {
public bool TrySaveStream(string path, Stream inputStream) {
try {
if (FileExists(path)) {
return false;
}
SaveStream(path, inputStream);
}
catch {

View File

@@ -1,5 +1,5 @@
namespace Orchard.ContentTypes.Extensions {
public static class StrinExtensions {
public static class StringExtensions {
public static string TrimEnd(this string rough, string trim = "") {
if (rough == null)
return null;

View File

@@ -65,6 +65,7 @@ namespace Orchard.CustomForms.Drivers {
IfNotNull(context.Attribute(part.PartDefinition.Name, "Message"), x => part.Record.Message = x);
IfNotNull(context.Attribute(part.PartDefinition.Name, "Redirect"), x => part.Record.Redirect = Boolean.Parse(x));
IfNotNull(context.Attribute(part.PartDefinition.Name, "RedirectUrl"), x => part.Record.RedirectUrl = x);
IfNotNull(context.Attribute(part.PartDefinition.Name, "SubmitButtonText"), x => part.Record.SubmitButtonText = x);
}
private static void IfNotNull<T>(T value, Action<T> then) {
@@ -80,6 +81,7 @@ namespace Orchard.CustomForms.Drivers {
context.Element(part.PartDefinition.Name).SetAttributeValue("Message", part.Record.Message);
context.Element(part.PartDefinition.Name).SetAttributeValue("Redirect", part.Record.Redirect);
context.Element(part.PartDefinition.Name).SetAttributeValue("RedirectUrl", part.Record.RedirectUrl);
context.Element(part.PartDefinition.Name).SetAttributeValue("SubmitButtonText", part.Record.SubmitButtonText);
}
}
}

View File

@@ -53,6 +53,12 @@ namespace Orchard.CustomForms {
return 3;
}
public int UpdateFrom3() {
SchemaBuilder.AlterTable("CustomFormPartRecord", table => table.AddColumn<string>("SubmitButtonText"));
return 4;
}
public void Uninstall() {
ContentDefinitionManager.DeleteTypeDefinition("CustomForm");
}

View File

@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.Core.Title.Models;
namespace Orchard.CustomForms.Models {
public class CustomFormPart : ContentPart<CustomFormPartRecord> {
@@ -36,6 +35,12 @@ namespace Orchard.CustomForms.Models {
set { Record.RedirectUrl = value; }
}
[Required]
public string SubmitButtonText {
get { return Record.SubmitButtonText; }
set { Record.SubmitButtonText = value; }
}
public string Title {
get { return this.As<ITitleAspect>().Title; }
}

View File

@@ -14,5 +14,7 @@ namespace Orchard.CustomForms.Models {
[StringLengthMax]
public virtual string RedirectUrl { get; set; }
public virtual bool Redirect { get; set; }
public virtual string SubmitButtonText { get; set; }
}
}

View File

@@ -31,6 +31,12 @@
</div>
</fieldset>
<fieldset>
@Html.LabelFor(m => m.CustomFormPart.SubmitButtonText)
@Html.TextBoxFor(m => m.CustomFormPart.SubmitButtonText, new { @class = "text large", @Value = (Model.CustomFormPart.SubmitButtonText ?? @T("Submit").Text) })
<span class="hint">@T("The text of the submit button.")</span>
</fieldset>
<fieldset>
@Html.EditorFor(m => m.CustomFormPart.Redirect)
<label for="@Html.FieldIdFor(m => m.CustomFormPart.Redirect)" class="forcheckbox">@T("Redirect the user once the form is submitted")</label>

View File

@@ -18,7 +18,7 @@
@Display(Model)
<fieldset class="submit-button">
<button type="submit" name="submit.Save" value="submit.Save">@T("Submit")</button>
<button type="submit" name="submit.Save" value="submit.Save">@Model.ContentItem.CustomFormPart.SubmitButtonText</button>
</fieldset>
}

View File

@@ -17,6 +17,6 @@
@Html.Hidden("returnUrl", Request.RawUrl);
<fieldset class="submit-button">
<button type="submit" name="submit.Save" value="submit.Save">@T("Submit")</button>
<button type="submit" name="submit.Save" value="submit.Save">@Model.ContentPart.SubmitButtonText</button>
</fieldset>
}

View File

@@ -1,5 +1,9 @@
(function ($) {
$(function () {
$(".available-extensions")
.find("label")
.expandoControl(function (controller) { return controller.next("div"); }, { collapse: false, remember: true });
$(".select-all").click(function () {
var $checkbox = $(this);
var $allCheckboxes = $checkbox.closest("ol").find(":checkbox");

View File

@@ -4,6 +4,7 @@
Layout.Title = T("Add New Tenant").ToString();
Script.Require("jQuery").AtFoot();
Script.Include(Url.Content("~/Themes/TheAdmin/Scripts/admin.js")).AtFoot();
Script.Include("multi-tenancy.admin.js").AtFoot();
}
@@ -54,9 +55,9 @@
</div>
</fieldset>
<fieldset>
<fieldset class="available-extensions">
<label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label>
<div>
<label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label>
<span class="hint">@T("Select the Themes which should be available for this tenant. If none is selected, they will all be available.")</span>
<ol>
@@ -81,9 +82,9 @@
</div>
</fieldset>
<fieldset>
<fieldset class="available-extensions">
<label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label>
<div>
<label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label>
<span class="hint">@T("Select the Modules which should be available for this tenant. If none is selected, they will all be available.")</span>
<ol>

View File

@@ -5,6 +5,7 @@
Layout.Title = T("Edit Tenant").ToString();
Script.Require("jQuery").AtFoot();
Script.Include(Url.Content("~/Themes/TheAdmin/Scripts/admin.js")).AtFoot();
Script.Include("multi-tenancy.admin.js").AtFoot();
}
@@ -55,9 +56,9 @@
</div>
</fieldset>
<fieldset>
<fieldset class="available-extensions">
<label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label>
<div>
<label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label>
<span class="hint">@T("Select the Themes which should be available for this tenant. If none is selected, they will all be available.")</span>
<ol>
@@ -82,9 +83,9 @@
</div>
</fieldset>
<fieldset>
<fieldset class="available-extensions">
<label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label>
<div>
<label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label>
<span class="hint">@T("Select the Modules which should be available for this tenant. If none is selected, they will all be available.")</span>
<ol>

View File

@@ -1,7 +1,7 @@
using Orchard.Localization;
using Orchard.UI.Navigation;
namespace Orchard.Core.Dashboard {
namespace Orchard.Pages {
public class AdminMenu : INavigationProvider {
public Localizer T { get; set; }
public string MenuName { get { return "admin"; } }

View File

@@ -135,7 +135,6 @@
<Content Include="Styles\menu.templates-admin.css" />
<Content Include="Styles\menu.templates.png" />
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
<Content Include="Scripts\Web.config" />
<Content Include="Styles\Web.config" />
<Content Include="Properties\AssemblyInfo.cs" />
@@ -166,8 +165,8 @@
<Compile Include="Handlers\ShapePartHandler.cs" />
<Compile Include="Drivers\ShapePartDriver.cs" />
<Compile Include="Models\ShapePart.cs" />
<Compile Include="Migrations.cs" />
<Compile Include="RazorMigrations.cs" />
<Compile Include="Migrations\Migrations.cs" />
<Compile Include="Migrations\RazorMigrations.cs" />
<Compile Include="Services\ITemplateProcessor.cs" />
<Compile Include="Services\ITemplateService.cs" />
<Compile Include="Services\NoTemplateProcessorBanner.cs" />
@@ -198,9 +197,7 @@
<ItemGroup>
<Content Include="Views\EditorTemplates\TemplateProcessorPicker.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Tokens\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Views\DefinitionTemplates\Parts.Shape.cshtml" />
</ItemGroup>

View File

@@ -1,14 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />

View File

@@ -1,14 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />

View File

@@ -1,41 +0,0 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
</httpHandlers>
<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<controls>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<remove name="host"/>
<remove name="pages"/>
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc"/>
@@ -23,24 +23,15 @@
</namespaces>
</pages>
</system.web.webPages.razor>
<!--
For a description of web.config changes for .NET 4.5 see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.5" />
</system.Web>
-->
<system.web>
<compilation targetFramework="4.5">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="4.0"/>
</system.web>
</configuration>

View File

@@ -4,7 +4,7 @@ namespace TinyMce {
public class ResourceManifest : IResourceManifestProvider {
public void BuildManifests(ResourceManifestBuilder builder) {
var manifest = builder.Add();
manifest.DefineScript("TinyMce").SetUrl("tinymce.min.js").SetVersion("4.1.1").SetDependencies("jQuery");
manifest.DefineScript("TinyMce").SetUrl("tinymce.min.js").SetVersion("4.1.2").SetDependencies("jQuery");
manifest.DefineScript("OrchardTinyMce").SetUrl("orchard-tinymce.js").SetDependencies("TinyMce");
}
}

View File

@@ -1 +1 @@
tinymce.PluginManager.add("autoresize",function(e){function t(){return e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()}function i(n){var s,r,g,u,l,m,h,d,f=tinymce.DOM;if(r=e.getDoc()){if(g=r.body,u=r.documentElement,l=o.autoresize_min_height,!g||n&&"setcontent"===n.type&&n.initial||t())return void(g&&u&&(g.style.overflowY="auto",u.style.overflowY="auto"));h=e.dom.getStyle(g,"margin-top",!0),d=e.dom.getStyle(g,"margin-bottom",!0),m=g.offsetHeight+parseInt(h,10)+parseInt(d,10),(isNaN(m)||0>=m)&&(m=tinymce.Env.ie?g.scrollHeight:tinymce.Env.webkit&&0===g.clientHeight?0:g.offsetHeight),m>o.autoresize_min_height&&(l=m),o.autoresize_max_height&&m>o.autoresize_max_height?(l=o.autoresize_max_height,g.style.overflowY="auto",u.style.overflowY="auto"):(g.style.overflowY="hidden",u.style.overflowY="hidden",g.scrollTop=0),l!==a&&(s=l-a,f.setStyle(f.get(e.id+"_ifr"),"height",l+"px"),a=l,tinymce.isWebKit&&0>s&&i(n))}}function n(e,t,o){setTimeout(function(){i({}),e--?n(e,t,o):o&&o()},t)}var o=e.settings,a=0;e.settings.inline||(o.autoresize_min_height=parseInt(e.getParam("autoresize_min_height",e.getElement().offsetHeight),10),o.autoresize_max_height=parseInt(e.getParam("autoresize_max_height",0),10),e.on("init",function(){var t=e.getParam("autoresize_overflow_padding",1);e.dom.setStyles(e.getBody(),{paddingBottom:e.getParam("autoresize_bottom_margin",50),paddingLeft:t,paddingRight:t})}),e.on("nodechange setcontent keyup FullscreenStateChanged",i),e.getParam("autoresize_on_init",!0)&&e.on("init",function(){n(20,100,function(){n(5,1e3)})}),e.addCommand("mceAutoResize",i))});
tinymce.PluginManager.add("autoresize",function(e){function t(){return e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()}function i(o){var r,s,g,m,l,d,u,h,f,c,_,p,y=tinymce.DOM;if(s=e.getDoc()){if(g=s.body,m=s.documentElement,l=n.autoresize_min_height,!g||o&&"setcontent"===o.type&&o.initial||t())return void(g&&m&&(g.style.overflowY="auto",m.style.overflowY="auto"));u=e.dom.getStyle(g,"margin-top",!0),h=e.dom.getStyle(g,"margin-bottom",!0),f=e.dom.getStyle(g,"padding-top",!0),c=e.dom.getStyle(g,"padding-bottom",!0),_=e.dom.getStyle(g,"border-top-width",!0),p=e.dom.getStyle(g,"border-bottom-width",!0),d=g.offsetHeight+parseInt(u,10)+parseInt(h,10)+parseInt(f,10)+parseInt(c,10)+parseInt(_,10)+parseInt(p,10),(isNaN(d)||0>=d)&&(d=tinymce.Env.ie?g.scrollHeight:tinymce.Env.webkit&&0===g.clientHeight?0:g.offsetHeight),d>n.autoresize_min_height&&(l=d),n.autoresize_max_height&&d>n.autoresize_max_height?(l=n.autoresize_max_height,g.style.overflowY="auto",m.style.overflowY="auto"):(g.style.overflowY="hidden",m.style.overflowY="hidden",g.scrollTop=0),l!==a&&(r=l-a,y.setStyle(e.iframeElement,"height",l+"px"),a=l,tinymce.isWebKit&&0>r&&i(o))}}function o(e,t,n){setTimeout(function(){i({}),e--?o(e,t,n):n&&n()},t)}var n=e.settings,a=0;e.settings.inline||(n.autoresize_min_height=parseInt(e.getParam("autoresize_min_height",e.getElement().offsetHeight),10),n.autoresize_max_height=parseInt(e.getParam("autoresize_max_height",0),10),e.on("init",function(){var t=e.getParam("autoresize_overflow_padding",1);e.dom.setStyles(e.getBody(),{paddingBottom:e.getParam("autoresize_bottom_margin",50),paddingLeft:t,paddingRight:t})}),e.on("nodechange setcontent keyup FullscreenStateChanged",i),e.getParam("autoresize_on_init",!0)&&e.on("init",function(){o(20,100,function(){o(5,1e3)})}),e.addCommand("mceAutoResize",i))});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -76,7 +76,10 @@ namespace Orchard.ContentManagement.Drivers {
return editor;
}
if ((editor.GetGroup() ?? string.Empty) != (context.GroupId ?? string.Empty)) {
var editorGroup = editor.GetGroup() ?? "";
var contextGroup = context.GroupId ?? "";
if (!String.Equals(editorGroup, contextGroup, StringComparison.OrdinalIgnoreCase)) {
return editor;
}
}

View File

@@ -18,7 +18,7 @@ namespace Orchard.Data.Migration.Interpreters {
private readonly ShellSettings _shellSettings;
private readonly ISessionLocator _sessionLocator;
private readonly IEnumerable<ICommandInterpreter> _commandInterpreters;
private readonly Dialect _dialect;
private readonly Lazy<Dialect> _dialectLazy;
private readonly List<string> _sqlStatements;
private readonly ISessionFactoryHolder _sessionFactoryHolder;
private readonly IReportsCoordinator _reportsCoordinator;
@@ -40,8 +40,7 @@ namespace Orchard.Data.Migration.Interpreters {
Logger = NullLogger.Instance;
T = NullLocalizer.Instance;
var configuration = _sessionFactoryHolder.GetConfiguration();
_dialect = Dialect.GetDialect(configuration.Properties);
_dialectLazy = new Lazy<Dialect>(() => Dialect.GetDialect(sessionFactoryHolder.GetConfiguration().Properties));
}
public ILogger Logger { get; set; }
@@ -59,9 +58,9 @@ namespace Orchard.Data.Migration.Interpreters {
var builder = new StringBuilder();
builder.Append(_dialect.CreateMultisetTableString)
builder.Append(_dialectLazy.Value.CreateMultisetTableString)
.Append(' ')
.Append(_dialect.QuoteForTableName(PrefixTableName(command.Name)))
.Append(_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.Name)))
.Append(" (");
var appendComma = false;
@@ -80,7 +79,7 @@ namespace Orchard.Data.Migration.Interpreters {
builder.Append(", ");
}
builder.Append(_dialect.PrimaryKeyString)
builder.Append(_dialectLazy.Value.PrimaryKeyString)
.Append(" ( ")
.Append(String.Join(", ", primaryKeys.ToArray()))
.Append(" )");
@@ -105,7 +104,7 @@ namespace Orchard.Data.Migration.Interpreters {
var builder = new StringBuilder();
builder.Append(_dialect.GetDropTableString(PrefixTableName(command.Name)));
builder.Append(_dialectLazy.Value.GetDropTableString(PrefixTableName(command.Name)));
_sqlStatements.Add(builder.ToString());
RunPendingStatements();
@@ -162,7 +161,7 @@ namespace Orchard.Data.Migration.Interpreters {
return;
}
builder.AppendFormat("alter table {0} add ", _dialect.QuoteForTableName(PrefixTableName(command.TableName)));
builder.AppendFormat("alter table {0} add ", _dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)));
Visit(builder, (CreateColumnCommand)command);
_sqlStatements.Add(builder.ToString());
@@ -174,8 +173,8 @@ namespace Orchard.Data.Migration.Interpreters {
}
builder.AppendFormat("alter table {0} drop column {1}",
_dialect.QuoteForTableName(PrefixTableName(command.TableName)),
_dialect.QuoteForColumnName(command.ColumnName));
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)),
_dialectLazy.Value.QuoteForColumnName(command.ColumnName));
_sqlStatements.Add(builder.ToString());
}
@@ -185,12 +184,12 @@ namespace Orchard.Data.Migration.Interpreters {
}
builder.AppendFormat("alter table {0} alter column {1} ",
_dialect.QuoteForTableName(PrefixTableName(command.TableName)),
_dialect.QuoteForColumnName(command.ColumnName));
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)),
_dialectLazy.Value.QuoteForColumnName(command.ColumnName));
// type
if (command.DbType != DbType.Object) {
builder.Append(GetTypeName(_dialect, command.DbType, command.Length, command.Precision, command.Scale));
builder.Append(GetTypeName(_dialectLazy.Value, command.DbType, command.Length, command.Precision, command.Scale));
}
else {
if(command.Length > 0 || command.Precision > 0 || command.Scale > 0) {
@@ -212,8 +211,8 @@ namespace Orchard.Data.Migration.Interpreters {
}
builder.AppendFormat("create index {1} on {0} ({2}) ",
_dialect.QuoteForTableName(PrefixTableName(command.TableName)),
_dialect.QuoteForColumnName(PrefixTableName(command.IndexName)),
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)),
_dialectLazy.Value.QuoteForColumnName(PrefixTableName(command.IndexName)),
String.Join(", ", command.ColumnNames));
_sqlStatements.Add(builder.ToString());
@@ -225,8 +224,8 @@ namespace Orchard.Data.Migration.Interpreters {
}
builder.AppendFormat("drop index {0} ON {1}",
_dialect.QuoteForColumnName(PrefixTableName(command.IndexName)),
_dialect.QuoteForTableName(PrefixTableName(command.TableName)));
_dialectLazy.Value.QuoteForColumnName(PrefixTableName(command.IndexName)),
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)));
_sqlStatements.Add(builder.ToString());
}
@@ -251,11 +250,11 @@ namespace Orchard.Data.Migration.Interpreters {
var builder = new StringBuilder();
builder.Append("alter table ")
.Append(_dialect.QuoteForTableName(PrefixTableName(command.SrcTable)));
.Append(_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.SrcTable)));
builder.Append(_dialect.GetAddForeignKeyConstraintString(PrefixTableName(command.Name),
builder.Append(_dialectLazy.Value.GetAddForeignKeyConstraintString(PrefixTableName(command.Name),
command.SrcColumns,
_dialect.QuoteForTableName(PrefixTableName(command.DestTable)),
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.DestTable)),
command.DestColumns,
false));
@@ -271,7 +270,7 @@ namespace Orchard.Data.Migration.Interpreters {
var builder = new StringBuilder();
builder.AppendFormat("alter table {0} drop constraint {1}", _dialect.QuoteForTableName(PrefixTableName(command.SrcTable)), PrefixTableName(command.Name));
builder.AppendFormat("alter table {0} drop constraint {1}", _dialectLazy.Value.QuoteForTableName(PrefixTableName(command.SrcTable)), PrefixTableName(command.Name));
_sqlStatements.Add(builder.ToString());
RunPendingStatements();
@@ -291,15 +290,15 @@ namespace Orchard.Data.Migration.Interpreters {
}
// name
builder.Append(_dialect.QuoteForColumnName(command.ColumnName)).Append(Space);
builder.Append(_dialectLazy.Value.QuoteForColumnName(command.ColumnName)).Append(Space);
if (!command.IsIdentity || _dialect.HasDataTypeInIdentityColumn) {
builder.Append(GetTypeName(_dialect, command.DbType, command.Length, command.Precision, command.Scale));
if (!command.IsIdentity || _dialectLazy.Value.HasDataTypeInIdentityColumn) {
builder.Append(GetTypeName(_dialectLazy.Value, command.DbType, command.Length, command.Precision, command.Scale));
}
// append identity if handled
if (command.IsIdentity && _dialect.SupportsIdentityColumns) {
builder.Append(Space).Append(_dialect.IdentityColumnString);
if (command.IsIdentity && _dialectLazy.Value.SupportsIdentityColumns) {
builder.Append(Space).Append(_dialectLazy.Value.IdentityColumnString);
}
// [default value]
@@ -311,11 +310,11 @@ namespace Orchard.Data.Migration.Interpreters {
builder.Append(command.IsNotNull
? " not null"
: !command.IsPrimaryKey && !command.IsUnique
? _dialect.NullColumnString
? _dialectLazy.Value.NullColumnString
: string.Empty);
// append unique if handled, otherwise at the end of the satement
if (command.IsUnique && _dialect.SupportsUnique) {
if (command.IsUnique && _dialectLazy.Value.SupportsUnique) {
builder.Append(" unique");
}

View File

@@ -1,4 +1,5 @@
using System.Data;
using System;
using System.Data;
using System.Text;
using NHibernate.Dialect;
using Orchard.Data.Migration.Schema;
@@ -7,7 +8,7 @@ using Orchard.Localization;
namespace Orchard.Data.Migration.Interpreters {
public class MySqlCommandInterpreter : ICommandInterpreter<AlterColumnCommand> {
private readonly Dialect _dialect;
private readonly Lazy<Dialect> _dialectLazy;
private readonly ShellSettings _shellSettings;
public MySqlCommandInterpreter() {
@@ -24,20 +25,19 @@ namespace Orchard.Data.Migration.Interpreters {
ShellSettings shellSettings,
ISessionFactoryHolder sessionFactoryHolder) {
_shellSettings = shellSettings;
var configuration = sessionFactoryHolder.GetConfiguration();
_dialect = Dialect.GetDialect(configuration.Properties);
_dialectLazy = new Lazy<Dialect>(() => Dialect.GetDialect(sessionFactoryHolder.GetConfiguration().Properties));
}
public string[] CreateStatements(AlterColumnCommand command) {
var builder = new StringBuilder();
builder.AppendFormat("alter table {0} modify column {1} ",
_dialect.QuoteForTableName(PrefixTableName(command.TableName)),
_dialect.QuoteForColumnName(command.ColumnName));
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)),
_dialectLazy.Value.QuoteForColumnName(command.ColumnName));
// type
if (command.DbType != DbType.Object) {
builder.Append(DefaultDataMigrationInterpreter.GetTypeName(_dialect, command.DbType, command.Length, command.Precision, command.Scale));
builder.Append(DefaultDataMigrationInterpreter.GetTypeName(_dialectLazy.Value, command.DbType, command.Length, command.Precision, command.Scale));
}
else {
if (command.Length > 0 || command.Precision > 0 || command.Scale > 0) {

View File

@@ -5,7 +5,7 @@ using Orchard.Environment.Configuration;
namespace Orchard.Data.Migration.Interpreters {
public class SqlCeCommandInterpreter : ICommandInterpreter<DropIndexCommand> {
private readonly Dialect _dialect;
private readonly Lazy<Dialect> _dialectLazy;
private readonly ShellSettings _shellSettings;
public string DataProvider {
@@ -16,15 +16,14 @@ namespace Orchard.Data.Migration.Interpreters {
ShellSettings shellSettings,
ISessionFactoryHolder sessionFactoryHolder) {
_shellSettings = shellSettings;
var configuration = sessionFactoryHolder.GetConfiguration();
_dialect = Dialect.GetDialect(configuration.Properties);
_dialectLazy = new Lazy<Dialect>(() => Dialect.GetDialect(sessionFactoryHolder.GetConfiguration().Properties));
}
public string[] CreateStatements(DropIndexCommand command) {
return new [] { String.Format("drop index {0}.{1}",
_dialect.QuoteForTableName(PrefixTableName(command.TableName)),
_dialect.QuoteForColumnName(PrefixTableName(command.IndexName)))
_dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)),
_dialectLazy.Value.QuoteForColumnName(PrefixTableName(command.IndexName)))
};
}

View File

@@ -168,6 +168,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
context.ViewContext.ViewData = new ViewDataDictionary(context.Value);
context.ViewContext.TempData = new TempDataDictionary();
context.ViewContext.View = viewResult.View;
viewResult.View.Render(context.ViewContext, sw);
viewResult.ViewEngine.ReleaseView(controllerContext, viewResult.View);
return new HtmlString(sw.GetStringBuilder().ToString());

View File

@@ -31,7 +31,10 @@ namespace Orchard.Environment {
public string Value { get; set; }
}
public readonly IDictionary<string, IEnumerable<PropertyEntry>> _config = new Dictionary<string, IEnumerable<PropertyEntry>>();
// Needs to be static so when the class is first instantiated from OrchardStarter with the config file it is filled and then it's also available
// when later used from shells. Since it's only written once and then not modified it can be a normal Dictionary even if reads are then concurrent
// (also see "Thread Safety": http://msdn.microsoft.com/en-us/library/xfhwa508.aspx)
public static readonly IDictionary<string, IEnumerable<PropertyEntry>> _config = new Dictionary<string, IEnumerable<PropertyEntry>>();
public HostComponentsConfigModule() {
// Called by the framework, as this class is a "Module"
@@ -72,14 +75,15 @@ namespace Orchard.Environment {
if (!_config.TryGetValue(implementationType.FullName, out properties))
return;
// build an array of actions on this type to assign loggers to member properties
// build an array of actions on this type to assign configurations to member properties
var injectors = BuildPropertiesInjectors(implementationType, properties).ToArray();
// if there are no logger properties, there's no reason to hook the activated event
// if there are no configurable properties, there's no reason to hook into the activated event
if (!injectors.Any())
return;
// otherwise, whan an instance of this component is activated, inject the loggers on the instance
// otherwise, when an instance of this component is activated, inject the loggers on the instance
registration.Activated += (s, e) => {
foreach (var injector in injectors)
injector(e.Context, e.Instance);

View File

@@ -298,6 +298,10 @@ namespace Orchard.FileSystems.Media {
/// <returns>True if success; False otherwise.</returns>
public bool TrySaveStream(string path, Stream inputStream) {
try {
if (FileExists(path)) {
return false;
}
SaveStream(path, inputStream);
}
catch {

View File

@@ -8,10 +8,12 @@ using Orchard.Security.Permissions;
namespace Orchard.UI.Navigation {
public class MenuItem {
private IList<string> _classes = new List<string>();
private IEnumerable<MenuItem> _items;
public MenuItem() {
Permissions = Enumerable.Empty<Permission>();
LinkToFirstChild = true;
Level = 1;
}
public LocalizedString Text { get; set; }
@@ -23,8 +25,19 @@ namespace Orchard.UI.Navigation {
public bool LocalNav { get; set; }
public string Culture { get; set; }
public bool Selected { get; set; }
public int Level { get; set; }
public RouteValueDictionary RouteValues { get; set; }
public IEnumerable<MenuItem> Items { get; set; }
public IEnumerable<MenuItem> Items {
get { return _items; }
set {
_items = value;
foreach (var item in _items) {
item.Level = Level + 1;
}
}
}
public IEnumerable<Permission> Permissions { get; set; }
public IContent Content { get; set; }
public IList<string> Classes {

View File

@@ -91,22 +91,21 @@ namespace Orchard.UI.Navigation {
return selectedPath;
}
bool match = false;
// if the menu item doesn't have route values, compare urls
if (currentRequest != null && menuItem.RouteValues == null) {
// compare route values (if any) first
bool match = menuItem.RouteValues != null && RouteMatches(menuItem.RouteValues, currentRouteData);
// if route match failed, try comparing URL strings
if (currentRequest != null && !match) {
string appPath = currentRequest.ApplicationPath ?? "/";
string requestUrl = currentRequest.Path.StartsWith(appPath) ? currentRequest.Path.Substring(appPath.Length) : currentRequest.Path;
string modelUrl = menuItem.Href.Replace("~/", appPath);
modelUrl = modelUrl.StartsWith(appPath) ? modelUrl.Substring(appPath.Length) : modelUrl;
string requestUrl = currentRequest.Path.Replace(currentRequest.ApplicationPath ?? "/", string.Empty);
string modelUrl = menuItem.Href.Replace("~/", currentRequest.ApplicationPath);
modelUrl = modelUrl.Replace(currentRequest.ApplicationPath ?? "/", string.Empty);
if (requestUrl.Equals(modelUrl, StringComparison.OrdinalIgnoreCase) || (!string.IsNullOrEmpty(modelUrl) && requestUrl.StartsWith(modelUrl + "/", StringComparison.OrdinalIgnoreCase))) {
match = true;
}
}
else {
if (RouteMatches(menuItem.RouteValues, currentRouteData)) {
match = true;
}
}
if (match) {
menuItem.Selected = true;
@@ -182,7 +181,8 @@ namespace Orchard.UI.Navigation {
.Item(menuItem)
.Menu(menu)
.Parent(parentShape)
.Content(menuItem.Content);
.Content(menuItem.Content)
.Level(menuItem.Level);
foreach (var className in menuItem.Classes)
menuItemShape.Classes.Add(className);