Ejemplo n.º 1
0
        private static GameObject CreateReplacementObject(GameObject original, ConfigElement configElement)
        {
            Object preafab = Resources.Load(configElement.PrefabName);
            var createdGameObject = Instantiate(preafab) as GameObject;

            if (createdGameObject == null)
            {
                throw new ApplicationException("could not create prefab for  " + configElement.PrefabName);
            }

            if (original.transform.parent != null)
            {
                createdGameObject.transform.parent = original.transform.parent;
            }

            createdGameObject.transform.localPosition = original.transform.localPosition;
            createdGameObject.transform.localRotation = original.transform.localRotation;

            //if (!string.IsNullOrEmpty(configElement.ElementName))
            //    createdGameObject.name = configElement.ElementName;
            createdGameObject.name = configElement.ConfigElementId + " " + configElement.ElementName;

            var comp = createdGameObject.AddComponent<ConfigComponent>();
            comp.configElement = configElement;

            configElement.GameObject = createdGameObject;
            return createdGameObject;
        }
Ejemplo n.º 2
0
        private GameObject CreateConfElement(ConfigElement configElement, GameObject parentGameObject)
        {
            GameObject createdObject = CreateGameObject(configElement, parentGameObject);

            foreach (var child in configElement.Children)
            {
                CreateConfElement(child, createdObject);
            }
            return createdObject;
        }
Ejemplo n.º 3
0
 /**
  * Add a config element as a specific class. Usually this is done to add a
  * subclass as one of it's parent classes.
  */
 public void addConfigElement(ConfigElement config, Object asClass)
 {
     if (config != null)
     {
         ConfigElement current = null;
         if (configSet.TryGetValue(asClass, out current))
         {
             current.addConfigElement(config);
         }
         else
         {
             configSet.Add(asClass, cloneIfNecessary(config));
         }
     }
 }
