Skip to content

Commit

Permalink
Merge pull request #471 from Orckestra/dev
Browse files Browse the repository at this point in the history
C1 CMS v6.2
  • Loading branch information
napernik authored Aug 14, 2017
2 parents ba4ad2d + 0730646 commit 797473b
Show file tree
Hide file tree
Showing 252 changed files with 7,292 additions and 5,384 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Workflow.Activities;
Expand Down Expand Up @@ -195,6 +195,7 @@ private void ValidateStep2Bindings(object sender, ConditionalEventArgs e)
private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
{
AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);
DataEntityToken focusEntityToken;

UploadedFile uploadedFile = this.GetBinding<UploadedFile>("UploadedFile");
string filename;
Expand Down Expand Up @@ -235,9 +236,7 @@ private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs

IMediaFile addedFile = DataFacade.AddNew<IMediaFile>(mediaFile, store.DataSourceId.ProviderName);

addNewTreeRefresher.PostRefreshMesseges(addedFile.GetDataEntityToken());

SelectElement(addedFile.GetDataEntityToken());
focusEntityToken = addedFile.GetDataEntityToken();
}
else
{
Expand All @@ -261,13 +260,14 @@ private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs
DataFacade.Update(existingFile);
DataFacade.Update(fileData);

addNewTreeRefresher.PostRefreshMesseges(existingFile.GetDataEntityToken());

SelectElement(existingFile.GetDataEntityToken());
focusEntityToken = existingFile.GetDataEntityToken();
}

transactionScope.Complete();
}
}

addNewTreeRefresher.PostRefreshMesseges(focusEntityToken);
SelectElement(focusEntityToken);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Transactions;
using System.Workflow.Activities;
using Composite.C1Console.Actions;
using Composite.C1Console.Events;
using Composite.Data;
using Composite.Data.Types;
using Composite.Data.Types.StoreIdFilter;
using Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper;
using Composite.Core.Linq;
using Composite.Core.ResourceSystem;
using Composite.Data.Transactions;
using Composite.C1Console.Workflow;

using Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Management;


namespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider
{
Expand All @@ -28,13 +27,13 @@ public DeleteMediaFolderWorkflow()

private void HasDataReferences(object sender, ConditionalEventArgs e)
{
DataEntityToken token = (DataEntityToken)this.EntityToken;
IMediaFileFolder folder = (IMediaFileFolder)token.Data;
var token = (DataEntityToken)this.EntityToken;
var folder = (IMediaFileFolder)token.Data;

string storeId = folder.StoreId;
string parentPath = folder.Path;

string innerElementsPathPrefix = string.Format("{0}/", parentPath);
string innerElementsPathPrefix = $"{parentPath}/";

var fileQueryable = new StoreIdFilterQueryable<IMediaFile>(DataFacade.GetData<IMediaFile>(), storeId);
IEnumerable<IMediaFile> childFiles =
Expand Down Expand Up @@ -72,7 +71,7 @@ private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)
DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);
DataEntityToken token = (DataEntityToken)this.EntityToken;

using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())
using (var transactionScope = TransactionsFacade.CreateNewScope())
{
IMediaFileFolder folder = DataFacade.GetDataFromDataSourceId(token.DataSourceId, false) as IMediaFileFolder;

Expand All @@ -81,11 +80,9 @@ private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)
{
if (!DataFacade.WillDeleteSucceed(folder))
{
this.ShowMessage(
DialogType.Error,
StringResourceSystemFacade.GetString("Composite.Management", "DeleteMediaFolderWorkflow.CascadeDeleteErrorTitle"),
StringResourceSystemFacade.GetString("Composite.Management", "DeleteMediaFolderWorkflow.CascadeDeleteErrorMessage")
);
this.ShowMessage(DialogType.Error,
Texts.DeleteMediaFolderWorkflow_CascadeDeleteErrorTitle,
Texts.DeleteMediaFolderWorkflow_CascadeDeleteErrorMessage);

return;
}
Expand All @@ -101,16 +98,16 @@ private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)

