private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DataEntityToken token = (DataEntityToken)this.EntityToken;

            IMethodBasedFunctionInfo methodBasedFunctionInfo = (IMethodBasedFunctionInfo)token.Data;

            if (DataFacade.WillDeleteSucceed(methodBasedFunctionInfo))
            {
                DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

                DataFacade.Delete(token.Data);

                int count =
                    (from info in DataFacade.GetData <IMethodBasedFunctionInfo>()
                     where info.Namespace == methodBasedFunctionInfo.Namespace
                     select info).Count();

                if (count == 0)
                {
                    RefreshFunctionTree();
                }
                else
                {
                    treeRefresher.PostRefreshMesseges();
                }
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Plugins.MethodBasedFunctionProviderElementProvider", "CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Plugins.MethodBasedFunctionProviderElementProvider", "CascadeDeleteErrorMessage")
                    );
            }
        }
Example #2
0
        /// <exclude />
        public static bool TryValidateNamespace(string namespaceString, out string errorMessage)
        {
            errorMessage = "";

            if (string.IsNullOrEmpty(namespaceString))
            {
                errorMessage = StringResourceSystemFacade.GetString("Composite.NameValidation", "EmptyNamespace");
                return(false);
            }


            string[] namespaceElements = namespaceString.Split('.');

            foreach (string namespaceElement in namespaceElements)
            {
                if (NameValidation.TryValidateName(namespaceElement, out errorMessage) == false)
                {
                    return(false);
                }
            }

            if (namespaceElements.Distinct().Count() < namespaceElements.Count())
            {
                errorMessage = StringResourceSystemFacade.GetString("Composite.NameValidation", "DuplicateElementNamespace");
                return(false);
            }

            return(true);
        }
 private void initializeCodeActivity_ShowMessage_ExecuteCode(object sender, EventArgs e)
 {
     ShowMessage(DialogType.Message,
                 StringResourceSystemFacade.GetString("Composite.Plugins.UserGroupElementProvider", "DeleteUserGroup.DeleteUserGroupInitialStep.UserGroupHasUsersTitle"),
                 StringResourceSystemFacade.GetString("Composite.Plugins.UserGroupElementProvider", "DeleteUserGroup.DeleteUserGroupInitialStep.UserGroupHasUsersMessage")
                 );
 }
        private void ValidateNewDefinition(object sender, ConditionalEventArgs e)
        {
            Pair <string, Type>     metaDataPair           = this.GetBinding <Pair <string, Type> >("SelectedMetaDataDefinition");
            IPageMetaDataDefinition pageMetaDataDefinition = PageMetaDataFacade.GetMetaDataDefinition(GetCurrentPageId(), metaDataPair.First);

            e.Result = true;

            string newLabel = this.GetBinding <string>("Label");
            Guid   newMetaDataContainerId = this.GetBinding <Guid>("SelectedMetaDataContainer");

            Guid pageId = GetCurrentPageId();

            if (pageMetaDataDefinition.Label != newLabel)
            {
                if (PageMetaDataFacade.IsDefinitionAllowed(pageId, pageMetaDataDefinition.Name, newLabel, pageMetaDataDefinition.MetaDataTypeId) == false)
                {
                    e.Result = false;
                    ShowFieldMessage("Label", StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataFieldNameAlreadyUsed"));
                }
            }

            if (pageMetaDataDefinition.MetaDataContainerId != newMetaDataContainerId)
            {
                if (PageMetaDataFacade.IsNewContainerIdAllowed(pageId, pageMetaDataDefinition.Name, newMetaDataContainerId) == false)
                {
                    e.Result = false;
                    ShowFieldMessage("SelectedMetaDataContainer", StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerChangeNotAllowed"));
                }
            }
        }
Example #5
0
        private void ValidateFunctionName(object sender, ConditionalEventArgs e)
        {
            IInlineFunction function = this.GetBinding <IInlineFunction>("NewFunction");

            bool exists = FunctionFacade.FunctionExists(function.Namespace, function.Name);

            if (exists)
            {
                string errorMessage = StringResourceSystemFacade.GetString("Composite.Plugins.MethodBasedFunctionProviderElementProvider", "AddFunction.NameAlreadyUsed");
                errorMessage = string.Format(errorMessage, FunctionFacade.GetFunctionCompositionName(function.Namespace, function.Name));
                ShowFieldMessage("NewFunction.Name", errorMessage);
                e.Result = false;
                return;
            }

            ValidationResults validationResults = ValidationFacade.Validate <IInlineFunction>(function);

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult result in validationResults)
                {
                    this.ShowFieldMessage(string.Format("{0}.{1}", "NewFunction", result.Key), result.Message);
                }

                e.Result = false;
                return;
            }

            e.Result = true;
        }
        public IEnumerable <Element> GetRoots(SearchToken seachToken)
        {
            Element treeRootFolderElement = new Element(_context.CreateElementHandle(new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeRootFolderId)))
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = "Tree Definitions",
                    ToolTip     = "Tree Definitions",
                    HasChildren = this.TreeDefinitionFilenames.Count() > 0,
                    Icon        = TreeDefinitionsRootIcon
                }
            };

            treeRootFolderElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.AddTreeDefinitionWorkflow"), PermissionTypePredefined.Add)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeAddTreeDefinitionWorkflow.AddNew.Label"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeAddTreeDefinitionWorkflow.AddNew.ToolTip"),
                    Icon           = TreeDefinitionIconAdd,
                    Disabled       = false,
                    ActionLocation = ActionLocation.AddPrimaryActionLocation
                }
            });



            yield return(treeRootFolderElement);
        }