Ejemplo n.º 4
0
        private GameObject CreateGameObject(ConfigElement configElement, GameObject parentGameObject)
        {
            GameObject createdGameObject;
            if (string.IsNullOrEmpty(configElement.PrefabName))
            {
                createdGameObject = new GameObject();
            }
            else
            {
                Object preafab = Resources.Load(configElement.PrefabName);
                createdGameObject = Object.Instantiate(preafab) as GameObject;
            }

            Quaternion rotation = Rotation.FromAngle(configElement.RoatiationInParent);

            if (createdGameObject == null)
            {
                throw new ApplicationException("could not create prefab for  " + configElement.PrefabName);
            }

            if (parentGameObject != null)
            {
                createdGameObject.transform.parent = parentGameObject.transform;
            }

            createdGameObject.transform.localPosition = configElement.PositionInParent;
            createdGameObject.transform.localRotation = rotation;

            //if (!string.IsNullOrEmpty(configElement.ElementName))
            //    createdGameObject.name = configElement.ElementName;
            createdGameObject.name = configElement.ConfigElementId + " " + configElement.ElementName;

            var comp = createdGameObject.AddComponent<ConfigComponent>();
            comp.configElement = configElement;

            return createdGameObject;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserSelectorDefinition"/> class.
 /// </summary>
 /// <param name="element">The configuration element used to persist the control definition.</param>
 public UserSelectorDefinition(ConfigElement element)
     : base(element)
 {
 }
Ejemplo n.º 6
0
 public TwitterElement(ConfigElement parent)
     : base(parent)
 {
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Saves the values into a specific config element
        /// </summary>
        /// <param name="root">the root config element</param>
        protected override void SaveToConfig(ConfigElement root)
        {
            base.SaveToConfig(root);
            root["Server"]["ServerName"].Set(m_ServerName);
            root["Server"]["ServerNameShort"].Set(m_ServerNameShort);
            // Removed to not confuse users
//			root["Server"]["RootDirectory"].Set(m_rootDirectory);
            root["Server"]["LogConfigFile"].Set(m_logConfigFile);

            root["Server"]["ScriptCompilationTarget"].Set(m_scriptCompilationTarget);
            root["Server"]["ScriptAssemblies"].Set(m_scriptAssemblies);
            root["Server"]["AutoAccountCreation"].Set(m_autoAccountCreation);

            string serverType = "Normal";

            switch (m_serverType)
            {
            case eGameServerType.GST_Normal:
                serverType = "Normal";
                break;

            case eGameServerType.GST_Casual:
                serverType = "Casual";
                break;

            case eGameServerType.GST_Roleplay:
                serverType = "Roleplay";
                break;

            case eGameServerType.GST_PvE:
                serverType = "PvE";
                break;

            case eGameServerType.GST_PvP:
                serverType = "PvP";
                break;

            case eGameServerType.GST_Test:
                serverType = "Test";
                break;

            default:
                serverType = "Normal";
                break;
            }
            root["Server"]["GameType"].Set(serverType);

            root["Server"]["CheatLoggerName"].Set(m_cheatLoggerName);
            root["Server"]["GMActionLoggerName"].Set(m_gmActionsLoggerName);
            root["Server"]["InvalidNamesFile"].Set(m_invalidNamesFile);

            string db = "XML";

            switch (m_dbType)
            {
            case ConnectionType.DATABASE_XML:
                db = "XML";
                break;

            case ConnectionType.DATABASE_MYSQL:
                db = "MYSQL";
                break;

            case ConnectionType.DATABASE_SQLITE:
                db = "SQLITE";
                break;

            case ConnectionType.DATABASE_MSSQL:
                db = "MSSQL";
                break;

            case ConnectionType.DATABASE_ODBC:
                db = "ODBC";
                break;

            case ConnectionType.DATABASE_OLEDB:
                db = "OLEDB";
                break;

            default:
                m_dbType = ConnectionType.DATABASE_XML;
                break;
            }
            root["Server"]["DBType"].Set(db);
            root["Server"]["DBConnectionString"].Set(m_dbConnectionString);
            root["Server"]["DBAutosave"].Set(m_autoSave);
            root["Server"]["DBAutosaveInterval"].Set(m_saveInterval);
            root["Server"]["CpuUse"].Set(m_cpuUse);

            // Store UDP out endpoint
            if (m_udpOutEndpoint != null)
            {
                root["Server"]["UDPOutIP"].Set(m_udpOutEndpoint.Address.ToString());
                root["Server"]["UDPOutPort"].Set(m_udpOutEndpoint.Port.ToString());
            }
        }
Ejemplo n.º 8
0
 public UnrecognizedPropertyException(string name, ConfigElement element)
     : base(string.Format(
                "The property '{0}' is not recongized and cannot be compiled. The full property was: {1}",
                name, element))
 {
 }
        /// <summary>
        /// Defines the products backend content view.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <returns></returns>
        public static ContentViewControlElement DefineProductsBackendContentView(ConfigElement parent)
        {
            // define content view control
            var backendContentView = new ContentViewControlElement(parent)
            {
                ControlDefinitionName = BackendDefinitionName,
                ContentType = typeof(ProductItem)
            };

            // *** define views ***

            #region products backend list view

            var productsGridView = new MasterGridViewElement(backendContentView.ViewsConfig)
            {
                ViewName = ProductsDefinitions.BackendListViewName,
                ViewType = typeof(MasterGridView),
                AllowPaging = true,
                DisplayMode = FieldDisplayMode.Read,
                ItemsPerPage = 50,
                ResourceClassId = typeof(ProductsResources).Name,
                SearchFields = "Title",
                SortExpression = "Title ASC",
                Title = "ProductsViewTitle",
                WebServiceBaseUrl = "~/Sitefinity/Services/Content/Products.svc/"
            };

            #region Toolbar definition

            WidgetBarSectionElement masterViewToolbarSection = new WidgetBarSectionElement(productsGridView.ToolbarConfig.Sections)
            {
                Name = "toolbar"
            };


            var createproductsWidget = new CommandWidgetElement(masterViewToolbarSection.Items)
            {
                Name = "CreateproductsWidget",
                ButtonType = CommandButtonType.Create,
                CommandName = DefinitionsHelper.CreateCommandName,
                Text = "CreateItem",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfMainAction",
                WidgetType = typeof(CommandWidget),
                PermissionSet = ProductsConstants.Security.PermissionSetName,
                ActionName = ProductsConstants.Security.Create
            };
            masterViewToolbarSection.Items.Add(createproductsWidget);

            var deleteproductsWidget = new CommandWidgetElement(masterViewToolbarSection.Items)
            {
                Name = "DeleteproductsWidget",
                ButtonType = CommandButtonType.Standard,
                CommandName = DefinitionsHelper.GroupDeleteCommandName,
                Text = "Delete",
                ResourceClassId = typeof(ProductsResources).Name,
                WidgetType = typeof(CommandWidget),
                CssClass = "sfGroupBtn"
            };
            masterViewToolbarSection.Items.Add(deleteproductsWidget);

            masterViewToolbarSection.Items.Add(DefinitionsHelper.CreateSearchButtonWidget(masterViewToolbarSection.Items, typeof(ProductItem)));

            productsGridView.ToolbarConfig.Sections.Add(masterViewToolbarSection);

            #endregion

            #region Sidebar definition

            var languagesSection = new LocalizationWidgetBarSectionElement(productsGridView.SidebarConfig.Sections)
            {
                Name = "Languages",
                Title = "Languages",
                ResourceClassId = typeof(LocalizationResources).Name,
                CssClass = "sfFirst sfSeparator sfLangSelector",
                WrapperTagId = "languagesSection"
            };

            languagesSection.Items.Add(new LanguagesDropDownListWidgetElement(languagesSection.Items)
            {
                Name = "Languages",
                Text = "Languages",
                ResourceClassId = typeof(LocalizationResources).Name,
                CssClass = string.Empty,
                WidgetType = typeof(LanguagesDropDownListWidget),
                IsSeparator = false,
                LanguageSource = LanguageSource.Frontend,
                AddAllLanguagesOption = false,
                CommandName = DefinitionsHelper.ChangeLanguageCommandName
            });

            WidgetBarSectionElement sidebarSection = new WidgetBarSectionElement(productsGridView.SidebarConfig.Sections)
            {
                Name = "Filter",
                Title = "FilterProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfFirst sfWidgetsList sfSeparator sfModules",
                WrapperTagId = "filterSection"
            };

            sidebarSection.Items.Add(new CommandWidgetElement(sidebarSection.Items)
            {
                Name = "AllProducts",
                CommandName = DefinitionsHelper.ShowAllItemsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "AllProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = String.Empty,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false,
                ButtonCssClass = "sfSel",
            });

            sidebarSection.Items.Add(new CommandWidgetElement(sidebarSection.Items)
            {
                Name = "MyProducts",
                CommandName = DefinitionsHelper.ShowMyItemsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "MyProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = String.Empty,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });

            sidebarSection.Items.Add(new CommandWidgetElement(sidebarSection.Items)
            {
                Name = "DraftProducts",
                CommandName = DefinitionsHelper.ShowMasterItemsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "DraftProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = String.Empty,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });

            sidebarSection.Items.Add(new CommandWidgetElement(sidebarSection.Items)
            {
                Name = "PublishedProducts",
                CommandName = DefinitionsHelper.ShowPublishedItemsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "PublishedProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = String.Empty,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });

            sidebarSection.Items.Add(new CommandWidgetElement(sidebarSection.Items)
            {
                Name = "ScheduledProducts",
                CommandName = DefinitionsHelper.ShowScheduledItemsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "ScheduledProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = String.Empty,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });

            sidebarSection.Items.Add(new CommandWidgetElement(sidebarSection.Items)
            {
                Name = "PendingApprovalProducts",
                CommandName = DefinitionsHelper.PendingApprovalItemsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "WaitingForApproval",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = String.Empty,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });

            sidebarSection.Items.Add(new LiteralWidgetElement(sidebarSection.Items)
            {
                Name = "Separator",
                WrapperTagKey = HtmlTextWriterTag.Li,
                WidgetType = typeof(LiteralWidget),
                CssClass = "sfSeparator",
                Text = "&nbsp;",
                IsSeparator = true
            });

            var categoryFilterSection = new WidgetBarSectionElement(productsGridView.SidebarConfig.Sections)
            {
                Name = "Category",
                Title = "ProductItemsByCategory",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfFilterBy sfSeparator",
                WrapperTagId = "categoryFilterSection",
                Visible = false
            };
            productsGridView.SidebarConfig.Sections.Add(categoryFilterSection);

            var tagFilterSection = new WidgetBarSectionElement(productsGridView.SidebarConfig.Sections)
            {
                Name = "ByTag",
                Title = "ProductItemsByTag",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfFilterBy sfSeparator",
                WrapperTagId = "tagFilterSection",
                Visible = false
            };
            productsGridView.SidebarConfig.Sections.Add(tagFilterSection);

            var dateFilterSection = new WidgetBarSectionElement(productsGridView.SidebarConfig.Sections)
            {
                Name = "UpdatedProducts",
                Title = "DisplayLastUpdatedProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfFilterBy sfFilterByDate sfSeparator",
                WrapperTagId = "dateFilterSection",
                Visible = false
            };
            productsGridView.SidebarConfig.Sections.Add(dateFilterSection);

            categoryFilterSection.Items.Add(new CommandWidgetElement(categoryFilterSection.Items)
            {
                Name = "CloseCategories",
                CommandName = DefinitionsHelper.ShowSectionsExceptCommandName,
                CommandArgument = DefinitionsHelper.ConstructDisplaySectionsCommandArgument(
                    categoryFilterSection.WrapperTagId, tagFilterSection.WrapperTagId, dateFilterSection.WrapperTagId),
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "CloseCategories",
                ResourceClassId = typeof(Labels).Name,
                CssClass = "sfCloseFilter",
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });

            var categoryFilterWidget = new DynamicCommandWidgetElement(categoryFilterSection.Items)
            {
                Name = "CategoryFilter",
                CommandName = "filterByCategory",
                PageSize = 10,
                WidgetType = typeof(DynamicCommandWidget),
                IsSeparator = false,
                BindTo = BindCommandListTo.HierarchicalData,
                BaseServiceUrl = String.Format("~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/{0}/", TaxonomyManager.CategoriesTaxonomyId),
                ChildItemsServiceUrl = "~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/subtaxa/",
                PredecessorServiceUrl = "~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/predecessor/",
                ClientItemTemplate = @"<a href='javascript:void(0);' class='sf_binderCommand_filterByCategory'>{{ Title }}</a> <span class='sfCount'>({{ItemsCount}})</span>"
            };

            categoryFilterWidget.UrlParameters.Add("itemType", typeof(ProductItem).AssemblyQualifiedName);
            categoryFilterSection.Items.Add(categoryFilterWidget);

            tagFilterSection.Items.Add(new CommandWidgetElement(tagFilterSection.Items)
            {
                Name = "CloseTags",
                CommandName = DefinitionsHelper.ShowSectionsExceptCommandName,
                CommandArgument = DefinitionsHelper.ConstructDisplaySectionsCommandArgument(
                    tagFilterSection.WrapperTagId, categoryFilterSection.WrapperTagId, dateFilterSection.WrapperTagId),
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "CloseTags",
                ResourceClassId = typeof(Labels).Name,
                CssClass = "sfCloseFilter",
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });

            var clientTemplateBuilder = new System.Text.StringBuilder();
            clientTemplateBuilder.Append(@"<a href=""javascript:void(0);"" class=""sf_binderCommand_filterByTag");
            clientTemplateBuilder.Append(@""">{{Title}}</a> <span class='sfCount'>({{ItemsCount}})</span>");
            var tagFilterWidget = new DynamicCommandWidgetElement(tagFilterSection.Items)
            {
                Name = "TagFilter",
                CommandName = "filterByTag",
                PageSize = 10,
                WidgetType = typeof(DynamicCommandWidget),
                IsSeparator = false,
                BindTo = BindCommandListTo.Client,
                BaseServiceUrl = String.Format("~/Sitefinity/Services/Taxonomies/FlatTaxon.svc/{0}/", TaxonomyManager.TagsTaxonomyId),
                ResourceClassId = typeof(Labels).Name,
                MoreLinkText = "ShowMoreTags",
                MoreLinkCssClass = "sfShowMore",
                LessLinkText = "ShowLessTags",
                LessLinkCssClass = "sfShowMore",
                SelectedItemCssClass = "sfSel",
                ClientItemTemplate = clientTemplateBuilder.ToString()
            };
            tagFilterWidget.UrlParameters.Add("itemType", typeof(ProductItem).AssemblyQualifiedName);

            tagFilterSection.Items.Add(tagFilterWidget);


            DefinitionsHelper.CreateTaxonomyLink(
                TaxonomyManager.CategoriesTaxonomyId,
                DefinitionsHelper.HideSectionsExceptCommandName,
                DefinitionsHelper.ConstructDisplaySectionsCommandArgument(categoryFilterSection.WrapperTagId),
                sidebarSection);

            DefinitionsHelper.CreateTaxonomyLink(
                TaxonomyManager.TagsTaxonomyId,
                DefinitionsHelper.HideSectionsExceptCommandName,
                DefinitionsHelper.ConstructDisplaySectionsCommandArgument(tagFilterSection.WrapperTagId),
                sidebarSection);

            #region Filter by date

            var closeDateFilterWidget = (new CommandWidgetElement(dateFilterSection.Items)
            {
                Name = "CloseDateFilter",
                CommandName = DefinitionsHelper.ShowSectionsExceptCommandName,
                CommandArgument = DefinitionsHelper.ConstructDisplaySectionsCommandArgument(
                    tagFilterSection.WrapperTagId, categoryFilterSection.WrapperTagId, dateFilterSection.WrapperTagId),
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "CloseDateFilter",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfCloseFilter",
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });
            dateFilterSection.Items.Add(closeDateFilterWidget);

            var dateFilterWidget = new DateFilteringWidgetDefinitionElement(dateFilterSection.Items)
            {
                Name = "DateFilter",
                WidgetType = typeof(DateFilteringWidget),
                IsSeparator = false,
                PropertyNameToFilter = "LastModified"
            };

            DefinitionsHelper.GetPredefinedDateFilteringRanges(dateFilterWidget.PredefinedFilteringRanges);

            dateFilterSection.Items.Add(dateFilterWidget);

            sidebarSection.Items.Add(new CommandWidgetElement(sidebarSection.Items)
            {
                Name = "FilterByDate",
                CommandName = DefinitionsHelper.HideSectionsExceptCommandName,
                CommandArgument = DefinitionsHelper.ConstructDisplaySectionsCommandArgument(dateFilterSection.WrapperTagId),
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "ByDateModified",
                ResourceClassId = typeof(ProductsResources).Name,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            });

            #endregion Filter by date

            WidgetBarSectionElement manageAlso = new WidgetBarSectionElement(productsGridView.SidebarConfig.Sections)
            {
                Name = "ManageAlso",
                Title = "ManageAlso",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfWidgetsList sfSeparator",
                WrapperTagId = "manageAlsoSection"
            };

            CommandWidgetElement productsComments = new CommandWidgetElement(manageAlso.Items)
            {
                Name = "productsComments",
                CommandName = DefinitionsHelper.CommentsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "CommentsForProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfComments",
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            };
            manageAlso.Items.Add(productsComments);

            WidgetBarSectionElement settings = new WidgetBarSectionElement(productsGridView.SidebarConfig.Sections)
            {
                Name = "Settings",
                Title = "Settings",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfWidgetsList sfSettings",
                WrapperTagId = "settingsSection"
            };

            CommandWidgetElement productsPermissions = new CommandWidgetElement(settings.Items)
            {
                Name = "productsPermissions",
                CommandName = DefinitionsHelper.PermissionsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "PermissionsForProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            };
            settings.Items.Add(productsPermissions);

            CommandWidgetElement newsCustomFields = new CommandWidgetElement(settings.Items)
            {
                Name = "ProductsCustomFields",
                CommandName = DefinitionsHelper.ModuleEditor,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "CustomFields",
                ResourceClassId = typeof(ProductsResources).Name,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            };
            settings.Items.Add(newsCustomFields);

            CommandWidgetElement productsSettings = new CommandWidgetElement(settings.Items)
            {
                Name = "productsSettings",
                CommandName = DefinitionsHelper.SettingsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "SettingsForProducts",
                ResourceClassId = typeof(ProductsResources).Name,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false
            };
            settings.Items.Add(productsSettings);



            productsGridView.SidebarConfig.Title = "ManageProducts";
            productsGridView.SidebarConfig.ResourceClassId = typeof(ProductsResources).Name;
            productsGridView.SidebarConfig.Sections.Add(languagesSection);
            productsGridView.SidebarConfig.Sections.Add(sidebarSection);
            productsGridView.SidebarConfig.Sections.Add(manageAlso);
            productsGridView.SidebarConfig.Sections.Add(settings);

            #endregion

            #region ContextBar definition

            var translationsContextBarSection = new LocalizationWidgetBarSectionElement(productsGridView.ContextBarConfig.Sections)
            {
                Name = "Languages",
                WrapperTagKey = HtmlTextWriterTag.Div,
                CssClass = "sfContextWidgetWrp",
                MinLanguagesCountTreshold = DefinitionsHelper.LanguageItemsPerRow
            };

            translationsContextBarSection.Items.Add(new CommandWidgetElement(translationsContextBarSection.Items)
            {
                Name = "ShowMoreTranslations",
                CommandName = DefinitionsHelper.ShowMoreTranslationsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "ShowAllTranslations",
                ResourceClassId = typeof(LocalizationResources).Name,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false,
                CssClass = "sfShowHideLangVersions",
                WrapperTagKey = HtmlTextWriterTag.Div
            });

            translationsContextBarSection.Items.Add(new CommandWidgetElement(translationsContextBarSection.Items)
            {
                Name = "HideMoreTranslations",
                CommandName = DefinitionsHelper.HideMoreTranslationsCommandName,
                ButtonType = CommandButtonType.SimpleLinkButton,
                Text = "ShowBasicTranslationsOnly",
                ResourceClassId = typeof(LocalizationResources).Name,
                WidgetType = typeof(CommandWidget),
                IsSeparator = false,
                CssClass = "sfDisplayNone sfShowHideLangVersions",
                WrapperTagKey = HtmlTextWriterTag.Div
            });

            productsGridView.ContextBarConfig.Sections.Add(translationsContextBarSection);

            #endregion

            #region Grid View Mode

            var gridMode = new GridViewModeElement(productsGridView.ViewModesConfig)
            {
                Name = "Grid"
            };
            productsGridView.ViewModesConfig.Add(gridMode);

            DataColumnElement titleColumn = new DataColumnElement(gridMode.ColumnsConfig)
            {
                Name = "Title",
                HeaderText = Res.Get<Labels>().Title,
                HeaderCssClass = "sfTitleCol",
                ItemCssClass = "sfTitleCol",
                ClientTemplate = @"<a sys:href='javascript:void(0);' sys:class=""{{ 'sf_binderCommand_edit sfItemTitle sf' + UIStatus.toLowerCase()}}"">
                    <strong>{{Title}}</strong>
                    <span class='sfStatusLocation'>{{Status}}</span></a>"
            };
            gridMode.ColumnsConfig.Add(titleColumn);

            DataColumnElement qtyColumn = new DataColumnElement(gridMode.ColumnsConfig)
            {
                Name = "QuantityInStock",
                HeaderText = "QuantityInStock",
                ResourceClassId = typeof(ProductsResources).Name,
                ClientTemplate = "<span>{{QuantityInStock}}</span>",
                HeaderCssClass = "sfRegular",
                ItemCssClass = "sfRegular"
            };
            gridMode.ColumnsConfig.Add(qtyColumn);

            DataColumnElement priceColumn = new DataColumnElement(gridMode.ColumnsConfig)
            {
                Name = "Price",
                HeaderText = "Price",
                ResourceClassId = typeof(ProductsResources).Name,
                ClientTemplate = "<span>{{Price}}</span>",
                HeaderCssClass = "sfRegular",
                ItemCssClass = "sfRegular"
            };
            gridMode.ColumnsConfig.Add(priceColumn);


            var translationsColumn = new DynamicColumnElement(gridMode.ColumnsConfig)
            {
                Name = "Translations",
                HeaderText = "Translations",
                ResourceClassId = typeof(LocalizationResources).Name,
                DynamicMarkupGenerator = typeof(LanguagesColumnMarkupGenerator),
                ItemCssClass = "sfLanguagesCol",
                HeaderCssClass = "sfLanguagesCol"
            };
            translationsColumn.GeneratorSettingsElement = new LanguagesColumnMarkupGeneratorElement(translationsColumn)
            {
                LanguageSource = LanguageSource.Frontend,
                ItemsInGroupCount = DefinitionsHelper.LanguageItemsPerRow,
                ContainerTag = "div",
                GroupTag = "div",
                ItemTag = "div",
                ContainerClass = string.Empty,
                GroupClass = string.Empty,
                ItemClass = string.Empty
            };
            gridMode.ColumnsConfig.Add(translationsColumn);

            ActionMenuColumnElement actionsColumn = new ActionMenuColumnElement(gridMode.ColumnsConfig)
            {
                Name = "Actions",
                HeaderText = Res.Get<Labels>().Actions,
                HeaderCssClass = "sfMoreActions",
                ItemCssClass = "sfMoreActions"
            };
            FillActionMenuItems(actionsColumn.MenuItems, actionsColumn, typeof(ProductsResources).Name);
            gridMode.ColumnsConfig.Add(actionsColumn);

            DataColumnElement authorColumn = new DataColumnElement(gridMode.ColumnsConfig)
            {
                Name = "Author",
                HeaderText = Res.Get<Labels>().Author,
                ClientTemplate = "<span>{{Author}}</span>",
                HeaderCssClass = "sfRegular",
                ItemCssClass = "sfRegular"
            };
            gridMode.ColumnsConfig.Add(authorColumn);

            DataColumnElement dateColumn = new DataColumnElement(gridMode.ColumnsConfig)
            {
                Name = "Date",
                HeaderText = Res.Get<Labels>().Date,
                ClientTemplate = "<span>{{ (DateCreated) ? DateCreated.sitefinityLocaleFormat('dd MMM, yyyy hh:mm:ss'): '-' }}</span>",
                HeaderCssClass = "sfDate",
                ItemCssClass = "sfDate"
            };
            gridMode.ColumnsConfig.Add(dateColumn);

            #endregion

            #region DecisionScreens definition

            DecisionScreenElement dsElement = new DecisionScreenElement(productsGridView.DecisionScreensConfig)
            {
                Name = "NoItemsExistScreen",
                DecisionType = DecisionType.NoItemsExist,
                MessageType = MessageType.Neutral,
                Displayed = false,
                Title = "WhatDoYouWantToDoNow",
                MessageText = "NoProductItems",
                ResourceClassId = typeof(ProductsResources).Name
            };

            CommandWidgetElement actionCreateNew = new CommandWidgetElement(dsElement.Actions)
            {
                Name = "Create",
                ButtonType = CommandButtonType.Create,
                CommandName = DefinitionsHelper.CreateCommandName,
                Text = "CreateItem",
                ResourceClassId = typeof(ProductsResources).Name,
                CssClass = "sfCreateItem",
                PermissionSet = ProductsConstants.Security.PermissionSetName,
                ActionName = ProductsConstants.Security.Create
            };
            dsElement.Actions.Add(actionCreateNew);

            productsGridView.DecisionScreensConfig.Add(dsElement);

            #endregion

            #region Dialogs definition

            var parameters = string.Concat(
                "?ControlDefinitionName=",
                ProductsDefinitions.BackendDefinitionName,
                "&ViewName=",
                ProductsDefinitions.BackendInsertViewName);
            DialogElement createDialogElement = DefinitionsHelper.CreateDialogElement(
                productsGridView.DialogsConfig,
                DefinitionsHelper.CreateCommandName,
                "ContentViewInsertDialog",
                parameters);
            productsGridView.DialogsConfig.Add(createDialogElement);

            parameters = string.Concat(
                "?ControlDefinitionName=",
                ProductsDefinitions.BackendDefinitionName,
                "&ViewName=",
                ProductsDefinitions.BackendEditViewName);
            DialogElement editDialogElement = DefinitionsHelper.CreateDialogElement(
                productsGridView.DialogsConfig,
                DefinitionsHelper.EditCommandName,
                "ContentViewEditDialog",
                parameters);
            productsGridView.DialogsConfig.Add(editDialogElement);

            parameters = string.Concat(
                "?ControlDefinitionName=",
                ProductsDefinitions.BackendDefinitionName,
                "&ViewName=",
                ProductsDefinitions.BackendPreviewViewName,
                "&backLabelText=", Res.Get<ProductsResources>().BackToItems, "&SuppressBackToButtonLabelModify=true");
            DialogElement previewDialogElement = DefinitionsHelper.CreateDialogElement(
                productsGridView.DialogsConfig,
                DefinitionsHelper.PreviewCommandName,
                "ContentViewEditDialog",
                parameters);
            productsGridView.DialogsConfig.Add(previewDialogElement);

            string permissionsParams = string.Concat(
                "?moduleName=", ProductsModule.ModuleName,
                "&typeName=", typeof(ProductItem).AssemblyQualifiedName,
                "&backLabelText=", Res.Get<ProductsResources>().BackToItems,
                "&title=", Res.Get<ProductsResources>().PermissionsForProducts);
            DialogElement permissionsDialogElement = DefinitionsHelper.CreateDialogElement(
                productsGridView.DialogsConfig,
                DefinitionsHelper.PermissionsCommandName,
                "ModulePermissionsDialog",
                permissionsParams);
            productsGridView.DialogsConfig.Add(permissionsDialogElement);

            string versioningParams = string.Concat(
                "?ControlDefinitionName=",
                ProductsDefinitions.BackendDefinitionName,
                "&moduleName=", ProductsModule.ModuleName,
                "&typeName=", typeof(ProductItem).AssemblyQualifiedName,
                "&title=", Res.Get<ProductsResources>().PermissionsForProducts,
                "&backLabelText=", Res.Get<ProductsResources>().BackToItems,
                "&" + ProductsDefinitions.ComparisonViewHistoryScreenQueryParameter + "=" + ProductsDefinitions.BackendVersionComapreViewName);

            DialogElement versioningDialogElement = DefinitionsHelper.CreateDialogElement(
                productsGridView.DialogsConfig,
                DefinitionsHelper.HistoryCommandName,
                "VersionHistoryDialog",
                versioningParams);
            productsGridView.DialogsConfig.Add(versioningDialogElement);

            string versioningGridParams = string.Concat(
               "?ControlDefinitionName=",
               ProductsDefinitions.BackendDefinitionName,
               "&moduleName=", ProductsModule.ModuleName,
               "&typeName=", typeof(ProductItem).AssemblyQualifiedName,
               "&title=", Res.Get<ProductsResources>().PermissionsForProducts,
               "&backLabelText=", Res.Get<ProductsResources>().BackToItems,
               "&" + ProductsDefinitions.ComparisonViewHistoryScreenQueryParameter + "=" + ProductsDefinitions.BackendVersionComapreViewName);

            DialogElement versioningGridDialogElement = DefinitionsHelper.CreateDialogElement(
                productsGridView.DialogsConfig,
                ProductsDefinitions.HistoryGridCommandName,
                "VersionHistoryDialog",
                versioningGridParams);
            productsGridView.DialogsConfig.Add(versioningGridDialogElement);

            parameters = string.Concat(
               "?ControlDefinitionName=",
               ProductsDefinitions.BackendDefinitionName,
               "&ViewName=",
               ProductsDefinitions.BackendVersionPreviewViewName, "&backLabelText=", Res.Get<Labels>().BackToRevisionHistory, "&SuppressBackToButtonLabelModify=true");
            DialogElement previewVersionDialogElement = DefinitionsHelper.CreateDialogElement(
                productsGridView.DialogsConfig,
                DefinitionsHelper.VersionPreviewCommandName,
                "ContentViewEditDialog",
                parameters);
            productsGridView.DialogsConfig.Add(previewVersionDialogElement);


            parameters = string.Concat("?TypeName=ProductCatalogSample.Model.ProductItem&Title=", "Product Fields", "&BackLabelText=", Res.Get<ProductsResources>().BackToItems, "&ItemsName=", "Products");
            DialogElement moduleEditorDialogElement = DefinitionsHelper.CreateDialogElement(
                productsGridView.DialogsConfig,
                DefinitionsHelper.ModuleEditor,
                "ModuleEditorDialog",
                parameters);
            productsGridView.DialogsConfig.Add(moduleEditorDialogElement);
            #endregion

            #region Links definition

            productsGridView.LinksConfig.Add(new LinkElement(productsGridView.LinksConfig)
            {
                Name = "viewComments",
                CommandName = DefinitionsHelper.CommentsCommandName,
                NavigateUrl = RouteHelper.CreateNodeReference(ProductsModule.CommentsPageId)
            });

            productsGridView.LinksConfig.Add(new LinkElement(productsGridView.LinksConfig)
            {
                Name = "viewSettings",
                CommandName = DefinitionsHelper.SettingsCommandName,
                NavigateUrl = RouteHelper.CreateNodeReference(SiteInitializer.AdvancedSettingsNodeId) + "/products"
            });

            DefinitionsHelper.CreateNotImplementedLink(productsGridView);

            #endregion

            backendContentView.ViewsConfig.Add(productsGridView);

            #endregion

            #region products backend details view

            var productsEditDetailView = new DetailFormViewElement(backendContentView.ViewsConfig)
            {
                Title = "EditItem",
                ViewName = ProductsDefinitions.BackendEditViewName,
                ViewType = typeof(DetailFormView),
                ShowSections = true,
                DisplayMode = FieldDisplayMode.Write,
                ShowTopToolbar = true,
                ResourceClassId = typeof(ProductsResources).Name,
                WebServiceBaseUrl = "~/Sitefinity/Services/Content/Products.svc/",
                IsToRenderTranslationView = true
            };

            backendContentView.ViewsConfig.Add(productsEditDetailView);

            #region Versioning Comparison Screen

            var versionComparisonView = new ComparisonViewElement(backendContentView.ViewsConfig)
            {
                Title = "VersionComparison",
                ViewName = ProductsDefinitions.BackendVersionComapreViewName,
                ViewType = typeof(VersionComparisonView),
                DisplayMode = FieldDisplayMode.Read,
                ResourceClassId = typeof(ProductsResources).Name,
                UseWorkflow = false
            };

            backendContentView.ViewsConfig.Add(versionComparisonView);

            versionComparisonView.Fields.Add(new ComparisonFieldElement(versionComparisonView.Fields) { FieldName = "Title", Title = "lTitle", ResourceClassId = typeof(ProductsResources).Name });
            versionComparisonView.Fields.Add(new ComparisonFieldElement(versionComparisonView.Fields) { FieldName = "Content", Title = "Content", ResourceClassId = typeof(ProductsResources).Name });
            versionComparisonView.Fields.Add(new ComparisonFieldElement(versionComparisonView.Fields) { FieldName = "WhatIsInTheBox", Title = "WhatIsInTheBox", ResourceClassId = typeof(ProductsResources).Name });
            versionComparisonView.Fields.Add(new ComparisonFieldElement(versionComparisonView.Fields) { FieldName = "Price", Title = "Price", ResourceClassId = typeof(ProductsResources).Name });
            versionComparisonView.Fields.Add(new ComparisonFieldElement(versionComparisonView.Fields) { FieldName = "QuantityInStock", Title = "QuantityInStock", ResourceClassId = typeof(ProductsResources).Name });

            versionComparisonView.Fields.Add(new ComparisonFieldElement(versionComparisonView.Fields) { FieldName = "Category", Title = "Category", ResourceClassId = typeof(ProductsResources).Name });
            versionComparisonView.Fields.Add(new ComparisonFieldElement(versionComparisonView.Fields) { FieldName = "Tags", Title = "Tags", ResourceClassId = typeof(ProductsResources).Name });

            versionComparisonView.Fields.Add(new ComparisonFieldElement(versionComparisonView.Fields) { FieldName = "UrlName", Title = "UrlName", ResourceClassId = typeof(ProductsResources).Name });

            #endregion

            var productsInsertDetailView = new DetailFormViewElement(backendContentView.ViewsConfig)
            {
                Title = "CreateNewItem",
                ViewName = ProductsDefinitions.BackendInsertViewName,
                ViewType = typeof(DetailFormView),
                ShowSections = true,
                DisplayMode = FieldDisplayMode.Write,
                ShowTopToolbar = true,
                ResourceClassId = typeof(ProductsResources).Name,
                WebServiceBaseUrl = "~/Sitefinity/Services/Content/Products.svc/",
                IsToRenderTranslationView = false
            };

            backendContentView.ViewsConfig.Add(productsInsertDetailView);

            var previewExternalScripts = DefinitionsHelper.GetExtenalClientScripts(
                "Telerik.Sitefinity.Versioning.Web.UI.Scripts.VersionHistoryExtender.js, Telerik.Sitefinity",
                "OnDetailViewLoaded");

            var productsPreviewDetailView = new DetailFormViewElement(backendContentView.ViewsConfig)
            {
                ViewName = ProductsDefinitions.BackendPreviewViewName,
                ViewType = typeof(DetailFormView),
                ShowSections = true,
                DisplayMode = FieldDisplayMode.Read,
                ShowTopToolbar = true,
                ResourceClassId = typeof(ProductsResources).Name,
                ShowNavigation = false,
                WebServiceBaseUrl = "~/Sitefinity/Services/Content/Products.svc/",
                UseWorkflow = false,
                ExternalClientScripts = previewExternalScripts
            };

            backendContentView.ViewsConfig.Add(productsPreviewDetailView);

            #region products backend forms definition

            #region Insert Form

            ProductsDefinitions.CreateBackendSections(productsInsertDetailView, FieldDisplayMode.Write);
            ProductsDefinitions.CreateBackendFormToolbar(productsInsertDetailView, typeof(ProductsResources).Name, true);

            #endregion

            #region Edit Form

            ProductsDefinitions.CreateBackendSections(productsEditDetailView, FieldDisplayMode.Write);
            ProductsDefinitions.CreateBackendFormToolbar(productsEditDetailView, typeof(ProductsResources).Name, false);

            #endregion

            #region Preview History Form

            var previewLocalization = new Dictionary<string, string>()
            {
                { "ItemVersionOfClientTemplate", Res.Get<VersionResources>().ItemVersionOfClientTemplate },
                { "PreviouslyPublished", Res.Get<VersionResources>().PreviouslyPublishedBrackets },
                { "CannotDeleteLastPublishedVersion", Res.Get<VersionResources>().CannotDeleteLastPublishedVersion }
            };
            //var previewExternalScripts = DefinitionsHelper.GetExtenalClientScripts(
            //    "Telerik.Sitefinity.Versioning.Web.UI.Scripts.VersionHistoryExtender.js, Telerik.Sitefinity",
            //    "OnDetailViewLoaded");

            var productsHistoryPreviewDetailView = new DetailFormViewElement(backendContentView.ViewsConfig)
            {
                Title = "EditItem",
                ViewName = ProductsDefinitions.BackendVersionPreviewViewName,
                ViewType = typeof(DetailFormView),
                ShowSections = true,
                DisplayMode = FieldDisplayMode.Read,
                ShowTopToolbar = false,
                ResourceClassId = typeof(ProductsResources).Name,
                ExternalClientScripts = previewExternalScripts,
                WebServiceBaseUrl = "~/Sitefinity/Services/Content/Products.svc/",
                ShowNavigation = true,
                Localization = previewLocalization,
                UseWorkflow = false
            };

            CreateHistoryPreviewToolbar(productsHistoryPreviewDetailView);

            backendContentView.ViewsConfig.Add(productsHistoryPreviewDetailView);

            ProductsDefinitions.CreateBackendSections(productsHistoryPreviewDetailView, FieldDisplayMode.Read);

            #endregion

            #region Preview Form
            ProductsDefinitions.CreateBackendSections(productsPreviewDetailView, FieldDisplayMode.Read);
            //TODO: add the preview screen toolbar widgets -->Edit,etc...

            #endregion

            #endregion

            #endregion

            return backendContentView;

        }
 public void Read(ConfigElement element)
 {
     this.Id    = GeneratorUtility.Get(element, "Id", this.Id);
     this.Count = GeneratorUtility.Get(element, "Count", this.Count);
 }
		/// <summary>
		/// Defines the locations backend content view (control panel and views).
		/// </summary>
		/// <param name="parent">The parent element hosting the backend content view.</param>
		/// <returns></returns>
		public static ContentViewControlElement DefineLocationsBackendContentView(ConfigElement parent)
		{
			// initialize the content view; this is the element that will be returned to the page and holds all views of the admin panel
			var backendContentView = new ContentViewControlElement(parent)
			{
				ControlDefinitionName = BackendDefinitionName,
				ContentType = typeof(LocationItem),
				UseWorkflow = false
			};

			// GridView element serves as the "List View" for the item list. Grid columns are defined later
			var locationsGridView = new MasterGridViewElement(backendContentView.ViewsConfig)
			{
				ViewName = LocationsDefinitions.BackendListViewName,
				ViewType = typeof(MasterGridView),
				AllowPaging = true,
				DisplayMode = FieldDisplayMode.Read,
				ItemsPerPage = 50,
				SearchFields = "Title",
				SortExpression = "Title ASC",
				Title = "Locations",
				WebServiceBaseUrl = "~/Sitefinity/Services/Content/Locations.svc/"
			};
			backendContentView.ViewsConfig.Add(locationsGridView);

			#region Module Main Toolbar definition

			// Toolbar is the top menu with action buttons such as Create, Delete, Search, etc.
			var masterViewToolbarSection = new WidgetBarSectionElement(locationsGridView.ToolbarConfig.Sections)
			{
				Name = "Toolbar"
			};

			// "Create" Button for Toolbar
			var createLocationsWidget = new CommandWidgetElement(masterViewToolbarSection.Items)
			{
				Name = "CreateLocationsCommandWidget",
				ButtonType = CommandButtonType.Create,
				CommandName = DefinitionsHelper.CreateCommandName,
				Text = "Create Location",
				CssClass = "sfMainAction",
				WidgetType = typeof(CommandWidget)
			};
			masterViewToolbarSection.Items.Add(createLocationsWidget);

			// "Delete" button for Toolbar
			var deleteLocationsWidget = new CommandWidgetElement(masterViewToolbarSection.Items)
			{
				Name = "DeleteLocationsCommandWidget",
				ButtonType = CommandButtonType.Standard,
				CommandName = DefinitionsHelper.GroupDeleteCommandName,
				Text = "Delete",
				WidgetType = typeof(CommandWidget),
				CssClass = "sfGroupBtn"
			};
			masterViewToolbarSection.Items.Add(deleteLocationsWidget);

			// "Search" button for toolbar
			masterViewToolbarSection.Items.Add(DefinitionsHelper.CreateSearchButtonWidget(masterViewToolbarSection.Items, typeof(LocationItem)));
			locationsGridView.ToolbarConfig.Sections.Add(masterViewToolbarSection);

			#endregion

			#region Locations Grid (List View)

			// Define GridView mode
			var gridMode = new GridViewModeElement(locationsGridView.ViewModesConfig)
			{
				Name = "Grid"
			};
			locationsGridView.ViewModesConfig.Add(gridMode);

			#region Locations Grid Columns

			// Title column
			DataColumnElement titleColumn = new DataColumnElement(gridMode.ColumnsConfig)
			{
				Name = "Title",
				HeaderText = "Title",
				HeaderCssClass = "sfTitleCol",
				ItemCssClass = "sfTitleCol",
				ClientTemplate = @"<a sys:href='javascript:void(0);' sys:class=""{{ 'sf_binderCommand_edit sfItemTitle sfpublished"">
					<strong>{{Title}}</strong></a>"
			};
			gridMode.ColumnsConfig.Add(titleColumn);

			ActionMenuColumnElement actionsColumn = new ActionMenuColumnElement(gridMode.ColumnsConfig)
			{
				Name = "Actions",
				HeaderText = "Actions",
				HeaderCssClass = "sfMoreActions",
				ItemCssClass = "sfMoreActions"
			};
			actionsColumn.MenuItems.Add(DefinitionsHelper.CreateActionMenuCommand(actionsColumn.MenuItems, "View", HtmlTextWriterTag.Li, "preview", "View", string.Empty));
			actionsColumn.MenuItems.Add(DefinitionsHelper.CreateActionMenuCommand(actionsColumn.MenuItems, "Delete", HtmlTextWriterTag.Li, "delete", "Delete", string.Empty));

			gridMode.ColumnsConfig.Add(actionsColumn);

			#endregion

			#endregion

			#region Dialog Window definitions

			#region Insert Item Dialog

			// Insert Item Parameters
			var parameters = string.Concat(
				"?ControlDefinitionName=",
				LocationsDefinitions.BackendDefinitionName,
				"&ViewName=",
				LocationsDefinitions.BackendInsertViewName);

			// Insert Item Dialog
			DialogElement createDialogElement = DefinitionsHelper.CreateDialogElement(
				locationsGridView.DialogsConfig,
				DefinitionsHelper.CreateCommandName,
				"ContentViewInsertDialog",
				parameters);

			// add dialog to Backend
			locationsGridView.DialogsConfig.Add(createDialogElement);

			#endregion

			#region Edit Item Dialog

			// "Edit Item" Parameters
			parameters = string.Concat(
				"?ControlDefinitionName=",
				LocationsDefinitions.BackendDefinitionName,
				"&ViewName=",
				LocationsDefinitions.BackendEditViewName);

			// "Edit Item" Dialog
			DialogElement editDialogElement = DefinitionsHelper.CreateDialogElement(
				locationsGridView.DialogsConfig,
				DefinitionsHelper.EditCommandName,
				"ContentViewEditDialog",
				parameters);

			// Add Dialog to Backend
			locationsGridView.DialogsConfig.Add(editDialogElement);

			#endregion

			#region Preview Item Dialog

			// "Preview Item" parameters
			parameters = string.Concat(
				"?ControlDefinitionName=",
				LocationsDefinitions.BackendDefinitionName,
				"&ViewName=",
				LocationsDefinitions.BackendPreviewName,
				"&backLabelText=", "BacktoItems", "&SuppressBackToButtonLabelModify=true");

			// Preview Item Dialog
			DialogElement previewDialogElement = DefinitionsHelper.CreateDialogElement(
				locationsGridView.DialogsConfig,
				DefinitionsHelper.PreviewCommandName,
				"ContentViewEditDialog",
				parameters);

			// Add Dialog to Backend
			locationsGridView.DialogsConfig.Add(previewDialogElement);

			#endregion

			#endregion

			#region Admin Forms Views

			#region Create Item Form View

			// bind create item view to web service
			var locationsInsertDetailView = new DetailFormViewElement(backendContentView.ViewsConfig)
			{
				Title = "Create Location",
				ViewName = LocationsDefinitions.BackendInsertViewName,
				ViewType = typeof(DetailFormView),
				ShowSections = true,
				DisplayMode = FieldDisplayMode.Write,
				ShowTopToolbar = true,
				WebServiceBaseUrl = "~/Sitefinity/Services/Content/locations.svc/",
				IsToRenderTranslationView = false,
				UseWorkflow = false
			};

			backendContentView.ViewsConfig.Add(locationsInsertDetailView);

			#endregion

			#region Edit Item Form View

			// bind Edit item form to web service
			var locationsEditDetailView = new DetailFormViewElement(backendContentView.ViewsConfig)
			{
				Title = "Edit Location",
				ViewName = LocationsDefinitions.BackendEditViewName,
				ViewType = typeof(DetailFormView),
				ShowSections = true,
				DisplayMode = FieldDisplayMode.Write,
				ShowTopToolbar = true,
				WebServiceBaseUrl = "~/Sitefinity/Services/Content/Locations.svc/",
				IsToRenderTranslationView = false,
				UseWorkflow = false
			};

			backendContentView.ViewsConfig.Add(locationsEditDetailView);

			#endregion

			#region Preview Item Form View

			// bind Preview Form to web service
			var locationsPreviewDetailView = new DetailFormViewElement(backendContentView.ViewsConfig)
			{
				Title = "Location Preview",
				ViewName = LocationsDefinitions.BackendPreviewName,
				ViewType = typeof(DetailFormView),
				ShowSections = true,
				DisplayMode = FieldDisplayMode.Read,
				ShowTopToolbar = true,
				ShowNavigation = true,
				WebServiceBaseUrl = "~/Sitefinity/Services/Content/Locations.svc/",
				UseWorkflow = false
			};

			backendContentView.ViewsConfig.Add(locationsPreviewDetailView);

			#endregion

			#endregion

			#region Locations Backend Forms Definition

			#region Insert Form

			LocationsDefinitions.CreateBackendSections(locationsInsertDetailView, FieldDisplayMode.Write);
			LocationsDefinitions.CreateBackendFormToolbar(locationsInsertDetailView, true, true);

			#endregion

			#region Edit Form

			LocationsDefinitions.CreateBackendSections(locationsEditDetailView, FieldDisplayMode.Write);
			LocationsDefinitions.CreateBackendFormToolbar(locationsEditDetailView, false, true);

			#endregion

			#region Preview Form

			CreateBackendSections(locationsPreviewDetailView, FieldDisplayMode.Read);

			#endregion

			#endregion

			return backendContentView;
		}
 public SearchIndexStartupElement(ConfigElement parent) : base(parent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FormSelectorFieldControlElement"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public FormSelectorFieldControlElement(ConfigElement parent)
     : base(parent)
 {
 }
Ejemplo n.º 14
0
 public void addConfigElement(ConfigElement config)
 {
     addConfigElement(config, config.GetType());
 }
Ejemplo n.º 15
0
 public RobotSettingsUISettings(ConfigElement parent)
     : base(parent)
 {
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public EcommerceElement(ConfigElement parent)
     : base(parent)
 {
 }
Ejemplo n.º 17
0
 public ImageOptimizerSettings(ConfigElement parent)
     : base(parent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserSelectorDefinition"/> class.
 /// </summary>
 /// <param name="element">The configuration element used to persist the control definition.</param>
 public UserSelectorDefinition(ConfigElement element)
     : base(element)
 {
 }
Ejemplo n.º 19
0
 private ConfigElement cloneIfNecessary(ConfigElement config)
 {
     if (config.expectsModification())
     {
         return config;
     }
     return (ConfigElement) config.Clone();
 }
        /// <summary>
        /// Defines the ContentView control for News on the frontend
        /// </summary>
        /// <param name="parent">The parent configuration element.</param>
        /// <returns>A configured instance of <see cref="ContentViewControlElement"/>.</returns>
        internal static ContentViewControlElement DefineAgentsFrontendContentView(ConfigElement parent)
        {
            // define content view control
            var controlDefinition = new ContentViewControlElement(parent)
            {
                ControlDefinitionName = AgentsDefinitions.FrontendDefinitionName,
                ContentType = typeof(AgentItem)
            };

            // *** define views ***

            #region Agents backend list view

            var agentsListView = new ContentViewMasterElement(controlDefinition.ViewsConfig)
            {
                ViewName = AgentsDefinitions.FrontendListViewName,
                ViewType = typeof(MasterListView),
                AllowPaging = true,
                DisplayMode = FieldDisplayMode.Read,
                ItemsPerPage = 6,
                ResourceClassId = typeof(AgentsResources).Name,
                FilterExpression = DefinitionsHelper.PublishedOrScheduledFilterExpression,
                SortExpression = "Title ASC"
            };

            controlDefinition.ViewsConfig.Add(agentsListView);

            #endregion

            #region Agents backend details view

            var newsDetailsView = new ContentViewDetailElement(controlDefinition.ViewsConfig)
            {
                ViewName = AgentsDefinitions.FrontendDetailViewName,
                ViewType = typeof(DetailsView),
                ShowSections = false,
                DisplayMode = FieldDisplayMode.Read,
                ResourceClassId = typeof(AgentsResources).Name
            };

            controlDefinition.ViewsConfig.Add(newsDetailsView);

            #endregion

            //#region Dialogs definition

            //AgentsDefinitions.CreateDialogs(controlDefinition.DialogsConfig);

            //#endregion

            return controlDefinition;
        }
Ejemplo n.º 21
0
        private bool GetProperty(ConfigElement config, Type commentsSettingsElementType, string propName)
        {
            var propInfo = commentsSettingsElementType.GetProperty(propName, BindingFlags.Public | BindingFlags.Instance);
            var propValue = (bool)propInfo.GetValue(config, null);

            return propValue;
        }
 /// <summary>
 /// Fills the action menu items.
 /// </summary>
 /// <param name="menuItems">The menu items.</param>
 /// <param name="parent">The parent.</param>
 /// <param name="resourceClassId">The resource class pageId.</param>
 public static void FillActionMenuItems(ConfigElementList<WidgetElement> menuItems, ConfigElement parent, string resourceClassId)
 {
     menuItems.Add(
         CreateActionMenuCommand(menuItems, "View", HtmlTextWriterTag.Li, PreviewCommandName, "View", resourceClassId));
     menuItems.Add(
         CreateActionMenuCommand(menuItems, "Delete", HtmlTextWriterTag.Li, DeleteCommandName, "Delete", resourceClassId, "sfDeleteItm"));
     menuItems.Add(
         CreateActionMenuCommand(menuItems, "Publish", HtmlTextWriterTag.Li, PublishCommandName, "Publish", resourceClassId, "sfPublishItm"));
     menuItems.Add(
         CreateActionMenuCommand(menuItems, "Unpublish", HtmlTextWriterTag.Li, UnpublishCommandName, "Unpublish", resourceClassId, "sfUnpublishItm"));
     menuItems.Add(
         CreateActionMenuSeparator(menuItems, "Separator", HtmlTextWriterTag.Li, "sfSeparator", "Edit", resourceClassId));
     menuItems.Add(
         CreateActionMenuCommand(menuItems, "Content", HtmlTextWriterTag.Li, EditCommandName, "Content", resourceClassId));
     menuItems.Add(
         CreateActionMenuCommand(menuItems, "Permissions", HtmlTextWriterTag.Li, PermissionsCommandName, "Permissions", resourceClassId));
     menuItems.Add(
         CreateActionMenuCommand(menuItems, "History", HtmlTextWriterTag.Li, HistoryGridCommandName, "HistoryMenuItemTitle", "VersionResources"));
 }
 public GoogleMapsElement(ConfigElement parent)
     : base(parent)
 {
 }
 /// <summary>
 /// Creates the action menu command.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="name">The name.</param>
 /// <param name="wrapperTagKey">The wrapper tag key.</param>
 /// <param name="commandName">Name of the command.</param>
 /// <param name="text">The text.</param>
 /// <param name="resourceClassId">The resource class id.</param>
 /// <param name="cssClass">The CSS class.</param>
 /// <returns></returns>
 public static CommandWidgetElement CreateActionMenuCommand(
     ConfigElement parent,
     string name,
     HtmlTextWriterTag wrapperTagKey,
     string commandName,
     string text,
     string resourceClassId,
     string cssClass)
 {
     var commandWidgetElement = DefinitionsHelper.CreateActionMenuCommand(parent, name, wrapperTagKey, commandName, text, resourceClassId);
     commandWidgetElement.CssClass = cssClass;
     return commandWidgetElement;
 }
Ejemplo n.º 25
0
 public HrefLangExclusion(ConfigElement parent) : base(parent)
 {
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Loads the config values from a specific config element
        /// </summary>
        /// <param name="root">the root config element</param>
        protected override void LoadFromConfig(ConfigElement root)
        {
            base.LoadFromConfig(root);

            // Removed to not confuse users
//			m_rootDirectory = root["Server"]["RootDirectory"].GetString(m_rootDirectory);

            m_logConfigFile = root["Server"]["LogConfigFile"].GetString(m_logConfigFile);

            m_scriptCompilationTarget = root["Server"]["ScriptCompilationTarget"].GetString(m_scriptCompilationTarget);
            m_scriptAssemblies        = root["Server"]["ScriptAssemblies"].GetString(m_scriptAssemblies);
            m_autoAccountCreation     = root["Server"]["AutoAccountCreation"].GetBoolean(m_autoAccountCreation);

            string serverType = root["Server"]["GameType"].GetString("Normal");

            switch (serverType.ToLower())
            {
            case "normal":
                m_serverType = eGameServerType.GST_Normal;
                break;

            case "casual":
                m_serverType = eGameServerType.GST_Casual;
                break;

            case "roleplay":
                m_serverType = eGameServerType.GST_Roleplay;
                break;

            case "pve":
                m_serverType = eGameServerType.GST_PvE;
                break;

            case "pvp":
                m_serverType = eGameServerType.GST_PvP;
                break;

            case "test":
                m_serverType = eGameServerType.GST_Test;
                break;

            default:
                m_serverType = eGameServerType.GST_Normal;
                break;
            }

            m_ServerName      = root["Server"]["ServerName"].GetString(m_ServerName);
            m_ServerNameShort = root["Server"]["ServerNameShort"].GetString(m_ServerNameShort);

            m_cheatLoggerName     = root["Server"]["CheatLoggerName"].GetString(m_cheatLoggerName);
            m_gmActionsLoggerName = root["Server"]["GMActionLoggerName"].GetString(m_gmActionsLoggerName);
            m_invalidNamesFile    = root["Server"]["InvalidNamesFile"].GetString(m_invalidNamesFile);

            string db = root["Server"]["DBType"].GetString("XML");

            switch (db.ToLower())
            {
            case "xml":
                m_dbType = ConnectionType.DATABASE_XML;
                break;

            case "mysql":
                m_dbType = ConnectionType.DATABASE_MYSQL;
                break;

            case "sqlite":
                m_dbType = ConnectionType.DATABASE_SQLITE;
                break;

            case "mssql":
                m_dbType = ConnectionType.DATABASE_MSSQL;
                break;

            case "odbc":
                m_dbType = ConnectionType.DATABASE_ODBC;
                break;

            case "oledb":
                m_dbType = ConnectionType.DATABASE_OLEDB;
                break;

            default:
                m_dbType = ConnectionType.DATABASE_XML;
                break;
            }
            m_dbConnectionString = root["Server"]["DBConnectionString"].GetString(m_dbConnectionString);
            m_autoSave           = root["Server"]["DBAutosave"].GetBoolean(m_autoSave);
            m_saveInterval       = root["Server"]["DBAutosaveInterval"].GetInt(m_saveInterval);
            m_maxClientCount     = root["Server"]["MaxClientCount"].GetInt(m_maxClientCount);
            m_cpuCount           = root["Server"]["CpuCount"].GetInt(m_cpuCount);

            if (m_cpuCount < 1)
            {
                m_cpuCount = 1;
            }

            m_cpuUse = root["Server"]["CpuUse"].GetInt(m_cpuUse);
            if (m_cpuUse < 1)
            {
                m_cpuUse = 1;
            }

            // Parse UDP out endpoint
            IPAddress address    = null;
            int       port       = -1;
            string    addressStr = root["Server"]["UDPOutIP"].GetString(string.Empty);
            string    portStr    = root["Server"]["UDPOutPort"].GetString(string.Empty);

            if (IPAddress.TryParse(addressStr, out address) &&
                int.TryParse(portStr, out port) &&
                IPEndPoint.MaxPort >= port &&
                IPEndPoint.MinPort <= port)
            {
                m_udpOutEndpoint = new IPEndPoint(address, port);
            }
        }
Ejemplo n.º 27
0
        public override void Persist(object data, ChoDictionaryService <string, object> stateInfo)
        {
            string configFilePath = stateInfo[UNDERLYING_CONFIG_PATH] as string;

            if (configFilePath.IsNullOrWhiteSpace())
            {
                return;
            }

            configFilePath = GetFullPath(configFilePath);

            //ChoXmlDocument.CreateXmlFileIfEmpty(configFilePath);

            //string backupConfigFilePath = String.Format("{0}.{1}", configFilePath, ChoReservedFileExt.Cho);

            try
            {
                //Write meta-data info
                ChoConfigurationMetaDataManager.SetMetaDataSection(ConfigElement);
                //if (!IsAppConfigFile)
                //{
                //    if (File.Exists(backupConfigFilePath))
                //        File.SetAttributes(backupConfigFilePath, FileAttributes.Archive);
                //    File.Copy(configFilePath, backupConfigFilePath, true);
                //    if (File.Exists(backupConfigFilePath))
                //        File.SetAttributes(backupConfigFilePath, FileAttributes.Hidden);
                //}
            }
            catch (ChoFatalApplicationException)
            {
                throw;
            }
            catch (Exception ex)
            {
                ConfigElement.Log(ex.ToString());
                if (!ConfigElement.Silent)
                {
                    throw new ChoFatalApplicationException(ex.Message, ex);
                }
            }

            try
            {
                //if seperate config file maintained, make a link in the application configuration
                if (IsConfigReferenceDataChanged(stateInfo))
                {
                    using (ChoXmlDocument xmlDocument = new ChoXmlDocument(ChoGlobalApplicationSettings.Me.ApplicationConfigFilePath))
                    {
                        XmlNode configNode = xmlDocument.XmlDocument.MakeXPath(ConfigElement.ConfigElementPath);
                        if (configNode != null)
                        {
                            if (!IsAppConfigFile)
                            {
                                string configXml = @"<{0} {1}=""{2}"" {3}=""{4}"" />".FormatString(ConfigSectionName, ChoConfigurationManager.PathToken, UnderlyingConfigFilePath, ChoXmlDocument.CinchoNSToken, ChoXmlDocument.CinchooNSURI);
                                ChoXmlDocument.SetNamespaceAwareOuterXml(configNode, configXml, ChoXmlDocument.CinchooNSURI);
                            }
                        }
                    }
                }

                PersistConfigData(data, stateInfo);
            }
            catch (ChoFatalApplicationException)
            {
                throw;
            }
            catch (Exception ex)
            {
                ConfigElement.Log(ex.ToString());

                //if (!IsAppConfigFile)
                //    File.Copy(backupConfigFilePath, configFilePath, true);

                if (!ConfigElement.Silent)
                {
                    throw new ChoFatalApplicationException(ex.Message, ex);
                }
            }
            finally
            {
                stateInfo[ChoConfigurationConstants.FORCE_PERSIST] = false;
            }
        }
Ejemplo n.º 28
0
 public UnrecognizedSettingsElementException(ConfigElement element)
     : base($"The element '{element}' is not recongized and cannot be compiled.")
 {
 }
Ejemplo n.º 29
0
 public RecycleBinSecurityElement(ConfigElement parent) : base(parent)
 {
 }
 /// <summary>
 /// Saves the values into a specific config element
 /// </summary>
 /// <param name="root">the root config element</param>
 protected virtual void SaveToConfig(ConfigElement root)
 {
     root["Server"]["Port"].Set(_port);
     root["Server"]["IP"].Set(_ip);
 }
Ejemplo n.º 31
0
 public HrefLangConfig(ConfigElement parent) : base(parent)
 {
 }
Ejemplo n.º 32
0
 public OpengraphModuleConfig(ConfigElement parent) : base(parent)
 {
 }
Ejemplo n.º 33
0
        protected void LoadFrom(ConfigElement[] cfg, string propsDir, string map)
        {
            string path = propsDir + map + ".properties";

            ConfigElement.ParseFile(cfg, path, this);
        }
 public ImageOptimizerSettings(ConfigElement parent)
     : base(parent)
 {
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DropDownDefinitionElement" /> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public DropDownDefinitionElement(ConfigElement parent)
     : base(parent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RelatedUsersFieldElement"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public RelatedUsersFieldElement(ConfigElement parent)
     : base(parent)
 {
 }
Ejemplo n.º 37
0
 public override void RegisterConfigElement <T>(ConfigElement <T> element)
 {
     // Not necessary
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserSelectorElement"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public UserSelectorElement(ConfigElement parent)
     : base(parent)
 {
 }
Ejemplo n.º 39
0
 public override void SetConfigValue <T>(ConfigElement <T> element, T value)
 {
     // Not necessary, just save.
     SaveConfig();
 }
		/// <summary>
		/// Defines the ContentView control for News on the frontend
		/// </summary>
		/// <param name="parent">The parent configuration element.</param>
		/// <returns>A configured instance of <see cref="ContentViewControlElement"/>.</returns>
		internal static ContentViewControlElement DefineLocationsFrontendContentView(ConfigElement parent)
		{
			// define content view control
			var controlDefinition = new ContentViewControlElement(parent)
			{
				ControlDefinitionName = LocationsDefinitions.FrontendDefinitionName,
				ContentType = typeof(LocationItem),
                UseWorkflow = false
			};

			// *** define views ***

			#region Locations List View

			// define element
			var locationsListView = new ContentViewMasterElement(controlDefinition.ViewsConfig)
			{
				ViewName = LocationsDefinitions.FrontendListViewName,
				ViewType = typeof(MasterListView),
				AllowPaging = true,
				DisplayMode = FieldDisplayMode.Read,
				ItemsPerPage = 4,
				FilterExpression = DefinitionsHelper.NotPublishedDraftsFilterExpression,
				SortExpression = "Title ASC",
                UseWorkflow = false
			};

			// add to content view
			controlDefinition.ViewsConfig.Add(locationsListView);

			#endregion

			#region Locations Details View

			// Initialize View
			var locationsDetailsView = new ContentViewDetailElement(controlDefinition.ViewsConfig)
			{
				ViewName = LocationsDefinitions.FrontendDetailViewName,
				ViewType = typeof(DetailsView),
				ShowSections = false,
				DisplayMode = FieldDisplayMode.Read
			};

			// add to ContentView
			controlDefinition.ViewsConfig.Add(locationsDetailsView);

			#endregion

			// return content view control
			return controlDefinition;
		}
Ejemplo n.º 41
0
 public override T GetConfigValue <T>(ConfigElement <T> element)
 {
     // Not necessary, just return the value.
     return(element.Value);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RelatedUsersFieldDefinition"/> class.
 /// </summary>
 /// <param name="element">The configuration element used to persist the control definition.</param>
 public RelatedUsersFieldDefinition(ConfigElement element)
     : base(element)
 {
 }
Ejemplo n.º 43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RelatedUsersFieldDefinition"/> class.
 /// </summary>
 /// <param name="element">The configuration element used to persist the control definition.</param>
 public RelatedUsersFieldDefinition(ConfigElement element)
     : base(element)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AutoCompleteTextBoxDefinitionElement" /> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public AutoCompleteTextBoxDefinitionElement(ConfigElement parent)
     : base(parent)
 {
 }
Ejemplo n.º 45
0
        public ChoConfigSection(Type configObjectType, XmlNode node, XmlNode[] contextNodes, ChoBaseConfigurationElement configElement)
            : this()
        {
            _configElement = configElement;

            if (configElement != null)
            {
                //Get and Set MetaDataFileName
                configElement.ConfigurationMetaDataType = ConfigurationMetaDataType;
                IChoConfigStorage attrDefinedConfigStorage = configElement.MetaDataInfo != null ? configElement.MetaDataInfo.ConfigStorage : null;

                ChoBaseConfigurationMetaDataInfo defaultMetaDataInfo = InitDefaultMetaDataInfo(configElement);

                configElement.MetaDataInfo = ChoObject.Merge <ChoBaseConfigurationMetaDataInfo>(ChoConfigurationMetaDataManager.GetMetaDataSection(configElement), defaultMetaDataInfo);
                ConfigStorage = configElement.MetaDataInfo != null && configElement.MetaDataInfo.ConfigStorage != null ?
                                configElement.MetaDataInfo.ConfigStorage : attrDefinedConfigStorage;

                if (ConfigStorage == null)
                {
                    configElement.Log("Missing configuration storage, assigning to configSection default storage.");
                    ConfigStorage = DefaultConfigStorage;
                    if (ConfigStorage == null)
                    {
                        configElement.Log("Missing configuration storage, assigning to system default storage.");
                        ConfigStorage = ChoConfigStorageManagerSettings.Me.GetDefaultConfigStorage();
                    }
                }

                if (ConfigStorage != null)
                {
                    try
                    {
                        CheckValidConfigStoragePassed(ConfigStorage);
                    }
                    catch (ChoFatalApplicationException)
                    {
                        throw;
                    }
                    catch (Exception ex)
                    {
                        if (configElement.Silent)
                        {
                            ConfigElement.Log(ex.Message);
                            ConfigStorage = ChoConfigStorageManagerSettings.Me.GetDefaultConfigStorage();
                            if (ConfigStorage != null)
                            {
                                ConfigElement.Log("Using default [{0}] config storage.".FormatString(ConfigStorage.GetType().FullName));
                            }
                        }
                        else
                        {
                            throw;
                        }
                    }
                }

                if (ConfigStorage == null)
                {
                    throw new ChoConfigurationException("Missing configuration storage.");
                }

                IsMetaDataDefinitionChanged = !ChoObject.Equals <ChoBaseConfigurationMetaDataInfo>(ChoConfigurationMetaDataManager.GetMetaDataSection(configElement), defaultMetaDataInfo);
                configElement.MetaDataInfo.ConfigStorage = ConfigStorage;

                try
                {
                    ConfigData = ConfigStorage.Load(_configElement, node);
                }
                catch (ChoFatalApplicationException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    _configLoadExceptions.Add(ex);
                }
            }

            //if (ConfigStorage == null)
            //{
            //    try
            //    {
            //        ConfigStorage = DefaultConfigStorage;
            //        if (ConfigStorage == null)
            //            ConfigStorage = ChoConfigStorageManagerSettings.Me.GetDefaultConfigStorage();
            //    }
            //    catch (Exception ex)
            //    {
            //        _configLoadExceptions.Add(ex);
            //    }
            //}

            try
            {
                ConfigurationChangeWatcher = ConfigStorage.ConfigurationChangeWatcher;
                if (ConfigurationChangeWatcher != null)
                {
                    ConfigurationChangeWatcher.StartWatching();
                }
            }
            catch (Exception ex)
            {
                _configLoadExceptions.Add(ex);
            }
        }
        /// <summary>
        /// Defines the ContentView control for News on the frontend
        /// </summary>
        /// <param name="parent">The parent configuration element.</param>
        /// <returns>A configured instance of <see cref="ContentViewControlElement"/>.</returns>
        internal static ContentViewControlElement DefineProductsFrontendContentView(ConfigElement parent)
        {
            // define content view control
            var controlDefinition = new ContentViewControlElement(parent)
            {
                ControlDefinitionName = ProductsDefinitions.FrontendDefinitionName,
                ContentType = typeof(ProductItem)
            };

            // *** define views ***

            #region News backend list view

            var newsListView = new ContentViewMasterElement(controlDefinition.ViewsConfig)
            {
                ViewName = ProductsDefinitions.FrontendListViewName,
                ViewType = typeof(ProductCatalogSample.Web.UI.Public.MasterListView),
                AllowPaging = true,
                DisplayMode = FieldDisplayMode.Read,
                ItemsPerPage = 20,
                ResourceClassId = typeof(ProductsResources).Name,
                FilterExpression = DefinitionsHelper.PublishedOrScheduledFilterExpression,
                SortExpression = "PublicationDate DESC"
            };

            controlDefinition.ViewsConfig.Add(newsListView);

            #endregion

            #region News backend details view

            var newsDetailsView = new ContentViewDetailElement(controlDefinition.ViewsConfig)
            {
                ViewName = ProductsDefinitions.FrontendDetailViewName,
                ViewType = typeof(ProductDetailsView),
                ShowSections = false,
                DisplayMode = FieldDisplayMode.Read,
                ResourceClassId = typeof(ProductsResources).Name
            };

            controlDefinition.ViewsConfig.Add(newsDetailsView);

            #endregion

            return controlDefinition;
        }
Ejemplo n.º 47
0
 public YoastConfig(ConfigElement parent) : base(parent)
 {
 }
 /// <summary>
 /// Creates the action menu widget element.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="name">The name.</param>
 /// <param name="wrapperTagKey">The wrapper tag key.</param>
 /// <param name="commandName">Name of the command.</param>
 /// <param name="text">The text.</param>
 /// <param name="resourceClassId">The resource class pageId.</param>
 /// <returns></returns>
 public static CommandWidgetElement CreateActionMenuCommand(
     ConfigElement parent,
     string name,
     HtmlTextWriterTag wrapperTagKey,
     string commandName,
     string text,
     string resourceClassId)
 {
     return new CommandWidgetElement(parent)
     {
         Name = name,
         WrapperTagKey = wrapperTagKey,
         CommandName = commandName,
         Text = text,
         ResourceClassId = resourceClassId,
         WidgetType = typeof(CommandWidget)
     };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageUrlFieldControlDefinitionElement" /> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public ImageUrlFieldControlDefinitionElement(ConfigElement parent) : base(parent)
 {
 }
 /// <summary>
 /// Creates the actions menu separator.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="name">The name.</param>
 /// <param name="WrapperTagKey">The wrapper tag key.</param>
 /// <param name="cssClass">The CSS class.</param>
 /// <param name="text">The text.</param>
 /// <param name="resourceClassId">The resource class pageId.</param>
 /// <returns></returns>
 public static WidgetElement CreateActionMenuSeparator(
     ConfigElement parent,
     string name,
     HtmlTextWriterTag WrapperTagKey,
     string cssClass,
     string text,
     string resourceClassId)
 {
     return new LiteralWidgetElement(parent)
     {
         Name = name,
         WrapperTagKey = WrapperTagKey,
         CssClass = cssClass,
         Text = text,
         ResourceClassId = resourceClassId,
         WidgetType = typeof(LiteralWidget),
         IsSeparator = true
     };
 }
 public void Read(ConfigElement element)
 {
     this.Hp    = GeneratorUtility.Get(element, "Hp", this.Hp);
     this.Magic = GeneratorUtility.Get(element, "Magic", this.Magic);
 }