private void codeActivity1_ExecuteCode(object sender, EventArgs e)
{
DataEntityToken token = (DataEntityToken)this.EntityToken;
IMediaFileFolder folder = (IMediaFileFolder)token.Data;
var token = (DataEntityToken)this.EntityToken;
var folder = (IMediaFileFolder)token.Data;

string storeId = folder.StoreId;
string parentPath = folder.Path;

StoreIdFilterQueryable<IMediaFileFolder> folderQueryable = new StoreIdFilterQueryable<IMediaFileFolder>(DataFacade.GetData<IMediaFileFolder>(), storeId);
StoreIdFilterQueryable<IMediaFile> fileQueryable = new StoreIdFilterQueryable<IMediaFile>(DataFacade.GetData<IMediaFile>(), storeId);
var folderQueryable = new StoreIdFilterQueryable<IMediaFileFolder>(DataFacade.GetData<IMediaFileFolder>(), storeId);
var fileQueryable = new StoreIdFilterQueryable<IMediaFile>(DataFacade.GetData<IMediaFile>(), storeId);

string innerElementsPathPrefix = string.Format("{0}/", parentPath);
string innerElementsPathPrefix = $"{parentPath}/";

bool anyFiles =
(from item in fileQueryable
Expand All @@ -122,15 +119,11 @@ where item.FolderPath.StartsWith(innerElementsPathPrefix) || item.FolderPath ==
where item.Path.StartsWith(innerElementsPathPrefix)
select item).Any();

var message = !anyFiles && !anyFolders
? Texts.Website_Forms_Administrative_DeleteMediaFolder_Text
: Texts.Website_Forms_Administrative_DeleteMediaFolder_HasChildringText;

if ((anyFiles == false) && (anyFolders == false))
{
this.Bindings.Add("MessageText", StringResourceSystemFacade.GetString("Composite.Management", "Website.Forms.Administrative.DeleteMediaFolder.Text"));
}
else
{
this.Bindings.Add("MessageText", StringResourceSystemFacade.GetString("Composite.Management", "Website.Forms.Administrative.DeleteMediaFolder.HasChildringText"));
}
this.Bindings.Add("MessageText", message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ private void editStateCodeActivity_ExecuteCode(object sender, EventArgs e)
}


var contents = DataFacade.GetData<IPagePlaceholderContent>(f => f.PageId == selectedPage.Id && f.VersionId == selectedPage.VersionId).ToList();
var contents = DataFacade.GetData<IPagePlaceholderContent>(false)
.Where(f => f.PageId == selectedPage.Id && f.VersionId == selectedPage.VersionId)
.ToList();
var namedXhtmlFragments = contents.ToDictionary(content => content.PlaceHolderId, content => content.Content ?? "");


Expand Down Expand Up @@ -355,8 +357,8 @@ private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)
}

var contentDictionary = GetBinding<Dictionary<string, string>>("NamedXhtmlFragments");
var existingContents = DataFacade.GetData<IPagePlaceholderContent>(
f => f.PageId == selectedPage.Id && f.VersionId == selectedPage.VersionId).ToList();
var existingContents = DataFacade.GetData<IPagePlaceholderContent>(false)
.Where(f => f.PageId == selectedPage.Id && f.VersionId == selectedPage.VersionId).ToList();