Example #7
0
 private void AddDuplicateAssociatedDataAction(Element element)
 {
     element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Duplicate,
                                                                                   _addAssociatedDataPermissionTypes)))
     {
         VisualData = new ActionVisualizedData
         {
             Label =
                 StringResourceSystemFacade.GetString("Composite.Management",
                                                      "AssociatedDataElementProviderHelper.DuplicateAssociatedDataLabel"),
             ToolTip =
                 StringResourceSystemFacade.GetString("Composite.Management",
                                                      "AssociatedDataElementProviderHelper.DuplicateAssociatedDataToolTip"),
             Icon           = this.DuplicateAssociatedDataIcon,
             Disabled       = false,
             ActionLocation = new ActionLocation
             {
                 ActionType  = ActionType.Add,
                 IsInFolder  = false,
                 IsInToolbar = true,
                 ActionGroup = PrimaryActionGroup
             }
         }
     });
 }
        /// <exclude />
        public static bool TryValidate(Type interfaceType, out IEnumerable <string> errorMessages)
        {
            List <string> errors = new List <string>();

            errorMessages = errors;


            if (interfaceType.IsInterface == false)
            {
                string errorMessage = StringResourceSystemFacade.GetString("Composite.Management", "DataInterfaceValidator.TypeNotAnInterface");
                errors.Add(string.Format(errorMessage, interfaceType));
            }


            if (typeof(IData).IsAssignableFrom(interfaceType) == false)
            {
                string errorMessage = StringResourceSystemFacade.GetString("Composite.Management", "DataInterfaceValidator.TypeDoesNotImplementInterface");
                errors.Add(string.Format(errorMessage, interfaceType, typeof(IData)));
            }


            PropertyInfo[] properties = interfaceType.GetProperties();
            foreach (PropertyInfo propertyInfo in properties)
            {
                bool acceptedType = PrimitiveTypes.IsPrimitiveOrNullableType(propertyInfo.PropertyType);

                if (acceptedType == false)
                {
                    string errorMessage = StringResourceSystemFacade.GetString("Composite.Management", "DataInterfaceValidator.NotAcceptedType");
                    errors.Add(string.Format(errorMessage, propertyInfo.PropertyType, interfaceType));
                }
            }

            return(errors.Count == 0);
        }
        protected override IEnumerable <ElementAction> OnGetFunctionActions(IFunctionTreeBuilderLeafInfo function)
        {
            string functionName = function.Namespace + "." + function.Name;

            IMetaFunction metaFunction = GetMetaFunction(functionName);

            bool isWidget = !(metaFunction is IFunction);

            if (!isWidget)
            {
                yield return(CreateFunctionTesterAction(functionName));
            }

            yield return(new ElementAction(new ActionHandle(new FunctionInfoActionToken(functionName, isWidget)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label = StringResourceSystemFacade.GetString("Composite.Plugins.AllFunctionsElementProvider", "AllFunctionsElementProvider.ViewFunctionInformation"),
                    ToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.AllFunctionsElementProvider", "AllFunctionsElementProvider.ViewFunctionInformationTooltip"),
                    Disabled = false,
                    Icon = CommonElementIcons.Search,
                    ActionLocation = new ActionLocation
                    {
                        ActionType = ActionType.Other,
                        ActionGroup = PrimaryActionGroup,
                        IsInFolder = false,
                        IsInToolbar = true
                    }
                }
            });
        }
