Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using System.Globalization;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
{
|
||||
@@ -20,7 +21,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
if (sourceString != null)
|
||||
{
|
||||
decimal d;
|
||||
return (decimal.TryParse(sourceString, out d)) ? d : 0M;
|
||||
return (decimal.TryParse(sourceString, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d)) ? d : 0M;
|
||||
}
|
||||
|
||||
// in the database an a decimal is an a decimal
|
||||
|
||||
@@ -31,13 +31,14 @@
|
||||
<umb-button
|
||||
type="button"
|
||||
label="Clear selection"
|
||||
label-key="buttons_clearSelection"
|
||||
action="clearSelection()"
|
||||
disabled="actionInProgress">
|
||||
</umb-button>
|
||||
</umb-editor-sub-header-section>
|
||||
|
||||
<umb-editor-sub-header-section ng-if="isAnythingSelected()">
|
||||
<strong ng-show="!actionInProgress">{{ selectedItemsCount() }} of {{ listViewResultSet.items.length }} selected</strong>
|
||||
<strong ng-show="!actionInProgress">{{ selectedItemsCount() }} <localize key="general_of">of</localize> {{ listViewResultSet.items.length }} <localize key="general_selected">selected</localize></strong>
|
||||
<strong ng-show="actionInProgress" ng-bind="bulkStatus"></strong>
|
||||
|
||||
<div class="umb-loader-wrapper -bottom" ng-show="actionInProgress">
|
||||
@@ -86,7 +87,7 @@
|
||||
type="button"
|
||||
button-style="link"
|
||||
label="Publish"
|
||||
key="actions_publish"
|
||||
label-key="actions_publish"
|
||||
icon="icon-globe"
|
||||
action="publish()"
|
||||
disabled="actionInProgress">
|
||||
@@ -97,7 +98,7 @@
|
||||
type="button"
|
||||
button-style="link"
|
||||
label="Unpublish"
|
||||
key="actions_unpublish"
|
||||
label-key="actions_unpublish"
|
||||
icon="icon-block"
|
||||
action="unpublish()"
|
||||
disabled="actionInProgress">
|
||||
@@ -108,7 +109,7 @@
|
||||
type="button"
|
||||
button-style="link"
|
||||
label="Copy"
|
||||
key="actions_copy"
|
||||
label-key="actions_copy"
|
||||
icon="icon-documents"
|
||||
action="copy()"
|
||||
disabled="actionInProgress">
|
||||
@@ -119,7 +120,7 @@
|
||||
type="button"
|
||||
button-style="link"
|
||||
label="Move"
|
||||
key="actions_move"
|
||||
label-key="actions_move"
|
||||
icon="icon-enter"
|
||||
action="move()"
|
||||
disabled="actionInProgress">
|
||||
@@ -129,8 +130,8 @@
|
||||
ng-if="options.allowBulkDelete && (buttonPermissions == null || buttonPermissions.canDelete)"
|
||||
type="button"
|
||||
button-style="link"
|
||||
label="Delete"
|
||||
key="actions_delete"
|
||||
label="Delete"
|
||||
label-key="actions_delete"
|
||||
icon="icon-trash"
|
||||
action="delete()"
|
||||
disabled="actionInProgress">
|
||||
|
||||
@@ -9,10 +9,10 @@ More information and documentation can be found on CodePlex: http://umbracoexami
|
||||
<ExamineLuceneIndexSets>
|
||||
|
||||
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
|
||||
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/Internal/" />
|
||||
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/" />
|
||||
|
||||
<!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE -->
|
||||
<IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/InternalMember/">
|
||||
<IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/">
|
||||
<IndexAttributeFields>
|
||||
<add Name="id" />
|
||||
<add Name="nodeName"/>
|
||||
@@ -25,6 +25,6 @@ More information and documentation can be found on CodePlex: http://umbracoexami
|
||||
</IndexSet>
|
||||
|
||||
<!-- Default Indexset for external searches, this indexes all fields on all types of nodes-->
|
||||
<IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/External/" />
|
||||
<IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/" />
|
||||
|
||||
</ExamineLuceneIndexSets>
|
||||
@@ -60,6 +60,7 @@
|
||||
<key alias="atViewingFor">For</key>
|
||||
</area>
|
||||
<area alias="buttons">
|
||||
<key alias="clearSelection">Ryd valg</key>
|
||||
<key alias="select">Vælg</key>
|
||||
<key alias="selectCurrentFolder">Vælg nuværende mappe</key>
|
||||
<key alias="somethingElse">Gør noget andet</key>
|
||||
@@ -165,6 +166,10 @@
|
||||
<area alias="media">
|
||||
<key alias="clickToUpload">Klik for at uploade</key>
|
||||
<key alias="dropFilesHere">Slip filerne her...</key>
|
||||
<key alias="urls">Link til medie</key>
|
||||
<key alias="orClickHereToUpload">eller klik her for at vælge filer</key>
|
||||
<key alias="onlyAllowedFiles">Tilladte filtyper er kun</key>
|
||||
<key alias="maxFileSize">Maks filstørrelse er</key>
|
||||
</area>
|
||||
<area alias="member">
|
||||
<key alias="createNewMember">Opret et nyt medlem</key>
|
||||
@@ -203,7 +208,7 @@
|
||||
<key alias="confirmlogout">Er du sikker på at du vil forlade Umbraco?</key>
|
||||
<key alias="confirmSure">Er du sikker?</key>
|
||||
<key alias="cut">Klip</key>
|
||||
<key alias="editdictionary">Rediger ordbogs nøgle</key>
|
||||
<key alias="editdictionary">Rediger ordbogsnøgle</key>
|
||||
<key alias="editlanguage">Rediger sprog</key>
|
||||
<key alias="insertAnchor">Indsæt lokalt link</key>
|
||||
<key alias="insertCharacter">Indsæt tegn</key>
|
||||
@@ -427,8 +432,8 @@
|
||||
<key alias="listView">Listevisning</key>
|
||||
<key alias="saving">Gemmer...</key>
|
||||
<key alias="current">nuværende</key>
|
||||
<key alias="move">Flyt</key>
|
||||
<key alias="embed">Indlejring</key>
|
||||
<key alias="selected">valgt</key>
|
||||
</area>
|
||||
|
||||
<area alias="colors">
|
||||
@@ -991,7 +996,7 @@ Mange hilsner fra Umbraco robotten
|
||||
<key alias="memberRoles">Roller</key>
|
||||
<key alias="memberTypes">Medlemstype</key>
|
||||
<key alias="documentTypes">Dokumenttyper</key>
|
||||
<key alias="relationTypes">Dokumenttyper</key>
|
||||
<key alias="relationTypes">Relationstyper</key>
|
||||
|
||||
<key alias="packager">Pakker</key>
|
||||
<key alias="packages">Pakker</key>
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
<key alias="atViewingFor">Viewing for</key>
|
||||
</area>
|
||||
<area alias="buttons">
|
||||
<key alias="clearSelection">Clear selection</key>
|
||||
<key alias="select">Select</key>
|
||||
<key alias="selectCurrentFolder">Select current folder</key>
|
||||
<key alias="somethingElse">Do something else</key>
|
||||
@@ -172,7 +173,7 @@
|
||||
<area alias="media">
|
||||
<key alias="clickToUpload">Click to upload</key>
|
||||
<key alias="dropFilesHere">Drop your files here...</key>
|
||||
<key alias="urls">Link to media</key>
|
||||
<key alias="urls">Link to media</key>
|
||||
<key alias="orClickHereToUpload">or click here to choose files</key>
|
||||
<key alias="onlyAllowedFiles">Only allowed file types are</key>
|
||||
<key alias="maxFileSize">Max file size is</key>
|
||||
@@ -488,8 +489,8 @@
|
||||
<key alias="listView">List view</key>
|
||||
<key alias="saving">Saving...</key>
|
||||
<key alias="current">current</key>
|
||||
<key alias="move">Move</key>
|
||||
<key alias="embed">Embed</key>
|
||||
<key alias="selected">selected</key>
|
||||
</area>
|
||||
|
||||
<area alias="colors">
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
<key alias="atViewingFor">Viewing for</key>
|
||||
</area>
|
||||
<area alias="buttons">
|
||||
<key alias="clearSelection">Clear selection</key>
|
||||
<key alias="select">Select</key>
|
||||
<key alias="selectCurrentFolder">Select current folder</key>
|
||||
<key alias="somethingElse">Do something else</key>
|
||||
@@ -492,8 +493,8 @@
|
||||
<key alias="listView">List view</key>
|
||||
<key alias="saving">Saving...</key>
|
||||
<key alias="current">current</key>
|
||||
<key alias="move">Move</key>
|
||||
<key alias="embed">Embed</key>
|
||||
<key alias="selected">selected</key>
|
||||
</area>
|
||||
<area alias="colors">
|
||||
<key alias="black">Black</key>
|
||||
|
||||
@@ -3,15 +3,103 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Examine;
|
||||
using Lucene.Net.Documents;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using UmbracoExamine;
|
||||
|
||||
namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
[PropertyEditor(Core.Constants.PropertyEditors.GridAlias, "Grid layout", "grid", HideLabel = true, IsParameterEditor = false, ValueType = "JSON", Group="rich content", Icon="icon-layout")]
|
||||
public class GridPropertyEditor : PropertyEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// We're going to bind to the Examine events so we can ensure grid data is index nicely
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// I think this kind of logic belongs on this property editor, putting this inside of the indexer certainly doesn't seem right
|
||||
/// </remarks>
|
||||
static GridPropertyEditor()
|
||||
{
|
||||
foreach (var i in ExamineManager.Instance.IndexProviderCollection.OfType<BaseUmbracoIndexer>())
|
||||
{
|
||||
i.DocumentWriting += DocumentWriting;
|
||||
}
|
||||
}
|
||||
|
||||
private static void DocumentWriting(object sender, Examine.LuceneEngine.DocumentWritingEventArgs e)
|
||||
{
|
||||
var indexer = (BaseUmbracoIndexer)sender;
|
||||
foreach (var field in indexer.IndexerData.UserFields)
|
||||
{
|
||||
if (e.Fields.ContainsKey(field.Name))
|
||||
{
|
||||
if (e.Fields[field.Name].DetectIsJson())
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = JsonConvert.DeserializeObject<JObject>(e.Fields[field.Name]);
|
||||
|
||||
//check if this is formatted for grid json
|
||||
JToken name;
|
||||
JToken sections;
|
||||
if (json.HasValues && json.TryGetValue("name", out name) && json.TryGetValue("sections", out sections))
|
||||
{
|
||||
//get all values and put them into a single field (using JsonPath)
|
||||
var sb = new StringBuilder();
|
||||
foreach (var row in json.SelectTokens("$.sections[*].rows[*]"))
|
||||
{
|
||||
var rowName = row["name"].Value<string>();
|
||||
var areaVals = row.SelectTokens("$.areas[*].controls[*].value");
|
||||
|
||||
foreach (var areaVal in areaVals)
|
||||
{
|
||||
var str = areaVal.Value<string>();
|
||||
str = XmlHelper.CouldItBeXml(str) ? str.StripHtml() : str;
|
||||
sb.Append(str);
|
||||
sb.Append(" ");
|
||||
|
||||
//add the row name as an individual field
|
||||
e.Document.Add(
|
||||
new Field(
|
||||
string.Format("{0}.{1}", field.Name, rowName), str, Field.Store.YES, Field.Index.ANALYZED));
|
||||
}
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
//First save the raw value to a raw field
|
||||
e.Document.Add(
|
||||
new Field(
|
||||
string.Format("{0}{1}", UmbracoContentIndexer.RawFieldPrefix, field.Name),
|
||||
e.Fields[field.Name], Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO));
|
||||
|
||||
//now replace the original value with the combined/cleaned value
|
||||
e.Document.RemoveField(field.Name);
|
||||
e.Document.Add(
|
||||
new Field(
|
||||
field.Name,
|
||||
sb.ToString(), Field.Store.YES, Field.Index.ANALYZED));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
//swallow...on purpose, there's a chance that this isn't json and we don't want that to affect
|
||||
// the website.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overridden to ensure that the value is validated
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user