foreach (var existingContent in existingContents)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using Composite.Data;
using Composite.Data.Types;
Expand Down Expand Up @@ -38,7 +38,7 @@ private void undoCodeActivity_Undo_ExecuteCode(object sender, EventArgs e)
using (new DataScope(DataScopeIdentifier.Administrated))
{
administrativePlaceholders =
(from ph in DataFacade.GetData<IPagePlaceholderContent>()
(from ph in DataFacade.GetData<IPagePlaceholderContent>(false)
where ph.PageId == pageId && ph.VersionId == versionId
select ph).ToList();
}
Expand All @@ -47,7 +47,7 @@ private void undoCodeActivity_Undo_ExecuteCode(object sender, EventArgs e)
using (new DataScope(DataScopeIdentifier.Public))
{
publicPlaceholders =
(from ph in DataFacade.GetData<IPagePlaceholderContent>()
(from ph in DataFacade.GetData<IPagePlaceholderContent>(false)
where ph.PageId == pageId && ph.VersionId == versionId
select ph).ToList();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Workflow.Runtime;
Expand Down Expand Up @@ -73,7 +74,7 @@ where string.Compare(user.Username, newUser.Username, StringComparison.Invariant
if(usersWithTheSameName.Any())
{
ShowFieldMessage(BindingNames.Username,
StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.UserLoginIsAlreadyUsed"));
LocalizationFiles.Composite_Management.UserElementProvider_UserLoginIsAlreadyUsed);

isValid = false;
}
Expand Down Expand Up @@ -104,8 +105,8 @@ private void MissingActiveLanguageCodeActivity_ExecuteCode(object sender, EventA

managementConsoleMessageService.ShowMessage(
DialogType.Message,
StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.MissingActiveLanguageTitle"),
StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.MissingActiveLanguageMessage"));
LocalizationFiles.Composite_Management.UserElementProvider_MissingActiveLanguageTitle,
LocalizationFiles.Composite_Management.UserElementProvider_MissingActiveLanguageMessage);
}


Expand Down Expand Up @@ -155,7 +156,7 @@ private void step1CodeActivity_ExecuteCode(object sender, EventArgs e)

foreach (ValidationResult result in validationResults)
{
this.ShowFieldMessage(string.Format("{0}.{1}", BindingNames.NewUser, result.Key), result.Message);
this.ShowFieldMessage($"{BindingNames.NewUser}.{result.Key}", result.Message);
}

IQueryable<IUser> usersWithTheSameName =
Expand All @@ -165,7 +166,9 @@ where string.Compare(user.Username, newUser.Username, StringComparison.Invariant

if (usersWithTheSameName.Any())
{
this.ShowFieldMessage(BindingNames.Username, StringResourceSystemFacade.GetString("Composite.Management", "AddNewUserWorkflow.UsernameDuplicateError"));
this.ShowFieldMessage(BindingNames.Username,
LocalizationFiles.Composite_Management.AddNewUserWorkflow_UsernameDuplicateError);

}
}

Expand Down Expand Up @@ -202,7 +205,10 @@ private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)

addNewTreeRefresher.PostRefreshMesseges(newUser.GetDataEntityToken());

LoggingService.LogVerbose("UserManagement", String.Format("New C1 Console user '{0}' created by '{1}'.", newUser.Username, UserValidationFacade.GetUsername()), LoggingService.Category.Audit);
LoggingService.LogEntry("UserManagement",
$"New C1 Console user '{newUser.Username}' created by '{UserValidationFacade.GetUsername()}'.",
LoggingService.Category.Audit,
TraceEventType.Information);


this.ExecuteWorklow(newUser.GetDataEntityToken(), typeof(EditUserWorkflow));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System;
using System.Diagnostics;
using System.Workflow.Activities;
using Composite.C1Console.Actions;
using Composite.C1Console.Events;
using Composite.Data;
using Composite.Data.Types;
Expand All @@ -12,7 +12,7 @@

namespace Composite.Plugins.Elements.ElementProviders.UserElementProvider
{
[EntityTokenLock()]
[EntityTokenLock]
[AllowPersistingWorkflow(WorkflowPersistingType.Idle)]
public sealed partial class DeleteUserWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow
{
Expand All @@ -36,7 +36,7 @@ private void IsDeleteSelf(object sender, ConditionalEventArgs e)

private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)
{
DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;
var dataEntityToken = (DataEntityToken)this.EntityToken;

IUser user = (IUser)dataEntityToken.Data;

Expand All @@ -55,20 +55,21 @@ private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
{
this.ShowMessage(
DialogType.Error,
StringResourceSystemFacade.GetString("Composite.Management", "DeleteUserWorkflow.CascadeDeleteErrorTitle"),
StringResourceSystemFacade.GetString("Composite.Management", "DeleteUserWorkflow.CascadeDeleteErrorMessage"));
LocalizationFiles.Composite_Management.DeleteUserWorkflow_CascadeDeleteErrorTitle,
LocalizationFiles.Composite_Management.DeleteUserWorkflow_CascadeDeleteErrorMessage);
return;
}

UserPerspectiveFacade.DeleteAll(user.Username);

DataFacade.Delete(user);

LoggingService.LogVerbose("UserManagement",
LoggingService.LogEntry("UserManagement",
$"C1 Console user '{user.Username}' deleted by '{UserValidationFacade.GetUsername()}'.",
LoggingService.Category.Audit);
LoggingService.Category.Audit,
TraceEventType.Information);

this.CreateParentTreeRefresher().PostRefreshMessages(dataEntityToken, 2);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Workflow.Runtime;
Expand Down Expand Up @@ -191,7 +192,7 @@ private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)

foreach (ValidationResult result in validationResults)
{
this.ShowFieldMessage(string.Format("{0}.{1}", BindingNames.User, result.Key), result.Message);
this.ShowFieldMessage($"{BindingNames.User}.{result.Key}", result.Message);
userValidated = false;
}

Expand Down Expand Up @@ -396,7 +397,10 @@ from r in oldRelations
DataFacade.AddNew(userUserGroupRelation);
}

LoggingService.LogVerbose("UserManagement", String.Format("C1 Console user '{0}' updated by '{1}'.", user.Username, UserValidationFacade.GetUsername()), LoggingService.Category.Audit);
LoggingService.LogEntry("UserManagement",
$"C1 Console user '{user.Username}' updated by '{UserValidationFacade.GetUsername()}'.",
LoggingService.Category.Audit,
TraceEventType.Information);

transactionScope.Complete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
Expand Down Expand Up @@ -77,7 +78,10 @@ private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs

this.CloseCurrentView();

LoggingService.LogVerbose("UserManagement", String.Format("New C1 Console user group '{0}' created by '{1}'.", userGroup.Name, UserValidationFacade.GetUsername()), LoggingService.Category.Audit);
LoggingService.LogEntry("UserManagement",
$"New C1 Console user group '{userGroup.Name}' created by '{UserValidationFacade.GetUsername()}'.",
LoggingService.Category.Audit,
TraceEventType.Information);

addNewTreeRefresher.PostRefreshMesseges(userGroup.GetDataEntityToken());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System;
using System.Diagnostics;
using System.Linq;
using Composite.Data;
using Composite.Data.Types;
Expand Down Expand Up @@ -51,7 +52,10 @@ private void finalizeCodeActivity_Delete_ExecuteCode(object sender, EventArgs e)

DataFacade.Delete(userGroup);

LoggingService.LogVerbose("UserManagement", String.Format("C1 Console user group '{0}' deleted by '{1}'.", userGroup.Name, UserValidationFacade.GetUsername()), LoggingService.Category.Audit);
LoggingService.LogEntry("UserManagement",
$"C1 Console user group '{userGroup.Name}' deleted by '{UserValidationFacade.GetUsername()}'.",
LoggingService.Category.Audit,
TraceEventType.Information);

deleteTreeRefresher.PostRefreshMesseges();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Workflow.Activities;
using System.Xml.Linq;
Expand Down Expand Up @@ -140,7 +141,10 @@ private void saveCodeActivity_Save_ExecuteCode(object sender, EventArgs e)

SetSaveStatus(true);

LoggingService.LogVerbose("UserManagement", $"C1 Console user group '{userGroup.Name}' updated by '{UserValidationFacade.GetUsername()}'.", LoggingService.Category.Audit);
LoggingService.LogEntry("UserManagement",
$"C1 Console user group '{userGroup.Name}' updated by '{UserValidationFacade.GetUsername()}'.",
LoggingService.Category.Audit,
TraceEventType.Information);

if (userGroup.Name != this.GetBinding<string>("OldName"))
{
Expand Down
Loading

0 comments on commit 797473b

Please sign in to comment.