Example #10
0
        private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);
            DataEntityToken     token         = (DataEntityToken)this.EntityToken;

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

                // Media folder may already be deleted at this point
                if (folder != null)
                {
                    if (!DataFacade.WillDeleteSucceed(folder))
                    {
                        this.ShowMessage(
                            DialogType.Error,
                            StringResourceSystemFacade.GetString("Composite.Management", "DeleteMediaFolderWorkflow.CascadeDeleteErrorTitle"),
                            StringResourceSystemFacade.GetString("Composite.Management", "DeleteMediaFolderWorkflow.CascadeDeleteErrorMessage")
                            );

                        return;
                    }

                    DataFacade.Delete(folder);
                }

                transactionScope.Complete();
            }

            treeRefresher.PostRefreshMesseges();
        }
        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)
        {
            this.UpdateBinding("LayoutLabel", StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "InstallLocalPackage.ShowError.LayoutLabel"));
            this.UpdateBinding("TableCaption", StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "InstallLocalPackage.ShowError.InfoTableCaption"));

            this.Bindings.Add("UploadedFile", new UploadedFile());
        }
Example #12
0
        private void codeActivity1_ExecuteCode(object sender, EventArgs e)
        {
            DataEntityToken  token  = (DataEntityToken)this.EntityToken;
            IMediaFileFolder 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);

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

            bool anyFiles =
                (from item in fileQueryable
                 where item.FolderPath.StartsWith(innerElementsPathPrefix) || item.FolderPath == parentPath
                 select item).Any();

            bool anyFolders =
                (from item in folderQueryable
                 where item.Path.StartsWith(innerElementsPathPrefix)
                 select item).Any();


            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"));
            }
        }
Example #13
0
    private void BuildLogTable(IEnumerable <LogEntry> entries)
    {
        XElement table = new XElement("table");

        XElement tableHeader = new XElement("tr");

        tableHeader.Add(
            new XElement("th", " "),
            new XElement("th", StringResourceSystemFacade.GetString("Composite.Management", "ServerLog.LogEntry.DateLabel")),
            new XElement("th", StringResourceSystemFacade.GetString("Composite.Management", "ServerLog.LogEntry.MessageLabel")),
            new XElement("th", StringResourceSystemFacade.GetString("Composite.Management", "ServerLog.LogEntry.TitleLabel")),
            new XElement("th", StringResourceSystemFacade.GetString("Composite.Management", "ServerLog.LogEntry.EventTypeLabel"))
            );

        table.Add(tableHeader);

        int index = 0;

        foreach (LogEntry logEntry in entries.Reverse())
        {
            TraceEventType eventType;

            try
            {
                eventType = (TraceEventType)Enum.Parse(typeof(TraceEventType), logEntry.Severity);
            }
            catch (Exception)
            {
                eventType = TraceEventType.Information;
            }


            var colors = new []
            {
                new Tuple <TraceEventType, string>(TraceEventType.Information, "lime"),
                new Tuple <TraceEventType, string>(TraceEventType.Verbose, "white"),
                new Tuple <TraceEventType, string>(TraceEventType.Warning, "orange"),
                new Tuple <TraceEventType, string>(TraceEventType.Error, "red"),
                new Tuple <TraceEventType, string>(TraceEventType.Critical, "darkred")
            };

            string colorName = colors.Where(c => c.Item1 == eventType).Select(c => c.Item2).FirstOrDefault() ?? "orange";

            XAttribute color = new XAttribute("bgcolor", colorName);


            XElement row = new XElement("tr");
            row.Add(
                new XElement("td", color, " "),
                new XElement("td", logEntry.TimeStamp.ToString(View_DateTimeFormat)),
                new XElement("td", MessageMarkup(logEntry, index++)),
                new XElement("td", EncodeXml10InvalidCharacters(logEntry.Title)),
                new XElement("td", logEntry.Severity)
                );

            table.Add(row);
        }

        LogHolder.Controls.Add(new LiteralControl(table.ToString()));
    }
