From 496f8bc8146bc63e662c5e65c0702f18fe7bc3ff Mon Sep 17 00:00:00 2001 From: Bertrand Le Roy Date: Thu, 29 Jul 2010 12:40:11 -0700 Subject: [PATCH 01/11] French translation fixes --HG-- branch : dev --- .../App_Data/Localization/fr/orchard.core.po | 63 ++++++++++++++++--- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/src/Orchard.Web/Core/App_Data/Localization/fr/orchard.core.po b/src/Orchard.Web/Core/App_Data/Localization/fr/orchard.core.po index a56bb7c13..d64890cf3 100644 --- a/src/Orchard.Web/Core/App_Data/Localization/fr/orchard.core.po +++ b/src/Orchard.Web/Core/App_Data/Localization/fr/orchard.core.po @@ -788,6 +788,11 @@ msgstr "Nom" msgid "Title" msgstr "Titre" +#: ~/Core/Reports/Views/Admin/Index.aspx +#| msgid "Date" +msgid "Date" +msgstr "Date" + #: ~/Core/Routable/Drivers/RoutePartDriver.cs #| msgid "Please do not use any of the following characters in your slugs: \"/\", \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\". No spaces are allowed (please use dashes or underscores instead)." msgid "Please do not use any of the following characters in your slugs: \"/\", \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\". No spaces are allowed (please use dashes or underscores instead)." @@ -2028,6 +2033,26 @@ msgstr "Permettre les nouveaux commentaires" msgid "Enable to show the comment form. Disabling still allows the existing comments to be shown but does not allow the conversation to continue." msgstr "Permettre l'affichage du formulaire de commentaire. Désactiver ceci permet aux commentaires existants d'être affichés mais ne permet pas à la conversation de se prolonger." +#: ~/Modules/Orchard.Comments/Views/EditorTemplates/Parts/Comments.Comments.ascx +#| msgid "Comments" +msgid "Comments" +msgstr "Commentaires" + +#: ~/Modules/Orchard.Comments/Views/EditorTemplates/Parts/Comments.Comments.ascx +#| msgid "Comments are shown. Existing comments are displayed." +msgid "Comments are shown. Existing comments are displayed." +msgstr "Les commentaires existants sont affichés." + +#: ~/Modules/Orchard.Comments/Views/EditorTemplates/Parts/Comments.Comments.ascx +#| msgid "Allow new comments" +msgid "Allow new comments" +msgstr "Autoriser les nouveaux commentaires" + +#: ~/Modules/Orchard.Comments/Views/EditorTemplates/Parts/Comments.Comments.ascx +#| msgid "Enable to show the comment form. Disabling still allows the existing comments to be shown but does not allow the conversation to continue." +msgid "Enable to show the comment form. Disabling still allows the existing comments to be shown but does not allow the conversation to continue." +msgstr "Afficher le formulaire d'entrée des commentaires. Désactiver ne supprime pas l'affichage des commentaires existants mais empêche la poursuite de la conversation." + #: ~/Modules/Orchard.Comments/Views/EditorTemplates/Parts/Comments.SiteSettings.ascx #| msgid "Comments" msgid "Comments" @@ -2048,6 +2073,11 @@ msgstr "Activer la protection contre le Spam" msgid "Akismet key" msgstr "Clé Akismet" +#: ~/Modules/Orchard.Comments/Views/EditorTemplates/Parts/Comments.SiteSettings.ascx +#| msgid "Akismet endpoint URL" +msgid "Akismet endpoint URL" +msgstr "URL du service Akismet" + #: ~/Modules/Orchard.Comments/Views/EditorTemplates/Parts/Comments.SiteSettings.ascx #| msgid "Blog URL" msgid "Blog URL" @@ -2129,8 +2159,8 @@ msgid "The \"{0}\" field has been removed." msgstr "Le champ \"{0}\" a été enlevé." #: ~/Modules/Orchard.ContentTypes/Views/Admin/AddFieldTo.ascx -#| msgid "Add a new field to \"{0}\"" -msgid "Add a new field to \"{0}\"" +#| msgid "Add New Field To \"{0}\"" +msgid "Add New Field To \"{0}\"" msgstr "Ajouter un nouveau champ à '{0}'" #: ~/Modules/Orchard.ContentTypes/Views/Admin/AddFieldTo.ascx @@ -4114,9 +4144,9 @@ msgid "Permissions" msgstr "Permissions" #: ~/Modules/Orchard.Roles/Views/Admin/Edit.aspx -#| msgid "{0} Module" -msgid "{0} Module" -msgstr "Module {0}" +#| msgid "{0} Feature" +msgid "{0} Feature" +msgstr "Fonctionnalité {0}" #: ~/Modules/Orchard.Roles/Views/Admin/Edit.aspx #| msgid "Permission" @@ -4398,6 +4428,11 @@ msgstr "L'étiquette n'a pas pu être effacée." msgid "Editing tags failed: " msgstr "La modification des étiquettes a échoué: " +#: ~/Modules/Orchard.Tags/Controllers/AdminController.cs +#| msgid "Couldn't create tag" +msgid "Couldn't create tag" +msgstr "L'étiquette n'a pas pu être créée." + #: ~/Modules/Orchard.Tags/Controllers/AdminController.cs #| msgid "The tag {0} already exists" msgid "The tag {0} already exists" @@ -5053,7 +5088,7 @@ msgstr "Modifier" msgid "Posted by {0} {1}" msgstr "Posté par {0} {1}" -#: ~/Themes/Classic/Views/DisplayTemplates/Parts/Pages.Page.Metadata.ascx +#: ~/Themes/Classic/Views/DisplayTemplates/Parts/Common.Metadata.ascx #| msgid "nobody(?)" msgid "nobody(?)" msgstr "personne(?)" @@ -5073,7 +5108,7 @@ msgstr "Modifier" msgid "Posted by {0} {1}" msgstr "Posté par {0} {1}" -#: ~/Themes/ClassicDark/Views/DisplayTemplates/Parts/Pages.Page.Metadata.ascx +#: ~/Themes/ClassicDark/Views/DisplayTemplates/Parts/Common.Metadata.ascx #| msgid "nobody(?)" msgid "nobody(?)" msgstr "personne(?)" @@ -5129,8 +5164,8 @@ msgid "Log Off" msgstr "Déconnexion" #: ~/Themes/Contoso/Views/User.ascx -#| msgid "Login" -msgid "Login" +#| msgid "Log on" +msgid "Log on" msgstr "Connexion" #: ~/Themes/Contoso/Views/DisplayTemplates/Items/Blogs.BlogPost.ListByArchive.ascx @@ -5183,6 +5218,11 @@ msgstr "Bonjour {0}!" msgid "Comment" msgstr "Commentaire" +#: ~/Themes/Contoso/Views/DisplayTemplates/Parts/Comments.Comments.ascx +#| msgid "Leave a comment {0}!" +msgid "Leave a comment {0}!" +msgstr "Laissez-nous un commentaire, {0}!" + #: ~/Themes/Contoso/Views/DisplayTemplates/Parts/Comments.Comments.ascx #| msgid "Submit Comment" msgid "Submit Comment" @@ -5308,6 +5348,11 @@ msgstr "Commentaire" msgid "Submit Comment" msgstr "Envoyer le commentaire" +#: ~/Themes/Corporate/Views/DisplayTemplates/Parts/Common.Metadata.ascx +#| msgid "nobody(?)" +msgid "nobody(?)" +msgstr "personne(?)" + #: ~/Themes/Green/Views/DisplayTemplates/Parts/Common.Metadata.ascx #| msgid "nobody(?)" msgid "nobody(?)" From cec1b3b8d610c8ceed14d6f8de7de3c40182824b Mon Sep 17 00:00:00 2001 From: Jonathan Wall Date: Thu, 29 Jul 2010 12:40:24 -0700 Subject: [PATCH 02/11] Made all textbox fields have the same padding in the admin. --HG-- branch : dev --- src/Orchard.Web/Core/PublishLater/Styles/datetime.css | 2 +- src/Orchard.Web/Themes/TheAdmin/Styles/site.css | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Core/PublishLater/Styles/datetime.css b/src/Orchard.Web/Core/PublishLater/Styles/datetime.css index be7b3331b..dc3a06eba 100644 --- a/src/Orchard.Web/Core/PublishLater/Styles/datetime.css +++ b/src/Orchard.Web/Core/PublishLater/Styles/datetime.css @@ -7,7 +7,7 @@ html.dyn input.hinted { font-style:italic; } input#PublishLater_ScheduledPublishUtcDate { - width:56%; + width:50%; } input#PublishLater_ScheduledPublishUtcTime { width:36%; diff --git a/src/Orchard.Web/Themes/TheAdmin/Styles/site.css b/src/Orchard.Web/Themes/TheAdmin/Styles/site.css index 27180db97..c1bd1d169 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Styles/site.css +++ b/src/Orchard.Web/Themes/TheAdmin/Styles/site.css @@ -445,7 +445,7 @@ label input { } /* todo: (heskew) try to get .text on stuff like .text-box */ select, textarea, input.text, input.textMedium, input.text-box { - padding:1px; + padding:3px; border:1px solid #bdbcbc; } input.text, input.textMedium, input.text-box { @@ -454,6 +454,9 @@ input.text, input.textMedium, input.text-box { input.textMedium { width:26em; } +select { + padding:1px; +} select:focus, textarea:focus, input.text:focus, input.text-box:focus { border-color:#666d51; } @@ -472,7 +475,6 @@ textarea { min-height:8em; } #main input.large.text, #main textarea { - padding:4px; width:99%; } #main .primary input.large.text, #main .primary textarea { @@ -635,6 +637,7 @@ button.ibutton { /* (Items) Tables ----------------------------------------------------------*/ table.items { + margin:0 0 1.4em 0; background:#fff; border:1px solid #eaeaea; border-bottom:none; From 78493d3f75942598cf113372fdb5ac67c64ffb7b Mon Sep 17 00:00:00 2001 From: Jonathan Wall Date: Thu, 29 Jul 2010 12:47:26 -0700 Subject: [PATCH 03/11] Fix translations spacing on themes. Added ie button styles. --HG-- branch : dev --- src/Orchard.Web/Core/Localization/Styles/base.css | 1 + src/Orchard.Web/Themes/ClassicDark/Styles/site.css | 1 + src/Orchard.Web/Themes/Corporate/Styles/site.css | 1 + src/Orchard.Web/Themes/TheAdmin/Styles/ie.css | 10 ++++++++++ 4 files changed, 13 insertions(+) diff --git a/src/Orchard.Web/Core/Localization/Styles/base.css b/src/Orchard.Web/Core/Localization/Styles/base.css index 9cd4f7a05..b050f4184 100644 --- a/src/Orchard.Web/Core/Localization/Styles/base.css +++ b/src/Orchard.Web/Core/Localization/Styles/base.css @@ -12,6 +12,7 @@ .content-localization .content-localizations li, .content-localization .add-localization { font-size:1.2em; + float:left; } .content-localization .content-localizations>* { display:inline-block; diff --git a/src/Orchard.Web/Themes/ClassicDark/Styles/site.css b/src/Orchard.Web/Themes/ClassicDark/Styles/site.css index 942575417..f53c17461 100644 --- a/src/Orchard.Web/Themes/ClassicDark/Styles/site.css +++ b/src/Orchard.Web/Themes/ClassicDark/Styles/site.css @@ -379,6 +379,7 @@ span.message { } .content-localization .content-localizations li:hover { background-color: #000; + border-color: #99ff66; } .content-localization .content-localizations li a { text-decoration: none; diff --git a/src/Orchard.Web/Themes/Corporate/Styles/site.css b/src/Orchard.Web/Themes/Corporate/Styles/site.css index 352a62a99..7436485af 100644 --- a/src/Orchard.Web/Themes/Corporate/Styles/site.css +++ b/src/Orchard.Web/Themes/Corporate/Styles/site.css @@ -425,6 +425,7 @@ html, body {background-color: #FFFFFF; background-image: url(../Content/Images/b .content-localization .content-localizations ul { overflow: auto; + list-style-type:none; } diff --git a/src/Orchard.Web/Themes/TheAdmin/Styles/ie.css b/src/Orchard.Web/Themes/TheAdmin/Styles/ie.css index 36bca0efc..baa0ed383 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Styles/ie.css +++ b/src/Orchard.Web/Themes/TheAdmin/Styles/ie.css @@ -1,3 +1,13 @@ .contentItems { border:1px solid #D3D2D2; +} + +button, .button, .button:link, .button:visited { + cursor:pointer; + padding:0.1em 0.8em 0.2em 0.8em; + text-align:center; +} + +.button { + line-height:inherit; } \ No newline at end of file From 2078932f41af67d549d8fc2818f9a258db657f96 Mon Sep 17 00:00:00 2001 From: Jonathan Wall Date: Thu, 29 Jul 2010 15:36:34 -0700 Subject: [PATCH 04/11] Fixed install/download links on browse gallery page. --HG-- branch : dev --- .../Orchard.Packaging/Styles/admin.css | 17 +++++++++++++ .../Views/Gallery/Modules.ascx | 25 +++++++++++-------- 2 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 src/Orchard.Web/Modules/Orchard.Packaging/Styles/admin.css diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Styles/admin.css b/src/Orchard.Web/Modules/Orchard.Packaging/Styles/admin.css new file mode 100644 index 000000000..32f790900 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Styles/admin.css @@ -0,0 +1,17 @@ +.moduleName { + float:left; + } + +.contentItems .related { + padding:1.2em 0.4em 0.5em +} + +.contentItems .properties { + float:none; + clear:both; +} + +.contentItems .pageStatus { + margin:.8em 0; + color:#666; +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.ascx b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.ascx index 27a4d19a6..07086564c 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.ascx +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.ascx @@ -1,4 +1,6 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<% Html.RegisterStyle("admin.css"); %> +

