Exemplo n.º 1
0
        /// <summary>
        /// Returns all Apps for the current zone
        /// </summary>
        /// <returns></returns>
        public List <IApp> GetApps(ITenant tenant, Func <Eav.Apps.App, IAppDataConfiguration> buildConfig /*, bool includeDefaultApp*/)
        {
            var appIds = new ZoneRuntime(ZoneRuntime.ZoneId, Log).Apps;

            return(appIds
                   .Select(a => new App(tenant, ZoneRuntime.ZoneId, a.Key, buildConfig, true, Log) as IApp)
                   .OrderBy(a => a.Name)
                   .ToList());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns all Apps for the current zone
        /// </summary>
        /// <returns></returns>
        public static List <App> GetApps(int zoneId, bool includeDefaultApp, PortalSettings ownerPs, Log parentLog)
        {
            var appIds   = new ZoneRuntime(zoneId, parentLog).Apps;// State.GetAppList(zoneId);
            var sexyApps = appIds.Select(eavApp => new App(zoneId, eavApp.Key, ownerPs));

            if (!includeDefaultApp)
            {
                sexyApps = sexyApps.Where(a => a.Name != Constants.ContentAppName);
            }

            return(sexyApps.OrderBy(a => a.Name).ToList());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns all Apps for the current zone
        /// </summary>
        /// <returns></returns>
        public List <IApp> GetApps(ISite site, Func <Eav.Apps.App, IAppDataConfiguration> buildConfig)
        {
            var zId    = ZoneRuntime.ZoneId;
            var appIds = new ZoneRuntime().Init(zId, Log).Apps;

            return(appIds
                   .Select(a => ServiceProvider.Build <App>()
                           .PreInit(site)
                           .Init(new AppIdentity(zId, a.Key), buildConfig, Log) as IApp)
                   .OrderBy(a => a.Name)
                   .ToList());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns all Apps for the current zone
        /// </summary>
        /// <returns></returns>
        public List <IApp> GetApps(ITenant tenant, Func <Eav.Apps.App, IAppDataConfiguration> buildConfig)
        {
            var zId    = ZoneRuntime.ZoneId;
            var appIds = new ZoneRuntime(zId, Log).Apps;

            return(appIds
                   .Select(a => Factory.Resolve <App>()
                           .PreInit(tenant)
                           .Init(new AppIdentity(zId, a.Key), buildConfig, true, Log) as IApp)
                   .OrderBy(a => a.Name)
                   .ToList());
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns all Apps for the current zone
        /// </summary>
        /// <returns></returns>
        public static List <App> GetApps(int zoneId, bool includeDefaultApp, ITenant tenant, Log parentLog)
        {
            var appIds    = new ZoneRuntime(zoneId, parentLog).Apps;
            var builtApps = appIds.Select(eavApp => new App(tenant, zoneId, eavApp.Key));

            if (!includeDefaultApp)
            {
                builtApps = builtApps.Where(a => a.Name != Eav.Constants.ContentAppName);
            }

            return(builtApps.OrderBy(a => a.Name).ToList());
        }
Exemplo n.º 6
0
        protected void InitExportXDocument(string defaultLanguage, string moduleVersion)
        {
            EnsureThisIsInitialized();

            // Create XML document and declaration
            var doc = _exportDocument = new XmlBuilder().BuildDocument();

            #region Header

            var dimensions = new ZoneRuntime(ZoneId).Languages();
            var header     = new XElement(XmlConstants.Header,
                                          _isAppExport && _appStaticName != XmlConstants.AppContentGuid
                    ? new XElement(XmlConstants.App, new XAttribute(XmlConstants.Guid, _appStaticName))
                    : null,
                                          new XElement(XmlConstants.Language, new XAttribute(XmlConstants.LangDefault, defaultLanguage)),
                                          new XElement(XmlConstants.DimensionDefinition, dimensions.Select(d => new XElement(XmlConstants.DimensionDefElement,
                                                                                                                             new XAttribute(XmlConstants.DimId, d.DimensionId),
                                                                                                                             new XAttribute(XmlConstants.Name, d.Name),
                                                                                                                             new XAttribute(XmlConstants.CultureSysKey, d.Key ?? string.Empty),
                                                                                                                             new XAttribute(XmlConstants.CultureExtKey, d.EnvironmentKey ?? string.Empty),
                                                                                                                             new XAttribute(XmlConstants.CultureIsActiveAttrib, d.Active)
                                                                                                                             )))
                                          );

            #endregion

            #region Attribute Sets

            var attributeSets = new XElement(XmlConstants.AttributeSets);

            // Go through each AttributeSetID
            foreach (var attributeSetId in AttributeSetIDs)
            {
                var id         = int.Parse(attributeSetId);
                var set        = (ContentType)AppPackage.ContentTypes[id];
                var attributes = new XElement(XmlConstants.Attributes);

                // Add all Attributes to AttributeSet including meta informations
                foreach (var x in set.Attributes.OrderBy(a => a.SortOrder))
                {
                    var attribute = new XElement(XmlConstants.Attribute,
                                                 new XAttribute(XmlConstants.Static, x.Name),
                                                 new XAttribute(XmlConstants.Type, x.Type),
                                                 new XAttribute(XmlConstants.IsTitle, x.IsTitle),
                                                 // Add Attribute MetaData
                                                 from c in AppPackage.GetMetadata(Constants.MetadataForAttribute, x.AttributeId).ToList()
                                                 select GetEntityXElement(c.EntityId, c.Type.StaticName)
                                                 );

                    attributes.Add(attribute);
                }

                // Add AttributeSet / Content Type
                var attributeSet = new XElement(XmlConstants.AttributeSet,
                                                new XAttribute(XmlConstants.Static, set.StaticName),
                                                new XAttribute(XmlConstants.Name, set.Name),
                                                new XAttribute(XmlConstants.Description, set.Description),
                                                new XAttribute(XmlConstants.Scope, set.Scope),
                                                new XAttribute(XmlConstants.AlwaysShareConfig, set.AlwaysShareConfiguration),
                                                attributes);

                // Add Ghost-Info if content type inherits from another content type
                if (set.ParentId.HasValue)
                {
                    var parentStaticName = AppPackage.ContentTypes[set.ParentId.Value].StaticName;
                    attributeSet.Add(new XAttribute(XmlConstants.AttributeSetParentDef, parentStaticName));
                }

                attributeSets.Add(attributeSet);
            }

            #endregion

            #region Entities

            var entities = new XElement(XmlConstants.Entities);

            // Go through each Entity
            foreach (var entityId in EntityIDs)
            {
                var id = int.Parse(entityId);

                // Get the entity and ContentType from ContentContext add Add it to ContentItems
                var entity = AppPackage.Entities[id];
                entities.Add(GetEntityXElement(entity.EntityId, entity.Type.StaticName));
            }

            #endregion

            // init files (add to queue)
            AddFilesToExportQueue();

            // Create root node "SexyContent" and add ContentTypes, ContentItems and Templates
            doc.Add(new XElement(XmlConstants.RootNode,
                                 new XAttribute(XmlConstants.FileVersion, Settings.FileVersion),
                                 new XAttribute(XmlConstants.MinEnvVersion, Settings.MinimumRequiredVersion),
                                 new XAttribute(XmlConstants.MinModVersion, moduleVersion),
                                 new XAttribute(XmlConstants.ExportDate, DateTime.Now),
                                 header,
                                 attributeSets,
                                 entities,
                                 GetFilesXElements(),
                                 GetFoldersXElements()));
        }