Example #14
0
        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            var dataEntityToken = (DataEntityToken)this.EntityToken;

            IUser user = (IUser)dataEntityToken.Data;

            if (!DataFacade.WillDeleteSucceed(user))
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Management", "DeleteUserWorkflow.CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Management", "DeleteUserWorkflow.CascadeDeleteErrorMessage"));
                return;
            }

            UserPerspectiveFacade.DeleteAll(user.Username);

            DataFacade.Delete(user);

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

            this.CreateParentTreeRefresher().PostRefreshMessages(dataEntityToken, 2);
        }
 protected override IEnumerable <ElementAction> OnGetFolderActions()
 {
     return(new ElementAction[]
     {
         new ElementAction(new ActionHandle(
                               new WorkflowActionToken(
                                   WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider.AddNewVisualFunctionWorkflow"),
                                   new PermissionType[] { PermissionType.Add }
                                   )))
         {
             VisualData = new ActionVisualizedData
             {
                 Label = StringResourceSystemFacade.GetString("Composite.Plugins.VisualFunction", "VisualFunctionElementProvider.AddNewLabel"),
                 ToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.VisualFunction", "VisualFunctionElementProvider.AddNewToolTip"),
                 Icon = VisualFunctionProviderElementProvider.AddFunction,
                 Disabled = false,
                 ActionLocation = new ActionLocation
                 {
                     ActionType = ActionType.Add,
                     IsInFolder = false,
                     IsInToolbar = true,
                     ActionGroup = PrimaryActionGroup
                 }
             }
         }
     });
 }
        private static ElementAction CreateFunctionTesterAction(string functionName = "")
        {
            WorkflowActionToken actionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Workflows.Plugins.Elements.ElementProviders.AllFunctionsElementProvider.FunctionTesterWorkflow"))
            {
                Payload = functionName
            };

            return(new ElementAction(new ActionHandle(actionToken))
            {
                VisualData = new ActionVisualizedData
                {
                    Label = StringResourceSystemFacade.GetString("Composite.Plugins.AllFunctionsElementProvider", "AllFunctionsElementProvider.FunctionTester.Label"),
                    ToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.AllFunctionsElementProvider", "AllFunctionsElementProvider.FunctionTester.ToolTip"),
                    Icon = TestFunctionIcon,
                    Disabled = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType = ActionType.Other,
                        IsInFolder = false,
                        IsInToolbar = true,
                        ActionGroup = PrimaryActionGroup
                    }
                }
            });
        }
        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)
        {
            ReportFunctionActionNode reportFunctionActionNode = (ReportFunctionActionNode)ActionNode.Deserialize(this.Payload);

            Dictionary <string, string> piggybag = PiggybagSerializer.Deserialize(this.ExtraPayload);

            var replaceContext = new DynamicValuesHelperReplaceContext(this.EntityToken, piggybag);

            XElement markup = reportFunctionActionNode.FunctionMarkupDynamicValuesHelper.ReplaceValues(replaceContext);

            BaseRuntimeTreeNode baseRuntimeTreeNode = FunctionTreeBuilder.Build(markup);
            XDocument           result = baseRuntimeTreeNode.GetValue() as XDocument;

            if (result == null)
            {
                string message = string.Format(StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeValidationError.ReportFunctionAction.WrongReturnValue"), "XDocument");

                Log.LogError("TreeFacade", message);

                throw new InvalidOperationException(message);
            }

            this.Bindings.Add("Label", reportFunctionActionNode.DocumentLabelDynamicValueHelper.ReplaceValues(replaceContext));
            this.Bindings.Add("Icon", reportFunctionActionNode.DocumentIcon.ResourceName);
            this.Bindings.Add("HtmlBlob", result.ToString());
        }
Example #18
0
        protected override void BindStateToProperties()
        {
            if (this.ReadOnly)
            {
                return;
            }

            try
            {
                if (string.IsNullOrEmpty(this.CurrentStringValue))
                {
                    this.Date = null;
                }
                else
                {
                    this.Date = DateTime.Parse(this.CurrentStringValue);
                    if (!ShowHours)
                    {
                        this.Date -= this.Date.Value.TimeOfDay;
                    }
                }
                this.IsValid = true;
            }
            catch (Exception)
            {
                this.IsValid         = false;
                this.ValidationError = string.Format(StringResourceSystemFacade.GetString("Composite.Management", "Validation.DateTime.InvalidDateFormat"),
                                                     this.CurrentStringValue, SampleDateString);
            }
        }
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
        {
            if (entityToken.Id == DeveloperApplicationProviderEntityToken.TreeRootFolderId)
            {
                foreach (string treeDefinitionFilename in this.TreeDefinitionFilenames)
                {
                    string filename = Path.GetFileName(treeDefinitionFilename);

                    Element treeDefintionElement = new Element(_context.CreateElementHandle(
                                                                   new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeDefinitionId, filename)))
                    {
                        VisualData = new ElementVisualizedData
                        {
                            Label   = filename,
                            ToolTip = filename,
                            Icon    = TreeDefinitionIcon
                        }
                    };

                    treeDefintionElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.DeleteTreeDefinitionWorkflow"), PermissionTypePredefined.Delete)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Delete.Label"),
                            ToolTip        = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Delete.ToolTip"),
                            Icon           = TreeDefinitionIconDelete,
                            Disabled       = false,
                            ActionLocation = ActionLocation.DeletePrimaryActionLocation
                        }
                    });

                    treeDefintionElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.EditTreeDefinitionWorkflow"), PermissionTypePredefined.Edit)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Edit.Label"),
                            ToolTip        = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Edit.ToolTip"),
                            Icon           = TreeDefinitionIconEdit,
                            Disabled       = false,
                            ActionLocation = ActionLocation.EditPrimaryActionLocation
                        }
                    });

                    yield return(treeDefintionElement);
                }

                yield break;
            }
            else if (entityToken.Id == DeveloperApplicationProviderEntityToken.TreeDefinitionId)
            {
                //DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)entityToken;

                //foreach (Element element in TreeFacade.GetElementsByTreeId(castedEntityToken.Filename, entityToken, new Dictionary<string, string>()))
                //{
                //    yield return element;
                //}
            }

            yield break;
        }