<%: Html.TitleForPage(T("Browse Gallery").ToString())%>

@@ -24,22 +26,23 @@ <% if (Model.Modules.Count() > 0) { %>
    <%foreach (var item in Model.Modules) {%> -
  • -
      -
      +
    • +

      <%: (item.SyndicationItem.Title == null ? T("(No title)").Text : item.SyndicationItem.Title.Text)%> - <%: T("Version: {0}", "1.0")%>

      -

      <%: (item.SyndicationItem.Summary == null ? T("(No description").Text : item.SyndicationItem.Summary.Text) %>

      -
        -
      • <%: T("Last Updated: {0}", item.SyndicationItem.LastUpdatedTime.ToLocalTime()) %>
      • -
      •  | <%: T("Author: {0}", item.SyndicationItem.Authors.Any() ? String.Join(", ", item.SyndicationItem.Authors.Select(a => a.Name)) : T("Unknown").Text)%>
      • -
      + -
    + + +
    +

    <%: (item.SyndicationItem.Summary == null ? T("(No description").Text : item.SyndicationItem.Summary.Text) %>The sandbox module is a testing ground for Orchard developers and should not be activated except for testing and development purposes.

    +
      +
    • <%: T("Last Updated: {0}", item.SyndicationItem.LastUpdatedTime.ToLocalTime()) %>
    • +
    •  | <%: T("Author: {0}", item.SyndicationItem.Authors.Any() ? String.Join(", ", item.SyndicationItem.Authors.Select(a => a.Name)) : T("Unknown").Text)%>
    • +
    +
  • <% }%>
<% From 8d9925a75b824c2d5f111fd13cf6575ee45e53aa Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 29 Jul 2010 15:44:15 -0700 Subject: [PATCH 05/11] Corrected search index bug preventing dynamic items from being indexed if they didn't have a common aspect - Added a lock on write operations - Changed Indexing event handler to intercept all ContentPart instances --HG-- branch : dev --- .../Lucene/Services/LuceneIndexProvider.cs | 79 +++++++++++-------- .../Lucene/Services/LuceneSearchBuilder.cs | 1 + .../Handlers/CreateIndexingTaskHandler.cs | 13 +-- .../Handlers/InfosetFieldIndexingHandler.cs | 21 +++-- .../Services/IndexingTaskExecutor.cs | 4 +- 5 files changed, 69 insertions(+), 49 deletions(-) diff --git a/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs b/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs index d77d0383e..c0b8dc3b9 100644 --- a/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs +++ b/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs @@ -114,19 +114,23 @@ namespace Lucene.Services { } public void CreateIndex(string indexName) { - var writer = new IndexWriter(GetDirectory(indexName), _analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED); - writer.Close(); + lock ( _appDataFolder ) { + var writer = new IndexWriter(GetDirectory(indexName), _analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED); + writer.Close(); + } Logger.Information("Index [{0}] created", indexName); } public void DeleteIndex(string indexName) { - new DirectoryInfo(_appDataFolder.MapPath(_appDataFolder.Combine(_basePath, indexName))) - .Delete(true); + lock ( _appDataFolder ) { + new DirectoryInfo(_appDataFolder.MapPath(_appDataFolder.Combine(_basePath, indexName))) + .Delete(true); - var settingsFileName = GetSettingsFileName(indexName); - if(File.Exists(settingsFileName)) { - File.Delete(settingsFileName); + var settingsFileName = GetSettingsFileName(indexName); + if (File.Exists(settingsFileName)) { + File.Delete(settingsFileName); + } } } @@ -146,25 +150,27 @@ namespace Lucene.Services { // Remove any previous document for these content items Delete(indexName, indexDocuments.Select(i => i.ContentItemId)); - var writer = new IndexWriter(GetDirectory(indexName), _analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); - LuceneDocumentIndex current = null; + lock ( _appDataFolder ) { + var writer = new IndexWriter(GetDirectory(indexName), _analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); + LuceneDocumentIndex current = null; - try { + try { - foreach ( var indexDocument in indexDocuments ) { - current = indexDocument; - var doc = CreateDocument(indexDocument); - - writer.AddDocument(doc); - Logger.Debug("Document [{0}] indexed", indexDocument.ContentItemId); + foreach (var indexDocument in indexDocuments) { + current = indexDocument; + var doc = CreateDocument(indexDocument); + + writer.AddDocument(doc); + Logger.Debug("Document [{0}] indexed", indexDocument.ContentItemId); + } + } + catch (Exception ex) { + Logger.Error(ex, "An unexpected error occured while add the document [{0}] from the index [{1}].", current.ContentItemId, indexName); + } + finally { + writer.Optimize(); + writer.Close(); } - } - catch ( Exception ex ) { - Logger.Error(ex, "An unexpected error occured while add the document [{0}] from the index [{1}].", current.ContentItemId, indexName); - } - finally { - writer.Optimize(); - writer.Close(); } } @@ -177,25 +183,28 @@ namespace Lucene.Services { return; } - var writer = new IndexWriter(GetDirectory(indexName), _analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); + lock ( _appDataFolder ) { - try { - var query = new BooleanQuery(); + var writer = new IndexWriter(GetDirectory(indexName), _analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); try { - foreach (var id in documentIds) { - query.Add(new BooleanClause(new TermQuery(new Term("id", id.ToString())), BooleanClause.Occur.SHOULD)); - } + var query = new BooleanQuery(); - writer.DeleteDocuments(query); + try { + foreach (var id in documentIds) { + query.Add(new BooleanClause(new TermQuery(new Term("id", id.ToString())), BooleanClause.Occur.SHOULD)); + } + + writer.DeleteDocuments(query); + } + catch (Exception ex) { + Logger.Error(ex, "An unexpected error occured while removing the documents [{0}] from the index [{1}].", String.Join(", ", documentIds), indexName); + } } - catch (Exception ex) { - Logger.Error(ex, "An unexpected error occured while removing the documents [{0}] from the index [{1}].", String.Join(", ", documentIds), indexName); + finally { + writer.Close(); } } - finally { - writer.Close(); - } } public IDocumentIndex New(int documentId) { diff --git a/src/Orchard.Web/Modules/Lucene/Services/LuceneSearchBuilder.cs b/src/Orchard.Web/Modules/Lucene/Services/LuceneSearchBuilder.cs index b6c689e20..74d310a6f 100644 --- a/src/Orchard.Web/Modules/Lucene/Services/LuceneSearchBuilder.cs +++ b/src/Orchard.Web/Modules/Lucene/Services/LuceneSearchBuilder.cs @@ -47,6 +47,7 @@ namespace Lucene.Services { InitPendingClause(); } + public ISearchBuilder Parse(string defaultField, string query) { return Parse(new string[] {defaultField}, query); } diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/CreateIndexingTaskHandler.cs b/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/CreateIndexingTaskHandler.cs index ff0b59942..fad36f498 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/CreateIndexingTaskHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/CreateIndexingTaskHandler.cs @@ -1,4 +1,5 @@ -using Orchard.ContentManagement.Handlers; +using Orchard.ContentManagement.FieldStorage.InfosetStorage; +using Orchard.ContentManagement.Handlers; using Orchard.ContentManagement; using Orchard.Core.Common.Models; using Orchard.Tasks.Indexing; @@ -21,16 +22,18 @@ namespace Orchard.Indexing.Handlers { _indexingTaskManager = indexingTaskManager; _indexNotifierHandlers = indexNotifierHandlers; - OnPublishing>(CreateIndexingTask); - OnRemoved>(RemoveIndexingTask); + OnPublishing(CreateIndexingTask); + OnRemoved(RemoveIndexingTask); } - void CreateIndexingTask(PublishContentContext context, ContentPart part) { + void CreateIndexingTask(PublishContentContext context, ContentPart part) { _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem); + UpdateIndex(); } - void RemoveIndexingTask(RemoveContentContext context, ContentPart part) { + void RemoveIndexingTask(RemoveContentContext context, ContentPart part) { _indexingTaskManager.CreateDeleteIndexTask(context.ContentItem); + UpdateIndex(); } private void UpdateIndex() { diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/InfosetFieldIndexingHandler.cs b/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/InfosetFieldIndexingHandler.cs index cc82f3055..feeed3de8 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/InfosetFieldIndexingHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/InfosetFieldIndexingHandler.cs @@ -13,15 +13,20 @@ namespace Orchard.Indexing.Handlers { OnIndexing( (context, cp) => { var infosetPart = context.ContentItem.As(); - if ( infosetPart != null ) { - foreach ( var part in infosetPart.ContentItem.Parts ) { - foreach ( var field in part.PartDefinition.Fields ) { - if ( field.Settings.GetModel().Included ) { - var fieldName = field.Name; - var value = part.Fields.Where(f => f.Name == fieldName).First().Storage.Get(null); - context.DocumentIndex.Add(String.Format("{0}-{1}", infosetPart.TypeDefinition.Name, fieldName.ToLower()), value).RemoveTags().Analyze(); - } + if (infosetPart == null) { + return; + } + + // part fields + foreach ( var part in infosetPart.ContentItem.Parts ) { + foreach ( var field in part.PartDefinition.Fields ) { + if (!field.Settings.GetModel().Included) { + continue; } + + var fieldName = field.Name; + var value = part.Fields.Where(f => f.Name == fieldName).First().Storage.Get(null); + context.DocumentIndex.Add(String.Format("{0}-{1}", infosetPart.TypeDefinition.Name.ToLower(), fieldName.ToLower()), value).RemoveTags().Analyze(); } } }); diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Services/IndexingTaskExecutor.cs b/src/Orchard.Web/Modules/Orchard.Indexing/Services/IndexingTaskExecutor.cs index a883564d1..4ed5951b4 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Services/IndexingTaskExecutor.cs +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Services/IndexingTaskExecutor.cs @@ -103,8 +103,10 @@ namespace Orchard.Indexing.Services { // nothing to do ? - if (taskRecords.Length + updateIndexDocuments.Count == 0) + if (taskRecords.Length + updateIndexDocuments.Count == 0) { + Logger.Information("Index update requested, nothing to do"); return; + } Logger.Information("Processing {0} indexing tasks", taskRecords.Length); From 5741737edc086d128bc7d37ed86b5e3764db4907 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 29 Jul 2010 15:49:45 -0700 Subject: [PATCH 06/11] Removed the link to the Register page in the gallery --HG-- branch : dev --- .../Views/Account/LogOn.aspx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/PackageIndexReferenceImplementation/Views/Account/LogOn.aspx b/src/Tools/PackageIndexReferenceImplementation/Views/Account/LogOn.aspx index 41bfb9eda..a88f06de7 100644 --- a/src/Tools/PackageIndexReferenceImplementation/Views/Account/LogOn.aspx +++ b/src/Tools/PackageIndexReferenceImplementation/Views/Account/LogOn.aspx @@ -7,7 +7,7 @@

Log On

- Please enter your username and password. <%: Html.ActionLink("Register", "Register") %> if you don't have an account. + Please enter your username and password.

<% using (Html.BeginForm()) { %> From 564e6c528bd76f95ca686e7d22f0514b6728a69a Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 29 Jul 2010 15:53:40 -0700 Subject: [PATCH 07/11] =?UTF-8?q?Instead=20of=20=E2=80=9C~/modules?= =?UTF-8?q?=E2=80=9D=20use=20=E2=80=9C~/feed=E2=80=9D=20in=20the=20gallery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : dev rename : src/Tools/PackageIndexReferenceImplementation/Controllers/ModulesController.cs => src/Tools/PackageIndexReferenceImplementation/Controllers/FeedController.cs --- .../Controllers/{ModulesController.cs => FeedController.cs} | 4 ++-- .../PackageIndexReferenceImplementation.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/Tools/PackageIndexReferenceImplementation/Controllers/{ModulesController.cs => FeedController.cs} (95%) diff --git a/src/Tools/PackageIndexReferenceImplementation/Controllers/ModulesController.cs b/src/Tools/PackageIndexReferenceImplementation/Controllers/FeedController.cs similarity index 95% rename from src/Tools/PackageIndexReferenceImplementation/Controllers/ModulesController.cs rename to src/Tools/PackageIndexReferenceImplementation/Controllers/FeedController.cs index d0347d8e9..f2c92caee 100644 --- a/src/Tools/PackageIndexReferenceImplementation/Controllers/ModulesController.cs +++ b/src/Tools/PackageIndexReferenceImplementation/Controllers/FeedController.cs @@ -15,13 +15,13 @@ using PackageIndexReferenceImplementation.Services; namespace PackageIndexReferenceImplementation.Controllers { [HandleError] - public class ModulesController : Controller { + public class FeedController : Controller { private readonly FeedStorage _feedStorage; private readonly MediaStorage _mediaStorage; public IMembershipService MembershipService { get; set; } - public ModulesController() { + public FeedController() { _feedStorage = new FeedStorage(); _mediaStorage = new MediaStorage(); if ( MembershipService == null ) { MembershipService = new AccountMembershipService(); } diff --git a/src/Tools/PackageIndexReferenceImplementation/PackageIndexReferenceImplementation.csproj b/src/Tools/PackageIndexReferenceImplementation/PackageIndexReferenceImplementation.csproj index fd1a2f903..891868a53 100644 --- a/src/Tools/PackageIndexReferenceImplementation/PackageIndexReferenceImplementation.csproj +++ b/src/Tools/PackageIndexReferenceImplementation/PackageIndexReferenceImplementation.csproj @@ -72,7 +72,7 @@ - + From ef55b203d2492f048c0b669ce2aedf3b280241dc Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 29 Jul 2010 15:55:19 -0700 Subject: [PATCH 08/11] Updated gallery feed url --HG-- branch : dev --- .../Modules/Orchard.Packaging/DefaultPackagingUpdater.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/DefaultPackagingUpdater.cs b/src/Orchard.Web/Modules/Orchard.Packaging/DefaultPackagingUpdater.cs index eb5a9568a..604cd5a32 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/DefaultPackagingUpdater.cs +++ b/src/Orchard.Web/Modules/Orchard.Packaging/DefaultPackagingUpdater.cs @@ -14,8 +14,8 @@ namespace Orchard.Packaging { } public void Install(Feature feature) { - // add http://orchardproject.net/feeds/modules as the default Modules Feed - _packagingSourceManager.AddSource(new PackagingSource { Id = Guid.NewGuid(), FeedTitle = "Orchard Module Gallery", FeedUrl = "http://orchardproject.net/feeds/modules" }); + // add http://orchardproject.net/gallery/feed as the default Modules Feed + _packagingSourceManager.AddSource(new PackagingSource { Id = Guid.NewGuid(), FeedTitle = "Orchard Module Gallery", FeedUrl = "http://orchardproject.net/gallery/feed" }); } public void Enable(Feature feature) { From b1324bc7a491902b79506b6b23549d9ca646e1a5 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 29 Jul 2010 17:44:15 -0700 Subject: [PATCH 09/11] Changed cache key for regenerating the configuration it if there are setup issues --HG-- branch : dev --- src/Orchard/Data/SessionConfigurationCache.cs | 3 +++ src/Orchard/Utility/Hash.cs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/Orchard/Data/SessionConfigurationCache.cs b/src/Orchard/Data/SessionConfigurationCache.cs index 4190e31c4..f774a0118 100644 --- a/src/Orchard/Data/SessionConfigurationCache.cs +++ b/src/Orchard/Data/SessionConfigurationCache.cs @@ -105,6 +105,9 @@ namespace Orchard.Data { private Hash ComputeHash() { var hash = new Hash(); + hash.AddString(_shellSettings.DataProvider); + hash.AddString(_shellSettings.DataTablePrefix); + hash.AddString(_shellSettings.DataConnectionString); hash.AddString(_shellSettings.Name); // We need to hash the assemnly names, record names and property names diff --git a/src/Orchard/Utility/Hash.cs b/src/Orchard/Utility/Hash.cs index 83f60db1b..49622d72f 100644 --- a/src/Orchard/Utility/Hash.cs +++ b/src/Orchard/Utility/Hash.cs @@ -12,6 +12,8 @@ namespace Orchard.Utility { public string Value { get { return _hash.ToString(); } } public void AddString(string value) { + if ( string.IsNullOrEmpty(value) ) + return; _hash += value.GetHashCode(); } From 39b33a18327bef899eed3291f9995fde4c329b8e Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 29 Jul 2010 17:44:37 -0700 Subject: [PATCH 10/11] Updated index for robustness --HG-- branch : dev --- .../Lucene/Services/LuceneIndexProvider.cs | 79 ++++++++----------- .../Handlers/CreateIndexingTaskHandler.cs | 4 +- src/Orchard/Indexing/IIndexProvider.cs | 2 +- 3 files changed, 38 insertions(+), 47 deletions(-) diff --git a/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs b/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs index c0b8dc3b9..d0235d3be 100644 --- a/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs +++ b/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs @@ -114,23 +114,19 @@ namespace Lucene.Services { } public void CreateIndex(string indexName) { - lock ( _appDataFolder ) { - var writer = new IndexWriter(GetDirectory(indexName), _analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED); - writer.Close(); - } + var writer = new IndexWriter(GetDirectory(indexName), _analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED); + writer.Close(); Logger.Information("Index [{0}] created", indexName); } public void DeleteIndex(string indexName) { - lock ( _appDataFolder ) { - new DirectoryInfo(_appDataFolder.MapPath(_appDataFolder.Combine(_basePath, indexName))) - .Delete(true); + new DirectoryInfo(_appDataFolder.MapPath(_appDataFolder.Combine(_basePath, indexName))) + .Delete(true); - var settingsFileName = GetSettingsFileName(indexName); - if (File.Exists(settingsFileName)) { - File.Delete(settingsFileName); - } + var settingsFileName = GetSettingsFileName(indexName); + if (File.Exists(settingsFileName)) { + File.Delete(settingsFileName); } } @@ -143,35 +139,33 @@ namespace Lucene.Services { } public void Store(string indexName, IEnumerable indexDocuments) { - if(indexDocuments.AsQueryable().Count() == 0) { + if (indexDocuments.AsQueryable().Count() == 0) { return; } // Remove any previous document for these content items Delete(indexName, indexDocuments.Select(i => i.ContentItemId)); - lock ( _appDataFolder ) { - var writer = new IndexWriter(GetDirectory(indexName), _analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); - LuceneDocumentIndex current = null; + var writer = new IndexWriter(GetDirectory(indexName), _analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); + LuceneDocumentIndex current = null; - try { + try { - foreach (var indexDocument in indexDocuments) { - current = indexDocument; - var doc = CreateDocument(indexDocument); + foreach (var indexDocument in indexDocuments) { + current = indexDocument; + var doc = CreateDocument(indexDocument); - writer.AddDocument(doc); - Logger.Debug("Document [{0}] indexed", indexDocument.ContentItemId); - } - } - catch (Exception ex) { - Logger.Error(ex, "An unexpected error occured while add the document [{0}] from the index [{1}].", current.ContentItemId, indexName); - } - finally { - writer.Optimize(); - writer.Close(); + writer.AddDocument(doc); + Logger.Debug("Document [{0}] indexed", indexDocument.ContentItemId); } } + catch (Exception ex) { + Logger.Error(ex, "An unexpected error occured while add the document [{0}] from the index [{1}].", current.ContentItemId, indexName); + } + finally { + writer.Optimize(); + writer.Close(); + } } public void Delete(string indexName, int documentId) { @@ -183,28 +177,25 @@ namespace Lucene.Services { return; } - lock ( _appDataFolder ) { + var writer = new IndexWriter(GetDirectory(indexName), _analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); - var writer = new IndexWriter(GetDirectory(indexName), _analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); + try { + var query = new BooleanQuery(); try { - var query = new BooleanQuery(); - - try { - foreach (var id in documentIds) { - query.Add(new BooleanClause(new TermQuery(new Term("id", id.ToString())), BooleanClause.Occur.SHOULD)); - } - - writer.DeleteDocuments(query); - } - catch (Exception ex) { - Logger.Error(ex, "An unexpected error occured while removing the documents [{0}] from the index [{1}].", String.Join(", ", documentIds), indexName); + foreach (var id in documentIds) { + query.Add(new BooleanClause(new TermQuery(new Term("id", id.ToString())), BooleanClause.Occur.SHOULD)); } + + writer.DeleteDocuments(query); } - finally { - writer.Close(); + catch (Exception ex) { + Logger.Error(ex, "An unexpected error occured while removing the documents [{0}] from the index [{1}].", String.Join(", ", documentIds), indexName); } } + finally { + writer.Close(); + } } public IDocumentIndex New(int documentId) { diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/CreateIndexingTaskHandler.cs b/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/CreateIndexingTaskHandler.cs index fad36f498..604eb4140 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/CreateIndexingTaskHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Handlers/CreateIndexingTaskHandler.cs @@ -28,12 +28,12 @@ namespace Orchard.Indexing.Handlers { void CreateIndexingTask(PublishContentContext context, ContentPart part) { _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem); - UpdateIndex(); + // UpdateIndex(); } void RemoveIndexingTask(RemoveContentContext context, ContentPart part) { _indexingTaskManager.CreateDeleteIndexTask(context.ContentItem); - UpdateIndex(); + // UpdateIndex(); } private void UpdateIndex() { diff --git a/src/Orchard/Indexing/IIndexProvider.cs b/src/Orchard/Indexing/IIndexProvider.cs index 09978da31..eb0029068 100644 --- a/src/Orchard/Indexing/IIndexProvider.cs +++ b/src/Orchard/Indexing/IIndexProvider.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Orchard.ContentManagement; namespace Orchard.Indexing { - public interface IIndexProvider : IDependency { + public interface IIndexProvider : ISingletonDependency { /// /// Creates a new index /// From 8d2757f27a5bd12f807edc224e812573b0a9f19d Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 29 Jul 2010 17:45:40 -0700 Subject: [PATCH 11/11] Refactored packaging module - Adding source and updating modules are safer --HG-- branch : dev --- .../DefaultPackagingUpdater.cs | 9 +++- .../Services/PackagingSourceManager.cs | 45 ++++++++++++++----- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/DefaultPackagingUpdater.cs b/src/Orchard.Web/Modules/Orchard.Packaging/DefaultPackagingUpdater.cs index 604cd5a32..e2216b9b2 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/DefaultPackagingUpdater.cs +++ b/src/Orchard.Web/Modules/Orchard.Packaging/DefaultPackagingUpdater.cs @@ -2,19 +2,24 @@ using Orchard.Environment; using Orchard.Environment.Extensions; using Orchard.Environment.Extensions.Models; +using Orchard.Localization; using Orchard.Packaging.Services; +using Orchard.UI.Notify; namespace Orchard.Packaging { [OrchardFeature("Gallery")] public class DefaultPackagingUpdater : IFeatureEventHandler { private readonly IPackagingSourceManager _packagingSourceManager; + private readonly INotifier _notifier; - public DefaultPackagingUpdater(IPackagingSourceManager packagingSourceManager) { + public DefaultPackagingUpdater(IPackagingSourceManager packagingSourceManager, INotifier notifier) { _packagingSourceManager = packagingSourceManager; + _notifier = notifier; } + public Localizer T { get; set; } + public void Install(Feature feature) { - // add http://orchardproject.net/gallery/feed as the default Modules Feed _packagingSourceManager.AddSource(new PackagingSource { Id = Guid.NewGuid(), FeedTitle = "Orchard Module Gallery", FeedUrl = "http://orchardproject.net/gallery/feed" }); } diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Services/PackagingSourceManager.cs b/src/Orchard.Web/Modules/Orchard.Packaging/Services/PackagingSourceManager.cs index 7478e0c6d..95780d7f5 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Services/PackagingSourceManager.cs +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Services/PackagingSourceManager.cs @@ -8,32 +8,38 @@ using System.Xml.Linq; using System.Xml.Serialization; using Orchard.Environment.Extensions; using Orchard.FileSystems.AppData; +using Orchard.Localization; +using Orchard.UI.Notify; namespace Orchard.Packaging.Services { [OrchardFeature("PackagingServices")] public class PackagingSourceManager : IPackagingSourceManager { - private static readonly XmlSerializer _sourceSerializer = new XmlSerializer(typeof (List), new XmlRootAttribute("Sources")); + private static readonly XmlSerializer _sourceSerializer = new XmlSerializer(typeof(List), new XmlRootAttribute("Sources")); private readonly IAppDataFolder _appDataFolder; + private readonly INotifier _notifier; - public PackagingSourceManager(IAppDataFolder appDataFolder) { + public PackagingSourceManager(IAppDataFolder appDataFolder, INotifier notifier) { _appDataFolder = appDataFolder; + _notifier = notifier; + T = NullLocalizer.Instance; } + Localizer T { get; set; } + #region IPackagingSourceManager Members public IEnumerable GetSources() { string text = _appDataFolder.ReadFile(GetSourcesPath()); - if (string.IsNullOrEmpty(text)) { + if ( string.IsNullOrEmpty(text) ) { return Enumerable.Empty(); } var textReader = new StringReader(_appDataFolder.ReadFile(GetSourcesPath())); - return (IEnumerable) _sourceSerializer.Deserialize(textReader); + return (IEnumerable)_sourceSerializer.Deserialize(textReader); } public void AddSource(PackagingSource source) { - UpdateSource(source); - SaveSources(GetSources().Concat(new[] {source})); + SaveSources(GetSources().Concat(new[] { source }).GroupBy(x => x.FeedUrl).Select(g => g.First())); } public void RemoveSource(Guid id) { @@ -41,16 +47,16 @@ namespace Orchard.Packaging.Services { } public void UpdateLists() { - foreach (PackagingSource source in GetSources()) { + foreach ( PackagingSource source in GetSources() ) { UpdateSource(source); } } public IEnumerable GetModuleList(PackagingSource packagingSource = null) { - IEnumerable packageInfos = ( packagingSource == null ? GetSources() : new [] { packagingSource }) + IEnumerable packageInfos = ( packagingSource == null ? GetSources() : new[] { packagingSource } ) .SelectMany( source => - Bind(ParseFeed(_appDataFolder.ReadFile(GetFeedCachePath(source))), + Bind(ParseFeed(GetModuleListForSource(source)), feed => feed.Items.SelectMany( item => @@ -65,6 +71,13 @@ namespace Orchard.Packaging.Services { return packageInfos.ToArray(); } + private string GetModuleListForSource(PackagingSource source) { + if ( !_appDataFolder.FileExists(GetFeedCachePath(source)) ) { + UpdateSource(source); + } + return _appDataFolder.ReadFile(GetFeedCachePath(source)); + } + #endregion private static string GetSourcesPath() { @@ -83,8 +96,13 @@ namespace Orchard.Packaging.Services { } private void UpdateSource(PackagingSource source) { - XDocument feed = XDocument.Load(source.FeedUrl, LoadOptions.PreserveWhitespace); - _appDataFolder.CreateFile(GetFeedCachePath(source), feed.ToString(SaveOptions.DisableFormatting)); + try { + XDocument feed = XDocument.Load(source.FeedUrl, LoadOptions.PreserveWhitespace); + _appDataFolder.CreateFile(GetFeedCachePath(source), feed.ToString(SaveOptions.DisableFormatting)); + } + catch ( Exception e ) { + _notifier.Warning(T("Error loading content of feed '{0}': {1}", source.FeedUrl, e.Message)); + } } @@ -93,7 +111,7 @@ namespace Orchard.Packaging.Services { } private static IEnumerable Unit(T t) where T : class { - return t != null ? new[] {t} : Enumerable.Empty(); + return t != null ? new[] { t } : Enumerable.Empty(); } private static IEnumerable Bind(T t, Func> f) where T : class { @@ -101,6 +119,9 @@ namespace Orchard.Packaging.Services { } private SyndicationFeed ParseFeed(string content) { + if ( string.IsNullOrEmpty(( content )) ) + return new SyndicationFeed(); + var formatter = new Atom10FeedFormatter(); formatter.ReadFrom(XmlReader.Create(new StringReader(content))); return formatter.Feed;