Example #20
0
        private void ValidateReferencingProperties(object sender, ConditionalEventArgs e)
        {
            var dataEntityToken = (DataEntityToken)this.EntityToken;
            var data            = dataEntityToken.Data as ILocalizedControlled;

            IEnumerable <ReferenceFailingPropertyInfo> referenceFailingProperties = DataLocalizationFacade.GetReferencingLocalizeFailingProperties(data).Evaluate();

            if (referenceFailingProperties.Any(f => f.OptionalReferenceWithValue == false))
            {
                List <string> row = new List <string>();

                row.Add(StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "LocalizeData.ShowError.Description"));

                foreach (ReferenceFailingPropertyInfo referenceFailingPropertyInfo in referenceFailingProperties.Where(f => f.OptionalReferenceWithValue == false))
                {
                    row.Add(string.Format(StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "LocalizeData.ShowError.FieldErrorFormat"), referenceFailingPropertyInfo.DataFieldDescriptor.Name, referenceFailingPropertyInfo.ReferencedType.GetTypeTitle(), referenceFailingPropertyInfo.OriginLocaleDataValue.GetLabel()));
                }

                List <List <string> > rows = new List <List <string> > {
                    row
                };

                this.UpdateBinding("ErrorHeader", new List <string> {
                    "Fields"
                });
                this.UpdateBinding("Errors", rows);

                e.Result = false;
            }
            else
            {
                e.Result = true;
            }
        }
 private void MissingActiveLanguageActivity_ExecuteCode(object sender, EventArgs e)
 {
     ShowMessage(
         DialogType.Message,
         StringResourceSystemFacade.GetString("Composite.Plugins.VisualFunction", "AddNew.MissingActiveLanguageTitle"),
         StringResourceSystemFacade.GetString("Composite.Plugins.VisualFunction", "AddNew.MissingActiveLanguageMessage"));
 }
Example #22
0
        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;

            IUser user = (IUser)dataEntityToken.Data;

            if (DataFacade.WillDeleteSucceed(user))
            {
                UserPerspectiveFacade.DeleteAll(user.Username);

                DataFacade.Delete(user);

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

                deleteTreeRefresher.PostRefreshMesseges();
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Management", "DeleteUserWorkflow.CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Management", "DeleteUserWorkflow.CascadeDeleteErrorMessage")
                    );
            }
        }
        private void collectDefaultValuesCodeActivity_ShowWizzard_ExecuteCode(object sender, EventArgs e)
        {
            Pair <string, Type> metaDataPair = this.GetBinding <Pair <string, Type> >("SelectedMetaDataDefinition");

            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(metaDataPair.Second);
            Type metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);

            DataTypeDescriptorFormsHelper helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor);

            helper.LayoutLabel      = StringResourceSystemFacade.GetString("Composite.Plugins.PageTypeElementProvider", "PageType.AddPageTypeMetaDataFieldWorkflow.AddingDefaultMetaData.Title");
            helper.LayoutIconHandle = "pagetype-add-metedatafield";

            GeneratedTypesHelper generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);

            helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);

            IData newDataTemplate = DataFacade.BuildNew(metaDataType);

            helper.UpdateWithNewBindings(this.Bindings);
            helper.ObjectToBindings(newDataTemplate, this.Bindings);
            this.UpdateBinding("NewDataTemplate", newDataTemplate);

            this.DeliverFormData(
                metaDataType.GetTypeTitle(),
                StandardUiContainerTypes.Wizard,
                helper.GetForm(),
                this.Bindings,
                helper.GetBindingsValidationRules(newDataTemplate)
                );
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            SearchActionToken searchActionToken = (SearchActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            string viewId = Guid.NewGuid().ToString();



            string url = UrlUtils.ResolveAdminUrl(string.Format("content/dialogs/treesearch/treeSearchForm.aspx?ProviderName={0}&EntityToken={1}&ViewId={2}&ConsoleId={3}", HttpUtility.UrlEncode(searchActionToken.ProviderName), HttpUtility.UrlEncode(serializedEntityToken), HttpUtility.UrlEncode(viewId), HttpUtility.UrlEncode(currentConsoleId)));

            ConsoleMessageQueueFacade.Enqueue(
                new OpenViewMessageQueueItem
            {
                Url                = url,
                ViewId             = viewId,
                ViewType           = ViewType.ModalDialog,
                Label              = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchElements"),
                ToolTip            = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchElementsToolTip"),
                IconResourceHandle = CommonElementIcons.Question
            }, currentConsoleId);


            return(null);
        }
Example #25
0
        /// <exclude />
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            writer.AddAttribute("name", this.UniqueID);
            writer.AddAttribute("callbackid", this.ClientID);

            if (this.AutoPostBack)
            {
                writer.AddAttribute("onchange", "this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)");
            }

            if (this.SelectionRequired)
            {
                writer.AddAttribute("required", "true");
                string requiredLabel = this.SelectionRequiredLabel;
                if (string.IsNullOrEmpty(requiredLabel))
                {
                    requiredLabel = StringResourceSystemFacade.GetString("Composite.Management", "AspNetUiControl.Selector.SelectValueLabel");
                }
                writer.AddAttribute("label", requiredLabel);
            }

            if (this.IsDisabled)
            {
                writer.AddAttribute("isdisabled", "true");
            }

            this.AddClientAttributes(writer);
        }
        private void ValidateInputs(object sender, ConditionalEventArgs e)
        {
            IMediaFileFolder folder = this.GetDataItemFromEntityToken <IMediaFileFolder>();

            string oldFolderPath = this.GetBinding <string>("OldFolderPath");
            string folderPath    = CreateFolderPath();

            if (oldFolderPath != folderPath)
            {
                Guid folderId = folder.Id;

                if (DataFacade.GetData <IMediaFileFolder>()
                    .Any(f => string.Compare(f.Path, folderPath, StringComparison.OrdinalIgnoreCase) == 0 &&
                         f.Id != folderId))
                {
                    ShowFieldMessage("FolderName", StringResourceSystemFacade.GetString("Composite.Management", "Website.Forms.Administrative.AddNewMediaFolder.FolderNameAlreadyUsed"));
                    e.Result = false;
                    return;
                }

                IEnumerable <string> filenames = DataFacade.GetData <IMediaFile>().Where(f => f.FolderPath == oldFolderPath).Select(f => f.FileName);
                foreach (string filename in filenames)
                {
                    string compositePath = IMediaFileExtensions.GetCompositePath(folder.StoreId, folderPath, filename);
                    if (compositePath.Length > 2048)
                    {
                        this.ShowFieldMessage("FolderName", "${Composite.Management, Website.Forms.Administrative.EditMediaFolder.TotalFilenameToLong.Message}");
                        e.Result = false;
                        return;
                    }
                }
            }

            e.Result = true;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            //string documentTitle = "Unpublished Pages and Page Folder Data";
            //string description = "The list below display pages and page data which are currently being edited or are ready to be approved / published.";
            string documentTitle = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-title");
            string description   = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-description");
            string emptyLabel    = StringResourceSystemFacade.GetString("Composite.Plugins.GeneratedDataTypesElementProvider", "ViewUnpublishedItems-document-empty-label");
            string url           = string.Format("{0}?showpagedata=true&title={1}&description={2}&emptyLabel={3}",
                                                 UrlUtils.ResolveAdminUrl(string.Format("content/views/publishworkflowstatus/ViewUnpublishedItems.aspx")),
                                                 HttpUtility.UrlEncode(documentTitle, Encoding.UTF8),
                                                 HttpUtility.UrlEncode(description, Encoding.UTF8),
                                                 HttpUtility.UrlEncode(emptyLabel, Encoding.UTF8));

            IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();
            OpenViewMessageQueueItem         openViewMsg     = new OpenViewMessageQueueItem
            {
                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                ViewId      = "ViewUnpublishedPageItems",
                Label       = documentTitle,
                Url         = url,
                ViewType    = ViewType.Main
            };

            ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);

            return(null);
        }
 private void MissingPageTemplateActivity_ExecuteCode(object sender, EventArgs e)
 {
     ShowMessage(
         DialogType.Message,
         StringResourceSystemFacade.GetString("Composite.Plugins.VisualFunction", "Edit.NoPageTemplatesExistsErrorTitle"),
         StringResourceSystemFacade.GetString("Composite.Plugins.VisualFunction", "Edit.NoPageTemplatesExistsErrorMessage"));
 }
 private void initializeCodeActivity_ShowMessage_ExecuteCode(object sender, EventArgs e)
 {
     this.ShowMessage(
         DialogType.Message,
         StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow.NoDefinedTypesExists.Title"),
         StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow.NoDefinedTypesExists.Message"));
 }
Example #30
0
        public IEnumerable <Element> GetRoots(SearchToken seachToken)
        {
            Element rootFolderElement = new Element(_context.CreateElementHandle(new PageTemplateFeatureEntityToken(PageTemplateFeatureEntityToken.RootFolderId)))
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.RootLabel"),
                    ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.RootToolTip"),
                    HasChildren = this.PageTemplateFeatureFilenames.Any(),
                    Icon        = PageTemplateFeatureRootIcon,
                    OpenedIcon  = PageTemplateFeatureRootIconOpen
                }
            };

            rootFolderElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.AddPageTemplateFeatureWorkflow"), PermissionTypePredefined.Add)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.AddTemplateFeature"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.AddTemplateFeatureToolTip"),
                    Icon           = PageTemplateFeatureIconAdd,
                    Disabled       = false,
                    ActionLocation = ActionLocation.AddPrimaryActionLocation
                }
            });

            yield return(rootFolderElement);
        }